Fixes for bluesky bridge support

This commit is contained in:
Thomas Ricouard 2023-07-04 08:37:30 +02:00
parent e33dcdf372
commit a97868cab7
3 changed files with 7 additions and 7 deletions

View file

@ -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
)
}

View file

@ -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 {

View file

@ -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