otpless-headless-rn 2.0.6 → 2.0.8
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.
package/android/build.gradle
CHANGED
|
@@ -74,7 +74,7 @@ dependencies {
|
|
|
74
74
|
//noinspection GradleDynamicVersion
|
|
75
75
|
implementation "com.facebook.react:react-native:+"
|
|
76
76
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
77
|
-
implementation ("io.github.otpless-tech:otpless-headless-sdk:0.6.
|
|
77
|
+
implementation ("io.github.otpless-tech:otpless-headless-sdk:0.6.6")
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
if (isNewArchitectureEnabled()) {
|
|
@@ -69,6 +69,7 @@ class OtplessHeadlessRNModule(private val reactContext: ReactApplicationContext)
|
|
|
69
69
|
|
|
70
70
|
@ReactMethod
|
|
71
71
|
fun initialize(appId: String, loginUri: String? = null) {
|
|
72
|
+
if (currentActivity == null) return
|
|
72
73
|
(currentActivity as? AppCompatActivity)?.lifecycleScope?.let { scope ->
|
|
73
74
|
scope.launch(Dispatchers.IO) {
|
|
74
75
|
OtplessSDK.initialize(
|
|
@@ -92,6 +93,7 @@ class OtplessHeadlessRNModule(private val reactContext: ReactApplicationContext)
|
|
|
92
93
|
|
|
93
94
|
@ReactMethod
|
|
94
95
|
fun initTrueCaller(requestMap: ReadableMap, promise: Promise) {
|
|
96
|
+
if (currentActivity == null) return
|
|
95
97
|
val request = parseTrueCallerRequest(requestMap)
|
|
96
98
|
val scopes = parseTrueCallerScope(requestMap)
|
|
97
99
|
val result = OtplessSDK.initTrueCaller(currentActivity!!, request) {
|
|
@@ -170,11 +172,6 @@ class OtplessHeadlessRNModule(private val reactContext: ReactApplicationContext)
|
|
|
170
172
|
promise.resolve(OtplessSDK.isSdkReady)
|
|
171
173
|
}
|
|
172
174
|
|
|
173
|
-
@ReactMethod
|
|
174
|
-
fun setResponseCallback() {
|
|
175
|
-
OtplessSDK.setResponseCallback(this::sendHeadlessEventCallback)
|
|
176
|
-
}
|
|
177
|
-
|
|
178
175
|
@ReactMethod
|
|
179
176
|
fun cleanup() {
|
|
180
177
|
otplessJob?.cancel()
|
package/ios/OtplessHeadlessRN.m
CHANGED
|
@@ -7,8 +7,6 @@ RCT_EXTERN_METHOD(initialize:(NSString *)appId
|
|
|
7
7
|
loginUri: (nullable NSString *) loginUri
|
|
8
8
|
)
|
|
9
9
|
|
|
10
|
-
RCT_EXTERN_METHOD(setResponseCallback)
|
|
11
|
-
|
|
12
10
|
RCT_EXTERN_METHOD(start:(NSDictionary *)request)
|
|
13
11
|
|
|
14
12
|
RCT_EXTERN_METHOD(commitResponse: (nullable NSDictionary *) response)
|
|
@@ -99,6 +99,7 @@ class OtplessHeadlessRN: RCTEventEmitter, OtplessResponseDelegate {
|
|
|
99
99
|
DispatchQueue.main.async {
|
|
100
100
|
let rootViewController = UIApplication.shared.delegate?.window??.rootViewController
|
|
101
101
|
if rootViewController != nil {
|
|
102
|
+
Otpless.shared.setResponseDelegate(self)
|
|
102
103
|
Otpless.shared.initialise(withAppId: appId, vc: rootViewController!)
|
|
103
104
|
return
|
|
104
105
|
}
|
|
@@ -107,6 +108,7 @@ class OtplessHeadlessRN: RCTEventEmitter, OtplessResponseDelegate {
|
|
|
107
108
|
if #available(iOS 13.0, *) {
|
|
108
109
|
let windowSceneVC = self.getRootViewControllerFromWindowScene()
|
|
109
110
|
if windowSceneVC != nil {
|
|
111
|
+
Otpless.shared.setResponseDelegate(self)
|
|
110
112
|
Otpless.shared.initialise(withAppId: appId, vc: rootViewController!)
|
|
111
113
|
return
|
|
112
114
|
}
|
|
@@ -114,11 +116,6 @@ class OtplessHeadlessRN: RCTEventEmitter, OtplessResponseDelegate {
|
|
|
114
116
|
}
|
|
115
117
|
}
|
|
116
118
|
|
|
117
|
-
@objc(setResponseCallback)
|
|
118
|
-
func setResponseCallback() {
|
|
119
|
-
Otpless.shared.setResponseDelegate(self)
|
|
120
|
-
}
|
|
121
|
-
|
|
122
119
|
@objc(start:)
|
|
123
120
|
func start(request: [String: Any]) {
|
|
124
121
|
let otplessRequest = createOtplessRequest(args: request)
|