Don't show notify button in users lists
This commit is contained in:
parent
6f7c576c3a
commit
c653fb79b6
|
@ -118,7 +118,8 @@ struct AccountDetailHeaderView: View {
|
|||
if let relationship = viewModel.relationship, !viewModel.isCurrentUser {
|
||||
HStack {
|
||||
FollowButton(viewModel: .init(accountId: account.id,
|
||||
relationship: relationship))
|
||||
relationship: relationship,
|
||||
shouldDisplayNotify: true))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,8 @@ public struct AccountsListRow: View {
|
|||
Spacer()
|
||||
if currentAccount.account?.id != viewModel.account.id {
|
||||
FollowButton(viewModel: .init(accountId: viewModel.account.id,
|
||||
relationship: viewModel.relationShip))
|
||||
relationship: viewModel.relationShip,
|
||||
shouldDisplayNotify: false))
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
|
|
|
@ -8,12 +8,14 @@ public class FollowButtonViewModel: ObservableObject {
|
|||
var client: Client?
|
||||
|
||||
public let accountId: String
|
||||
public let shouldDisplayNotify: Bool
|
||||
@Published private(set) public var relationship: Relationshionship
|
||||
@Published private(set) public var isUpdating: Bool = false
|
||||
|
||||
public init(accountId: String, relationship: Relationshionship) {
|
||||
public init(accountId: String, relationship: Relationshionship, shouldDisplayNotify: Bool) {
|
||||
self.accountId = accountId
|
||||
self.relationship = relationship
|
||||
self.shouldDisplayNotify = shouldDisplayNotify
|
||||
}
|
||||
|
||||
func follow() async {
|
||||
|
@ -75,7 +77,7 @@ public struct FollowButton: View {
|
|||
}
|
||||
.buttonStyle(.bordered)
|
||||
.disabled(viewModel.isUpdating)
|
||||
if viewModel.relationship.following {
|
||||
if viewModel.relationship.following, viewModel.shouldDisplayNotify {
|
||||
Button {
|
||||
Task {
|
||||
await viewModel.toggleNotify()
|
||||
|
|
Loading…
Reference in New Issue