@digiotech/react-native 1.0.14 → 1.0.16

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;
@@ -83,7 +83,7 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate,DigioEsignDele
83
83
  return DigioBuilder()
84
84
  .withController(viewController: rootViewController)
85
85
  .setDocumentId(documentId: documentId)
86
- // .setDelegate(delegate: self)
86
+ .setDelegate(delegate: self)
87
87
  .setIdentifier(identifier: identifier)
88
88
  .setEnvironment(environment: environment.elementsEqual("sandbox") ? DigioEnvironment.SANDBOX : DigioEnvironment.PRODUCTION)
89
89
  .setPrimaryColor(hexColor: primaryColor ?? "")
@@ -162,10 +162,10 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate,DigioEsignDele
162
162
  }
163
163
  }
164
164
 
165
- func onGatewayEvent(event: String) {
166
- print("onGatewayEvent esign \(event)")
167
- self.sendEvent(withName: "gatewayEvent", body: convertToDictionary(text: event))
168
- }
165
+ func onGatewayEvent(event: String) {
166
+ print("onGatewayEvent esign \(event)")
167
+ self.sendEvent(withName: "gatewayEvent", body: convertToDictionary(text: event))
168
+ }
169
169
 
170
170
 
171
171
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digiotech/react-native",
3
- "version": "1.0.14",
3
+ "version": "1.0.16",
4
4
  "description": "SDK for invoking client side journey for any of Digio request",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",