From a97868cab7de298766f981890240e2609043182b Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Tue, 4 Jul 2023 08:37:30 +0200 Subject: [PATCH] Fixes for bluesky bridge support --- .../Account/Sources/Account/AccountDetailHeaderView.swift | 6 +++--- .../Sources/Account/AccountsList/AccountsListRow.swift | 2 +- Packages/Models/Sources/Models/Account.swift | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Packages/Account/Sources/Account/AccountDetailHeaderView.swift b/Packages/Account/Sources/Account/AccountDetailHeaderView.swift index 571a893d..21926db5 100644 --- a/Packages/Account/Sources/Account/AccountDetailHeaderView.swift +++ b/Packages/Account/Sources/Account/AccountDetailHeaderView.swift @@ -125,7 +125,7 @@ struct AccountDetailHeaderView: View { scrollViewProxy?.scrollTo("status", anchor: .top) } } label: { - makeCustomInfoLabel(title: "account.posts", count: account.statusesCount) + makeCustomInfoLabel(title: "account.posts", count: account.statusesCount ?? 0) } .accessibilityHint("accessibility.tabs.profile.post-count.hint") .buttonStyle(.borderless) @@ -133,7 +133,7 @@ struct AccountDetailHeaderView: View { Button { routerPath.navigate(to: .following(id: account.id)) } label: { - makeCustomInfoLabel(title: "account.following", count: account.followingCount) + makeCustomInfoLabel(title: "account.following", count: account.followingCount ?? 0) } .accessibilityHint("accessibility.tabs.profile.following-count.hint") .buttonStyle(.borderless) @@ -143,7 +143,7 @@ struct AccountDetailHeaderView: View { } label: { makeCustomInfoLabel( title: "account.followers", - count: account.followersCount, + count: account.followersCount ?? 0, needsBadge: currentAccount.account?.id == account.id && !currentAccount.followRequests.isEmpty ) } diff --git a/Packages/Account/Sources/Account/AccountsList/AccountsListRow.swift b/Packages/Account/Sources/Account/AccountsList/AccountsListRow.swift index f7e4a0ec..f507c877 100644 --- a/Packages/Account/Sources/Account/AccountsList/AccountsListRow.swift +++ b/Packages/Account/Sources/Account/AccountsList/AccountsListRow.swift @@ -53,7 +53,7 @@ public struct AccountsListRow: View { // First parameter is the number for the plural // Second parameter is the formatted string to show - Text("account.label.followers \(viewModel.account.followersCount) \(viewModel.account.followersCount, format: .number.notation(.compactName))") + Text("account.label.followers \(viewModel.account.followersCount ?? 0) \(viewModel.account.followersCount ?? 0, format: .number.notation(.compactName))") .font(.scaledFootnote) if let field = viewModel.account.fields.filter({ $0.verifiedAt != nil }).first { diff --git a/Packages/Models/Sources/Models/Account.swift b/Packages/Models/Sources/Models/Account.swift index ea79e884..984cb9b1 100644 --- a/Packages/Models/Sources/Models/Account.swift +++ b/Packages/Models/Sources/Models/Account.swift @@ -47,9 +47,9 @@ public final class Account: Codable, Identifiable, Hashable, Sendable, Equatable public let acct: String public let note: HTMLString public let createdAt: ServerDate - public let followersCount: Int - public let followingCount: Int - public let statusesCount: Int + public let followersCount: Int? + public let followingCount: Int? + public let statusesCount: Int? public let lastStatusAt: String? public let fields: [Field] public let locked: Bool