Skip to content
Snippets Groups Projects
Commit 8ced6ec0 authored by Dariusz Rybicki's avatar Dariusz Rybicki
Browse files

Don't pop chat screen if reporting fails

parent 6383e7b6
No related branches found
No related tags found
3 merge requests!71Releasing v1.1.5 (214),!69Implemented filtering for banned/blocked users and reporting,!67v1.1.5 b(203)
......@@ -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)
}
}
......
......@@ -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)
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment