diff options
author | Allan Wang <me@allanwang.ca> | 2018-12-28 21:45:46 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-28 21:45:46 -0500 |
commit | 9c3d7c8b6cca17dc10fc310d41e547d1fe1725ea (patch) | |
tree | 8e6202efb768d954145038cb8642453c62650c5e /app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt | |
parent | c9769223cb014f588d93c1a73da157010e68a1c8 (diff) | |
parent | 8c4db7d79d4f9557d0eef2ef707663c5e8a7aac6 (diff) | |
download | frost-9c3d7c8b6cca17dc10fc310d41e547d1fe1725ea.tar.gz frost-9c3d7c8b6cca17dc10fc310d41e547d1fe1725ea.tar.bz2 frost-9c3d7c8b6cca17dc10fc310d41e547d1fe1725ea.zip |
Merge pull request #1269 from AllanWang/enhancement/coroutine-auth
Enhancement/coroutine
Diffstat (limited to 'app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt b/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt index 50c2fe77..8a6e57af 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/contracts/FrostContentContract.kt @@ -18,8 +18,9 @@ package com.pitchedapps.frost.contracts import android.view.View import com.pitchedapps.frost.facebook.FbItem -import io.reactivex.subjects.BehaviorSubject -import io.reactivex.subjects.PublishSubject +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.ExperimentalCoroutinesApi +import kotlinx.coroutines.channels.BroadcastChannel /** * Created by Allan Wang on 20/12/17. @@ -29,7 +30,7 @@ import io.reactivex.subjects.PublishSubject * Contract for the underlying parent, * binds to activities & fragments */ -interface FrostContentContainer { +interface FrostContentContainer : CoroutineScope { val baseUrl: String @@ -45,24 +46,28 @@ interface FrostContentContainer { * Contract for components shared among * all content providers */ +@UseExperimental(ExperimentalCoroutinesApi::class) interface FrostContentParent : DynamicUiContract { + val scope: CoroutineScope + val core: FrostContentCore /** * Observable to get data on whether view is refreshing or not */ - val refreshObservable: PublishSubject<Boolean> + val refreshChannel: BroadcastChannel<Boolean> /** * Observable to get data on refresh progress, with range [0, 100] */ - val progressObservable: PublishSubject<Int> + val progressChannel: BroadcastChannel<Int> /** * Observable to get new title data (unique values only) */ - val titleObservable: BehaviorSubject<String> + // todo note that this should be like a behavior subject vs publish subject + val titleChannel: BroadcastChannel<String> var baseUrl: String @@ -106,6 +111,9 @@ interface FrostContentParent : DynamicUiContract { */ interface FrostContentCore : DynamicUiContract { + val scope: CoroutineScope + get() = parent.scope + /** * Reference to parent * Bound through calling [FrostContentParent.bind] |