diff options
Diffstat (limited to 'ios/MullvadVPN/View controllers/ProblemReport')
3 files changed, 22 insertions, 33 deletions
diff --git a/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportInteractor.swift b/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportInteractor.swift index 400db47dd1..194e7271f8 100644 --- a/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportInteractor.swift +++ b/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportInteractor.swift @@ -29,10 +29,13 @@ final class ProblemReportInteractor: @unchecked Sendable { ) } - func fetchReportString(completion: @escaping @Sendable (Result<String, Error>) -> Void) { + func fetchReportString(completion: @escaping @Sendable (String) -> Void) { consolidatedLog.addLogFiles(fileURLs: ApplicationTarget.allCases.flatMap { ApplicationConfiguration.logFileURLs(for: $0, in: ApplicationConfiguration.containerURL) - }, completion: completion) + }) { [weak self] in + guard let self else { return } + completion(consolidatedLog.string) + } } func sendReport( @@ -41,19 +44,15 @@ final class ProblemReportInteractor: @unchecked Sendable { completion: @escaping @Sendable (Result<Void, Error>) -> Void ) { let logString = self.consolidatedLog.string + if logString.isEmpty { - fetchReportString { [weak self] result in - switch result { - case let .success(logString): - self?.sendProblemReport( - email: email, - message: message, - logString: logString, - completion: completion - ) - case let .failure(error): - completion(.failure(error)) - } + fetchReportString { [weak self] updatedLogString in + self?.sendProblemReport( + email: email, + message: message, + logString: updatedLogString, + completion: completion + ) } } else { sendProblemReport( @@ -66,7 +65,6 @@ final class ProblemReportInteractor: @unchecked Sendable { } func cancelSendingReport() { - consolidatedLog.cancel() requestCancellable?.cancel() } @@ -87,7 +85,7 @@ final class ProblemReportInteractor: @unchecked Sendable { metadata: metadataDict ) - requestCancellable = self.apiProxy.sendProblemReport(request, retryStrategy: .default) { result in + requestCancellable = apiProxy.sendProblemReport(request, retryStrategy: .default) { result in DispatchQueue.main.async { completion(result) } diff --git a/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportReviewViewController.swift b/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportReviewViewController.swift index 3ba1ca5f58..01d7afb09c 100644 --- a/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportReviewViewController.swift +++ b/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportReviewViewController.swift @@ -95,28 +95,20 @@ class ProblemReportReviewViewController: UIViewController { private func loadLogs() { spinnerView.startAnimating() - interactor.fetchReportString { [weak self] result in + interactor.fetchReportString { [weak self] reportString in guard let self else { return } - - if case let .success(reportString) = result { - Task { @MainActor in - textView.text = reportString - spinnerView.stopAnimating() - spinnerContainerView.isHidden = true - } + Task { @MainActor in + textView.text = reportString + spinnerView.stopAnimating() + spinnerContainerView.isHidden = true } } } #if DEBUG private func share() { - interactor.fetchReportString { [weak self] result in - guard - let self, - case let .success(reportString) = result, - !reportString.isEmpty - else { return } - + interactor.fetchReportString { [weak self] reportString in + guard let self,!reportString.isEmpty else { return } Task { @MainActor in let activityController = UIActivityViewController( activityItems: [reportString], diff --git a/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportSubmissionOverlayView.swift b/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportSubmissionOverlayView.swift index 0d7148380f..005a81bd64 100644 --- a/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportSubmissionOverlayView.swift +++ b/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportSubmissionOverlayView.swift @@ -62,8 +62,7 @@ class ProblemReportSubmissionOverlayView: UIView { tableName: "ProblemReport", value: "Thanks!", comment: "" - ), - attributes: [.foregroundColor: UIColor.successColor] + ) ) if email.isEmpty { |
