diff --git a/Sources/ChatFeature/Controllers/SingleChatController.swift b/Sources/ChatFeature/Controllers/SingleChatController.swift index f4206db06f73a7ef238f2ce89953dba08d0908ea..3b8c60b92d4a8d0dfe95f08506a801ec2a948948 100644 --- a/Sources/ChatFeature/Controllers/SingleChatController.swift +++ b/Sources/ChatFeature/Controllers/SingleChatController.swift @@ -433,7 +433,8 @@ public final class SingleChatController: UIViewController { guard let self = self else { return } self.drawerCancellables.removeAll() let screenshot = try! self.makeAppScreenshot() - self.viewModel.report(screenshot: screenshot) { + self.viewModel.report(screenshot: screenshot) { success in + guard success else { return } self.navigationController?.popViewController(animated: true) } } diff --git a/Sources/ChatFeature/ViewModels/SingleChatViewModel.swift b/Sources/ChatFeature/ViewModels/SingleChatViewModel.swift index e4dae1d46771c4593229e2a5e76e0b7163618213..8ba933ad52ff63b6beca403e84bd688ccb043ac9 100644 --- a/Sources/ChatFeature/ViewModels/SingleChatViewModel.swift +++ b/Sources/ChatFeature/ViewModels/SingleChatViewModel.swift @@ -255,7 +255,7 @@ final class SingleChatViewModel: NSObject { sectionsRelay.value.count > 0 ? sectionsRelay.value[index].model : nil } - func report(screenshot: UIImage, completion: @escaping () -> Void) { + func report(screenshot: UIImage, completion: @escaping (Bool) -> Void) { let report = Report( sender: .init( userId: contact.id.base64EncodedString(), @@ -275,7 +275,7 @@ final class SingleChatViewModel: NSObject { case .failure(let error): DispatchQueue.main.async { self.hudRelay.send(.error(.init(with: error))) - completion() + completion(false) } case .success(_): @@ -283,7 +283,7 @@ final class SingleChatViewModel: NSObject { DispatchQueue.main.async { self.hudRelay.send(.none) self.presentReportConfirmation() - completion() + completion(true) } } }