From 8c48bce627383c405052ebe2066ac5efabcb1cbd Mon Sep 17 00:00:00 2001 From: CMK Date: Mon, 15 Mar 2021 13:42:46 +0800 Subject: [PATCH] chore: rename toot --- Localization/app.json | 28 +++++++++---------- .../Section/ComposeStatusSection.swift | 6 ++-- .../Diffiable/Section/StatusSection.swift | 2 +- Mastodon/Generated/Strings.swift | 26 ++++++++--------- .../Resources/en.lproj/Localizable.strings | 14 +++++----- .../Scene/Compose/ComposeViewController.swift | 5 ++-- .../Compose/ComposeViewModel+Diffable.swift | 4 +-- Mastodon/Scene/Compose/ComposeViewModel.swift | 4 +-- ...meTimelineViewController+DebugAction.swift | 8 +++--- .../HomeTimelineViewController.swift | 2 +- .../TableViewCell/PickServerCell.swift | 4 +-- .../Scene/Share/View/Content/StatusView.swift | 2 +- 12 files changed, 52 insertions(+), 53 deletions(-) diff --git a/Localization/app.json b/Localization/app.json index 17994bb3..d521a98d 100644 --- a/Localization/app.json +++ b/Localization/app.json @@ -15,9 +15,9 @@ "title": "Vote Failure", "poll_expired": "The poll has expired" }, - "discard_compose_content": { - "title": "Discard Toot", - "message": "Confirm discard composed toot content." + "discard_post_content": { + "title": "Discard Publish", + "message": "Confirm discard composed post content." } }, "controls": { @@ -41,7 +41,7 @@ "open_in_safari": "Open in Safari" }, "status": { - "user_boosted": "%s boosted", + "user_reblogged": "%s reblogged", "show_post": "Show Post", "status_content_warning": "content warning", "media_content_warning": "Tap to reveal that may be sensitive", @@ -76,17 +76,17 @@ }, "server_picker": { "title": "Pick a Server,\nany server.", - "Button": { - "Category": { + "button": { + "category": { "All": "All" }, - "SeeLess": "See Less", - "SeeMore": "See More" + "see_less": "See Less", + "see_more": "See More" }, - "Label": { - "Language": "LANGUAGE", - "Users": "USERS", - "Category": "CATEGORY" + "label": { + "language": "LANGUAGE", + "users": "USERS", + "category": "CATEGORY" }, "input": { "placeholder": "Find a server or join your own..." @@ -181,11 +181,11 @@ }, "compose": { "title": { - "new_toot": "New Toot", + "new_post": "New Post", "new_reply": "New Reply" }, "content_input_placeholder": "Type or paste what's on your mind", - "compose_action": "Toot" + "compose_action": "Publish" } } } \ No newline at end of file diff --git a/Mastodon/Diffiable/Section/ComposeStatusSection.swift b/Mastodon/Diffiable/Section/ComposeStatusSection.swift index 5c212454..ce08fc00 100644 --- a/Mastodon/Diffiable/Section/ComposeStatusSection.swift +++ b/Mastodon/Diffiable/Section/ComposeStatusSection.swift @@ -18,8 +18,8 @@ enum ComposeStatusSection: Equatable, Hashable { extension ComposeStatusSection { enum ComposeKind { - case toot - case replyToot(tootObjectID: NSManagedObjectID) + case post + case reply(repliedToStatusObjectID: NSManagedObjectID) } } @@ -33,7 +33,7 @@ extension ComposeStatusSection { ) -> UITableViewDiffableDataSource { UITableViewDiffableDataSource(tableView: tableView) { [weak textEditorViewTextAttributesDelegate] tableView, indexPath, item -> UITableViewCell? in switch item { - case .replyTo(let tootObjectID): + case .replyTo(let repliedToStatusObjectID): let cell = tableView.dequeueReusableCell(withIdentifier: String(describing: ComposeRepliedToTootContentTableViewCell.self), for: indexPath) as! ComposeRepliedToTootContentTableViewCell // TODO: return cell diff --git a/Mastodon/Diffiable/Section/StatusSection.swift b/Mastodon/Diffiable/Section/StatusSection.swift index 517fd5a2..3f4a4f36 100644 --- a/Mastodon/Diffiable/Section/StatusSection.swift +++ b/Mastodon/Diffiable/Section/StatusSection.swift @@ -91,7 +91,7 @@ extension StatusSection { cell.statusView.headerInfoLabel.text = { let author = toot.author let name = author.displayName.isEmpty ? author.username : author.displayName - return L10n.Common.Controls.Status.userBoosted(name) + return L10n.Common.Controls.Status.userReblogged(name) }() // set name username avatar diff --git a/Mastodon/Generated/Strings.swift b/Mastodon/Generated/Strings.swift index 105e98ef..dda118a0 100644 --- a/Mastodon/Generated/Strings.swift +++ b/Mastodon/Generated/Strings.swift @@ -19,11 +19,11 @@ internal enum L10n { /// Please try again later. internal static let pleaseTryAgainLater = L10n.tr("Localizable", "Common.Alerts.Common.PleaseTryAgainLater") } - internal enum DiscardComposeContent { - /// Confirm discard composed toot content. - internal static let message = L10n.tr("Localizable", "Common.Alerts.DiscardComposeContent.Message") - /// Discard Toot - internal static let title = L10n.tr("Localizable", "Common.Alerts.DiscardComposeContent.Title") + internal enum DiscardPostContent { + /// Confirm discard composed post content. + internal static let message = L10n.tr("Localizable", "Common.Alerts.DiscardPostContent.Message") + /// Discard Publish + internal static let title = L10n.tr("Localizable", "Common.Alerts.DiscardPostContent.Title") } internal enum ServerError { /// Server Error @@ -84,9 +84,9 @@ internal enum L10n { internal static let showPost = L10n.tr("Localizable", "Common.Controls.Status.ShowPost") /// content warning internal static let statusContentWarning = L10n.tr("Localizable", "Common.Controls.Status.StatusContentWarning") - /// %@ boosted - internal static func userBoosted(_ p1: Any) -> String { - return L10n.tr("Localizable", "Common.Controls.Status.UserBoosted", String(describing: p1)) + /// %@ reblogged + internal static func userReblogged(_ p1: Any) -> String { + return L10n.tr("Localizable", "Common.Controls.Status.UserReblogged", String(describing: p1)) } internal enum Poll { /// Closed @@ -136,15 +136,15 @@ internal enum L10n { internal enum Scene { internal enum Compose { - /// Toot + /// Publish internal static let composeAction = L10n.tr("Localizable", "Scene.Compose.ComposeAction") /// Type or paste what's on your mind internal static let contentInputPlaceholder = L10n.tr("Localizable", "Scene.Compose.ContentInputPlaceholder") internal enum Title { + /// New Post + internal static let newPost = L10n.tr("Localizable", "Scene.Compose.Title.NewPost") /// New Reply internal static let newReply = L10n.tr("Localizable", "Scene.Compose.Title.NewReply") - /// New Toot - internal static let newToot = L10n.tr("Localizable", "Scene.Compose.Title.NewToot") } } internal enum ConfirmEmail { @@ -290,9 +290,9 @@ internal enum L10n { internal static let title = L10n.tr("Localizable", "Scene.ServerPicker.Title") internal enum Button { /// See Less - internal static let seeless = L10n.tr("Localizable", "Scene.ServerPicker.Button.Seeless") + internal static let seeLess = L10n.tr("Localizable", "Scene.ServerPicker.Button.SeeLess") /// See More - internal static let seemore = L10n.tr("Localizable", "Scene.ServerPicker.Button.Seemore") + internal static let seeMore = L10n.tr("Localizable", "Scene.ServerPicker.Button.SeeMore") internal enum Category { /// All internal static let all = L10n.tr("Localizable", "Scene.ServerPicker.Button.Category.All") diff --git a/Mastodon/Resources/en.lproj/Localizable.strings b/Mastodon/Resources/en.lproj/Localizable.strings index 5605683d..c2eeb491 100644 --- a/Mastodon/Resources/en.lproj/Localizable.strings +++ b/Mastodon/Resources/en.lproj/Localizable.strings @@ -1,7 +1,7 @@ "Common.Alerts.Common.PleaseTryAgain" = "Please try again."; "Common.Alerts.Common.PleaseTryAgainLater" = "Please try again later."; -"Common.Alerts.DiscardComposeContent.Message" = "Confirm discard composed toot content."; -"Common.Alerts.DiscardComposeContent.Title" = "Discard Toot"; +"Common.Alerts.DiscardPostContent.Message" = "Confirm discard composed post content."; +"Common.Alerts.DiscardPostContent.Title" = "Discard Publish"; "Common.Alerts.ServerError.Title" = "Server Error"; "Common.Alerts.SignUpFailure.Title" = "Sign Up Failure"; "Common.Alerts.VoteFailure.PollExpired" = "The poll has expired"; @@ -33,14 +33,14 @@ "Common.Controls.Status.Poll.VoterCount.Single" = "%d voter"; "Common.Controls.Status.ShowPost" = "Show Post"; "Common.Controls.Status.StatusContentWarning" = "content warning"; -"Common.Controls.Status.UserBoosted" = "%@ boosted"; +"Common.Controls.Status.UserReblogged" = "%@ reblogged"; "Common.Controls.Timeline.LoadMore" = "Load More"; "Common.Countable.Photo.Multiple" = "photos"; "Common.Countable.Photo.Single" = "photo"; -"Scene.Compose.ComposeAction" = "Toot"; +"Scene.Compose.ComposeAction" = "Publish"; "Scene.Compose.ContentInputPlaceholder" = "Type or paste what's on your mind"; +"Scene.Compose.Title.NewPost" = "New Post"; "Scene.Compose.Title.NewReply" = "New Reply"; -"Scene.Compose.Title.NewToot" = "New Toot"; "Scene.ConfirmEmail.Button.DontReceiveEmail" = "I never got an email"; "Scene.ConfirmEmail.Button.OpenEmailApp" = "Open Email App"; "Scene.ConfirmEmail.DontReceiveEmail.Description" = "Check if your email address is correct as well as your junk folder if you haven’t."; @@ -84,8 +84,8 @@ tap the link to confirm your account."; "Scene.Register.Input.Username.Placeholder" = "username"; "Scene.Register.Title" = "Tell us about you."; "Scene.ServerPicker.Button.Category.All" = "All"; -"Scene.ServerPicker.Button.Seeless" = "See Less"; -"Scene.ServerPicker.Button.Seemore" = "See More"; +"Scene.ServerPicker.Button.SeeLess" = "See Less"; +"Scene.ServerPicker.Button.SeeMore" = "See More"; "Scene.ServerPicker.EmptyState.BadNetwork" = "Something went wrong while loading data. Check your internet connection."; "Scene.ServerPicker.EmptyState.FindingServers" = "Finding available servers..."; "Scene.ServerPicker.Input.Placeholder" = "Find a server or join your own..."; diff --git a/Mastodon/Scene/Compose/ComposeViewController.swift b/Mastodon/Scene/Compose/ComposeViewController.swift index 22a48fb0..729c81e8 100644 --- a/Mastodon/Scene/Compose/ComposeViewController.swift +++ b/Mastodon/Scene/Compose/ComposeViewController.swift @@ -191,8 +191,8 @@ extension ComposeViewController { private func showDismissConfirmAlertController() { let alertController = UIAlertController( - title: L10n.Common.Alerts.DiscardComposeContent.title, - message: L10n.Common.Alerts.DiscardComposeContent.message, + title: L10n.Common.Alerts.DiscardPostContent.title, + message: L10n.Common.Alerts.DiscardPostContent.message, preferredStyle: .alert ) let discardAction = UIAlertAction(title: L10n.Common.Controls.Actions.discard, style: .destructive) { [weak self] _ in @@ -227,7 +227,6 @@ extension ComposeViewController: TextEditorViewTextAttributesDelegate { updateAttributedString attributedString: NSAttributedString, completion: @escaping (NSAttributedString?) -> Void ) { - DispatchQueue.global().async { let string = attributedString.string os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s: update: %s", ((#file as NSString).lastPathComponent), #line, #function, string) diff --git a/Mastodon/Scene/Compose/ComposeViewModel+Diffable.swift b/Mastodon/Scene/Compose/ComposeViewModel+Diffable.swift index 0ee3e0b3..b175aaca 100644 --- a/Mastodon/Scene/Compose/ComposeViewModel+Diffable.swift +++ b/Mastodon/Scene/Compose/ComposeViewModel+Diffable.swift @@ -26,10 +26,10 @@ extension ComposeViewModel { var snapshot = NSDiffableDataSourceSnapshot() snapshot.appendSections([.repliedTo, .status]) switch composeKind { - case .replyToot(let tootObjectID): + case .reply(let tootObjectID): snapshot.appendItems([.replyTo(tootObjectID: tootObjectID)], toSection: .repliedTo) snapshot.appendItems([.toot(replyToTootObjectID: tootObjectID, attribute: composeTootAttribute)], toSection: .status) - case .toot: + case .post: snapshot.appendItems([.toot(replyToTootObjectID: nil, attribute: composeTootAttribute)], toSection: .status) } diffableDataSource.apply(snapshot, animatingDifferences: false) diff --git a/Mastodon/Scene/Compose/ComposeViewModel.swift b/Mastodon/Scene/Compose/ComposeViewModel.swift index a6228099..097de6ae 100644 --- a/Mastodon/Scene/Compose/ComposeViewModel.swift +++ b/Mastodon/Scene/Compose/ComposeViewModel.swift @@ -36,8 +36,8 @@ final class ComposeViewModel { self.context = context self.composeKind = composeKind switch composeKind { - case .toot: self.title = CurrentValueSubject(L10n.Scene.Compose.Title.newToot) - case .replyToot: self.title = CurrentValueSubject(L10n.Scene.Compose.Title.newReply) + case .post: self.title = CurrentValueSubject(L10n.Scene.Compose.Title.newPost) + case .reply: self.title = CurrentValueSubject(L10n.Scene.Compose.Title.newReply) } self.activeAuthentication = CurrentValueSubject(context.authenticationService.activeMastodonAuthentication.value) // end init diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift index 0937e1fb..08696db9 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController+DebugAction.swift @@ -108,8 +108,8 @@ extension HomeTimelineViewController { switch item { case .homeTimelineIndex(let objectID, _): let homeTimelineIndex = viewModel.fetchedResultsController.managedObjectContext.object(with: objectID) as! HomeTimelineIndex - let toot = homeTimelineIndex.toot.reblog ?? homeTimelineIndex.toot - return toot.poll != nil + let post = homeTimelineIndex.toot.reblog ?? homeTimelineIndex.toot + return post.poll != nil default: return false } @@ -148,8 +148,8 @@ extension HomeTimelineViewController { self.context.apiService.backgroundManagedObjectContext.performChanges { [weak self] in guard let self = self else { return } for objectID in droppingTootObjectIDs { - guard let toot = try? self.context.apiService.backgroundManagedObjectContext.existingObject(with: objectID) as? Toot else { continue } - self.context.apiService.backgroundManagedObjectContext.delete(toot) + guard let post = try? self.context.apiService.backgroundManagedObjectContext.existingObject(with: objectID) as? Toot else { continue } + self.context.apiService.backgroundManagedObjectContext.delete(post) } } .sink { _ in diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController.swift index 19e8c3ed..e405a4a9 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController.swift @@ -166,7 +166,7 @@ extension HomeTimelineViewController { @objc private func composeBarButtonItemPressed(_ sender: UIBarButtonItem) { os_log(.info, log: .debug, "%{public}s[%{public}ld], %{public}s", ((#file as NSString).lastPathComponent), #line, #function) - let composeViewModel = ComposeViewModel(context: context, composeKind: .toot) + let composeViewModel = ComposeViewModel(context: context, composeKind: .post) coordinator.present(scene: .compose(viewModel: composeViewModel), from: self, transition: .modal(animated: true, completion: nil)) } diff --git a/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift b/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift index 95a5491c..5ff83cc7 100644 --- a/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift +++ b/Mastodon/Scene/Onboarding/PickServer/TableViewCell/PickServerCell.swift @@ -88,8 +88,8 @@ class PickServerCell: UITableViewCell { let expandButton: UIButton = { let button = UIButton(type: .custom) - button.setTitle(L10n.Scene.ServerPicker.Button.seemore, for: .normal) - button.setTitle(L10n.Scene.ServerPicker.Button.seeless, for: .selected) + button.setTitle(L10n.Scene.ServerPicker.Button.seeMore, for: .normal) + button.setTitle(L10n.Scene.ServerPicker.Button.seeLess, for: .selected) button.setTitleColor(Asset.Colors.lightBrandBlue.color, for: .normal) button.titleLabel?.font = .preferredFont(forTextStyle: .footnote) button.translatesAutoresizingMaskIntoConstraints = false diff --git a/Mastodon/Scene/Share/View/Content/StatusView.swift b/Mastodon/Scene/Share/View/Content/StatusView.swift index ad773478..324da6e2 100644 --- a/Mastodon/Scene/Share/View/Content/StatusView.swift +++ b/Mastodon/Scene/Share/View/Content/StatusView.swift @@ -350,7 +350,7 @@ extension StatusView { NSLayoutConstraint.activate([ audioView.leadingAnchor.constraint(equalTo: statusTextContainerView.leadingAnchor), audioView.trailingAnchor.constraint(equalTo: statusTextContainerView.trailingAnchor), - audioView.heightAnchor.constraint(equalToConstant: 44) + audioView.heightAnchor.constraint(equalToConstant: 44).priority(.defaultHigh) ]) // video gif statusContainerStackView.addArrangedSubview(mosaicPlayerView)