Skip to content

Commit

Permalink
feat: added receiver exported or receiver not exported for android 34…
Browse files Browse the repository at this point in the history
… and higher broadcast receiver
  • Loading branch information
akashkdigio committed May 24, 2024
1 parent 7ccbc37 commit fcdbc3d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.content.Intent;
import android.content.IntentFilter;
import android.text.TextUtils;
import android.os.Build;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand Down Expand Up @@ -137,7 +138,8 @@ public DigioReactNativeModule(ReactApplicationContext reactContext) {
public void onHostResume() {
if (!isReceiverRegistered) {
IntentFilter filter = new IntentFilter(DigioConstants.GATEWAY_EVENT);
this.getReactApplicationContext().registerReceiver(eventBroadcastReceiver, filter);
// this.getReactApplicationContext().registerReceiver(eventBroadcastReceiver, filter);
compatRegisterReceiver(this.getReactApplicationContext(), eventBroadcastReceiver, filter, true);
isReceiverRegistered = true;
}

Expand All @@ -162,6 +164,16 @@ public String getName() {
return NAME;
}

private void compatRegisterReceiver(Context context, BroadcastReceiver receiver,
IntentFilter filter, boolean exported) {
if (Build.VERSION.SDK_INT >= 34 && context.getApplicationInfo().targetSdkVersion >= 34) {
context.registerReceiver(
receiver, filter, exported ? Context.RECEIVER_EXPORTED : Context.RECEIVER_NOT_EXPORTED);
} else {
context.registerReceiver(receiver, filter);
}
}

@ReactMethod
public void start(String documentId, String identifier, String tokenId, ReadableMap additionalData, ReadableMap config, Promise promise) {
this.resultPromise = promise;
Expand Down
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PODS:
- boost (1.83.0)
- CocoaAsyncSocket (7.6.5)
- digio-react-native (1.0.13):
- digio-react-native (1.0.14):
- DigioEsignSDK
- DigiokycSDK
- glog
Expand Down Expand Up @@ -1320,7 +1320,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
boost: 26fad476bfa736552bbfa698a06cc530475c1505
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
digio-react-native: d4bb55bc81be23a039a9e1d2550656ead14ba5da
digio-react-native: 0f437e5abd7201007bf409482b641c98ba443e5c
DigioEsignSDK: a83db91acf10a043ba06da5d56aa976b64eb0c48
DigiokycSDK: 198d94e5856735c791ee6ca475cb5f78fc333210
DoubleConversion: fea03f2699887d960129cc54bba7e52542b6f953
Expand Down
4 changes: 2 additions & 2 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ export default function App() {
);
digio
.start(
'DID240507182157944L5FEM5BAFL6SCU',
'KID240524125515071XG44EYBE6KUX3R',
'akash.kumar@digio.in',
'GWT240507182158398221W78VJFJNL1U'
'GWT2405241255150929ZJWPKOP3XJSMS'
)
.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": "1.0.14",
"version": "1.0.15",
"description": "SDK for invoking client side journey for any of Digio request",
"main": "lib/commonjs/index",
"module": "lib/module/index",
Expand Down

0 comments on commit fcdbc3d

Please sign in to comment.