From 2419256760712f30b218e022e5fba4bd0dcbb79a Mon Sep 17 00:00:00 2001 From: Agoni-0 <2748774819@qq.com> Date: Fri, 25 Oct 2024 23:39:15 +0800 Subject: [PATCH] Update BlockBlogUseCase.kt --- .../repository/usecases/BlockBlogUseCase.kt | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/repository/usecases/BlockBlogUseCase.kt b/WordPress/src/main/java/org/wordpress/android/ui/reader/repository/usecases/BlockBlogUseCase.kt index f59e8917b12c..1ac96e183f02 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/repository/usecases/BlockBlogUseCase.kt +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/repository/usecases/BlockBlogUseCase.kt @@ -31,15 +31,15 @@ class BlockBlogUseCase @Inject constructor( feedId: Long ) = flow { // Blocking multiple sites in parallel isn't supported as the user would lose the ability to undo the action - if (continuation == null) { - if (!networkUtilsWrapper.isNetworkAvailable()) { - emit(NoNetwork) - } else { - performAction(blogId, feedId) - } - } else { - emit(AlreadyRunning) - } + if (continuation == null) { + if (!networkUtilsWrapper.isNetworkAvailable()) { + emit(NoNetwork) + } else { + performAction(blogId, feedId) + } + } else { + emit(AlreadyRunning) + } } private suspend fun FlowCollector.performAction( @@ -55,13 +55,13 @@ class BlockBlogUseCase @Inject constructor( val blockedBlogData = readerBlogActionsWrapper.blockBlogFromReaderLocal(blogId, feedId) emit(SiteBlockedInLocalDb(blockedBlogData)) - val succeeded = blockBlogAndWaitForResult(blockedBlogData) + val succeeded = blockBlogAndWaitForResult(blockedBlogData) - if (succeeded) { - emit(Success) - } else { - emit(RequestFailed) - } + if (succeeded) { + emit(Success) + } else { + emit(RequestFailed) + } } private suspend fun blockBlogAndWaitForResult(blockedBlogResult: BlockedBlogResult): Boolean {