Skip to content

Commit

Permalink
refactor(capture-sdk): Rename capture-sdk intent interface callback
Browse files Browse the repository at this point in the history
BSDK-258
  • Loading branch information
abolfazlimahdi committed Jan 22, 2024
1 parent 9f2f35e commit a40cd08
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -670,42 +670,42 @@ public static GiniCaptureFragment createGiniCaptureFragment() {
return GiniCaptureFragment.Companion.createInstance(null);
}

public CancellationToken createGiniCaptureFragmentForIntent(Context context, Intent intent, GiniCaptureIntentCallback captureIntentCallback) {
public CancellationToken createGiniCaptureFragmentForIntent(Context context, Intent intent, CreateGiniCaptureFragmentForIntentCallback captureIntentCallback) {
return createDocumentForImportedFiles(intent, context, new AsyncCallback<Document, ImportedFileValidationException>() {
@Override
public void onSuccess(Document result) {
// TODO please refactor this piece
captureIntentCallback.callback(new CreateCaptureFlowFragmentForIntentResult.Success(GiniCaptureFragment.Companion.createInstance(result)));
captureIntentCallback.callback(new CreateGiniCaptureFragmentForIntentResult.Success(GiniCaptureFragment.Companion.createInstance(result)));
}

@Override
public void onError(ImportedFileValidationException exception) {
captureIntentCallback.callback(new CreateCaptureFlowFragmentForIntentResult.Error(exception));
captureIntentCallback.callback(new CreateGiniCaptureFragmentForIntentResult.Error(exception));
}

@Override
public void onCancelled() {
captureIntentCallback.callback(new CreateCaptureFlowFragmentForIntentResult.Cancelled());
captureIntentCallback.callback(new CreateGiniCaptureFragmentForIntentResult.Cancelled());
}
});
}

interface GiniCaptureIntentCallback {
void callback(CreateCaptureFlowFragmentForIntentResult result);
interface CreateGiniCaptureFragmentForIntentCallback {
void callback(CreateGiniCaptureFragmentForIntentResult result);
}

static class CreateCaptureFlowFragmentForIntentResult<T> {
static class Cancelled extends CreateCaptureFlowFragmentForIntentResult {}
static class CreateGiniCaptureFragmentForIntentResult<T> {
static class Cancelled extends CreateGiniCaptureFragmentForIntentResult {}

static class Success extends CreateCaptureFlowFragmentForIntentResult {
static class Success extends CreateGiniCaptureFragmentForIntentResult {
@NonNull
GiniCaptureFragment fragment;

public Success(GiniCaptureFragment fragment) {
this.fragment = fragment;
}
}
static class Error extends CreateCaptureFlowFragmentForIntentResult {
static class Error extends CreateGiniCaptureFragmentForIntentResult {
@NonNull
Exception exception;

Expand Down

0 comments on commit a40cd08

Please sign in to comment.