style: 加入 `ExperimentalCoroutinesApi::class`
This commit is contained in:
parent
3a9ea7b471
commit
1a97fe4f57
|
|
@ -14,7 +14,7 @@ import com.huanchengfly.tieba.post.ui.page.editprofile.EditProfilePartialChange
|
||||||
import com.huanchengfly.tieba.post.ui.page.editprofile.EditProfileState
|
import com.huanchengfly.tieba.post.ui.page.editprofile.EditProfileState
|
||||||
import com.huanchengfly.tieba.post.utils.AccountUtil
|
import com.huanchengfly.tieba.post.utils.AccountUtil
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ class EditProfileViewModel @Inject constructor() :
|
||||||
class EditProfilePartialChangeProducer(
|
class EditProfilePartialChangeProducer(
|
||||||
private val tiebaApi: ITiebaApi
|
private val tiebaApi: ITiebaApi
|
||||||
) : PartialChangeProducer<EditProfileIntent, EditProfilePartialChange, EditProfileState> {
|
) : PartialChangeProducer<EditProfileIntent, EditProfilePartialChange, EditProfileState> {
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
override fun toPartialChangeFlow(intentFlow: Flow<EditProfileIntent>): Flow<EditProfilePartialChange> =
|
override fun toPartialChangeFlow(intentFlow: Flow<EditProfileIntent>): Flow<EditProfilePartialChange> =
|
||||||
merge(
|
merge(
|
||||||
intentFlow.filterIsInstance<EditProfileIntent.Init>()
|
intentFlow.filterIsInstance<EditProfileIntent.Init>()
|
||||||
|
|
@ -63,7 +63,7 @@ class EditProfileViewModel @Inject constructor() :
|
||||||
tiebaApi.profileModifyFlow(birthdayShowStatus, "${birthdayTime / 1000L}", intro, "$sex")
|
tiebaApi.profileModifyFlow(birthdayShowStatus, "${birthdayTime / 1000L}", intro, "$sex")
|
||||||
.map {
|
.map {
|
||||||
if (it.errorCode == 0) EditProfilePartialChange.Submit.Success else EditProfilePartialChange.Submit.Fail(
|
if (it.errorCode == 0) EditProfilePartialChange.Submit.Success else EditProfilePartialChange.Submit.Fail(
|
||||||
it.errorMsg ?: "unknown error"
|
it.errorMsg
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
.onStart {
|
.onStart {
|
||||||
|
|
@ -94,9 +94,9 @@ class EditProfileViewModel @Inject constructor() :
|
||||||
tiebaApi.imgPortrait(file)
|
tiebaApi.imgPortrait(file)
|
||||||
.map {
|
.map {
|
||||||
if (it.errorCode == 0 || it.errorCode == 300003)
|
if (it.errorCode == 0 || it.errorCode == 300003)
|
||||||
EditProfilePartialChange.UploadPortrait.Success(it.errorMsg ?: "success")
|
EditProfilePartialChange.UploadPortrait.Success(it.errorMsg)
|
||||||
else
|
else
|
||||||
EditProfilePartialChange.UploadPortrait.Fail(it.errorMsg ?: "")
|
EditProfilePartialChange.UploadPortrait.Fail(it.errorMsg)
|
||||||
}
|
}
|
||||||
.onStart { EditProfilePartialChange.UploadPortrait.Uploading }
|
.onStart { EditProfilePartialChange.UploadPortrait.Uploading }
|
||||||
.catch {
|
.catch {
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import com.huanchengfly.tieba.post.arch.UiIntent
|
||||||
import com.huanchengfly.tieba.post.arch.UiState
|
import com.huanchengfly.tieba.post.arch.UiState
|
||||||
import com.huanchengfly.tieba.post.repository.FrsPageRepository
|
import com.huanchengfly.tieba.post.repository.FrsPageRepository
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
import kotlinx.coroutines.flow.filterIsInstance
|
import kotlinx.coroutines.flow.filterIsInstance
|
||||||
|
|
@ -64,7 +64,7 @@ class ForumViewModel @Inject constructor() :
|
||||||
|
|
||||||
private object ForumPartialChangeProducer :
|
private object ForumPartialChangeProducer :
|
||||||
PartialChangeProducer<ForumUiIntent, ForumPartialChange, ForumUiState> {
|
PartialChangeProducer<ForumUiIntent, ForumPartialChange, ForumUiState> {
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
override fun toPartialChangeFlow(intentFlow: Flow<ForumUiIntent>): Flow<ForumPartialChange> =
|
override fun toPartialChangeFlow(intentFlow: Flow<ForumUiIntent>): Flow<ForumPartialChange> =
|
||||||
merge(
|
merge(
|
||||||
intentFlow.filterIsInstance<ForumUiIntent.Load>()
|
intentFlow.filterIsInstance<ForumUiIntent.Load>()
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import com.huanchengfly.tieba.post.arch.wrapImmutable
|
||||||
import com.huanchengfly.tieba.post.repository.FrsPageRepository
|
import com.huanchengfly.tieba.post.repository.FrsPageRepository
|
||||||
import com.huanchengfly.tieba.post.utils.appPreferences
|
import com.huanchengfly.tieba.post.utils.appPreferences
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
import kotlinx.coroutines.flow.filterIsInstance
|
import kotlinx.coroutines.flow.filterIsInstance
|
||||||
|
|
@ -75,7 +75,7 @@ class GoodThreadListViewModel @Inject constructor() : ForumThreadListViewModel()
|
||||||
|
|
||||||
private class ForumThreadListPartialChangeProducer(val type: ForumThreadListType) :
|
private class ForumThreadListPartialChangeProducer(val type: ForumThreadListType) :
|
||||||
PartialChangeProducer<ForumThreadListUiIntent, ForumThreadListPartialChange, ForumThreadListUiState> {
|
PartialChangeProducer<ForumThreadListUiIntent, ForumThreadListPartialChange, ForumThreadListUiState> {
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
override fun toPartialChangeFlow(intentFlow: Flow<ForumThreadListUiIntent>): Flow<ForumThreadListPartialChange> =
|
override fun toPartialChangeFlow(intentFlow: Flow<ForumThreadListUiIntent>): Flow<ForumThreadListPartialChange> =
|
||||||
merge(
|
merge(
|
||||||
intentFlow.filterIsInstance<ForumThreadListUiIntent.FirstLoad>()
|
intentFlow.filterIsInstance<ForumThreadListUiIntent.FirstLoad>()
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import com.huanchengfly.tieba.post.utils.DateTimeUtils
|
||||||
import com.huanchengfly.tieba.post.utils.HistoryUtil
|
import com.huanchengfly.tieba.post.utils.HistoryUtil
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
import kotlinx.coroutines.flow.filterIsInstance
|
import kotlinx.coroutines.flow.filterIsInstance
|
||||||
|
|
@ -60,7 +60,7 @@ class ForumHistoryListViewModel @Inject constructor() : HistoryListViewModel() {
|
||||||
|
|
||||||
private class HistoryListPartialChangeProducer(val type: Int) :
|
private class HistoryListPartialChangeProducer(val type: Int) :
|
||||||
PartialChangeProducer<HistoryListUiIntent, HistoryListPartialChange, HistoryListUiState> {
|
PartialChangeProducer<HistoryListUiIntent, HistoryListPartialChange, HistoryListUiState> {
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
override fun toPartialChangeFlow(intentFlow: Flow<HistoryListUiIntent>): Flow<HistoryListPartialChange> =
|
override fun toPartialChangeFlow(intentFlow: Flow<HistoryListUiIntent>): Flow<HistoryListPartialChange> =
|
||||||
merge(
|
merge(
|
||||||
intentFlow.filterIsInstance<HistoryListUiIntent.Refresh>()
|
intentFlow.filterIsInstance<HistoryListUiIntent.Refresh>()
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import com.huanchengfly.tieba.post.arch.UiEvent
|
||||||
import com.huanchengfly.tieba.post.arch.UiIntent
|
import com.huanchengfly.tieba.post.arch.UiIntent
|
||||||
import com.huanchengfly.tieba.post.arch.UiState
|
import com.huanchengfly.tieba.post.arch.UiState
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
import kotlinx.coroutines.flow.filterIsInstance
|
import kotlinx.coroutines.flow.filterIsInstance
|
||||||
|
|
@ -32,7 +32,7 @@ class HotTopicListViewModel @Inject constructor() :
|
||||||
|
|
||||||
private object HotTopicListPartialChangeProducer :
|
private object HotTopicListPartialChangeProducer :
|
||||||
PartialChangeProducer<HotTopicListUiIntent, HotTopicListPartialChange, HotTopicListUiState> {
|
PartialChangeProducer<HotTopicListUiIntent, HotTopicListPartialChange, HotTopicListUiState> {
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
override fun toPartialChangeFlow(intentFlow: Flow<HotTopicListUiIntent>): Flow<HotTopicListPartialChange> =
|
override fun toPartialChangeFlow(intentFlow: Flow<HotTopicListUiIntent>): Flow<HotTopicListPartialChange> =
|
||||||
merge(
|
merge(
|
||||||
intentFlow.filterIsInstance<HotTopicListUiIntent.Load>()
|
intentFlow.filterIsInstance<HotTopicListUiIntent.Load>()
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ import com.huanchengfly.tieba.post.arch.UiIntent
|
||||||
import com.huanchengfly.tieba.post.arch.UiState
|
import com.huanchengfly.tieba.post.arch.UiState
|
||||||
import com.huanchengfly.tieba.post.utils.appPreferences
|
import com.huanchengfly.tieba.post.utils.appPreferences
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
import kotlinx.coroutines.flow.filterIsInstance
|
import kotlinx.coroutines.flow.filterIsInstance
|
||||||
|
|
@ -44,7 +44,7 @@ class ConcernViewModel @Inject constructor() :
|
||||||
}
|
}
|
||||||
|
|
||||||
private object ExplorePartialChangeProducer : PartialChangeProducer<ConcernUiIntent, ConcernPartialChange, ConcernUiState> {
|
private object ExplorePartialChangeProducer : PartialChangeProducer<ConcernUiIntent, ConcernPartialChange, ConcernUiState> {
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
override fun toPartialChangeFlow(intentFlow: Flow<ConcernUiIntent>): Flow<ConcernPartialChange> =
|
override fun toPartialChangeFlow(intentFlow: Flow<ConcernUiIntent>): Flow<ConcernPartialChange> =
|
||||||
merge(
|
merge(
|
||||||
intentFlow.filterIsInstance<ConcernUiIntent.Refresh>().flatMapConcat { produceRefreshPartialChange() },
|
intentFlow.filterIsInstance<ConcernUiIntent.Refresh>().flatMapConcat { produceRefreshPartialChange() },
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import com.huanchengfly.tieba.post.arch.UiEvent
|
||||||
import com.huanchengfly.tieba.post.arch.UiIntent
|
import com.huanchengfly.tieba.post.arch.UiIntent
|
||||||
import com.huanchengfly.tieba.post.arch.UiState
|
import com.huanchengfly.tieba.post.arch.UiState
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
import kotlinx.coroutines.flow.filterIsInstance
|
import kotlinx.coroutines.flow.filterIsInstance
|
||||||
|
|
@ -34,7 +34,7 @@ class HotViewModel @Inject constructor() :
|
||||||
|
|
||||||
private object HotPartialChangeProducer :
|
private object HotPartialChangeProducer :
|
||||||
PartialChangeProducer<HotUiIntent, HotPartialChange, HotUiState> {
|
PartialChangeProducer<HotUiIntent, HotPartialChange, HotUiState> {
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
override fun toPartialChangeFlow(intentFlow: Flow<HotUiIntent>): Flow<HotPartialChange> =
|
override fun toPartialChangeFlow(intentFlow: Flow<HotUiIntent>): Flow<HotPartialChange> =
|
||||||
merge(
|
merge(
|
||||||
intentFlow.filterIsInstance<HotUiIntent.Load>()
|
intentFlow.filterIsInstance<HotUiIntent.Load>()
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ import com.huanchengfly.tieba.post.arch.wrapImmutable
|
||||||
import com.huanchengfly.tieba.post.models.DislikeBean
|
import com.huanchengfly.tieba.post.models.DislikeBean
|
||||||
import com.huanchengfly.tieba.post.utils.appPreferences
|
import com.huanchengfly.tieba.post.utils.appPreferences
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
import kotlinx.coroutines.flow.filterIsInstance
|
import kotlinx.coroutines.flow.filterIsInstance
|
||||||
|
|
@ -54,7 +54,7 @@ class PersonalizedViewModel @Inject constructor() :
|
||||||
}
|
}
|
||||||
|
|
||||||
private object ExplorePartialChangeProducer : PartialChangeProducer<PersonalizedUiIntent, PersonalizedPartialChange, PersonalizedUiState> {
|
private object ExplorePartialChangeProducer : PartialChangeProducer<PersonalizedUiIntent, PersonalizedPartialChange, PersonalizedUiState> {
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
override fun toPartialChangeFlow(intentFlow: Flow<PersonalizedUiIntent>): Flow<PersonalizedPartialChange> =
|
override fun toPartialChangeFlow(intentFlow: Flow<PersonalizedUiIntent>): Flow<PersonalizedPartialChange> =
|
||||||
merge(
|
merge(
|
||||||
intentFlow.filterIsInstance<PersonalizedUiIntent.Refresh>().flatMapConcat { produceRefreshPartialChange() },
|
intentFlow.filterIsInstance<PersonalizedUiIntent.Refresh>().flatMapConcat { produceRefreshPartialChange() },
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import com.huanchengfly.tieba.post.arch.*
|
||||||
import com.huanchengfly.tieba.post.models.database.TopForum
|
import com.huanchengfly.tieba.post.models.database.TopForum
|
||||||
import com.huanchengfly.tieba.post.utils.AccountUtil
|
import com.huanchengfly.tieba.post.utils.AccountUtil
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
import org.litepal.LitePal
|
import org.litepal.LitePal
|
||||||
|
|
||||||
|
|
@ -27,7 +27,7 @@ class HomeViewModel : BaseViewModel<HomeUiIntent, HomePartialChange, HomeUiState
|
||||||
|
|
||||||
object HomePartialChangeProducer :
|
object HomePartialChangeProducer :
|
||||||
PartialChangeProducer<HomeUiIntent, HomePartialChange, HomeUiState> {
|
PartialChangeProducer<HomeUiIntent, HomePartialChange, HomeUiState> {
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
override fun toPartialChangeFlow(intentFlow: Flow<HomeUiIntent>): Flow<HomePartialChange> {
|
override fun toPartialChangeFlow(intentFlow: Flow<HomeUiIntent>): Flow<HomePartialChange> {
|
||||||
return merge(
|
return merge(
|
||||||
intentFlow.filterIsInstance<HomeUiIntent.Refresh>()
|
intentFlow.filterIsInstance<HomeUiIntent.Refresh>()
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import com.huanchengfly.tieba.post.api.models.MessageListBean
|
||||||
import com.huanchengfly.tieba.post.api.retrofit.exception.getErrorMessage
|
import com.huanchengfly.tieba.post.api.retrofit.exception.getErrorMessage
|
||||||
import com.huanchengfly.tieba.post.arch.*
|
import com.huanchengfly.tieba.post.arch.*
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ class AtMeListViewModel @Inject constructor() : NotificationsListViewModel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class NotificationsListPartialChangeProducer(private val type: NotificationsType) : PartialChangeProducer<NotificationsListUiIntent, NotificationsListPartialChange, NotificationsListUiState> {
|
private class NotificationsListPartialChangeProducer(private val type: NotificationsType) : PartialChangeProducer<NotificationsListUiIntent, NotificationsListPartialChange, NotificationsListUiState> {
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
override fun toPartialChangeFlow(intentFlow: Flow<NotificationsListUiIntent>): Flow<NotificationsListPartialChange> =
|
override fun toPartialChangeFlow(intentFlow: Flow<NotificationsListUiIntent>): Flow<NotificationsListPartialChange> =
|
||||||
merge(
|
merge(
|
||||||
intentFlow.filterIsInstance<NotificationsListUiIntent.Refresh>().flatMapConcat { produceRefreshPartialChange() },
|
intentFlow.filterIsInstance<NotificationsListUiIntent.Refresh>().flatMapConcat { produceRefreshPartialChange() },
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import com.huanchengfly.tieba.post.arch.*
|
||||||
import com.huanchengfly.tieba.post.models.database.Account
|
import com.huanchengfly.tieba.post.models.database.Account
|
||||||
import com.huanchengfly.tieba.post.utils.AccountUtil
|
import com.huanchengfly.tieba.post.utils.AccountUtil
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
|
@ -28,7 +28,7 @@ class UserViewModel @Inject constructor() : BaseViewModel<UserUiIntent, UserPart
|
||||||
}
|
}
|
||||||
|
|
||||||
object UserPartialChangeProducer :PartialChangeProducer<UserUiIntent, UserPartialChange, UserUiState> {
|
object UserPartialChangeProducer :PartialChangeProducer<UserUiIntent, UserPartialChange, UserUiState> {
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
override fun toPartialChangeFlow(intentFlow: Flow<UserUiIntent>): Flow<UserPartialChange> =
|
override fun toPartialChangeFlow(intentFlow: Flow<UserUiIntent>): Flow<UserPartialChange> =
|
||||||
merge(
|
merge(
|
||||||
intentFlow.filterIsInstance<UserUiIntent.Refresh>().flatMapConcat { it.toPartialChangeFlow() }
|
intentFlow.filterIsInstance<UserUiIntent.Refresh>().flatMapConcat { it.toPartialChangeFlow() }
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import com.huanchengfly.tieba.post.arch.UiIntent
|
||||||
import com.huanchengfly.tieba.post.arch.UiState
|
import com.huanchengfly.tieba.post.arch.UiState
|
||||||
import com.huanchengfly.tieba.post.models.protos.LoadPicPageData
|
import com.huanchengfly.tieba.post.models.protos.LoadPicPageData
|
||||||
import com.huanchengfly.tieba.post.models.protos.PhotoViewData
|
import com.huanchengfly.tieba.post.models.protos.PhotoViewData
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
import kotlinx.coroutines.flow.filterIsInstance
|
import kotlinx.coroutines.flow.filterIsInstance
|
||||||
|
|
@ -27,7 +27,7 @@ class PhotoViewViewModel :
|
||||||
override fun createPartialChangeProducer(): PartialChangeProducer<PhotoViewUiIntent, PhotoViewPartialChange, PhotoViewUiState> = PhotoViewPartialChangeProducer
|
override fun createPartialChangeProducer(): PartialChangeProducer<PhotoViewUiIntent, PhotoViewPartialChange, PhotoViewUiState> = PhotoViewPartialChangeProducer
|
||||||
|
|
||||||
private object PhotoViewPartialChangeProducer : PartialChangeProducer<PhotoViewUiIntent, PhotoViewPartialChange, PhotoViewUiState> {
|
private object PhotoViewPartialChangeProducer : PartialChangeProducer<PhotoViewUiIntent, PhotoViewPartialChange, PhotoViewUiState> {
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
override fun toPartialChangeFlow(intentFlow: Flow<PhotoViewUiIntent>): Flow<PhotoViewPartialChange> =
|
override fun toPartialChangeFlow(intentFlow: Flow<PhotoViewUiIntent>): Flow<PhotoViewPartialChange> =
|
||||||
merge(
|
merge(
|
||||||
intentFlow.filterIsInstance<PhotoViewUiIntent.Init>()
|
intentFlow.filterIsInstance<PhotoViewUiIntent.Init>()
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import com.huanchengfly.tieba.post.arch.*
|
||||||
import com.huanchengfly.tieba.post.models.database.Block
|
import com.huanchengfly.tieba.post.models.database.Block
|
||||||
import com.huanchengfly.tieba.post.toJson
|
import com.huanchengfly.tieba.post.toJson
|
||||||
import com.huanchengfly.tieba.post.utils.BlockManager
|
import com.huanchengfly.tieba.post.utils.BlockManager
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
|
|
||||||
class BlockSettingsViewModel :
|
class BlockSettingsViewModel :
|
||||||
|
|
@ -26,7 +26,7 @@ class BlockSettingsViewModel :
|
||||||
}
|
}
|
||||||
|
|
||||||
private object BlockSettingsPartialChangeProducer : PartialChangeProducer<BlockSettingsUiIntent, BlockSettingsPartialChange, BlockSettingsUiState> {
|
private object BlockSettingsPartialChangeProducer : PartialChangeProducer<BlockSettingsUiIntent, BlockSettingsPartialChange, BlockSettingsUiState> {
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
override fun toPartialChangeFlow(intentFlow: Flow<BlockSettingsUiIntent>): Flow<BlockSettingsPartialChange> =
|
override fun toPartialChangeFlow(intentFlow: Flow<BlockSettingsUiIntent>): Flow<BlockSettingsPartialChange> =
|
||||||
merge(
|
merge(
|
||||||
intentFlow.filterIsInstance<BlockSettingsUiIntent.Load>().flatMapConcat { produceLoadPartialChange() },
|
intentFlow.filterIsInstance<BlockSettingsUiIntent.Load>().flatMapConcat { produceLoadPartialChange() },
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ import com.huanchengfly.tieba.post.arch.UiIntent
|
||||||
import com.huanchengfly.tieba.post.arch.UiState
|
import com.huanchengfly.tieba.post.arch.UiState
|
||||||
import com.huanchengfly.tieba.post.arch.wrapImmutable
|
import com.huanchengfly.tieba.post.arch.wrapImmutable
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.flow.Flow
|
import kotlinx.coroutines.flow.Flow
|
||||||
import kotlinx.coroutines.flow.catch
|
import kotlinx.coroutines.flow.catch
|
||||||
import kotlinx.coroutines.flow.filterIsInstance
|
import kotlinx.coroutines.flow.filterIsInstance
|
||||||
|
|
@ -48,7 +48,7 @@ class ThreadStoreViewModel @Inject constructor() :
|
||||||
|
|
||||||
private object ThreadStorePartialChangeProducer :
|
private object ThreadStorePartialChangeProducer :
|
||||||
PartialChangeProducer<ThreadStoreUiIntent, ThreadStorePartialChange, ThreadStoreUiState> {
|
PartialChangeProducer<ThreadStoreUiIntent, ThreadStorePartialChange, ThreadStoreUiState> {
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
override fun toPartialChangeFlow(intentFlow: Flow<ThreadStoreUiIntent>): Flow<ThreadStorePartialChange> =
|
override fun toPartialChangeFlow(intentFlow: Flow<ThreadStoreUiIntent>): Flow<ThreadStorePartialChange> =
|
||||||
merge(
|
merge(
|
||||||
intentFlow.filterIsInstance<ThreadStoreUiIntent.Refresh>()
|
intentFlow.filterIsInstance<ThreadStoreUiIntent.Refresh>()
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ import com.huanchengfly.tieba.post.api.retrofit.exception.getErrorMessage
|
||||||
import com.huanchengfly.tieba.post.models.SignDataBean
|
import com.huanchengfly.tieba.post.models.SignDataBean
|
||||||
import com.huanchengfly.tieba.post.models.database.Account
|
import com.huanchengfly.tieba.post.models.database.Account
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.FlowPreview
|
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.flow.*
|
import kotlinx.coroutines.flow.*
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
|
@ -109,7 +109,7 @@ class SingleAccountSigner(
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
@OptIn(FlowPreview::class)
|
@OptIn(ExperimentalCoroutinesApi::class)
|
||||||
override suspend fun start(): Boolean {
|
override suspend fun start(): Boolean {
|
||||||
var result = false
|
var result = false
|
||||||
signData.clear()
|
signData.clear()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue