#39 add test, flow, core modules + up version#60
#39 add test, flow, core modules + up version#60kramlex wants to merge 7 commits intoicerockdev:developfrom
Conversation
paging-core/build.gradle.kts
Outdated
| } | ||
|
|
||
| dependencies { | ||
| commonMainImplementation(libs.coroutines) |
There was a problem hiding this comment.
api dependency. we have CoroutineScope in constructor
| abstract suspend fun loadFirstPageSuspend() | ||
| abstract suspend fun loadNextPageSuspend() | ||
| abstract suspend fun refreshSuspend() | ||
| abstract suspend fun setDataSuspend(items: List<Item>?) |
There was a problem hiding this comment.
this should not be abstract - it should be implemented here, in core.
abstract should be only protected methods for set/get data in state.
paging-flow/build.gradle.kts
Outdated
| } | ||
|
|
||
| kotlin { | ||
| jvm() |
| ): StateFlow<List<T>> = combine(this, loading) { items, nextPageLoading -> | ||
| if (nextPageLoading) { | ||
| items + itemFactory() | ||
| } else { | ||
| items | ||
| } | ||
| }.stateIn(parentScope, SharingStarted.Lazily, emptyList()) |
There was a problem hiding this comment.
why duplication?
this.withLoadingItem(loading, itemFactory).stateIn(..)
| fun <T> Flow<List<T>>.stateWithReachEndNotifier( | ||
| parentScope: CoroutineScope, | ||
| action: (Int) -> Unit | ||
| ): StateFlow<ReachEndNotifierList<T>> = map { list -> | ||
| list.withReachEndNotifier(action) | ||
| }.stateIn(parentScope, SharingStarted.Lazily, ReachEndNotifierList(emptyList(), action)) |
| import kotlinx.coroutines.launch | ||
| import kotlin.test.Test | ||
|
|
||
| class IntegrationTests : BaseTestsClass() { |
There was a problem hiding this comment.
find way to reuse tests code between livedata and flow implementation
|
|
||
| private var loadNextPageDeferred: Deferred<List<Item>>? = null | ||
|
|
||
| fun loadFirstPage() { |
|
|
||
| package dev.icerock.moko.paging.state | ||
|
|
||
| sealed interface PagingDataState<T> { |
There was a problem hiding this comment.
why it's implemented in #59 issue? we can't add flow without it?
|
|
||
| typealias ResourceStateThrow<T> = ResourceState<T, Throwable> | ||
|
|
||
| sealed interface ResourceState<out T, out E> { |
There was a problem hiding this comment.
duplication of moko-mvvm-state is bad =_=
There was a problem hiding this comment.
so we should extract livedata dependency from mvvm-state...we will have mvvm-state, mvvm-state-livedata, mvvm-state-flow
There was a problem hiding this comment.
yes, if you can do this comment - icerockdev/moko-mvvm#152 (comment)
paging-test/build.gradle.kts
Outdated
| androidMainApi(libs.androidCoreTesting) | ||
| commonMainApi(libs.ktorClient) | ||
| commonMainApi(libs.ktorClientMock) | ||
| iosX64MainApi(libs.coroutines) |
| val result: Result<T>? = expectation.wait() | ||
| if (result == null) throw RuntimeException("runBlocking failed") | ||
| val result: Result<T> = expectation.wait() | ||
| ?: throw RuntimeException("runBlocking failed") |
There was a problem hiding this comment.
TooGenericExceptionThrown: RuntimeException is a too generic Exception. Prefer throwing specific exceptions that indicate a specific error case.
(at-me in a reply with help or ignore)
Was this a good recommendation?
[ 🙁 Not relevant ] - [ 😕 Won't fix ] - [ 😑 Not critical, will fix ] - [ 🙂 Critical, will fix ] - [ 😊 Critical, fixing now ]
|
Kudos, SonarCloud Quality Gate passed! |








No description provided.