diff --git a/Localization/app.json b/Localization/app.json index 155061044..67694109f 100644 --- a/Localization/app.json +++ b/Localization/app.json @@ -183,8 +183,10 @@ }, "header": { "no_status_found": "No Status Found", - "blocking_warning": "You can’t view Artbot’s profile\n until you unblock them.\nYour account looks like this to them.", - "blocked_warning": "You can’t view Artbot’s profile\n until they unblock you.", + "blocking_warning": "You can’t view this profile\n until you unblock them.\nYour account looks like this to them.", + "user_blocking_warning": "You can’t view %s's profile\n until you unblock them.\nYour account looks like this to them.", + "blocked_warning": "You can’t view this’s profile\n until they unblock you.", + "user_blocked_warning": "You can’t view %s’s profile\n until they unblock you.", "suspended_warning": "This account has been suspended.", "user_suspended_warning": "%s’s account has been suspended." }, diff --git a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist index f1135b12e..da1d80e90 100644 --- a/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/Mastodon.xcodeproj/xcuserdata/mainasuk.xcuserdatad/xcschemes/xcschememanagement.plist @@ -12,7 +12,7 @@ CoreDataStack.xcscheme_^#shared#^_ orderHint - 20 + 21 Mastodon - ASDK.xcscheme_^#shared#^_ @@ -37,7 +37,7 @@ NotificationService.xcscheme_^#shared#^_ orderHint - 21 + 20 SuppressBuildableAutocreation diff --git a/Mastodon/Diffiable/Item/Item.swift b/Mastodon/Diffiable/Item/Item.swift index 635d0a57d..bde116b69 100644 --- a/Mastodon/Diffiable/Item/Item.swift +++ b/Mastodon/Diffiable/Item/Item.swift @@ -62,15 +62,15 @@ extension Item { enum Reason: Equatable { case noStatusFound - case blocking - case blocked + case blocking(name: String?) + case blocked(name: String?) case suspended(name: String?) static func == (lhs: Item.EmptyStateHeaderAttribute.Reason, rhs: Item.EmptyStateHeaderAttribute.Reason) -> Bool { switch (lhs, rhs) { case (.noStatusFound, noStatusFound): return true - case (.blocking, blocking): return true - case (.blocked, blocked): return true + case (.blocking(let nameLeft), blocking(let nameRight)): return nameLeft == nameRight + case (.blocked(let nameLeft), blocked(let nameRight)): return nameLeft == nameRight case (.suspended(let nameLeft), .suspended(let nameRight)): return nameLeft == nameRight default: return false } diff --git a/Mastodon/Generated/Strings.swift b/Mastodon/Generated/Strings.swift index 78d72d0b7..b02535cca 100644 --- a/Mastodon/Generated/Strings.swift +++ b/Mastodon/Generated/Strings.swift @@ -355,14 +355,22 @@ internal enum L10n { } } internal enum Header { - /// You can’t view Artbot’s profile\n until they unblock you. + /// You can’t view this’s profile\n until they unblock you. internal static let blockedWarning = L10n.tr("Localizable", "Common.Controls.Timeline.Header.BlockedWarning") - /// You can’t view Artbot’s profile\n until you unblock them.\nYour account looks like this to them. + /// You can’t view this profile\n until you unblock them.\nYour account looks like this to them. internal static let blockingWarning = L10n.tr("Localizable", "Common.Controls.Timeline.Header.BlockingWarning") /// No Status Found internal static let noStatusFound = L10n.tr("Localizable", "Common.Controls.Timeline.Header.NoStatusFound") /// This account has been suspended. internal static let suspendedWarning = L10n.tr("Localizable", "Common.Controls.Timeline.Header.SuspendedWarning") + /// You can’t view %@’s profile\n until they unblock you. + internal static func userBlockedWarning(_ p1: Any) -> String { + return L10n.tr("Localizable", "Common.Controls.Timeline.Header.UserBlockedWarning", String(describing: p1)) + } + /// You can’t view %@'s profile\n until you unblock them.\nYour account looks like this to them. + internal static func userBlockingWarning(_ p1: Any) -> String { + return L10n.tr("Localizable", "Common.Controls.Timeline.Header.UserBlockingWarning", String(describing: p1)) + } /// %@’s account has been suspended. internal static func userSuspendedWarning(_ p1: Any) -> String { return L10n.tr("Localizable", "Common.Controls.Timeline.Header.UserSuspendedWarning", String(describing: p1)) diff --git a/Mastodon/Resources/ar.lproj/Localizable.strings b/Mastodon/Resources/ar.lproj/Localizable.strings index 98d43de03..d8876a0e5 100644 --- a/Mastodon/Resources/ar.lproj/Localizable.strings +++ b/Mastodon/Resources/ar.lproj/Localizable.strings @@ -120,13 +120,18 @@ Please check your internet connection."; "Common.Controls.Timeline.Accessibility.CountFavorites" = "%@ favorites"; "Common.Controls.Timeline.Accessibility.CountReblogs" = "%@ reblogs"; "Common.Controls.Timeline.Accessibility.CountReplies" = "%@ replies"; -"Common.Controls.Timeline.Header.BlockedWarning" = "You can’t view Artbot’s profile +"Common.Controls.Timeline.Header.BlockedWarning" = "You can’t view this’s profile until they unblock you."; -"Common.Controls.Timeline.Header.BlockingWarning" = "You can’t view Artbot’s profile +"Common.Controls.Timeline.Header.BlockingWarning" = "You can’t view this profile until you unblock them. Your account looks like this to them."; "Common.Controls.Timeline.Header.NoStatusFound" = "No Status Found"; "Common.Controls.Timeline.Header.SuspendedWarning" = "This account has been suspended."; +"Common.Controls.Timeline.Header.UserBlockedWarning" = "You can’t view %@’s profile + until they unblock you."; +"Common.Controls.Timeline.Header.UserBlockingWarning" = "You can’t view %@'s profile + until you unblock them. +Your account looks like this to them."; "Common.Controls.Timeline.Header.UserSuspendedWarning" = "%@’s account has been suspended."; "Common.Controls.Timeline.Loader.LoadMissingPosts" = "Load missing posts"; "Common.Controls.Timeline.Loader.LoadingMissingPosts" = "Loading missing posts..."; diff --git a/Mastodon/Resources/en.lproj/Localizable.strings b/Mastodon/Resources/en.lproj/Localizable.strings index 98d43de03..d8876a0e5 100644 --- a/Mastodon/Resources/en.lproj/Localizable.strings +++ b/Mastodon/Resources/en.lproj/Localizable.strings @@ -120,13 +120,18 @@ Please check your internet connection."; "Common.Controls.Timeline.Accessibility.CountFavorites" = "%@ favorites"; "Common.Controls.Timeline.Accessibility.CountReblogs" = "%@ reblogs"; "Common.Controls.Timeline.Accessibility.CountReplies" = "%@ replies"; -"Common.Controls.Timeline.Header.BlockedWarning" = "You can’t view Artbot’s profile +"Common.Controls.Timeline.Header.BlockedWarning" = "You can’t view this’s profile until they unblock you."; -"Common.Controls.Timeline.Header.BlockingWarning" = "You can’t view Artbot’s profile +"Common.Controls.Timeline.Header.BlockingWarning" = "You can’t view this profile until you unblock them. Your account looks like this to them."; "Common.Controls.Timeline.Header.NoStatusFound" = "No Status Found"; "Common.Controls.Timeline.Header.SuspendedWarning" = "This account has been suspended."; +"Common.Controls.Timeline.Header.UserBlockedWarning" = "You can’t view %@’s profile + until they unblock you."; +"Common.Controls.Timeline.Header.UserBlockingWarning" = "You can’t view %@'s profile + until you unblock them. +Your account looks like this to them."; "Common.Controls.Timeline.Header.UserSuspendedWarning" = "%@’s account has been suspended."; "Common.Controls.Timeline.Loader.LoadMissingPosts" = "Load missing posts"; "Common.Controls.Timeline.Loader.LoadingMissingPosts" = "Loading missing posts..."; diff --git a/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel.swift b/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel.swift index c282e6719..7d6a6c8fe 100644 --- a/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel.swift +++ b/Mastodon/Scene/Profile/Timeline/UserTimelineViewModel.swift @@ -82,19 +82,28 @@ final class UserTimelineViewModel { diffableDataSource.apply(snapshot, animatingDifferences: !items.isEmpty) } + let name = self.userDisplayName.value guard !isBlocking else { - snapshot.appendItems([Item.emptyStateHeader(attribute: Item.EmptyStateHeaderAttribute(reason: .blocking))], toSection: .main) + snapshot.appendItems( + [Item.emptyStateHeader(attribute: Item.EmptyStateHeaderAttribute(reason: .blocking(name: name)))], + toSection: .main + ) return } guard !isBlockedBy else { - snapshot.appendItems([Item.emptyStateHeader(attribute: Item.EmptyStateHeaderAttribute(reason: .blocked))], toSection: .main) + snapshot.appendItems( + [Item.emptyStateHeader(attribute: Item.EmptyStateHeaderAttribute(reason: .blocked(name: name)))], + toSection: .main + ) return } - let name = self.userDisplayName.value guard !isSuspended else { - snapshot.appendItems([Item.emptyStateHeader(attribute: Item.EmptyStateHeaderAttribute(reason: .suspended(name: name)))], toSection: .main) + snapshot.appendItems( + [Item.emptyStateHeader(attribute: Item.EmptyStateHeaderAttribute(reason: .suspended(name: name)))], + toSection: .main + ) return } diff --git a/Mastodon/Scene/Share/View/Content/TimelineHeaderView.swift b/Mastodon/Scene/Share/View/Content/TimelineHeaderView.swift index f095f6f44..2948af4cf 100644 --- a/Mastodon/Scene/Share/View/Content/TimelineHeaderView.swift +++ b/Mastodon/Scene/Share/View/Content/TimelineHeaderView.swift @@ -97,10 +97,18 @@ extension Item.EmptyStateHeaderAttribute.Reason { switch self { case .noStatusFound: return L10n.Common.Controls.Timeline.Header.noStatusFound - case .blocking: - return L10n.Common.Controls.Timeline.Header.blockingWarning - case .blocked: - return L10n.Common.Controls.Timeline.Header.blockedWarning + case .blocking(let name): + if let name = name { + return L10n.Common.Controls.Timeline.Header.userBlockingWarning(name) + } else { + return L10n.Common.Controls.Timeline.Header.blockingWarning + } + case .blocked(let name): + if let name = name { + return L10n.Common.Controls.Timeline.Header.userBlockedWarning(name) + } else { + return L10n.Common.Controls.Timeline.Header.blockedWarning + } case .suspended(let name): if let name = name { return L10n.Common.Controls.Timeline.Header.userSuspendedWarning(name) @@ -119,8 +127,8 @@ struct TimelineHeaderView_Previews: PreviewProvider { Group { UIViewPreview(width: 375) { let headerView = TimelineHeaderView() - headerView.iconImageView.image = Item.EmptyStateHeaderAttribute.Reason.blocking.iconImage - headerView.messageLabel.text = Item.EmptyStateHeaderAttribute.Reason.blocking.message + headerView.iconImageView.image = Item.EmptyStateHeaderAttribute.Reason.blocking(name: nil).iconImage + headerView.messageLabel.text = Item.EmptyStateHeaderAttribute.Reason.blocking(name: nil).message return headerView } .previewLayout(.fixed(width: 375, height: 400))