diff --git a/Mastodon/Scene/Report/Report/ReportViewController.swift b/Mastodon/Scene/Report/Report/ReportViewController.swift index 1fa8428e6..1fe1a720c 100644 --- a/Mastodon/Scene/Report/Report/ReportViewController.swift +++ b/Mastodon/Scene/Report/Report/ReportViewController.swift @@ -91,8 +91,16 @@ extension ReportViewController: ReportReasonViewControllerDelegate { guard let reason = viewController.viewModel.selectReason else { return } switch reason { case .dislike: - // TODO: - break + let reportResultViewModel = ReportResultViewModel( + context: context, + user: viewModel.user, + isReported: false + ) + coordinator.present( + scene: .reportResult(viewModel: reportResultViewModel), + from: self, + transition: .show + ) case .violateRule: coordinator.present( scene: .reportServerRules(viewModel: viewModel.reportServerRulesViewModel), @@ -113,7 +121,16 @@ extension ReportViewController: ReportReasonViewControllerDelegate { extension ReportViewController: ReportServerRulesViewControllerDelegate { func reportServerRulesViewController(_ viewController: ReportServerRulesViewController, nextButtonPressed button: UIButton) { if viewController.viewModel.isDislike { - // TODO: + let reportResultViewModel = ReportResultViewModel( + context: context, + user: viewModel.user, + isReported: false + ) + coordinator.present( + scene: .reportResult(viewModel: reportResultViewModel), + from: self, + transition: .show + ) } else if viewController.viewModel.selectRule != nil { coordinator.present( scene: .reportStatus(viewModel: viewModel.reportStatusViewModel), @@ -163,7 +180,8 @@ extension ReportViewController: ReportSupplementaryViewControllerDelegate { let reportResultViewModel = ReportResultViewModel( context: context, - user: viewModel.user + user: viewModel.user, + isReported: true ) coordinator.present( diff --git a/Mastodon/Scene/Report/ReportResult/ReportResultView.swift b/Mastodon/Scene/Report/ReportResult/ReportResultView.swift index aa063ac2d..dff87e356 100644 --- a/Mastodon/Scene/Report/ReportResult/ReportResultView.swift +++ b/Mastodon/Scene/Report/ReportResult/ReportResultView.swift @@ -50,10 +50,16 @@ struct ReportResultView: View { Text(viewModel.headline) .foregroundColor(Color(Asset.Colors.Label.primary.color)) .font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 28, weight: .bold)) as CTFont)) - avatarView - Text(verbatim: "While we review this, you can take action against @\(viewModel.username)") - .foregroundColor(Color(Asset.Colors.Label.secondary.color)) - .font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)) as CTFont)) + if viewModel.isReported { + avatarView + Text(verbatim: "While we review this, you can take action against @\(viewModel.username)") + .foregroundColor(Color(Asset.Colors.Label.secondary.color)) + .font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)) as CTFont)) + } else { + Text(verbatim: "When you see something you don’t like on Mastodon, you can remove the person from your experience.") + .foregroundColor(Color(Asset.Colors.Label.secondary.color)) + .font(Font(UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: .systemFont(ofSize: 17, weight: .regular)) as CTFont)) + } } Spacer() } @@ -151,7 +157,7 @@ struct ReportActionButton: View { #if DEBUG struct ReportResultView_Previews: PreviewProvider { - static var viewModel: ReportResultViewModel { + static func viewModel(isReported: Bool) -> ReportResultViewModel { let context = AppContext.shared let request = MastodonUser.sortedFetchRequest request.fetchLimit = 1 @@ -184,18 +190,24 @@ struct ReportResultView_Previews: PreviewProvider { return ReportResultViewModel( context: context, - user: .init(objectID: user.objectID) + user: .init(objectID: user.objectID), + isReported: isReported ) } static var previews: some View { Group { NavigationView { - ReportResultView(viewModel: viewModel) + ReportResultView(viewModel: viewModel(isReported: true)) .navigationBarTitle(Text("")) .navigationBarTitleDisplayMode(.inline) } NavigationView { - ReportResultView(viewModel: viewModel) + ReportResultView(viewModel: viewModel(isReported: false)) + .navigationBarTitle(Text("")) + .navigationBarTitleDisplayMode(.inline) + } + NavigationView { + ReportResultView(viewModel: viewModel(isReported: true)) .navigationBarTitle(Text("")) .navigationBarTitleDisplayMode(.inline) } diff --git a/Mastodon/Scene/Report/ReportResult/ReportResultViewModel.swift b/Mastodon/Scene/Report/ReportResult/ReportResultViewModel.swift index 8617f26f9..ea949a901 100644 --- a/Mastodon/Scene/Report/ReportResult/ReportResultViewModel.swift +++ b/Mastodon/Scene/Report/ReportResult/ReportResultViewModel.swift @@ -22,8 +22,11 @@ class ReportResultViewModel: ObservableObject { // input let context: AppContext let user: ManagedObjectRecord + let isReported: Bool - @Published var headline = "Thanks for reporting, we’ll look into this." + var headline: String { + isReported ? "Thanks for reporting, we’ll look into this." : "Don’t want to see this?" + } @Published var bottomPaddingHeight: CGFloat = .zero @Published var backgroundColor: UIColor = Asset.Scene.Report.background.color @@ -42,10 +45,12 @@ class ReportResultViewModel: ObservableObject { init( context: AppContext, - user: ManagedObjectRecord + user: ManagedObjectRecord, + isReported: Bool ) { self.context = context self.user = user + self.isReported = isReported // end init Task { @MainActor in