MemeLabs / strims

GNU Affero General Public License v3.0
10 stars 6 forks source link

android: use coroutines #73

Closed jbpratt closed 4 years ago

jbpratt commented 4 years ago

Attempting to transition to using coroutines after discussion with @Slugalisk.

This is not working currently, I am a bit confused about a few things. I don't remember when we were working on it, but from what I have seen it seems that Java's Future (Java 7?) is blocking, as well as on the UI side we aren't yet making the calls in a scope yet, but is this the reason we used the sempahore?. (Poor structure currently)

I am also not currently doing this correctly, I think, on the RPCClient. There were a few different evolutions, one being:

return suspendCoroutine { ... }

and then just bringing in a scope to use, which I don't think is correct on this side of the app, the scope of the viewmodel should be what is used.

https://stackoverflow.com/a/50875792/11751968 https://kotlinlang.org/docs/tutorials/coroutines/async-programming.html https://developer.android.com/kotlin/coroutines https://developer.android.com/topic/libraries/architecture/coroutines