@digiotech/react-native 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,6 +8,7 @@ import android.content.Context;
|
|
|
8
8
|
import android.content.Intent;
|
|
9
9
|
import android.content.IntentFilter;
|
|
10
10
|
import android.text.TextUtils;
|
|
11
|
+
import android.os.Build;
|
|
11
12
|
|
|
12
13
|
import androidx.annotation.NonNull;
|
|
13
14
|
import androidx.annotation.Nullable;
|
|
@@ -137,7 +138,8 @@ public class DigioReactNativeModule extends ReactContextBaseJavaModule implement
|
|
|
137
138
|
public void onHostResume() {
|
|
138
139
|
if (!isReceiverRegistered) {
|
|
139
140
|
IntentFilter filter = new IntentFilter(DigioConstants.GATEWAY_EVENT);
|
|
140
|
-
this.getReactApplicationContext().registerReceiver(eventBroadcastReceiver, filter);
|
|
141
|
+
// this.getReactApplicationContext().registerReceiver(eventBroadcastReceiver, filter);
|
|
142
|
+
compatRegisterReceiver(this.getReactApplicationContext(), eventBroadcastReceiver, filter, true);
|
|
141
143
|
isReceiverRegistered = true;
|
|
142
144
|
}
|
|
143
145
|
|
|
@@ -162,6 +164,16 @@ public class DigioReactNativeModule extends ReactContextBaseJavaModule implement
|
|
|
162
164
|
return NAME;
|
|
163
165
|
}
|
|
164
166
|
|
|
167
|
+
private void compatRegisterReceiver(Context context, BroadcastReceiver receiver,
|
|
168
|
+
IntentFilter filter, boolean exported) {
|
|
169
|
+
if (Build.VERSION.SDK_INT >= 34 && context.getApplicationInfo().targetSdkVersion >= 34) {
|
|
170
|
+
context.registerReceiver(
|
|
171
|
+
receiver, filter, exported ? Context.RECEIVER_EXPORTED : Context.RECEIVER_NOT_EXPORTED);
|
|
172
|
+
} else {
|
|
173
|
+
context.registerReceiver(receiver, filter);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
165
177
|
@ReactMethod
|
|
166
178
|
public void start(String documentId, String identifier, String tokenId, ReadableMap additionalData, ReadableMap config, Promise promise) {
|
|
167
179
|
this.resultPromise = promise;
|