mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-05-19 00:38:10 +00:00
Cleanup
This commit is contained in:
parent
1e5e1e864e
commit
3d4c636de8
|
@ -21,10 +21,6 @@ private struct IsSupporter: EnvironmentKey {
|
||||||
static let defaultValue: Bool = false
|
static let defaultValue: Bool = false
|
||||||
}
|
}
|
||||||
|
|
||||||
private struct IsStatusDetailLoaded: EnvironmentKey {
|
|
||||||
static let defaultValue: Bool = false
|
|
||||||
}
|
|
||||||
|
|
||||||
private struct IsStatusFocused: EnvironmentKey {
|
private struct IsStatusFocused: EnvironmentKey {
|
||||||
static let defaultValue: Bool = false
|
static let defaultValue: Bool = false
|
||||||
}
|
}
|
||||||
|
@ -59,11 +55,6 @@ public extension EnvironmentValues {
|
||||||
set { self[IsSupporter.self] = newValue }
|
set { self[IsSupporter.self] = newValue }
|
||||||
}
|
}
|
||||||
|
|
||||||
var isStatusDetailLoaded: Bool {
|
|
||||||
get { self[IsStatusDetailLoaded.self] }
|
|
||||||
set { self[IsStatusDetailLoaded.self] = newValue }
|
|
||||||
}
|
|
||||||
|
|
||||||
var isStatusFocused: Bool {
|
var isStatusFocused: Bool {
|
||||||
get { self[IsStatusFocused.self] }
|
get { self[IsStatusFocused.self] }
|
||||||
set { self[IsStatusFocused.self] = newValue }
|
set { self[IsStatusFocused.self] = newValue }
|
||||||
|
|
|
@ -112,7 +112,6 @@ public struct StatusDetailView: View {
|
||||||
.environment(\.extraLeadingInset, isReplyToPrevious ? 10 : 0)
|
.environment(\.extraLeadingInset, isReplyToPrevious ? 10 : 0)
|
||||||
.environment(\.isStatusReplyToPrevious, isReplyToPrevious)
|
.environment(\.isStatusReplyToPrevious, isReplyToPrevious)
|
||||||
.environment(\.isStatusFocused, isFocused)
|
.environment(\.isStatusFocused, isFocused)
|
||||||
.environment(\.isStatusDetailLoaded, isFocused ? !self.viewModel.isLoadingContext : false)
|
|
||||||
.overlay {
|
.overlay {
|
||||||
if isFocused {
|
if isFocused {
|
||||||
GeometryReader { reader in
|
GeometryReader { reader in
|
||||||
|
|
|
@ -17,9 +17,10 @@ import SwiftUI
|
||||||
}
|
}
|
||||||
|
|
||||||
var state: State = .loading
|
var state: State = .loading
|
||||||
var isLoadingContext = true
|
|
||||||
var title: LocalizedStringKey = ""
|
var title: LocalizedStringKey = ""
|
||||||
var scrollToId: String?
|
var scrollToId: String?
|
||||||
|
|
||||||
|
@ObservationIgnored
|
||||||
var isReplyToPreviousCache: [String: Bool] = [:]
|
var isReplyToPreviousCache: [String: Bool] = [:]
|
||||||
|
|
||||||
init(statusId: String) {
|
init(statusId: String) {
|
||||||
|
@ -75,7 +76,6 @@ import SwiftUI
|
||||||
private func fetchStatusDetail(animate: Bool) async {
|
private func fetchStatusDetail(animate: Bool) async {
|
||||||
guard let client, let statusId else { return }
|
guard let client, let statusId else { return }
|
||||||
do {
|
do {
|
||||||
isLoadingContext = true
|
|
||||||
let data = try await fetchContextData(client: client, statusId: statusId)
|
let data = try await fetchContextData(client: client, statusId: statusId)
|
||||||
title = "status.post-from-\(data.status.account.displayNameWithoutEmojis)"
|
title = "status.post-from-\(data.status.account.displayNameWithoutEmojis)"
|
||||||
var statuses = data.context.ancestors
|
var statuses = data.context.ancestors
|
||||||
|
@ -87,11 +87,9 @@ import SwiftUI
|
||||||
if animate {
|
if animate {
|
||||||
withAnimation {
|
withAnimation {
|
||||||
state = .display(statuses: statuses)
|
state = .display(statuses: statuses)
|
||||||
isLoadingContext = false
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
state = .display(statuses: statuses)
|
state = .display(statuses: statuses)
|
||||||
isLoadingContext = false
|
|
||||||
scrollToId = statusId
|
scrollToId = statusId
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
@ -13,7 +13,6 @@ public struct StatusRowView: View {
|
||||||
@Environment(\.isCompact) private var isCompact: Bool
|
@Environment(\.isCompact) private var isCompact: Bool
|
||||||
@Environment(\.accessibilityVoiceOverEnabled) private var accessibilityVoiceOverEnabled
|
@Environment(\.accessibilityVoiceOverEnabled) private var accessibilityVoiceOverEnabled
|
||||||
@Environment(\.isStatusFocused) private var isFocused
|
@Environment(\.isStatusFocused) private var isFocused
|
||||||
@Environment(\.isStatusDetailLoaded) private var isStatusDetailLoaded
|
|
||||||
@Environment(\.isStatusReplyToPrevious) private var isStatusReplyToPrevious
|
@Environment(\.isStatusReplyToPrevious) private var isStatusReplyToPrevious
|
||||||
|
|
||||||
@Environment(QuickLook.self) private var quickLook
|
@Environment(QuickLook.self) private var quickLook
|
||||||
|
|
Loading…
Reference in a new issue