ios: fix updating chat wallpaper while app is in background (#4661)

This commit is contained in:
Stanislav Dmitrenko
2024-08-12 20:57:04 +00:00
committed by GitHub
parent d1f704d160
commit 6a12f2dec8

View File

@@ -11,13 +11,22 @@ import SwiftUI
import SimpleXChat
struct ChatViewBackground: ViewModifier {
@EnvironmentObject var theme: AppTheme
@Environment(\.colorScheme) var colorScheme
var image: Image
var imageType: WallpaperType
var background: Color
var tint: Color
func body(content: Content) -> some View {
// Workaround a problem (SwiftUI bug?) when wallpaper is not updated when user changes global theme in iOS settings from dark to light and vice versa
if colorScheme == .light {
back(content)
} else {
back(content)
}
}
func back(_ content: Content) -> some View {
content.background(
Canvas { context, size in
var image = context.resolve(image)