From b1024be74d1417798b14afd277fde71b3fe19bc1 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Sat, 7 May 2022 16:10:57 +0100 Subject: [PATCH] mobile: hide notifications and webrtc calls (#612) * mobile: hide notifications and webrtc calls * android: remove webrtc link --- .../app/views/usersettings/SettingsView.kt | 3 ++- apps/ios/Shared/AppDelegate.swift | 21 ++++++++++--------- apps/ios/Shared/Views/Chat/ChatView.swift | 16 +++++++------- .../Shared/Views/ChatList/ChatListView.swift | 2 +- .../Views/UserSettings/SettingsView.swift | 19 ++++++++++------- 5 files changed, 33 insertions(+), 28 deletions(-) diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/SettingsView.kt b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/SettingsView.kt index 5eb906cea..1c4aac68f 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/SettingsView.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/SettingsView.kt @@ -194,7 +194,8 @@ fun SettingsLayout( Text(annotatedStringResource(R.string.install_simplex_chat_for_terminal)) } Divider(Modifier.padding(horizontal = 8.dp)) - SettingsSectionView(showVideoChatPrototype) { +// SettingsSectionView(showVideoChatPrototype) { + SettingsSectionView() { Text("v${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})") } } diff --git a/apps/ios/Shared/AppDelegate.swift b/apps/ios/Shared/AppDelegate.swift index 2d427d20a..415f6348f 100644 --- a/apps/ios/Shared/AppDelegate.swift +++ b/apps/ios/Shared/AppDelegate.swift @@ -21,16 +21,17 @@ class AppDelegate: NSObject, UIApplicationDelegate { logger.debug("AppDelegate: didRegisterForRemoteNotificationsWithDeviceToken \(token)") let m = ChatModel.shared m.deviceToken = token - let useNotifications = UserDefaults.standard.bool(forKey: "useNotifications") - if useNotifications { - Task { - do { - m.tokenStatus = try await apiRegisterToken(token: token) - } catch { - logger.error("apiRegisterToken error: \(responseError(error))") - } - } - } + UserDefaults.standard.set(false, forKey: DEFAULT_USE_NOTIFICATIONS) +// let useNotifications = UserDefaults.standard.bool(forKey: "useNotifications") +// if useNotifications { +// Task { +// do { +// m.tokenStatus = try await apiRegisterToken(token: token) +// } catch { +// logger.error("apiRegisterToken error: \(responseError(error))") +// } +// } +// } } func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { diff --git a/apps/ios/Shared/Views/Chat/ChatView.swift b/apps/ios/Shared/Views/Chat/ChatView.swift index 21fc16c5b..f9c313863 100644 --- a/apps/ios/Shared/Views/Chat/ChatView.swift +++ b/apps/ios/Shared/Views/Chat/ChatView.swift @@ -106,14 +106,14 @@ struct ChatView: View { ChatInfoView(chat: chat, showChatInfo: $showChatInfo) } } - ToolbarItem(placement: .navigationBarTrailing) { - if case let .direct(contact) = cInfo { - HStack { - callButton(contact, .audio, imageName: "phone") - callButton(contact, .video, imageName: "video") - } - } - } +// ToolbarItem(placement: .navigationBarTrailing) { +// if case let .direct(contact) = cInfo { +// HStack { +// callButton(contact, .audio, imageName: "phone") +// callButton(contact, .video, imageName: "video") +// } +// } +// } } .navigationBarBackButtonHidden(true) } diff --git a/apps/ios/Shared/Views/ChatList/ChatListView.swift b/apps/ios/Shared/Views/ChatList/ChatListView.swift index ff9ba5bee..0761350b5 100644 --- a/apps/ios/Shared/Views/ChatList/ChatListView.swift +++ b/apps/ios/Shared/Views/ChatList/ChatListView.swift @@ -14,7 +14,7 @@ struct ChatListView: View { @State private var showSettings = false @State private var searchText = "" @State private var showCallView = false - @AppStorage("pendingConnections") private var pendingConnections = true + @AppStorage(DEFAULT_PENDING_CONNECTIONS) private var pendingConnections = true var user: User diff --git a/apps/ios/Shared/Views/UserSettings/SettingsView.swift b/apps/ios/Shared/Views/UserSettings/SettingsView.swift index 996560adb..5e716b76b 100644 --- a/apps/ios/Shared/Views/UserSettings/SettingsView.swift +++ b/apps/ios/Shared/Views/UserSettings/SettingsView.swift @@ -14,12 +14,15 @@ let appVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionS let appBuild = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String +let DEFAULT_USE_NOTIFICATIONS = "useNotifications" +let DEFAULT_PENDING_CONNECTIONS = "pendingConnections" + struct SettingsView: View { @Environment(\.colorScheme) var colorScheme @EnvironmentObject var chatModel: ChatModel @Binding var showSettings: Bool - @AppStorage("useNotifications") private var useNotifications = false - @AppStorage("pendingConnections") private var pendingConnections = true + @AppStorage(DEFAULT_USE_NOTIFICATIONS) private var useNotifications = false + @AppStorage(DEFAULT_PENDING_CONNECTIONS) private var pendingConnections = true @State var showNotificationsAlert: Bool = false @State var whichNotificationsAlert = NotificationAlert.enable @@ -137,12 +140,12 @@ struct SettingsView: View { .padding(.trailing, 8) Text("Install [SimpleX Chat for terminal](https://github.com/simplex-chat/simplex-chat)") } - if let token = chatModel.deviceToken { - HStack { - notificationsIcon() - notificationsToggle(token) - } - } +// if let token = chatModel.deviceToken { +// HStack { +// notificationsIcon() +// notificationsToggle(token) +// } +// } // NavigationLink { // CallViewDebug() // .frame(maxHeight: .infinity, alignment: .top)