library for effortless, reactive data loading built with RxJava Store<Article> Store = ParsingStoreBuilder.<BufferedSource, String>builder() .fetcher(this::ResponseAsSource) .persister(SourcePersisterFactory.create(context.getFilesDir()) .parser(GsonParserFactory.createSourceParser(gson, Article.class)) .open(); Barcode barcode = new Barcode("Article", "42"); store.get(barcode).subscribe(onNext, onError, onComplete)
is to include a Fetcher which is just a typealias to a function that returns a Flow<FetcherResult<ReturnType>>. //build it val store = StoreBuilder.from( Fetcher.of { key: Unit -> userApi.noti fi cations( authHeader = " Bearer ${oauthRepository.getCurrent()}", offset = null) }).build() //use it store.stream(StoreRequest.cached(Unit, refresh = true)).map { it.dataOrNull() } .collect{response-> } Fetcher as a Function 2017 2019 2021
to add to new Matt: because I don’t understand old Mike: SGTM as long as all tests are migrated, I also don’t understand old Matt: Sure how hard can it be?
val location:locationRepository, private val map:mapRepository ): HikeManager { private suspend fun track() { combine(location.current(), map.current()) { location, map -> val request = createStoreWriteRequest(location, map) val response = mutableStore.write(request) handleResponse(response) }}} Store 5 Usage of MutableStore
val location:locationRepository, private val map:mapRepository ): HikeManager { private suspend fun track() { combine(location.current(), map.current()) { location, map -> val request = createStoreWriteRequest(location, map) val response = mutableStore.write(request) handleResponse(response) }}} Store 5 Usage of MutableStore
fun getLastFailedSync(key: Key): Long? suspend fun setLastFailedSync(key: Key, timestamp: Long): Boolean suspend fun clear(key: Key): Boolean suspend fun clearAll(): Boolean}
description: String, val kind: Kind, val version: Int, val creationDate: Long, ) : Identi fi able<String> { enum class Kind { Boolean, Multivariate}} Trails Feature Flag Model
Fetcher.ofWithFallback( name = “networkFetcher”, fallback = hardcodedFetcher ) { key -> when (key) { is Collection -> fetchFeatureFlagStatuses(key.userId) is Single -> fetchFeatureFlagStatus(key.userId, key. fl agId)}}
= “hardcodedFetcher” ) { key -> when (key) { is Collection -> loadFeatureFlagStatuses(key.userId) is Single -> loadFeatureFlagStatus(key.userId, key. fl agId)}}