diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/editprofile/viewmodel/EditProfileViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/editprofile/viewmodel/EditProfileViewModel.kt index fe418c60..9d96ee23 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/editprofile/viewmodel/EditProfileViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/editprofile/viewmodel/EditProfileViewModel.kt @@ -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.utils.AccountUtil import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.* import javax.inject.Inject @@ -30,7 +30,7 @@ class EditProfileViewModel @Inject constructor() : class EditProfilePartialChangeProducer( private val tiebaApi: ITiebaApi ) : PartialChangeProducer { - @OptIn(FlowPreview::class) + @OptIn(ExperimentalCoroutinesApi::class) override fun toPartialChangeFlow(intentFlow: Flow): Flow = merge( intentFlow.filterIsInstance() @@ -63,7 +63,7 @@ class EditProfileViewModel @Inject constructor() : tiebaApi.profileModifyFlow(birthdayShowStatus, "${birthdayTime / 1000L}", intro, "$sex") .map { if (it.errorCode == 0) EditProfilePartialChange.Submit.Success else EditProfilePartialChange.Submit.Fail( - it.errorMsg ?: "unknown error" + it.errorMsg ) } .onStart { @@ -94,9 +94,9 @@ class EditProfileViewModel @Inject constructor() : tiebaApi.imgPortrait(file) .map { if (it.errorCode == 0 || it.errorCode == 300003) - EditProfilePartialChange.UploadPortrait.Success(it.errorMsg ?: "success") + EditProfilePartialChange.UploadPortrait.Success(it.errorMsg) else - EditProfilePartialChange.UploadPortrait.Fail(it.errorMsg ?: "") + EditProfilePartialChange.UploadPortrait.Fail(it.errorMsg) } .onStart { EditProfilePartialChange.UploadPortrait.Uploading } .catch { diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/ForumViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/ForumViewModel.kt index 843dbfdb..c5847c5b 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/ForumViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/ForumViewModel.kt @@ -15,7 +15,7 @@ import com.huanchengfly.tieba.post.arch.UiIntent import com.huanchengfly.tieba.post.arch.UiState import com.huanchengfly.tieba.post.repository.FrsPageRepository import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.filterIsInstance @@ -64,7 +64,7 @@ class ForumViewModel @Inject constructor() : private object ForumPartialChangeProducer : PartialChangeProducer { - @OptIn(FlowPreview::class) + @OptIn(ExperimentalCoroutinesApi::class) override fun toPartialChangeFlow(intentFlow: Flow): Flow = merge( intentFlow.filterIsInstance() diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/threadlist/ForumThreadListViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/threadlist/ForumThreadListViewModel.kt index 8a6bd787..e052993d 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/threadlist/ForumThreadListViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/forum/threadlist/ForumThreadListViewModel.kt @@ -21,7 +21,7 @@ import com.huanchengfly.tieba.post.arch.wrapImmutable import com.huanchengfly.tieba.post.repository.FrsPageRepository import com.huanchengfly.tieba.post.utils.appPreferences import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.filterIsInstance @@ -75,7 +75,7 @@ class GoodThreadListViewModel @Inject constructor() : ForumThreadListViewModel() private class ForumThreadListPartialChangeProducer(val type: ForumThreadListType) : PartialChangeProducer { - @OptIn(FlowPreview::class) + @OptIn(ExperimentalCoroutinesApi::class) override fun toPartialChangeFlow(intentFlow: Flow): Flow = merge( intentFlow.filterIsInstance() diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/history/list/HistoryListViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/history/list/HistoryListViewModel.kt index d33042e8..e3fdd89c 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/history/list/HistoryListViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/history/list/HistoryListViewModel.kt @@ -13,7 +13,7 @@ import com.huanchengfly.tieba.post.utils.DateTimeUtils import com.huanchengfly.tieba.post.utils.HistoryUtil import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.filterIsInstance @@ -60,7 +60,7 @@ class ForumHistoryListViewModel @Inject constructor() : HistoryListViewModel() { private class HistoryListPartialChangeProducer(val type: Int) : PartialChangeProducer { - @OptIn(FlowPreview::class) + @OptIn(ExperimentalCoroutinesApi::class) override fun toPartialChangeFlow(intentFlow: Flow): Flow = merge( intentFlow.filterIsInstance() diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/hottopic/list/HotTopicListViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/hottopic/list/HotTopicListViewModel.kt index c44d8647..7e10f46b 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/hottopic/list/HotTopicListViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/hottopic/list/HotTopicListViewModel.kt @@ -11,7 +11,7 @@ import com.huanchengfly.tieba.post.arch.UiEvent import com.huanchengfly.tieba.post.arch.UiIntent import com.huanchengfly.tieba.post.arch.UiState import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.filterIsInstance @@ -32,7 +32,7 @@ class HotTopicListViewModel @Inject constructor() : private object HotTopicListPartialChangeProducer : PartialChangeProducer { - @OptIn(FlowPreview::class) + @OptIn(ExperimentalCoroutinesApi::class) override fun toPartialChangeFlow(intentFlow: Flow): Flow = merge( intentFlow.filterIsInstance() diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/concern/ConcernViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/concern/ConcernViewModel.kt index d10102a3..6eb8ce04 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/concern/ConcernViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/concern/ConcernViewModel.kt @@ -17,7 +17,7 @@ import com.huanchengfly.tieba.post.arch.UiIntent import com.huanchengfly.tieba.post.arch.UiState import com.huanchengfly.tieba.post.utils.appPreferences import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.filterIsInstance @@ -44,7 +44,7 @@ class ConcernViewModel @Inject constructor() : } private object ExplorePartialChangeProducer : PartialChangeProducer { - @OptIn(FlowPreview::class) + @OptIn(ExperimentalCoroutinesApi::class) override fun toPartialChangeFlow(intentFlow: Flow): Flow = merge( intentFlow.filterIsInstance().flatMapConcat { produceRefreshPartialChange() }, diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/hot/HotViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/hot/HotViewModel.kt index 8b68347f..58f9a105 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/hot/HotViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/hot/HotViewModel.kt @@ -13,7 +13,7 @@ import com.huanchengfly.tieba.post.arch.UiEvent import com.huanchengfly.tieba.post.arch.UiIntent import com.huanchengfly.tieba.post.arch.UiState import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.filterIsInstance @@ -34,7 +34,7 @@ class HotViewModel @Inject constructor() : private object HotPartialChangeProducer : PartialChangeProducer { - @OptIn(FlowPreview::class) + @OptIn(ExperimentalCoroutinesApi::class) override fun toPartialChangeFlow(intentFlow: Flow): Flow = merge( intentFlow.filterIsInstance() diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/personalized/PersonalizedViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/personalized/PersonalizedViewModel.kt index f699dc75..12c58ad9 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/personalized/PersonalizedViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/explore/personalized/PersonalizedViewModel.kt @@ -22,7 +22,7 @@ import com.huanchengfly.tieba.post.arch.wrapImmutable import com.huanchengfly.tieba.post.models.DislikeBean import com.huanchengfly.tieba.post.utils.appPreferences import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.filterIsInstance @@ -54,7 +54,7 @@ class PersonalizedViewModel @Inject constructor() : } private object ExplorePartialChangeProducer : PartialChangeProducer { - @OptIn(FlowPreview::class) + @OptIn(ExperimentalCoroutinesApi::class) override fun toPartialChangeFlow(intentFlow: Flow): Flow = merge( intentFlow.filterIsInstance().flatMapConcat { produceRefreshPartialChange() }, diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/home/HomeViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/home/HomeViewModel.kt index 5fa8fe77..5a183cf6 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/home/HomeViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/home/HomeViewModel.kt @@ -8,7 +8,7 @@ import com.huanchengfly.tieba.post.arch.* import com.huanchengfly.tieba.post.models.database.TopForum import com.huanchengfly.tieba.post.utils.AccountUtil import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.* import org.litepal.LitePal @@ -27,7 +27,7 @@ class HomeViewModel : BaseViewModel { - @OptIn(FlowPreview::class) + @OptIn(ExperimentalCoroutinesApi::class) override fun toPartialChangeFlow(intentFlow: Flow): Flow { return merge( intentFlow.filterIsInstance() diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/notifications/list/NotificationsListViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/notifications/list/NotificationsListViewModel.kt index 414febce..352bcb1f 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/notifications/list/NotificationsListViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/notifications/list/NotificationsListViewModel.kt @@ -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.arch.* import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.* import javax.inject.Inject @@ -42,7 +42,7 @@ class AtMeListViewModel @Inject constructor() : NotificationsListViewModel() { } private class NotificationsListPartialChangeProducer(private val type: NotificationsType) : PartialChangeProducer { - @OptIn(FlowPreview::class) + @OptIn(ExperimentalCoroutinesApi::class) override fun toPartialChangeFlow(intentFlow: Flow): Flow = merge( intentFlow.filterIsInstance().flatMapConcat { produceRefreshPartialChange() }, diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/user/UserViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/user/UserViewModel.kt index 5a8efd2c..43caaff7 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/user/UserViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/main/user/UserViewModel.kt @@ -8,7 +8,7 @@ import com.huanchengfly.tieba.post.arch.* import com.huanchengfly.tieba.post.models.database.Account import com.huanchengfly.tieba.post.utils.AccountUtil import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.* import javax.inject.Inject @@ -28,7 +28,7 @@ class UserViewModel @Inject constructor() : BaseViewModel { - @OptIn(FlowPreview::class) + @OptIn(ExperimentalCoroutinesApi::class) override fun toPartialChangeFlow(intentFlow: Flow): Flow = merge( intentFlow.filterIsInstance().flatMapConcat { it.toPartialChangeFlow() } diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/photoview/PhotoViewViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/photoview/PhotoViewViewModel.kt index 22aa823c..f1ccab3f 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/photoview/PhotoViewViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/photoview/PhotoViewViewModel.kt @@ -10,7 +10,7 @@ import com.huanchengfly.tieba.post.arch.UiIntent import com.huanchengfly.tieba.post.arch.UiState import com.huanchengfly.tieba.post.models.protos.LoadPicPageData 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.catch import kotlinx.coroutines.flow.filterIsInstance @@ -27,7 +27,7 @@ class PhotoViewViewModel : override fun createPartialChangeProducer(): PartialChangeProducer = PhotoViewPartialChangeProducer private object PhotoViewPartialChangeProducer : PartialChangeProducer { - @OptIn(FlowPreview::class) + @OptIn(ExperimentalCoroutinesApi::class) override fun toPartialChangeFlow(intentFlow: Flow): Flow = merge( intentFlow.filterIsInstance() diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/settings/block/BlockSettingsViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/settings/block/BlockSettingsViewModel.kt index d23fa148..eb7313cc 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/settings/block/BlockSettingsViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/settings/block/BlockSettingsViewModel.kt @@ -5,7 +5,7 @@ import com.huanchengfly.tieba.post.arch.* import com.huanchengfly.tieba.post.models.database.Block import com.huanchengfly.tieba.post.toJson import com.huanchengfly.tieba.post.utils.BlockManager -import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.* class BlockSettingsViewModel : @@ -26,7 +26,7 @@ class BlockSettingsViewModel : } private object BlockSettingsPartialChangeProducer : PartialChangeProducer { - @OptIn(FlowPreview::class) + @OptIn(ExperimentalCoroutinesApi::class) override fun toPartialChangeFlow(intentFlow: Flow): Flow = merge( intentFlow.filterIsInstance().flatMapConcat { produceLoadPartialChange() }, diff --git a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/threadstore/ThreadStoreViewModel.kt b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/threadstore/ThreadStoreViewModel.kt index b69e2283..3e12a57f 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/ui/page/threadstore/ThreadStoreViewModel.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/ui/page/threadstore/ThreadStoreViewModel.kt @@ -15,7 +15,7 @@ import com.huanchengfly.tieba.post.arch.UiIntent import com.huanchengfly.tieba.post.arch.UiState import com.huanchengfly.tieba.post.arch.wrapImmutable import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.catch import kotlinx.coroutines.flow.filterIsInstance @@ -48,7 +48,7 @@ class ThreadStoreViewModel @Inject constructor() : private object ThreadStorePartialChangeProducer : PartialChangeProducer { - @OptIn(FlowPreview::class) + @OptIn(ExperimentalCoroutinesApi::class) override fun toPartialChangeFlow(intentFlow: Flow): Flow = merge( intentFlow.filterIsInstance() diff --git a/app/src/main/java/com/huanchengfly/tieba/post/utils/OKSigner.kt b/app/src/main/java/com/huanchengfly/tieba/post/utils/OKSigner.kt index 7dc37e8b..d456eee6 100644 --- a/app/src/main/java/com/huanchengfly/tieba/post/utils/OKSigner.kt +++ b/app/src/main/java/com/huanchengfly/tieba/post/utils/OKSigner.kt @@ -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.database.Account import kotlinx.coroutines.Dispatchers -import kotlinx.coroutines.FlowPreview +import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.delay import kotlinx.coroutines.flow.* import kotlinx.coroutines.withContext @@ -109,7 +109,7 @@ class SingleAccountSigner( return this } - @OptIn(FlowPreview::class) + @OptIn(ExperimentalCoroutinesApi::class) override suspend fun start(): Boolean { var result = false signData.clear()