Fix crash on lock screen (#779)

Missing environment Theme in LogoView.

Probably broken in #775
This commit is contained in:
Davide 2024-10-30 10:18:39 +01:00 committed by GitHub
parent 00bd826096
commit 9d6dfe6a76
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 7 deletions

View File

@ -42,7 +42,7 @@ extension PassepartoutApp {
.onOpenURL { url in
ImporterPipe.shared.send([url])
}
.themeLockScreen()
.themeLockScreen(theme)
}
}
}

View File

@ -68,7 +68,7 @@ struct ThemeBooleanModalModifier<Modal>: ViewModifier where Modal: View {
modal()
.frame(minWidth: modalSize?.width, minHeight: modalSize?.height)
.interactiveDismissDisabled(!isInteractive)
.themeLockScreen()
.themeLockScreen(theme)
}
}
@ -97,7 +97,7 @@ struct ThemeItemModalModifier<Modal, T>: ViewModifier where Modal: View, T: Iden
modal($0)
.frame(minWidth: modalSize?.width, minHeight: modalSize?.height)
.interactiveDismissDisabled(!isInteractive)
.themeLockScreen()
.themeLockScreen(theme)
}
}
@ -129,13 +129,13 @@ struct ThemeBooleanPopoverModifier<Popover>: ViewModifier where Popover: View {
.popover(isPresented: $isPresented) {
popover
.frame(minWidth: theme.popoverSize?.width, minHeight: theme.popoverSize?.height)
.themeLockScreen()
.themeLockScreen(theme)
}
} else {
content
.sheet(isPresented: $isPresented) {
popover
.themeLockScreen()
.themeLockScreen(theme)
}
}
}
@ -322,6 +322,9 @@ struct ThemeLockScreenModifier: ViewModifier {
@AppStorage(AppPreference.locksInBackground.key)
private var locksInBackground = false
@ObservedObject
var theme: Theme
func body(content: Content) -> some View {
LockableView(
locksInBackground: $locksInBackground,
@ -331,6 +334,7 @@ struct ThemeLockScreenModifier: ViewModifier {
lockedContent: LogoView.init,
unlockBlock: Self.unlockScreenBlock
)
.environmentObject(theme)
}
private static func unlockScreenBlock() async -> Bool {

View File

@ -199,8 +199,8 @@ extension View {
modifier(ThemeHoverListRowModifier())
}
public func themeLockScreen() -> some View {
modifier(ThemeLockScreenModifier())
public func themeLockScreen(_ theme: Theme) -> some View {
modifier(ThemeLockScreenModifier(theme: theme))
}
public func themeTip(_ text: String, edge: Edge) -> some View {