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 6f35df9c206f..a3a9cb332083 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,16 +31,15 @@ class BlockBlogUseCase @Inject constructor( feedId: Long ) = flow { performAction(blogId, feedId) - // 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( @@ -56,13 +55,13 @@ class BlockBlogUseCase @Inject constructor( val blockedBlogData = readerBlogActionsWrapper.blockBlogFromReaderLocal(blogId, feedId) emit(SiteBlockedInLocalDb(blockedBlogData)) -// val succeeded = blockBlogAndWaitForResult(blockedBlogData) -// -// if (succeeded) { -// emit(Success) -// } else { -// emit(RequestFailed) -// } + val succeeded = blockBlogAndWaitForResult(blockedBlogData) + + if (succeeded) { + emit(Success) + } else { + emit(RequestFailed) + } } private suspend fun blockBlogAndWaitForResult(blockedBlogResult: BlockedBlogResult): Boolean {