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 {
|
if let relationship = viewModel.relationship, !viewModel.isCurrentUser {
|
||||||
HStack {
|
HStack {
|
||||||
FollowButton(viewModel: .init(accountId: account.id,
|
FollowButton(viewModel: .init(accountId: account.id,
|
||||||
relationship: relationship))
|
relationship: relationship,
|
||||||
|
shouldDisplayNotify: true))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,7 +49,8 @@ public struct AccountsListRow: View {
|
||||||
Spacer()
|
Spacer()
|
||||||
if currentAccount.account?.id != viewModel.account.id {
|
if currentAccount.account?.id != viewModel.account.id {
|
||||||
FollowButton(viewModel: .init(accountId: viewModel.account.id,
|
FollowButton(viewModel: .init(accountId: viewModel.account.id,
|
||||||
relationship: viewModel.relationShip))
|
relationship: viewModel.relationShip,
|
||||||
|
shouldDisplayNotify: false))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.onAppear {
|
.onAppear {
|
||||||
|
|
|
@ -8,12 +8,14 @@ public class FollowButtonViewModel: ObservableObject {
|
||||||
var client: Client?
|
var client: Client?
|
||||||
|
|
||||||
public let accountId: String
|
public let accountId: String
|
||||||
|
public let shouldDisplayNotify: Bool
|
||||||
@Published private(set) public var relationship: Relationshionship
|
@Published private(set) public var relationship: Relationshionship
|
||||||
@Published private(set) public var isUpdating: Bool = false
|
@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.accountId = accountId
|
||||||
self.relationship = relationship
|
self.relationship = relationship
|
||||||
|
self.shouldDisplayNotify = shouldDisplayNotify
|
||||||
}
|
}
|
||||||
|
|
||||||
func follow() async {
|
func follow() async {
|
||||||
|
@ -75,7 +77,7 @@ public struct FollowButton: View {
|
||||||
}
|
}
|
||||||
.buttonStyle(.bordered)
|
.buttonStyle(.bordered)
|
||||||
.disabled(viewModel.isUpdating)
|
.disabled(viewModel.isUpdating)
|
||||||
if viewModel.relationship.following {
|
if viewModel.relationship.following, viewModel.shouldDisplayNotify {
|
||||||
Button {
|
Button {
|
||||||
Task {
|
Task {
|
||||||
await viewModel.toggleNotify()
|
await viewModel.toggleNotify()
|
||||||
|
|
Loading…
Reference in New Issue