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