From 5f0ccb9f17d403a12efbf4db5f6c6a3a791400ec Mon Sep 17 00:00:00 2001 From: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com> Date: Tue, 20 Aug 2024 16:04:00 +0000 Subject: [PATCH] ios: fix interface color without callKit (#4727) * ios: fix interface color without callKit * call area * better hiding sheet when making a call without CallKit * invert condition --- apps/ios/Shared/ContentView.swift | 8 ++++---- apps/ios/Shared/Theme/Theme.swift | 4 ++-- apps/ios/Shared/Views/Chat/ChatInfoView.swift | 9 ++++++++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/apps/ios/Shared/ContentView.swift b/apps/ios/Shared/ContentView.swift index d93625986e..1f41e7c31d 100644 --- a/apps/ios/Shared/ContentView.swift +++ b/apps/ios/Shared/ContentView.swift @@ -36,7 +36,7 @@ struct ContentView: View { @State private var waitingForOrPassedAuth = true @State private var chatListActionSheet: ChatListActionSheet? = nil - private let callTopPadding: CGFloat = 50 + private let callTopPadding: CGFloat = 40 private enum ChatListActionSheet: Identifiable { case planAndConnectSheet(sheet: PlanAndConnectActionSheet) @@ -151,12 +151,12 @@ struct ContentView: View { } } .onAppear { - reactOnDarkThemeChanges() + reactOnDarkThemeChanges(systemInDarkThemeCurrently) } .onChange(of: colorScheme) { scheme in // It's needed to update UI colors when iOS wants to make screenshot after going to background, // so when a user changes his global theme from dark to light or back, the app will adapt to it - reactOnDarkThemeChanges() + reactOnDarkThemeChanges(scheme == .dark) } .onChange(of: theme.name) { _ in ThemeManager.adjustWindowStyle() @@ -207,7 +207,7 @@ struct ContentView: View { CallDuration(call: call) } .padding(.horizontal) - .frame(height: callTopPadding - 10) + .frame(height: callTopPadding) .background(Color(uiColor: UIColor(red: 47/255, green: 208/255, blue: 88/255, alpha: 1))) .onTapGesture { chatModel.activeCallViewIsCollapsed = false diff --git a/apps/ios/Shared/Theme/Theme.swift b/apps/ios/Shared/Theme/Theme.swift index d4dcc8097f..e2641eb8dd 100644 --- a/apps/ios/Shared/Theme/Theme.swift +++ b/apps/ios/Shared/Theme/Theme.swift @@ -91,8 +91,8 @@ var systemInDarkThemeCurrently: Bool { return UITraitCollection.current.userInterfaceStyle == .dark } -func reactOnDarkThemeChanges() { - if currentThemeDefault.get() == DefaultTheme.SYSTEM_THEME_NAME && CurrentColors.colors.isLight == systemInDarkThemeCurrently { +func reactOnDarkThemeChanges(_ inDarkNow: Bool) { + if currentThemeDefault.get() == DefaultTheme.SYSTEM_THEME_NAME && CurrentColors.colors.isLight == inDarkNow { // Change active colors from light to dark and back based on system theme ThemeManager.applyTheme(DefaultTheme.SYSTEM_THEME_NAME) } diff --git a/apps/ios/Shared/Views/Chat/ChatInfoView.swift b/apps/ios/Shared/Views/Chat/ChatInfoView.swift index ff46b9619c..ea3b04c2ff 100644 --- a/apps/ios/Shared/Views/Chat/ChatInfoView.swift +++ b/apps/ios/Shared/Views/Chat/ChatInfoView.swift @@ -671,7 +671,14 @@ private struct CallButton: View { InfoViewButton(image: image, title: title, disabledLook: !canCall, width: width) { if canCall { - CallController.shared.startCall(contact, mediaType) + if CallController.useCallKit() { + CallController.shared.startCall(contact, mediaType) + } else { + // When CallKit is not used, colorscheme will be changed and it will be visible if not hiding sheets first + dismissAllSheets(animated: true) { + CallController.shared.startCall(contact, mediaType) + } + } } else if contact.nextSendGrpInv { showAlert(SomeAlert( alert: mkAlert(