summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPN/View controllers/ProblemReport
diff options
context:
space:
mode:
authorJon Petersson <jon.petersson@mullvad.net>2025-05-26 16:15:11 +0200
committerJon Petersson <jon.petersson@mullvad.net>2025-05-30 11:32:54 +0200
commit8b77bdbdf51a99b9b833bc56a8d67fdeb46fc581 (patch)
treeec3f39acc4e1cc54ad9392d30a167abcae1d1f23 /ios/MullvadVPN/View controllers/ProblemReport
parent83effc10b5cb3f26ca1c65d30ae62baf10f495d3 (diff)
downloadmullvadvpn-8b77bdbdf51a99b9b833bc56a8d67fdeb46fc581.tar.xz
mullvadvpn-8b77bdbdf51a99b9b833bc56a8d67fdeb46fc581.zip
Revert cancellation of log consolidation
Diffstat (limited to 'ios/MullvadVPN/View controllers/ProblemReport')
-rw-r--r--ios/MullvadVPN/View controllers/ProblemReport/ProblemReportInteractor.swift30
-rw-r--r--ios/MullvadVPN/View controllers/ProblemReport/ProblemReportReviewViewController.swift22
-rw-r--r--ios/MullvadVPN/View controllers/ProblemReport/ProblemReportSubmissionOverlayView.swift3
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 {