This commit is contained in:
Thomas Ricouard 2023-09-17 20:32:57 +02:00
parent 1e5e1e864e
commit 3d4c636de8
4 changed files with 2 additions and 15 deletions

View file

@ -21,10 +21,6 @@ private struct IsSupporter: EnvironmentKey {
static let defaultValue: Bool = false
}
private struct IsStatusDetailLoaded: EnvironmentKey {
static let defaultValue: Bool = false
}
private struct IsStatusFocused: EnvironmentKey {
static let defaultValue: Bool = false
}
@ -59,11 +55,6 @@ public extension EnvironmentValues {
set { self[IsSupporter.self] = newValue }
}
var isStatusDetailLoaded: Bool {
get { self[IsStatusDetailLoaded.self] }
set { self[IsStatusDetailLoaded.self] = newValue }
}
var isStatusFocused: Bool {
get { self[IsStatusFocused.self] }
set { self[IsStatusFocused.self] = newValue }

View file

@ -112,7 +112,6 @@ public struct StatusDetailView: View {
.environment(\.extraLeadingInset, isReplyToPrevious ? 10 : 0)
.environment(\.isStatusReplyToPrevious, isReplyToPrevious)
.environment(\.isStatusFocused, isFocused)
.environment(\.isStatusDetailLoaded, isFocused ? !self.viewModel.isLoadingContext : false)
.overlay {
if isFocused {
GeometryReader { reader in

View file

@ -17,9 +17,10 @@ import SwiftUI
}
var state: State = .loading
var isLoadingContext = true
var title: LocalizedStringKey = ""
var scrollToId: String?
@ObservationIgnored
var isReplyToPreviousCache: [String: Bool] = [:]
init(statusId: String) {
@ -75,7 +76,6 @@ import SwiftUI
private func fetchStatusDetail(animate: Bool) async {
guard let client, let statusId else { return }
do {
isLoadingContext = true
let data = try await fetchContextData(client: client, statusId: statusId)
title = "status.post-from-\(data.status.account.displayNameWithoutEmojis)"
var statuses = data.context.ancestors
@ -87,11 +87,9 @@ import SwiftUI
if animate {
withAnimation {
state = .display(statuses: statuses)
isLoadingContext = false
}
} else {
state = .display(statuses: statuses)
isLoadingContext = false
scrollToId = statusId
}
} catch {

View file

@ -13,7 +13,6 @@ public struct StatusRowView: View {
@Environment(\.isCompact) private var isCompact: Bool
@Environment(\.accessibilityVoiceOverEnabled) private var accessibilityVoiceOverEnabled
@Environment(\.isStatusFocused) private var isFocused
@Environment(\.isStatusDetailLoaded) private var isStatusDetailLoaded
@Environment(\.isStatusReplyToPrevious) private var isStatusReplyToPrevious
@Environment(QuickLook.self) private var quickLook