otpless-headless-rn 1.0.1 → 1.0.2

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.
@@ -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.1.2")
77
+ implementation ("io.github.otpless-tech:otpless-headless-sdk:0.1.5")
78
78
  }
79
79
 
80
80
  if (isNewArchitectureEnabled()) {
@@ -2,6 +2,8 @@ package com.otplessheadlessrn
2
2
 
3
3
  import android.app.Activity
4
4
  import android.content.Intent
5
+ import androidx.appcompat.app.AppCompatActivity
6
+ import androidx.lifecycle.lifecycleScope
5
7
  import com.facebook.react.bridge.ActivityEventListener
6
8
  import com.facebook.react.bridge.Callback
7
9
  import com.facebook.react.bridge.ReactApplicationContext
@@ -130,8 +132,12 @@ class OtplessHeadlessRNModule(private val reactContext: ReactApplicationContext)
130
132
  OtplessSDK.startAsync(request = otplessRequest, this@OtplessHeadlessRNModule::sendHeadlessEventCallback)
131
133
  } else {
132
134
  otplessJob?.cancel()
133
- otplessJob = CoroutineScope(Dispatchers.IO).launch {
134
- OtplessSDK.start(request = otplessRequest, this@OtplessHeadlessRNModule::sendHeadlessEventCallback)
135
+ currentActivity?.let {
136
+ otplessJob = (it as AppCompatActivity).lifecycleScope.launch {
137
+ OtplessSDK.start(request = otplessRequest, this@OtplessHeadlessRNModule::sendHeadlessEventCallback)
138
+ }
139
+ } ?: run {
140
+ OtplessSDK.startAsync(request = otplessRequest, this@OtplessHeadlessRNModule::sendHeadlessEventCallback)
135
141
  }
136
142
  }
137
143
  }
@@ -17,7 +17,7 @@ Pod::Spec.new do |s|
17
17
  s.source_files = "ios/**/*.{h,m,mm,swift}"
18
18
 
19
19
  s.dependency "React-Core"
20
- s.dependency 'OtplessBM/Core', '1.0.5'
20
+ s.dependency 'OtplessBM/Core', '1.0.6'
21
21
  s.swift_versions = ['5.5']
22
22
 
23
23
  # Don't install the dependencies when we run `pod install` in the old architecture.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "otpless-headless-rn",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "react native plugin for otpless headless android and ios",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",