mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-30 04:01:02 +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 {
|
public static func == (lhs: Tag, rhs: Tag) -> Bool {
|
||||||
lhs.name == rhs.name
|
lhs.name == rhs.name &&
|
||||||
|
lhs.following == rhs.following
|
||||||
}
|
}
|
||||||
|
|
||||||
public var id: String {
|
public var id: String {
|
||||||
|
|
|
@ -144,7 +144,7 @@ public struct StatusRowView: View {
|
||||||
#endif
|
#endif
|
||||||
.listRowInsets(.init(top: 12,
|
.listRowInsets(.init(top: 12,
|
||||||
leading: .layoutPadding,
|
leading: .layoutPadding,
|
||||||
bottom: 12,
|
bottom: 6,
|
||||||
trailing: .layoutPadding))
|
trailing: .layoutPadding))
|
||||||
.accessibilityElement(children: isFocused ? .contain : .combine)
|
.accessibilityElement(children: isFocused ? .contain : .combine)
|
||||||
.accessibilityLabel(isFocused == false && accessibilityVoiceOverEnabled
|
.accessibilityLabel(isFocused == false && accessibilityVoiceOverEnabled
|
||||||
|
|
|
@ -8,6 +8,8 @@ struct TimelineTagHeaderView: View {
|
||||||
|
|
||||||
@Binding var tag: Tag?
|
@Binding var tag: Tag?
|
||||||
|
|
||||||
|
@State var isLoading: Bool = false
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
if let tag {
|
if let tag {
|
||||||
TimelineHeaderView {
|
TimelineHeaderView {
|
||||||
|
@ -26,15 +28,19 @@ struct TimelineTagHeaderView: View {
|
||||||
Spacer()
|
Spacer()
|
||||||
Button {
|
Button {
|
||||||
Task {
|
Task {
|
||||||
|
isLoading = true
|
||||||
if tag.following {
|
if tag.following {
|
||||||
self.tag = await account.unfollowTag(id: tag.name)
|
self.tag = await account.unfollowTag(id: tag.name)
|
||||||
} else {
|
} else {
|
||||||
self.tag = await account.followTag(id: tag.name)
|
self.tag = await account.followTag(id: tag.name)
|
||||||
}
|
}
|
||||||
|
isLoading = false
|
||||||
}
|
}
|
||||||
} label: {
|
} label: {
|
||||||
Text(tag.following ? "account.follow.following" : "account.follow.follow")
|
Text(tag.following ? "account.follow.following" : "account.follow.follow")
|
||||||
}.buttonStyle(.bordered)
|
}
|
||||||
|
.disabled(isLoading)
|
||||||
|
.buttonStyle(.bordered)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue