Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show spinner when consolidating logs for problem reports #6255

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -48,7 +48,6 @@ class ProblemReportReviewViewController: UIViewController {
#endif

textView.translatesAutoresizingMaskIntoConstraints = false
textView.text = reportString
textView.isEditable = false
textView.font = UIFont.monospacedSystemFont(
ofSize: UIFont.systemFontSize,
Expand All @@ -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
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading