mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-26 10:11:00 +00:00
Fix tag follow button
This commit is contained in:
parent
ef204cf6fd
commit
f401d4094d
3 changed files with 10 additions and 3 deletions
|
@ -16,7 +16,8 @@ public struct Tag: Codable, Identifiable, Equatable, Hashable {
|
|||
}
|
||||
|
||||
public static func == (lhs: Tag, rhs: Tag) -> Bool {
|
||||
lhs.name == rhs.name
|
||||
lhs.name == rhs.name &&
|
||||
lhs.following == rhs.following
|
||||
}
|
||||
|
||||
public var id: String {
|
||||
|
|
|
@ -144,7 +144,7 @@ public struct StatusRowView: View {
|
|||
#endif
|
||||
.listRowInsets(.init(top: 12,
|
||||
leading: .layoutPadding,
|
||||
bottom: 12,
|
||||
bottom: 6,
|
||||
trailing: .layoutPadding))
|
||||
.accessibilityElement(children: isFocused ? .contain : .combine)
|
||||
.accessibilityLabel(isFocused == false && accessibilityVoiceOverEnabled
|
||||
|
|
|
@ -8,6 +8,8 @@ struct TimelineTagHeaderView: View {
|
|||
|
||||
@Binding var tag: Tag?
|
||||
|
||||
@State var isLoading: Bool = false
|
||||
|
||||
var body: some View {
|
||||
if let tag {
|
||||
TimelineHeaderView {
|
||||
|
@ -26,15 +28,19 @@ struct TimelineTagHeaderView: View {
|
|||
Spacer()
|
||||
Button {
|
||||
Task {
|
||||
isLoading = true
|
||||
if tag.following {
|
||||
self.tag = await account.unfollowTag(id: tag.name)
|
||||
} else {
|
||||
self.tag = await account.followTag(id: tag.name)
|
||||
}
|
||||
isLoading = false
|
||||
}
|
||||
} label: {
|
||||
Text(tag.following ? "account.follow.following" : "account.follow.follow")
|
||||
}.buttonStyle(.bordered)
|
||||
}
|
||||
.disabled(isLoading)
|
||||
.buttonStyle(.bordered)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue