File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
android/src/main/java/com/nitroinappbrowser Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -4,17 +4,22 @@ import com.margelo.nitro.NitroModules
44import com.margelo.nitro.core.Promise
55import com.margelo.nitro.nitroinappbrowser.HybridNitroInAppBrowserSpec
66import com.margelo.nitro.nitroinappbrowser.NitroInAppBrowserOptions
7+ import kotlinx.coroutines.MainScope
8+ import kotlinx.coroutines.launch
79
810class HybridNitroInAppBrowser : HybridNitroInAppBrowserSpec () {
911 private val inAppBrowser = NitroInAppBrowserImpl (NitroModules .applicationContext)
12+ private val scope = MainScope ()
1013
1114 override fun open (url : String , options : NitroInAppBrowserOptions ? ): Promise <Unit > {
12- return Promise .async {
15+ return Promise .async(scope) {
1316 inAppBrowser.open(url, options)
1417 }
1518 }
1619
1720 override fun close () {
18- inAppBrowser.close()
21+ scope.launch {
22+ inAppBrowser.close()
23+ }
1924 }
2025}
You can’t perform that action at this time.
0 commit comments