@digiotech/react-native 1.0.10 → 1.0.13

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.
@@ -88,10 +88,10 @@ dependencies {
88
88
  // For > 0.71, this will be replaced by `com.facebook.react:react-android:$version` by react gradle plugin
89
89
  //noinspection GradleDynamicVersion
90
90
  implementation "com.facebook.react:react-native:+"
91
- implementation 'com.github.digio-tech:gateway:v4.0.8'
92
- // implementation 'com.github.digio-tech:gateway_kyc:v4.0.12_beta'
91
+ implementation 'com.github.digio-tech:gateway:v4.0.10'
92
+ compileOnly 'com.github.digio-tech:gateway_kyc:v4.0.15'
93
93
  implementation 'com.github.digio-tech:gateway_esign:4.0.8_beta1'
94
- compileOnly fileTree(dir: "libs", include: ["*.aar"])
94
+ // compileOnly fileTree(dir: "libs", include: ["*.aar"])
95
95
  implementation 'androidx.appcompat:appcompat:1.6.1'
96
96
  implementation 'com.google.android.material:material:1.9.0'
97
97
  implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
@@ -105,5 +105,9 @@ dependencies {
105
105
  implementation 'com.google.android.gms:play-services-mlkit-face-detection:17.1.0'
106
106
  implementation 'com.google.android.gms:play-services-location:21.0.1'
107
107
  implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
108
+
109
+ implementation 'com.github.digio-tech:protean-esign:v3.2'
110
+ implementation 'com.android.volley:volley:1.2.1'
111
+ implementation 'com.scottyab:rootbeer-lib:0.1.0'
108
112
  }
109
113
 
@@ -1,5 +1,6 @@
1
1
  package com.digioreactnative;
2
2
 
3
+ import android.util.Log;
3
4
  import android.annotation.SuppressLint;
4
5
  import android.app.Activity;
5
6
  import android.content.BroadcastReceiver;
@@ -46,6 +47,8 @@ public class DigioReactNativeModule extends ReactContextBaseJavaModule implement
46
47
  public static final String AAR_VERSION = "4.0.8";
47
48
  public static final int DIGIO_ACTIVITY = 73457843;
48
49
  private Promise resultPromise;
50
+ private boolean isReceiverRegistered = false;
51
+
49
52
 
50
53
  private BroadcastReceiver eventBroadcastReceiver = new BroadcastReceiver() {
51
54
 
@@ -132,18 +135,25 @@ public class DigioReactNativeModule extends ReactContextBaseJavaModule implement
132
135
 
133
136
  @Override
134
137
  public void onHostResume() {
135
- IntentFilter filter = new IntentFilter(DigioConstants.GATEWAY_EVENT);
136
- this.getReactApplicationContext().registerReceiver(eventBroadcastReceiver, filter);
138
+ if (!isReceiverRegistered) {
139
+ IntentFilter filter = new IntentFilter(DigioConstants.GATEWAY_EVENT);
140
+ this.getReactApplicationContext().registerReceiver(eventBroadcastReceiver, filter);
141
+ isReceiverRegistered = true;
142
+ }
143
+
137
144
  }
138
145
 
139
146
  @Override
140
147
  public void onHostPause() {
141
- this.getReactApplicationContext().unregisterReceiver(eventBroadcastReceiver);
148
+ // this.getReactApplicationContext().unregisterReceiver(eventBroadcastReceiver);
142
149
  }
143
150
 
144
151
  @Override
145
152
  public void onHostDestroy() {
146
-
153
+ if (isReceiverRegistered) {
154
+ this.getReactApplicationContext().unregisterReceiver(eventBroadcastReceiver);
155
+ isReceiverRegistered = false;
156
+ }
147
157
  }
148
158
 
149
159
  @Override
@@ -15,8 +15,10 @@ Pod::Spec.new do |s|
15
15
  s.source = { :git => "https://github.com/digio-tech/reactnative-sdk.git", :tag => "#{s.version}" }
16
16
 
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
-
19
- s.dependency 'DigiokycSDK', '~> 1.1.0'
18
+ # enable below to run local xcframework
19
+ # s.vendored_frameworks = 'ios/DigiokycSDK.xcframework'
20
+ s.dependency 'DigiokycSDK'
21
+ s.dependency 'DigioEsignSDK'
20
22
 
21
23
  # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
22
24
  # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
@@ -2,11 +2,13 @@ import DigiokycSDK
2
2
  import React
3
3
  import UIKit
4
4
  import Foundation
5
+ import DigioEsignSDK
5
6
 
6
7
  @objc(DigioReactNative)
7
- class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate {
8
+ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate,DigioEsignDelegate {
9
+
8
10
  var result: RCTPromiseResolveBlock!
9
-
11
+
10
12
  override func supportedEvents() -> [String]! {
11
13
  return ["gatewayEvent"]
12
14
  }
@@ -28,31 +30,24 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate {
28
30
  var fontFamily: String?
29
31
  var fontUrl: String?
30
32
  var environment: String = "production"
31
-
33
+
32
34
  additionalParams = additionalData as? [String : String];
33
-
35
+
34
36
  environment = config?["environment"] as? String ?? "production";
35
37
  primaryColor = config?["primaryColor"] as? String;
36
38
  logo = config?["logo"] as? String;
37
39
  fontFormat = config?["fontFormat"] as? String;
38
40
  fontFamily = config?["fontFamily"] as? String;
39
41
  fontUrl = config?["fontUrl"] as? String;
40
-
41
- // Your existing code here...
42
- try DigioKycBuilder()
43
- .withController(viewController: rootViewController!)
44
- .setDocumentId(documentId: documentId)
45
- .setKycResponseDelegate(delegate: self)
46
- .setIdentifier(identifier: identifier)
47
- .setEnvironment(environment: environment.elementsEqual("sandbox") ? DigioEnvironment.SANDBOX : DigioEnvironment.PRODUCTION)
48
- .setPrimaryColor(hexColor: primaryColor ?? "")
49
- .setTokenId(tokenId: tokenId ?? "")
50
- .setFontFormat(fontFormat: fontFormat ?? "")
51
- .setFontFamily(fontFamily: fontFamily ?? "")
52
- .setFontUrl(fontUrl: fontUrl ?? "")
53
- .setLogo(logo: logo ?? "")
54
- .setAdditionalParams(additionalParams: additionalParams ?? [:])
55
- .build()
42
+
43
+ if documentId.hasPrefix("ENA") || documentId.hasPrefix("DID") {
44
+ try self.startSign(rootViewController: rootViewController!, documentId: documentId, identifier: identifier, tokenId: tokenId, environment: environment, primaryColor: primaryColor, fontFormat: fontFormat, fontFamily: fontFamily, fontUrl: fontUrl, logo: logo, additionalParams: additionalParams)
45
+ .build()
46
+ }else{
47
+ try self.startKyc(rootViewController: rootViewController!, documentId: documentId, identifier: identifier, tokenId: tokenId, environment: environment, primaryColor: primaryColor, fontFormat: fontFormat, fontFamily: fontFamily, fontUrl: fontUrl, logo: logo, additionalParams: additionalParams)
48
+ .build()
49
+ }
50
+
56
51
  } catch let error {
57
52
  print("Exception --> \(error.localizedDescription)")
58
53
  }
@@ -61,7 +56,46 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate {
61
56
  }
62
57
  }
63
58
  }
64
- //
59
+
60
+ private func startKyc(rootViewController: UIViewController,documentId: String, identifier: String, tokenId: String?,
61
+ environment: String,primaryColor: String?,fontFormat: String?,
62
+ fontFamily: String?,fontUrl: String?,logo: String?,additionalParams: [String:String]?) -> DigioKycBuilder {
63
+ print("...........starting kyc.............")
64
+ return DigioKycBuilder()
65
+ .withController(viewController: rootViewController)
66
+ .setDocumentId(documentId: documentId)
67
+ .setKycResponseDelegate(delegate: self)
68
+ .setIdentifier(identifier: identifier)
69
+ .setEnvironment(environment: environment.elementsEqual("sandbox") ? DigioEnvironment.SANDBOX : DigioEnvironment.PRODUCTION)
70
+ .setPrimaryColor(hexColor: primaryColor ?? "")
71
+ .setTokenId(tokenId: tokenId ?? "")
72
+ .setFontFormat(fontFormat: fontFormat ?? "")
73
+ .setFontFamily(fontFamily: fontFamily ?? "")
74
+ .setFontUrl(fontUrl: fontUrl ?? "")
75
+ .setLogo(logo: logo ?? "")
76
+ .setAdditionalParams(additionalParams: additionalParams ?? [:])
77
+
78
+ }
79
+
80
+ private func startSign(rootViewController: UIViewController,documentId: String, identifier: String, tokenId: String?,
81
+ environment: String,primaryColor: String?,fontFormat: String?,fontFamily: String?,fontUrl: String?,logo: String?,additionalParams: [String:String]?) -> DigioBuilder{
82
+ print("...........starting sign.............")
83
+ return DigioBuilder()
84
+ .withController(viewController: rootViewController)
85
+ .setDocumentId(documentId: documentId)
86
+ // .setDelegate(delegate: self)
87
+ .setIdentifier(identifier: identifier)
88
+ .setEnvironment(environment: environment.elementsEqual("sandbox") ? DigioEnvironment.SANDBOX : DigioEnvironment.PRODUCTION)
89
+ .setPrimaryColor(hexColor: primaryColor ?? "")
90
+ .setTokenId(tokenId: tokenId ?? "")
91
+ .setFontFormat(fontFormat: fontFormat ?? "")
92
+ .setFontFamily(fontFamily: fontFamily ?? "")
93
+ .setFontUrl(fontUrl: fontUrl ?? "")
94
+ .setLogo(logo: logo ?? "")
95
+ .setAdditionalParams(additionalParams: additionalParams ?? [:])
96
+ .setServiceMode(serviceMode: DigioServiceMode.OTP)
97
+ }
98
+
65
99
  private func formatJson(response: String)->[String: Any]{
66
100
  let kycResponse = try! JSONDecoder().decode(DigioKycResponse.self, from: response.data(using: .utf8)!)
67
101
  var resultMap: [String: Any] = [:]
@@ -82,6 +116,7 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate {
82
116
  return resultMap
83
117
  }
84
118
 
119
+ /** Kyc sdk callback */
85
120
  func onDigioKycResponseSuccess(successResponse: String) {
86
121
  print("Success \(successResponse)")
87
122
  if self.result != nil {
@@ -100,7 +135,7 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate {
100
135
  print("Gateway event \(event)")
101
136
  self.sendEvent(withName: "gatewayEvent", body: convertToDictionary(text: event))
102
137
  }
103
-
138
+
104
139
  func convertToDictionary(text: String) -> [String: Any]? {
105
140
  if let data = text.data(using: .utf8) {
106
141
  do {
@@ -111,4 +146,26 @@ class DigioReactNative: RCTEventEmitter, DigioKycResponseDelegate {
111
146
  }
112
147
  return nil
113
148
  }
149
+ /** esign sdk callbacks */
150
+
151
+ func onDigioResponseSuccess(response: String) {
152
+ print("Success esign \(response)")
153
+ if self.result != nil {
154
+ self.result(formatJson(response: response))
155
+ }
156
+ }
157
+
158
+ func onDigioResponseFailure(response: String) {
159
+ print("Failure esign \(response)")
160
+ if self.result != nil {
161
+ self.result(formatJson(response: response))
162
+ }
163
+ }
164
+
165
+ func onGatewayEvent(event: String) {
166
+ print("onGatewayEvent esign \(event)")
167
+ self.sendEvent(withName: "gatewayEvent", body: convertToDictionary(text: event))
168
+ }
169
+
170
+
114
171
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digiotech/react-native",
3
- "version": "1.0.10",
3
+ "version": "1.0.13",
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",