summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJon Petersson <jon.petersson@kvadrat.se>2024-05-15 11:35:28 +0200
committerEmīls <emils@mullvad.net>2024-05-29 17:24:44 +0200
commita5c3ec4a0e01a70993c38f70cc9a0612c3e372e4 (patch)
tree4ea7b4d55b5114845631c3cd6d1d4441820ddc05
parentad90145a5d86d8c1e6e70f2238f11edf5e50f8d8 (diff)
downloadmullvadvpn-a5c3ec4a0e01a70993c38f70cc9a0612c3e372e4.tar.xz
mullvadvpn-a5c3ec4a0e01a70993c38f70cc9a0612c3e372e4.zip
Show spinner when consolidating logs for problem reports
-rw-r--r--ios/MullvadVPN/View controllers/Alert/AlertViewController.swift5
-rw-r--r--ios/MullvadVPN/View controllers/ProblemReport/ProblemReportReviewViewController.swift26
-rw-r--r--ios/MullvadVPN/View controllers/ProblemReport/ProblemReportViewController.swift4
3 files changed, 25 insertions, 10 deletions
diff --git a/ios/MullvadVPN/View controllers/Alert/AlertViewController.swift b/ios/MullvadVPN/View controllers/Alert/AlertViewController.swift
index 0902a4c17b..64957e7098 100644
--- a/ios/MullvadVPN/View controllers/Alert/AlertViewController.swift
+++ b/ios/MullvadVPN/View controllers/Alert/AlertViewController.swift
@@ -135,8 +135,9 @@ class AlertViewController: UIViewController {
)
}
- // Icon only alerts should have equal top and bottom margin.
- if presentation.icon != nil, contentView.arrangedSubviews.count == 1 {
+ // Icon only spinner alerts should have no background and equal top and bottom margins.
+ if presentation.icon == .spinner, contentView.arrangedSubviews.count == 1 {
+ viewContainer.backgroundColor = .clear
contentView.directionalLayoutMargins.bottom = UIMetrics.CustomAlert.containerMargins.top
}
}
diff --git a/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportReviewViewController.swift b/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportReviewViewController.swift
index b999eb32b4..603b6b34bb 100644
--- a/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportReviewViewController.swift
+++ b/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportReviewViewController.swift
@@ -10,10 +10,10 @@ import UIKit
class ProblemReportReviewViewController: UIViewController {
private var textView = UITextView()
- private let reportString: String
+ private let interactor: ProblemReportInteractor
- init(reportString: String) {
- self.reportString = reportString
+ init(interactor: ProblemReportInteractor) {
+ self.interactor = interactor
super.init(nibName: nil, bundle: nil)
}
@@ -48,7 +48,6 @@ class ProblemReportReviewViewController: UIViewController {
#endif
textView.translatesAutoresizingMaskIntoConstraints = false
- textView.text = reportString
textView.isEditable = false
textView.font = UIFont.monospacedSystemFont(
ofSize: UIFont.systemFontSize,
@@ -68,16 +67,33 @@ class ProblemReportReviewViewController: UIViewController {
// Used to layout constraints so that navigation controller could properly adjust the text
// view insets.
view.layoutIfNeeded()
+
+ loadLogs()
}
override func selectAll(_ sender: Any?) {
textView.selectAll(sender)
}
+ private func loadLogs() {
+ let presentation = AlertPresentation(
+ id: "problem-report-load",
+ icon: .spinner,
+ buttons: []
+ )
+
+ let alertController = AlertViewController(presentation: presentation)
+
+ present(alertController, animated: true) {
+ self.textView.text = self.interactor.reportString
+ self.dismiss(animated: true)
+ }
+ }
+
#if DEBUG
private func share() {
let activityController = UIActivityViewController(
- activityItems: [reportString],
+ activityItems: [interactor.reportString],
applicationActivities: nil
)
diff --git a/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportViewController.swift b/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportViewController.swift
index f255b43b51..15d21ee9db 100644
--- a/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportViewController.swift
+++ b/ios/MullvadVPN/View controllers/ProblemReport/ProblemReportViewController.swift
@@ -130,9 +130,7 @@ final class ProblemReportViewController: UIViewController, UITextFieldDelegate {
}
@objc func handleViewLogsButtonTap() {
- let reviewController = ProblemReportReviewViewController(
- reportString: interactor.reportString
- )
+ let reviewController = ProblemReportReviewViewController(interactor: interactor)
let navigationController = UINavigationController(rootViewController: reviewController)
present(navigationController, animated: true)