From c0c8ce8848398e34dbd094211e9c843763a14473 Mon Sep 17 00:00:00 2001 From: Diogo Date: Tue, 27 Aug 2024 16:20:52 +0100 Subject: [PATCH] long press on sun/moon switches to system setting --- .../Shared/Views/ChatList/UserPicker.swift | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/apps/ios/Shared/Views/ChatList/UserPicker.swift b/apps/ios/Shared/Views/ChatList/UserPicker.swift index f04df862bb..3859b4732f 100644 --- a/apps/ios/Shared/Views/ChatList/UserPicker.swift +++ b/apps/ios/Shared/Views/ChatList/UserPicker.swift @@ -108,19 +108,23 @@ struct UserPicker: View { .padding(.horizontal, 16) } .buttonStyle(PressedButtonStyle(defaultColor: theme.colors.surface, pressedColor: Color(uiColor: .secondarySystemFill))) - Button { + VStack { + Image(systemName: colorScheme == .light ? "sun.max" : "moon.stars") + .symbolRenderingMode(.monochrome) + .foregroundColor(theme.colors.secondary) + .frame(maxWidth: 20, maxHeight: 20) + } + .padding(.vertical, verticalSpaceDefault) + .padding(.horizontal, 16) + .onTapGesture { if (colorScheme == .light) { ThemeManager.applyTheme(systemDarkThemeDefault.get()) } else { ThemeManager.applyTheme(DefaultTheme.LIGHT.themeName) } - } label: { - Image(systemName: colorScheme == .light ? "sun.max" : "moon.stars") - .symbolRenderingMode(.monochrome) - .foregroundColor(theme.colors.secondary) - .frame(maxWidth: 20, maxHeight: 20) - .padding(.vertical, verticalSpaceDefault) - .padding(.horizontal, 16) + } + .onLongPressGesture { + ThemeManager.applyTheme(DefaultTheme.SYSTEM_THEME_NAME) } } .scaleEffect(x: 1, y: oneHandUI ? -1 : 1, anchor: .center)