-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#39 add test, flow, core modules + up version #60
base: develop
Are you sure you want to change the base?
Conversation
paging-core/build.gradle.kts
Outdated
} | ||
|
||
dependencies { | ||
commonMainImplementation(libs.coroutines) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
something wrong with format
): 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please remove duplication
import kotlinx.coroutines.launch | ||
import kotlin.test.Test | ||
|
||
class IntegrationTests : BaseTestsClass() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
find way to reuse tests code between livedata and flow implementation
|
||
private var loadNextPageDeferred: Deferred<List<Item>>? = null | ||
|
||
fun loadFirstPage() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why it's removed?
|
||
package dev.icerock.moko.paging.state | ||
|
||
sealed interface PagingDataState<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why it's implemented in #59 issue? we can't add flow without it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
|
||
typealias ResourceStateThrow<T> = ResourceState<T, Throwable> | ||
|
||
sealed interface ResourceState<out T, out E> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
duplication of moko-mvvm-state
is bad =_=
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mvvm-state depends on moko-livedata
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should I use these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coroutines already added
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.