Simplify strings

This commit is contained in:
Justin Mazzocchi 2020-11-22 12:20:36 -08:00
parent ad4e699ce1
commit 6e7541f208
No known key found for this signature in database
GPG key ID: E223E6937AAFB01C
3 changed files with 16 additions and 30 deletions

View file

@ -1,19 +1,19 @@
// Copyright © 2020 Metabolist. All rights reserved. // Copyright © 2020 Metabolist. All rights reserved.
"account.block-account" = "Block %@"; "account.block" = "Block";
"account.field.verified" = "Verified %@"; "account.field.verified" = "Verified %@";
"account.follow" = "Follow"; "account.follow" = "Follow";
"account.following" = "Following"; "account.following" = "Following";
"account.hide-reblogs-account" = "Hide reblogs from %@"; "account.hide-reblogs" = "Hide boosts";
"account.mute-account" = "Mute %@"; "account.mute" = "Mute";
"account.request" = "Request"; "account.request" = "Request";
"account.statuses" = "Posts"; "account.statuses" = "Posts";
"account.statuses-and-replies" = "Posts & Replies"; "account.statuses-and-replies" = "Posts & Replies";
"account.media" = "Media"; "account.media" = "Media";
"account.show-reblogs-account" = "Show reblogs from %@"; "account.show-reblogs" = "Show boosts";
"account.unblock-account" = "Unblock %@"; "account.unblock" = "Unblock";
"account.unfollow-account" = "Unfollow %@"; "account.unfollow" = "Unfollow";
"account.unmute-account" = "Unmute %@"; "account.unmute" = "Unmute";
"add" = "Add"; "add" = "Add";
"apns-default-message" = "New notification"; "apns-default-message" = "New notification";
"add-identity.instance-url" = "Instance URL"; "add-identity.instance-url" = "Instance URL";

View file

@ -66,24 +66,19 @@ final class ProfileViewController: TableViewController {
} }
private extension ProfileViewController { private extension ProfileViewController {
// swiftlint:disable:next function_body_length
func menu(accountViewModel: AccountViewModel, relationship: Relationship) -> UIMenu { func menu(accountViewModel: AccountViewModel, relationship: Relationship) -> UIMenu {
var actions = [UIAction]() var actions = [UIAction]()
if relationship.following { if relationship.following {
if relationship.showingReblogs { if relationship.showingReblogs {
actions.append(UIAction( actions.append(UIAction(
title: String.localizedStringWithFormat( title: NSLocalizedString("account.hide-reblogs", comment: ""),
NSLocalizedString("account.hide-reblogs-account", comment: ""),
accountViewModel.accountName),
image: UIImage(systemName: "arrow.2.squarepath")) { _ in image: UIImage(systemName: "arrow.2.squarepath")) { _ in
accountViewModel.hideReblogs() accountViewModel.hideReblogs()
}) })
} else { } else {
actions.append(UIAction( actions.append(UIAction(
title: String.localizedStringWithFormat( title: NSLocalizedString("account.show-reblogs", comment: ""),
NSLocalizedString("account.show-reblogs-account", comment: ""),
accountViewModel.accountName),
image: UIImage(systemName: "arrow.2.squarepath")) { _ in image: UIImage(systemName: "arrow.2.squarepath")) { _ in
accountViewModel.showReblogs() accountViewModel.showReblogs()
}) })
@ -92,17 +87,13 @@ private extension ProfileViewController {
if relationship.muting { if relationship.muting {
actions.append(UIAction( actions.append(UIAction(
title: String.localizedStringWithFormat( title: NSLocalizedString("account.unmute", comment: ""),
NSLocalizedString("account.unmute-account", comment: ""),
accountViewModel.accountName),
image: UIImage(systemName: "speaker")) { _ in image: UIImage(systemName: "speaker")) { _ in
accountViewModel.unmute() accountViewModel.unmute()
}) })
} else { } else {
actions.append(UIAction( actions.append(UIAction(
title: String.localizedStringWithFormat( title: NSLocalizedString("account.mute", comment: ""),
NSLocalizedString("account.mute-account", comment: ""),
accountViewModel.accountName),
image: UIImage(systemName: "speaker.slash")) { _ in image: UIImage(systemName: "speaker.slash")) { _ in
accountViewModel.mute() accountViewModel.mute()
}) })
@ -110,18 +101,15 @@ private extension ProfileViewController {
if relationship.blocking { if relationship.blocking {
actions.append(UIAction( actions.append(UIAction(
title: String.localizedStringWithFormat( title: NSLocalizedString("account.unblock", comment: ""),
NSLocalizedString("account.unblock-account", comment: ""),
accountViewModel.accountName),
image: UIImage(systemName: "slash.circle")) { _ in image: UIImage(systemName: "slash.circle")) { _ in
accountViewModel.unblock() accountViewModel.unblock()
}) })
} else { } else {
actions.append(UIAction( actions.append(UIAction(
title: String.localizedStringWithFormat( title: NSLocalizedString("account.block", comment: ""),
NSLocalizedString("account.block-account", comment: ""), image: UIImage(systemName: "slash.circle"),
accountViewModel.accountName), attributes: .destructive) { _ in
image: UIImage(systemName: "slash.circle")) { _ in
accountViewModel.block() accountViewModel.block()
}) })
} }

View file

@ -212,9 +212,7 @@ private extension AccountHeaderView {
guard let accountViewModel = self?.viewModel?.accountViewModel else { return } guard let accountViewModel = self?.viewModel?.accountViewModel else { return }
let unfollowAction = UIAction( let unfollowAction = UIAction(
title: String.localizedStringWithFormat( title: NSLocalizedString("account.unfollow", comment: ""),
NSLocalizedString("account.unfollow-account", comment: ""),
accountViewModel.accountName),
image: UIImage(systemName: "person.badge.minus"), image: UIImage(systemName: "person.badge.minus"),
attributes: .destructive) { _ in attributes: .destructive) { _ in
accountViewModel.unfollow() accountViewModel.unfollow()