This commit is contained in:
Thomas Ricouard 2024-06-20 19:25:28 +02:00
parent 3fbfecb171
commit afa3f4dd9c

View file

@ -48,11 +48,12 @@ struct AccountDetailHeaderView: View {
} }
.onChange(of: watcher.latestEvent?.id) { .onChange(of: watcher.latestEvent?.id) {
if let latestEvent = watcher.latestEvent, let latestEvent = latestEvent as? StreamEventNotification { if let latestEvent = watcher.latestEvent, let latestEvent = latestEvent as? StreamEventNotification {
if latestEvent.notification.account.id == viewModel.accountId { if latestEvent.notification.account.id == viewModel.accountId ||
latestEvent.notification.account.id == viewModel.premiumAccount?.id {
Task { Task {
if viewModel.account?.isLinkedToPremiumAccount == true { if viewModel.account?.isLinkedToPremiumAccount == true {
await viewModel.fetchAccount() await viewModel.fetchAccount()
} else { } else{
try? await viewModel.followButtonViewModel?.refreshRelationship() try? await viewModel.followButtonViewModel?.refreshRelationship()
} }
} }
@ -333,9 +334,8 @@ struct AccountDetailHeaderView: View {
Task { Task {
if viewModel.account?.isLinkedToPremiumAccount == true { if viewModel.account?.isLinkedToPremiumAccount == true {
try? await viewModel.followPremiumAccount() try? await viewModel.followPremiumAccount()
} else {
try? await viewModel.followButtonViewModel?.follow()
} }
try? await viewModel.followButtonViewModel?.follow()
} }
} label: { } label: {
Text("$ Subscribe") Text("$ Subscribe")