Arkadii Ivanov
08/13/2020, 8:41 AMcoroutines-interop
with mt coroutines, please check https://github.com/badoo/Reaktive/issues/304
It should be possible to publish a separate version. Please vote and/or respond. 🤘🚀Mina Eweida
08/13/2020, 4:49 PMMina Eweida
08/13/2020, 4:50 PMsingleFromCoroutine
with Ktor since it causes issues.Arkadii Ivanov
08/13/2020, 4:52 PMMina Eweida
08/13/2020, 4:55 PMArkadii Ivanov
08/13/2020, 4:58 PMMina Eweida
08/13/2020, 4:59 PMsingleFromFunction
. Which is not a clean solution but it works.
i.e. we did this
singleFromFunction {
singleFromCoroutine {
doYourKtorCallHere()
}.blockingGet()
}
The problem was Ktor is not freezing exceptions, so if you get an error with the network call it will crash on native so to fix that we did the following
singleFromFunction {
try {
singleFromCoroutine {
doYourKtorCallHere()
}.blockingGet()
} catch (throwable: Throwable) {
throw throwable.freeze()
}
}
Mina Eweida
08/13/2020, 5:00 PMArkadii Ivanov
08/13/2020, 5:02 PMMina Eweida
08/13/2020, 5:03 PMMina Eweida
08/13/2020, 5:03 PMsingleFromFunction {
try {
singleFromCoroutine {
doYourKtorCallHere()
}.blockingGet()
} catch (throwable: Throwable) {
throw throwable.freeze()
}
}.subscribeOn(ioScheduler)
Mina Eweida
08/13/2020, 5:04 PMArkadii Ivanov
08/13/2020, 5:04 PMArkadii Ivanov
08/13/2020, 5:05 PMArkadii Ivanov
08/13/2020, 5:05 PMMina Eweida
08/13/2020, 5:05 PMArkadii Ivanov
08/13/2020, 5:06 PMArkadii Ivanov
08/13/2020, 5:06 PMrunBlocking
in Kotlin/Native.
* Please avoid using Ktor here, it may crash.
*/
}
.subscribeOn(ioScheduler)
.observeOn(mainScheduler)
.subscribe { /* Get the result here */ }Arkadii Ivanov
08/13/2020, 5:06 PMArkadii Ivanov
08/13/2020, 5:07 PMMina Eweida
08/13/2020, 5:08 PMMina Eweida
08/13/2020, 5:09 PMArkadii Ivanov
08/13/2020, 5:11 PMMina Eweida
08/13/2020, 5:13 PMMina Eweida
08/13/2020, 5:13 PMuse
the client so that it does not get leakedArkadii Ivanov
08/13/2020, 5:15 PMArkadii Ivanov
08/13/2020, 5:17 PMMina Eweida
08/13/2020, 5:17 PMArkadii Ivanov
08/13/2020, 5:18 PMArkadii Ivanov
08/13/2020, 5:19 PMMina Eweida
08/13/2020, 5:20 PMOmar Mainegra
08/14/2020, 4:27 PM