Force update status detail
This commit is contained in:
parent
e192135f37
commit
ffda5fe6f0
|
@ -41,7 +41,7 @@ public struct StatusDetailView: View {
|
||||||
case .loading:
|
case .loading:
|
||||||
loadingDetailView
|
loadingDetailView
|
||||||
|
|
||||||
case let .display(status, context):
|
case let .display(status, context, date):
|
||||||
if !context.ancestors.isEmpty {
|
if !context.ancestors.isEmpty {
|
||||||
ForEach(context.ancestors) { ancestor in
|
ForEach(context.ancestors) { ancestor in
|
||||||
StatusRowView(viewModel: .init(status: ancestor, isCompact: false))
|
StatusRowView(viewModel: .init(status: ancestor, isCompact: false))
|
||||||
|
@ -49,6 +49,7 @@ public struct StatusDetailView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
makeCurrentStatusView(status: status)
|
makeCurrentStatusView(status: status)
|
||||||
|
.id(date)
|
||||||
|
|
||||||
if !context.descendants.isEmpty {
|
if !context.descendants.isEmpty {
|
||||||
ForEach(context.descendants) { descendant in
|
ForEach(context.descendants) { descendant in
|
||||||
|
|
|
@ -11,7 +11,7 @@ class StatusDetailViewModel: ObservableObject {
|
||||||
var client: Client?
|
var client: Client?
|
||||||
|
|
||||||
enum State {
|
enum State {
|
||||||
case loading, display(status: Status, context: StatusContext), error(error: Error)
|
case loading, display(status: Status, context: StatusContext, date: Date), error(error: Error)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Published var state: State = .loading
|
@Published var state: State = .loading
|
||||||
|
@ -25,7 +25,7 @@ class StatusDetailViewModel: ObservableObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
init(status: Status) {
|
init(status: Status) {
|
||||||
state = .display(status: status, context: .empty())
|
state = .display(status: status, context: .empty(), date: Date())
|
||||||
title = "status.post-from-\(status.account.displayNameWithoutEmojis)"
|
title = "status.post-from-\(status.account.displayNameWithoutEmojis)"
|
||||||
statusId = status.id
|
statusId = status.id
|
||||||
remoteStatusURL = nil
|
remoteStatusURL = nil
|
||||||
|
@ -75,10 +75,10 @@ class StatusDetailViewModel: ObservableObject {
|
||||||
title = "status.post-from-\(data.status.account.displayNameWithoutEmojis)"
|
title = "status.post-from-\(data.status.account.displayNameWithoutEmojis)"
|
||||||
if animate {
|
if animate {
|
||||||
withAnimation {
|
withAnimation {
|
||||||
state = .display(status: data.status, context: data.context)
|
state = .display(status: data.status, context: data.context, date: Date())
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
state = .display(status: data.status, context: data.context)
|
state = .display(status: data.status, context: data.context,date: Date())
|
||||||
scrollToId = statusId
|
scrollToId = statusId
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
|
Loading…
Reference in New Issue