Merge pull request #753 from j-f1/following-customization
Differentiate between “My followers” and other accounts followers for i18n
This commit is contained in:
commit
08b63bda00
|
@ -463,9 +463,12 @@
|
|||
"follows_you": "Follows You"
|
||||
},
|
||||
"dashboard": {
|
||||
"posts": "posts",
|
||||
"following": "following",
|
||||
"followers": "followers"
|
||||
"my_posts": "posts",
|
||||
"my_following": "following",
|
||||
"my_followers": "followers",
|
||||
"other_posts": "posts",
|
||||
"other_following": "following",
|
||||
"other_followers": "followers"
|
||||
},
|
||||
"fields": {
|
||||
"joined": "Joined",
|
||||
|
|
|
@ -463,9 +463,12 @@
|
|||
"follows_you": "Follows You"
|
||||
},
|
||||
"dashboard": {
|
||||
"posts": "posts",
|
||||
"following": "following",
|
||||
"followers": "followers"
|
||||
"my_posts": "posts",
|
||||
"my_following": "following",
|
||||
"my_followers": "followers",
|
||||
"other_posts": "posts",
|
||||
"other_following": "following",
|
||||
"other_followers": "followers"
|
||||
},
|
||||
"fields": {
|
||||
"joined": "Joined",
|
||||
|
|
|
@ -153,6 +153,9 @@ extension ProfileHeaderViewController {
|
|||
viewModel.$relationshipActionOptionSet
|
||||
.assign(to: \.relationshipActionOptionSet, on: profileHeaderView.viewModel)
|
||||
.store(in: &disposeBag)
|
||||
viewModel.$isMyself
|
||||
.assign(to: \.isMyself, on: profileHeaderView.viewModel)
|
||||
.store(in: &disposeBag)
|
||||
viewModel.$isEditing
|
||||
.assign(to: \.isEditing, on: profileHeaderView.viewModel)
|
||||
.store(in: &disposeBag)
|
||||
|
|
|
@ -30,6 +30,7 @@ final class ProfileHeaderViewModel {
|
|||
@Published var user: MastodonUser?
|
||||
@Published var relationshipActionOptionSet: RelationshipActionOptionSet = .none
|
||||
|
||||
@Published var isMyself = false
|
||||
@Published var isEditing = false
|
||||
@Published var isUpdating = false
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ extension ProfileHeaderView {
|
|||
|
||||
@Published var relationshipActionOptionSet: RelationshipActionOptionSet = .none
|
||||
@Published var isRelationshipActionButtonHidden = false
|
||||
@Published var isMyself = false
|
||||
|
||||
init() {
|
||||
$relationshipActionOptionSet
|
||||
|
@ -189,6 +190,19 @@ extension ProfileHeaderView.ViewModel {
|
|||
}
|
||||
.store(in: &disposeBag)
|
||||
// dashboard
|
||||
$isMyself
|
||||
.sink { isMyself in
|
||||
if isMyself {
|
||||
view.statusDashboardView.postDashboardMeterView.textLabel.text = L10n.Scene.Profile.Dashboard.myPosts
|
||||
view.statusDashboardView.followingDashboardMeterView.textLabel.text = L10n.Scene.Profile.Dashboard.myFollowing
|
||||
view.statusDashboardView.followersDashboardMeterView.textLabel.text = L10n.Scene.Profile.Dashboard.myFollowers
|
||||
} else {
|
||||
view.statusDashboardView.postDashboardMeterView.textLabel.text = L10n.Scene.Profile.Dashboard.otherPosts
|
||||
view.statusDashboardView.followingDashboardMeterView.textLabel.text = L10n.Scene.Profile.Dashboard.otherFollowing
|
||||
view.statusDashboardView.followersDashboardMeterView.textLabel.text = L10n.Scene.Profile.Dashboard.otherFollowers
|
||||
}
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
$statusesCount
|
||||
.sink { count in
|
||||
let text = count.flatMap { MastodonMetricFormatter().string(from: $0) } ?? "-"
|
||||
|
|
|
@ -311,6 +311,9 @@ extension ProfileViewController {
|
|||
viewModel.$isUpdating
|
||||
.assign(to: \.isUpdating, on: headerViewModel)
|
||||
.store(in: &disposeBag)
|
||||
viewModel.relationshipViewModel.$isMyself
|
||||
.assign(to: \.isMyself, on: headerViewModel)
|
||||
.store(in: &disposeBag)
|
||||
viewModel.relationshipViewModel.$optionSet
|
||||
.map { $0 ?? .none }
|
||||
.assign(to: \.relationshipActionOptionSet, on: headerViewModel)
|
||||
|
|
|
@ -792,11 +792,17 @@ public enum L10n {
|
|||
}
|
||||
public enum Dashboard {
|
||||
/// followers
|
||||
public static let followers = L10n.tr("Localizable", "Scene.Profile.Dashboard.Followers", fallback: "followers")
|
||||
public static let myFollowers = L10n.tr("Localizable", "Scene.Profile.Dashboard.MyFollowers", fallback: "followers")
|
||||
/// following
|
||||
public static let following = L10n.tr("Localizable", "Scene.Profile.Dashboard.Following", fallback: "following")
|
||||
public static let myFollowing = L10n.tr("Localizable", "Scene.Profile.Dashboard.MyFollowing", fallback: "following")
|
||||
/// posts
|
||||
public static let posts = L10n.tr("Localizable", "Scene.Profile.Dashboard.Posts", fallback: "posts")
|
||||
public static let myPosts = L10n.tr("Localizable", "Scene.Profile.Dashboard.MyPosts", fallback: "posts")
|
||||
/// followers
|
||||
public static let otherFollowers = L10n.tr("Localizable", "Scene.Profile.Dashboard.OtherFollowers", fallback: "followers")
|
||||
/// following
|
||||
public static let otherFollowing = L10n.tr("Localizable", "Scene.Profile.Dashboard.OtherFollowing", fallback: "following")
|
||||
/// posts
|
||||
public static let otherPosts = L10n.tr("Localizable", "Scene.Profile.Dashboard.OtherPosts", fallback: "posts")
|
||||
}
|
||||
public enum Fields {
|
||||
/// Add Row
|
||||
|
|
|
@ -283,9 +283,12 @@ uploaded to Mastodon.";
|
|||
"Scene.Profile.Accessibility.EditAvatarImage" = "Edit avatar image";
|
||||
"Scene.Profile.Accessibility.ShowAvatarImage" = "Show avatar image";
|
||||
"Scene.Profile.Accessibility.ShowBannerImage" = "Show banner image";
|
||||
"Scene.Profile.Dashboard.Followers" = "followers";
|
||||
"Scene.Profile.Dashboard.Following" = "following";
|
||||
"Scene.Profile.Dashboard.Posts" = "posts";
|
||||
"Scene.Profile.Dashboard.MyFollowers" = "followers";
|
||||
"Scene.Profile.Dashboard.MyFollowing" = "following";
|
||||
"Scene.Profile.Dashboard.MyPosts" = "posts";
|
||||
"Scene.Profile.Dashboard.OtherFollowers" = "followers";
|
||||
"Scene.Profile.Dashboard.OtherFollowing" = "following";
|
||||
"Scene.Profile.Dashboard.OtherPosts" = "posts";
|
||||
"Scene.Profile.Fields.AddRow" = "Add Row";
|
||||
"Scene.Profile.Fields.Joined" = "Joined";
|
||||
"Scene.Profile.Fields.Placeholder.Content" = "Content";
|
||||
|
|
|
@ -43,7 +43,7 @@ extension ProfileCardView {
|
|||
@Published public var isMuting = false
|
||||
@Published public var isBlocking = false
|
||||
@Published public var isBlockedBy = false
|
||||
|
||||
|
||||
@Published public var groupedAccessibilityLabel = ""
|
||||
|
||||
@Published public var familiarFollowers: Mastodon.Entity.FamiliarFollowers?
|
||||
|
@ -173,6 +173,19 @@ extension ProfileCardView.ViewModel {
|
|||
}
|
||||
|
||||
private func bindDashboard(view: ProfileCardView) {
|
||||
relationshipViewModel.$isMyself
|
||||
.sink { isMyself in
|
||||
if isMyself {
|
||||
view.statusDashboardView.postDashboardMeterView.textLabel.text = L10n.Scene.Profile.Dashboard.myPosts
|
||||
view.statusDashboardView.followingDashboardMeterView.textLabel.text = L10n.Scene.Profile.Dashboard.myFollowing
|
||||
view.statusDashboardView.followersDashboardMeterView.textLabel.text = L10n.Scene.Profile.Dashboard.myFollowers
|
||||
} else {
|
||||
view.statusDashboardView.postDashboardMeterView.textLabel.text = L10n.Scene.Profile.Dashboard.otherPosts
|
||||
view.statusDashboardView.followingDashboardMeterView.textLabel.text = L10n.Scene.Profile.Dashboard.otherFollowing
|
||||
view.statusDashboardView.followersDashboardMeterView.textLabel.text = L10n.Scene.Profile.Dashboard.otherFollowers
|
||||
}
|
||||
}
|
||||
.store(in: &disposeBag)
|
||||
$statusesCount
|
||||
.receive(on: DispatchQueue.main)
|
||||
.sink { count in
|
||||
|
|
|
@ -29,7 +29,6 @@ public final class ProfileStatusDashboardMeterView: UIView {
|
|||
let label = UILabel()
|
||||
label.font = .systemFont(ofSize: 13, weight: .regular)
|
||||
label.textColor = Asset.Colors.Label.primary.color
|
||||
label.text = L10n.Scene.Profile.Dashboard.posts
|
||||
label.textAlignment = .center
|
||||
if UIView.isZoomedMode {
|
||||
label.adjustsFontSizeToFitWidth = true
|
||||
|
|
|
@ -66,10 +66,6 @@ extension ProfileStatusDashboardView {
|
|||
containerStackView.setCustomSpacing(spacing + 2, after: followingDashboardMeterView)
|
||||
containerStackView.addArrangedSubview(followersDashboardMeterView)
|
||||
|
||||
postDashboardMeterView.textLabel.text = L10n.Scene.Profile.Dashboard.posts
|
||||
followingDashboardMeterView.textLabel.text = L10n.Scene.Profile.Dashboard.following
|
||||
followersDashboardMeterView.textLabel.text = L10n.Scene.Profile.Dashboard.followers
|
||||
|
||||
[postDashboardMeterView, followingDashboardMeterView, followersDashboardMeterView].forEach { meterView in
|
||||
let tapGestureRecognizer = UITapGestureRecognizer.singleTapGestureRecognizer
|
||||
tapGestureRecognizer.addTarget(self, action: #selector(ProfileStatusDashboardView.tapGestureRecognizerHandler(_:)))
|
||||
|
|
Loading…
Reference in New Issue