mirror of
https://github.com/metabolist/metatext.git
synced 2025-04-15 16:24:10 +00:00
fix linting
This commit is contained in:
parent
bd466deb74
commit
e95975be00
5 changed files with 84 additions and 23 deletions
|
@ -313,8 +313,11 @@
|
|||
"status.delete.confirm.post" = "Are you sure you want to delete this post?";
|
||||
"status.delete.confirm.toot" = "Are you sure you want to delete this toot?";
|
||||
"status.delete-and-redraft" = "Delete & re-draft";
|
||||
"status.delete-and-redraft.confirm.post" = "Are you sure you want to delete this post and re-draft it? Favorites and boosts will be lost, and replies to the original post will be orphaned.";
|
||||
"status.delete-and-redraft.confirm.toot" = "Are you sure you want to delete this toot and re-draft it? Favorites and boosts will be lost, and replies to the original toot will be orphaned.";
|
||||
"status.delete-and-redraft.confirm.post-favorites" = "Are you sure you want to delete this post and re-draft it? Favorites and boosts will be lost, and replies to the original post will be orphaned.";
|
||||
"status.delete-and-redraft.confirm.toot-favorites" = "Are you sure you want to delete this toot and re-draft it? Favorites and boosts will be lost, and replies to the original toot will be orphaned.";
|
||||
"status.delete-and-redraft.confirm.post-likes" = "Are you sure you want to delete this post and re-draft it? Likes and boosts will be lost, and replies to the original post will be orphaned.";
|
||||
"status.delete-and-redraft.confirm.toot-likes" = "Are you sure you want to delete this toot and re-draft it? Likes and boosts will be lost, and replies to the original toot will be orphaned.";
|
||||
|
||||
"status.mute" = "Mute conversation";
|
||||
"status.new-items.post" = "New posts";
|
||||
"status.new-items.toot" = "New toots";
|
||||
|
@ -333,6 +336,8 @@
|
|||
"status.reblog-button.undo.accessibility-label" = "Unboost";
|
||||
"status.favorite-button.accessibility-label" = "Favorite";
|
||||
"status.favorite-button.undo.accessibility-label" = "Unfavorite";
|
||||
"status.like-button.accessibility-label" = "Like";
|
||||
"status.like-button.undo.accessibility-label" = "Unlike";
|
||||
"status.show-more" = "Show More";
|
||||
"status.show-more-all-button.accessibilty-label" = "Show more for all";
|
||||
"status.show-less" = "Show Less";
|
||||
|
|
|
@ -66,6 +66,22 @@
|
|||
<string>%ld Favorites</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>status.likes-count-%ld</key>
|
||||
<dict>
|
||||
<key>NSStringLocalizedFormatKey</key>
|
||||
<string>%#@likes@</string>
|
||||
<key>likes</key>
|
||||
<dict>
|
||||
<key>NSStringFormatSpecTypeKey</key>
|
||||
<string>NSStringPluralRuleType</string>
|
||||
<key>NSStringFormatValueTypeKey</key>
|
||||
<string>ld</string>
|
||||
<key>one</key>
|
||||
<string>%ld Like</string>
|
||||
<key>other</key>
|
||||
<string>%ld Likes</string>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>status.replies-count-%ld</key>
|
||||
<dict>
|
||||
<key>NSStringLocalizedFormatKey</key>
|
||||
|
|
|
@ -687,12 +687,17 @@ private extension TableViewController {
|
|||
let deleteAndRedraftConfirmMessage: String
|
||||
let deleteConfirmMessage: String
|
||||
|
||||
let favoritesNoun = viewModel.identityContext.appPreferences.displayFavoritesAs.rawValue
|
||||
|
||||
switch viewModel.identityContext.appPreferences.statusWord {
|
||||
case .toot:
|
||||
deleteAndRedraftConfirmMessage = NSLocalizedString("status.delete-and-redraft.confirm.toot", comment: "")
|
||||
deleteAndRedraftConfirmMessage = NSLocalizedString(
|
||||
"status.delete-and-redraft.confirm.toot-".appending(favoritesNoun),
|
||||
comment: "")
|
||||
deleteConfirmMessage = NSLocalizedString("status.delete.confirm.toot", comment: "")
|
||||
case .post:
|
||||
deleteAndRedraftConfirmMessage = NSLocalizedString("status.delete-and-redraft.confirm.post", comment: "")
|
||||
deleteAndRedraftConfirmMessage = NSLocalizedString(
|
||||
"status.delete-and-redraft.confirm.post-".appending(favoritesNoun), comment: "")
|
||||
deleteConfirmMessage = NSLocalizedString("status.delete.confirm.post", comment: "")
|
||||
}
|
||||
|
||||
|
|
|
@ -163,6 +163,33 @@ private extension NotificationView {
|
|||
isAccessibilityElement = true
|
||||
}
|
||||
|
||||
var colorForFavoriteView: UIColor {
|
||||
switch notificationConfiguration.viewModel.identityContext.appPreferences.displayFavoritesAs {
|
||||
case .favorites:
|
||||
return .systemYellow
|
||||
case .likes:
|
||||
return .systemRed
|
||||
}
|
||||
}
|
||||
|
||||
var labelForFavoriteView: String {
|
||||
switch notificationConfiguration.viewModel.identityContext.appPreferences.displayFavoritesAs {
|
||||
case .favorites:
|
||||
return "notifications.favourited-your-status-%@"
|
||||
case .likes:
|
||||
return "notifications.liked-your-status-%@"
|
||||
}
|
||||
}
|
||||
|
||||
var imageNameForFavoriteView: String {
|
||||
switch notificationConfiguration.viewModel.identityContext.appPreferences.displayFavoritesAs {
|
||||
case .favorites:
|
||||
return "star.fill"
|
||||
case .likes:
|
||||
return "heart.fill"
|
||||
}
|
||||
}
|
||||
|
||||
func applyNotificationConfiguration() {
|
||||
let viewModel = notificationConfiguration.viewModel
|
||||
var imageName = viewModel.type.systemImageName
|
||||
|
@ -184,23 +211,13 @@ private extension NotificationView {
|
|||
identityContext: viewModel.identityContext)
|
||||
iconImageView.tintColor = .systemGreen
|
||||
case .favourite:
|
||||
let label: String
|
||||
let color: UIColor
|
||||
switch viewModel.identityContext.appPreferences.displayFavoritesAs {
|
||||
case .favorites:
|
||||
label = "notifications.favourited-your-status-%@"
|
||||
color = .systemYellow
|
||||
case .likes:
|
||||
label = "notifications.liked-your-status-%@"
|
||||
color = .systemRed
|
||||
imageName = "heart.fill"
|
||||
}
|
||||
typeLabel.attributedText = label.localizedBolding(
|
||||
imageName = imageNameForFavoriteView
|
||||
typeLabel.attributedText = labelForFavoriteView.localizedBolding(
|
||||
displayName: viewModel.accountViewModel.displayName,
|
||||
emojis: viewModel.accountViewModel.emojis,
|
||||
label: typeLabel,
|
||||
identityContext: viewModel.identityContext)
|
||||
iconImageView.tintColor = color
|
||||
iconImageView.tintColor = colorForFavoriteView
|
||||
case .poll:
|
||||
typeLabel.text = NSLocalizedString(
|
||||
viewModel.accountViewModel.isSelf
|
||||
|
|
|
@ -451,6 +451,15 @@ private extension StatusView {
|
|||
.store(in: &cancellables)
|
||||
}
|
||||
|
||||
var favoriteCountLabel: String {
|
||||
switch statusConfiguration.viewModel.identityContext.appPreferences.displayFavoritesAs {
|
||||
case .favorites:
|
||||
return "status.favorites-count-%ld"
|
||||
case .likes:
|
||||
return "status.likes-count-%ld"
|
||||
}
|
||||
}
|
||||
|
||||
func applyStatusConfiguration() {
|
||||
let viewModel = statusConfiguration.viewModel
|
||||
let isContextParent = viewModel.configuration.isContextParent
|
||||
|
@ -593,8 +602,9 @@ private extension StatusView {
|
|||
localizationKey: "status.reblogs-count-%ld",
|
||||
count: viewModel.reblogsCount)
|
||||
rebloggedByButton.isHidden = noReblogs
|
||||
|
||||
favoritedByButton.setAttributedLocalizedTitle(
|
||||
localizationKey: "status.favorites-count-%ld",
|
||||
localizationKey: favoriteCountLabel,
|
||||
count: viewModel.favoritesCount)
|
||||
favoritedByButton.isHidden = noFavorites
|
||||
|
||||
|
@ -822,7 +832,7 @@ private extension StatusView {
|
|||
if statusConfiguration.viewModel.favoritesCount > 0 {
|
||||
accessibilityAttributedLabel.appendWithSeparator(
|
||||
String.localizedStringWithFormat(
|
||||
NSLocalizedString("status.favorites-count-%ld", comment: ""),
|
||||
NSLocalizedString(favoriteCountLabel, comment: ""),
|
||||
statusConfiguration.viewModel.favoritesCount))
|
||||
}
|
||||
}
|
||||
|
@ -920,9 +930,17 @@ private extension StatusView {
|
|||
|
||||
func setFavoriteButtonColor(favorited: Bool) {
|
||||
var favoriteColor: UIColor
|
||||
var favoriteLabel: String
|
||||
var undoFavoriteLabel: String
|
||||
switch statusConfiguration.viewModel.identityContext.appPreferences.displayFavoritesAs {
|
||||
case .favorites: favoriteColor = favorited ? .systemYellow : .secondaryLabel
|
||||
case .likes: favoriteColor = favorited ? .systemRed : .secondaryLabel
|
||||
case .favorites:
|
||||
favoriteColor = favorited ? .systemYellow : .secondaryLabel
|
||||
favoriteLabel = "status.favorite-button.undo.accessibility-label"
|
||||
undoFavoriteLabel = "status.favorite-button.accessibility-label"
|
||||
case .likes:
|
||||
favoriteColor = favorited ? .systemRed : .secondaryLabel
|
||||
favoriteLabel = "status.like-button.undo.accessibility-label"
|
||||
undoFavoriteLabel = "status.like-button.accessibility-label"
|
||||
}
|
||||
|
||||
favoriteButton.tintColor = favoriteColor
|
||||
|
@ -930,10 +948,10 @@ private extension StatusView {
|
|||
|
||||
if favorited {
|
||||
favoriteButton.accessibilityLabel =
|
||||
NSLocalizedString("status.favorite-button.undo.accessibility-label", comment: "")
|
||||
NSLocalizedString(undoFavoriteLabel, comment: "")
|
||||
} else {
|
||||
favoriteButton.accessibilityLabel =
|
||||
NSLocalizedString("status.favorite-button.accessibility-label", comment: "")
|
||||
NSLocalizedString(favoriteLabel, comment: "")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue