mobile: hide notifications and webrtc calls (#612)

* mobile: hide notifications and webrtc calls

* android: remove webrtc link
This commit is contained in:
Evgeny Poberezkin
2022-05-07 16:10:57 +01:00
committed by GitHub
parent b3641bdf83
commit b1024be74d
5 changed files with 33 additions and 28 deletions

View File

@@ -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})")
}
}

View File

@@ -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) {

View File

@@ -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)
}

View File

@@ -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

View File

@@ -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)