Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public class DigioReactNativeModule extends ReactContextBaseJavaModule implement
public static final int DIGIO_ACTIVITY = 73457843;
private Promise resultPromise;
private boolean isReceiverRegistered = false;
private boolean isResultHandled = false;


private BroadcastReceiver eventBroadcastReceiver = new BroadcastReceiver() {
Expand Down Expand Up @@ -81,9 +82,19 @@ public void onReceive(Context context, Intent intent) {
ActivityEventListener activityEventListener = new ActivityEventListener() {
@Override
public void onActivityResult(Activity activity, int requestCode, int resultCode, @Nullable Intent intent) {
if (requestCode == DIGIO_ACTIVITY) {
int responseCode = intent.getIntExtra("responseCode", 0);
onNativeActivityResult(responseCode, intent);
if (requestCode == DIGIO_ACTIVITY && !isResultHandled) {
isResultHandled = true;
if (intent != null) {
int responseCode = 0;
if (intent.hasExtra("responseCode")) {
responseCode = intent.getIntExtra("responseCode", 0);
}else{
responseCode = intent.getIntExtra("errorCode", 0);
}
onNativeActivityResult(responseCode, intent);
}else{
onNativeActivityResult(resultCode, null);
}
}
}

Expand Down Expand Up @@ -249,6 +260,7 @@ public void start(String documentId, String identifier, String tokenId, Readable
digioConfig.setAdditionalData(additionalDataMap);
intent.putExtra("config", digioConfig);

isResultHandled = false;
this.getCurrentActivity().startActivityForResult(intent, DIGIO_ACTIVITY);
} catch (Exception e) {
// Throws DigioException if WorkflowResponseListener is not implemented/passed, or
Expand Down
4 changes: 2 additions & 2 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
const [digioEvent, setDigioEvent] = useState<string | null>(null);

useEffect(() => {
const digio = new Digio({ environment: Environment.PRODUCTION, serviceMode: ServiceMode.OTP });

Check failure on line 11 in example/src/App.tsx

View workflow job for this annotation

GitHub Actions / lint

Replace `·environment:·Environment.PRODUCTION,·serviceMode:·ServiceMode.OTP` with `⏎······environment:·Environment.PRODUCTION,⏎······serviceMode:·ServiceMode.OTP,⏎···`

const digioGatewayEventSubscription = digio.addGatewayEventListener(
(event: GatewayEvent) => {
Expand All @@ -21,9 +21,9 @@

digio
.start(
'DID25042217573519794QGI9P27RLKLF',
'KID250423131507165T4ALP7UIDB4UFZ',
'akash.kumar@digio.in',
'GWT250422175735425I7RZLI1K4OTV9S'
'GWT250423131507194T9AD9V4FENFHYS'
)
.then((res) => {
console.log(res);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@digiotech/react-native",
"version": "2.0.3",
"version": "2.0.4",
"description": "SDK for invoking client side journey for any of Digio request",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down
Loading