Skip to content
Permalink
Browse files

Update to Coroutines 1.3.0-RC2

  • Loading branch information...
chrisbanes committed Aug 10, 2019
1 parent e60989b commit 59ca279dceee0069fdd47487731744ae7fa0af12
@@ -61,7 +61,7 @@ object Libs {
}

object Coroutines {
private const val version = "1.3.0-RC"
private const val version = "1.3.0-RC2"
const val core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version"
const val rx2 = "org.jetbrains.kotlinx:kotlinx-coroutines-rx2:$version"
const val android = "org.jetbrains.kotlinx:kotlinx-coroutines-android:$version"
@@ -27,7 +27,7 @@ import app.tivi.interactors.PagingInteractor
import app.tivi.tmdb.TmdbManager
import kotlinx.coroutines.channels.ConflatedBroadcastChannel
import kotlinx.coroutines.flow.asFlow
import kotlinx.coroutines.flow.combineLatest
import kotlinx.coroutines.flow.combine
import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.launch

@@ -64,7 +64,8 @@ abstract class EntryViewModel<LI : EntryWithShow<out Entry>, PI : PagingInteract
}
}

val viewState = messages.asFlow().combineLatest(
val viewState = combine(
messages.asFlow(),
tmdbManager.imageProviderFlow,
pagingInteractor.observe().flowOn(pagingInteractor.dispatcher),
loaded.asFlow()
@@ -24,7 +24,7 @@ import app.tivi.data.entities.PendingAction
import app.tivi.data.syncers.syncerForEntity
import app.tivi.util.Logger
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.flow.asFlow
import kotlinx.coroutines.reactive.asFlow
import javax.inject.Inject

class EpisodeWatchStore @Inject constructor(
@@ -27,7 +27,7 @@ import app.tivi.data.resultentities.SeasonWithEpisodesAndWatches
import app.tivi.data.syncers.syncerForEntity
import app.tivi.util.Logger
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.flow.asFlow
import kotlinx.coroutines.reactive.asFlow
import javax.inject.Inject

class SeasonsEpisodesStore @Inject constructor(
@@ -28,7 +28,7 @@ import app.tivi.data.syncers.syncerForEntity
import app.tivi.util.Logger
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.reactive.flow.asFlow
import kotlinx.coroutines.reactive.asFlow
import javax.inject.Inject
import javax.inject.Singleton

@@ -23,7 +23,7 @@ import app.tivi.data.repositories.shows.ShowRepository
import app.tivi.data.resultentities.PopularEntryWithShow
import app.tivi.extensions.parallelForEach
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.flow.asFlow
import kotlinx.coroutines.reactive.asFlow
import javax.inject.Inject
import javax.inject.Singleton

@@ -22,7 +22,7 @@ import app.tivi.data.daos.RelatedShowsDao
import app.tivi.data.entities.RelatedShowEntry
import app.tivi.data.resultentities.RelatedShowEntryWithShow
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.flow.asFlow
import kotlinx.coroutines.reactive.asFlow
import javax.inject.Inject

class RelatedShowsStore @Inject constructor(
@@ -23,7 +23,7 @@ import app.tivi.data.daos.ShowImagesDao
import app.tivi.data.daos.TiviShowDao
import app.tivi.data.entities.ShowTmdbImage
import app.tivi.data.entities.TiviShow
import kotlinx.coroutines.reactive.flow.asFlow
import kotlinx.coroutines.reactive.asFlow
import javax.inject.Inject

class ShowStore @Inject constructor(
@@ -20,7 +20,7 @@ import app.tivi.data.DatabaseTransactionRunner
import app.tivi.data.daos.EntityInserter
import app.tivi.data.daos.UserDao
import app.tivi.data.entities.TraktUser
import kotlinx.coroutines.reactive.flow.asFlow
import kotlinx.coroutines.reactive.asFlow
import javax.inject.Inject

class TraktUsersStore @Inject constructor(
@@ -22,7 +22,7 @@ import app.tivi.data.daos.TrendingDao
import app.tivi.data.entities.TrendingShowEntry
import app.tivi.data.resultentities.TrendingEntryWithShow
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.flow.asFlow
import kotlinx.coroutines.reactive.asFlow
import javax.inject.Inject

class TrendingShowsStore @Inject constructor(
@@ -24,9 +24,9 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.switchMap
import kotlinx.coroutines.flow.flatMapLatest
import kotlinx.coroutines.launch
import kotlinx.coroutines.reactive.flow.asFlow
import kotlinx.coroutines.reactive.asFlow
import kotlinx.coroutines.withContext

interface Interactor<in P> {
@@ -61,7 +61,7 @@ abstract class SubjectInteractor<P : Any, T> : ObservableInteractor<P, T> {
private val flow = subject.toFlowable(BackpressureStrategy.LATEST)
.asFlow()
.distinctUntilChanged()
.switchMap { createObservable(it) }
.flatMapLatest { createObservable(it) }

override suspend operator fun invoke(params: P) = subject.onNext(params)

@@ -25,7 +25,7 @@ import app.tivi.util.AppCoroutineDispatchers
import io.reactivex.BackpressureStrategy
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.flow.asFlow
import kotlinx.coroutines.reactive.asFlow
import javax.inject.Inject

class ObservePagedFollowedShows @Inject constructor(
@@ -24,7 +24,7 @@ import app.tivi.util.AppCoroutineDispatchers
import io.reactivex.BackpressureStrategy
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.flow.asFlow
import kotlinx.coroutines.reactive.asFlow
import javax.inject.Inject

class ObservePagedPopularShows @Inject constructor(
@@ -24,7 +24,7 @@ import app.tivi.util.AppCoroutineDispatchers
import io.reactivex.BackpressureStrategy
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.flow.asFlow
import kotlinx.coroutines.reactive.asFlow
import javax.inject.Inject

class ObservePagedTrendingShows @Inject constructor(
@@ -25,7 +25,7 @@ import app.tivi.util.AppCoroutineDispatchers
import io.reactivex.BackpressureStrategy
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.reactive.flow.asFlow
import kotlinx.coroutines.reactive.asFlow
import javax.inject.Inject

class ObserveWatchedShows @Inject constructor(

0 comments on commit 59ca279

Please sign in to comment.
You can’t perform that action at this time.