From a5483a87d2dca886970ba25d0d7e1116c90194bf Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Mon, 15 Feb 2021 14:14:55 -0800 Subject: [PATCH] Mute and report cleanup --- Localizations/Localizable.strings | 9 +++--- Views/SwiftUI/MuteView.swift | 22 ++++++++------- Views/SwiftUI/ReportView.swift | 28 +++++++++---------- .../View Repesentables/ReportStatusView.swift | 1 + 4 files changed, 31 insertions(+), 29 deletions(-) diff --git a/Localizations/Localizable.strings b/Localizations/Localizable.strings index 693aa56..875a6fa 100644 --- a/Localizations/Localizable.strings +++ b/Localizations/Localizable.strings @@ -27,12 +27,12 @@ "account.joined-%@" = "Joined %@"; "account.locked.accessibility-label" = "Locked account"; "account.mute" = "Mute"; -"account.mute.indefinite" = "Indefnite"; +"account.mute.indefinite" = "Indefinite"; "account.mute.confirm-%@" = "Are you sure you want to mute %@?"; "account.mute.confirm.explanation" = "This will hide posts from them and posts mentioning them, but it will still allow them to see your posts and follow you."; "account.mute.confirm.hide-notifications" = "Hide notifications from this user?"; "account.mute.confirm.duration" = "Duration"; -"account.mute.target-%@" = "Muting %@"; +"account.mute.target-%@" = "Mute %@"; "account.muted" = "Muted"; "account.reject-follow-request-button.accessibility-label" = "Reject follow request"; "account.request" = "Request"; @@ -245,9 +245,9 @@ "notifications.unknown" = "Notification from %@"; "remove" = "Remove"; "report" = "Report"; +"report.additional-comments" = "Additional comments"; "report.hint" = "The report will be sent to your server moderators. You can provide an explanation of why you are reporting this account below:"; -"report.placeholder" = "Additional comments"; -"report.target-%@" = "Reporting %@"; +"report.target-%@" = "Report %@"; "report.forward.hint" = "The account is from another server. Send an anonymized copy of the report there as well?"; "report.forward-%@" = "Forward report to %@"; "search.scope.all" = "All"; @@ -302,7 +302,6 @@ "status.visibility.unlisted.description" = "Visible for all, but not in public timelines"; "status.visibility.private.description" = "Visible for followers only"; "status.visibility.direct.description" = "Visible for mentioned users only"; -"submit" = "Submit"; "tag.accessibility-recent-uses-%ld" = "%ld recent uses"; "tag.accessibility-hint.post" = "View posts associated with trend"; "tag.accessibility-hint.toot" = "View toots associated with trend"; diff --git a/Views/SwiftUI/MuteView.swift b/Views/SwiftUI/MuteView.swift index 69921d0..55b7fb2 100644 --- a/Views/SwiftUI/MuteView.swift +++ b/Views/SwiftUI/MuteView.swift @@ -11,21 +11,23 @@ struct MuteView: View { var body: some View { Form { - VStack(alignment: .leading, spacing: .defaultSpacing) { - Text("account.mute.confirm-\(viewModel.accountName)") - Text("account.mute.confirm.explanation") - } - Toggle("account.mute.confirm.hide-notifications", isOn: $viewModel.notifications) - Picker("account.mute.confirm.duration", selection: $viewModel.duration) { - ForEach(MuteViewModel.Duration.allCases) { duration in - Text(verbatim: duration.title).tag(duration) + Section { + VStack(alignment: .leading, spacing: .defaultSpacing) { + Text("account.mute.confirm-\(viewModel.accountName)") + Text("account.mute.confirm.explanation") + } + Toggle("account.mute.confirm.hide-notifications", isOn: $viewModel.notifications) + Picker("account.mute.confirm.duration", selection: $viewModel.duration) { + ForEach(MuteViewModel.Duration.allCases) { duration in + Text(verbatim: duration.title).tag(duration) + } } } - Group { + Section { if viewModel.loading { ProgressView() } else { - Button("account.mute") { + Button("account.mute.target-\(viewModel.accountName)") { viewModel.mute() } } diff --git a/Views/SwiftUI/ReportView.swift b/Views/SwiftUI/ReportView.swift index 22b9216..1378313 100644 --- a/Views/SwiftUI/ReportView.swift +++ b/Views/SwiftUI/ReportView.swift @@ -19,25 +19,25 @@ struct ReportView: View { } Section { Text("report.hint") - ZStack(alignment: .leading) { - if viewModel.elements.comment.isEmpty { - Text("report.placeholder").foregroundColor(.secondary) - } - TextEditor(text: $viewModel.elements.comment) - } - if !viewModel.isLocalAccount { + } + Section(header: Text("report.additional-comments")) { + TextEditor(text: $viewModel.elements.comment) + .accessibility(label: Text("report.additional-comments")) + } + if !viewModel.isLocalAccount { + Section { VStack(alignment: .leading) { Text("report.forward.hint") Toggle("report.forward-\(viewModel.accountHost)", isOn: $viewModel.elements.forward) } } - Group { - if viewModel.loading { - ProgressView() - } else { - Button("submit") { - viewModel.report() - } + } + Section { + if viewModel.loading { + ProgressView() + } else { + Button("report.target-\(viewModel.accountName)") { + viewModel.report() } } } diff --git a/Views/SwiftUI/View Repesentables/ReportStatusView.swift b/Views/SwiftUI/View Repesentables/ReportStatusView.swift index fb5338a..f5bd348 100644 --- a/Views/SwiftUI/View Repesentables/ReportStatusView.swift +++ b/Views/SwiftUI/View Repesentables/ReportStatusView.swift @@ -17,6 +17,7 @@ struct ReportStatusView: UIViewRepresentable { view.buttonsStackView.isHidden = true view.translatesAutoresizingMaskIntoConstraints = false view.isUserInteractionEnabled = false + view.accessibilityLabel = view.accessibilityAttributedLabel?.string return view }