From c409f58067e5600488a92622d2ed7b3cd4c923c6 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Fri, 20 Jan 2023 10:55:12 +0000 Subject: [PATCH] mobile: add PING count to network config, make advanced network config available without dev tools (#1805) * mobile: add PING count to network config, make advanced network config available without dev tools * export ios translations * add 120 sec PING interval back --- .../java/chat/simplex/app/model/SimpleXAPI.kt | 14 +++++-- .../usersettings/AdvancedNetworkSettings.kt | 27 ++++++++----- .../views/usersettings/NetworkAndServers.kt | 6 +-- .../app/src/main/res/values/strings.xml | 1 + .../AdvancedNetworkSettings.swift | 3 +- .../UserSettings/NetworkAndServers.swift | 12 +++--- .../de.xcloc/Localized Contents/de.xliff | 4 ++ .../en.xcloc/Localized Contents/en.xliff | 5 +++ .../fr.xcloc/Localized Contents/fr.xliff | 4 ++ .../it.xcloc/Localized Contents/it.xliff | 4 ++ .../ru.xcloc/Localized Contents/ru.xliff | 5 +++ apps/ios/SimpleX.xcodeproj/project.pbxproj | 40 +++++++++---------- apps/ios/SimpleXChat/APITypes.swift | 7 +++- apps/ios/SimpleXChat/AppGroup.swift | 5 +++ 14 files changed, 91 insertions(+), 46 deletions(-) diff --git a/apps/android/app/src/main/java/chat/simplex/app/model/SimpleXAPI.kt b/apps/android/app/src/main/java/chat/simplex/app/model/SimpleXAPI.kt index 661703d5a4..d65489149f 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/model/SimpleXAPI.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/model/SimpleXAPI.kt @@ -116,6 +116,7 @@ class AppPreferences(val context: Context) { val networkTCPConnectTimeout = mkTimeoutPreference(SHARED_PREFS_NETWORK_TCP_CONNECT_TIMEOUT, NetCfg.defaults.tcpConnectTimeout, NetCfg.proxyDefaults.tcpConnectTimeout) val networkTCPTimeout = mkTimeoutPreference(SHARED_PREFS_NETWORK_TCP_TIMEOUT, NetCfg.defaults.tcpTimeout, NetCfg.proxyDefaults.tcpTimeout) val networkSMPPingInterval = mkLongPreference(SHARED_PREFS_NETWORK_SMP_PING_INTERVAL, NetCfg.defaults.smpPingInterval) + val networkSMPPingCount = mkIntPreference(SHARED_PREFS_NETWORK_SMP_PING_COUNT, NetCfg.defaults.smpPingCount) val networkEnableKeepAlive = mkBoolPreference(SHARED_PREFS_NETWORK_ENABLE_KEEP_ALIVE, NetCfg.defaults.enableKeepAlive) val networkTCPKeepIdle = mkIntPreference(SHARED_PREFS_NETWORK_TCP_KEEP_IDLE, KeepAliveOpts.defaults.keepIdle) val networkTCPKeepIntvl = mkIntPreference(SHARED_PREFS_NETWORK_TCP_KEEP_INTVL, KeepAliveOpts.defaults.keepIntvl) @@ -212,6 +213,7 @@ class AppPreferences(val context: Context) { private const val SHARED_PREFS_NETWORK_TCP_CONNECT_TIMEOUT = "NetworkTCPConnectTimeout" private const val SHARED_PREFS_NETWORK_TCP_TIMEOUT = "NetworkTCPTimeout" private const val SHARED_PREFS_NETWORK_SMP_PING_INTERVAL = "NetworkSMPPingInterval" + private const val SHARED_PREFS_NETWORK_SMP_PING_COUNT = "NetworkSMPPingCount" private const val SHARED_PREFS_NETWORK_ENABLE_KEEP_ALIVE = "NetworkEnableKeepAlive" private const val SHARED_PREFS_NETWORK_TCP_KEEP_IDLE = "NetworkTCPKeepIdle" private const val SHARED_PREFS_NETWORK_TCP_KEEP_INTVL = "NetworkTCPKeepIntvl" @@ -1485,6 +1487,7 @@ open class ChatController(var ctrl: ChatCtrl?, val ntfManager: NtfManager, val a val tcpConnectTimeout = appPrefs.networkTCPConnectTimeout.get() val tcpTimeout = appPrefs.networkTCPTimeout.get() val smpPingInterval = appPrefs.networkSMPPingInterval.get() + val smpPingCount = appPrefs.networkSMPPingCount.get() val enableKeepAlive = appPrefs.networkEnableKeepAlive.get() val tcpKeepAlive = if (enableKeepAlive) { val keepIdle = appPrefs.networkTCPKeepIdle.get() @@ -1501,7 +1504,8 @@ open class ChatController(var ctrl: ChatCtrl?, val ntfManager: NtfManager, val a tcpConnectTimeout = tcpConnectTimeout, tcpTimeout = tcpTimeout, tcpKeepAlive = tcpKeepAlive, - smpPingInterval = smpPingInterval + smpPingInterval = smpPingInterval, + smpPingCount = smpPingCount ) } @@ -1512,6 +1516,7 @@ open class ChatController(var ctrl: ChatCtrl?, val ntfManager: NtfManager, val a appPrefs.networkTCPConnectTimeout.set(cfg.tcpConnectTimeout) appPrefs.networkTCPTimeout.set(cfg.tcpTimeout) appPrefs.networkSMPPingInterval.set(cfg.smpPingInterval) + appPrefs.networkSMPPingCount.set(cfg.smpPingCount) if (cfg.tcpKeepAlive != null) { appPrefs.networkEnableKeepAlive.set(true) appPrefs.networkTCPKeepIdle.set(cfg.tcpKeepAlive.keepIdle) @@ -1953,6 +1958,7 @@ data class NetCfg( val tcpTimeout: Long, // microseconds val tcpKeepAlive: KeepAliveOpts?, val smpPingInterval: Long, // microseconds + val smpPingCount: Int, val logTLSErrors: Boolean = false ) { val useSocksProxy: Boolean get() = socksProxy != null @@ -1965,7 +1971,8 @@ data class NetCfg( tcpConnectTimeout = 10_000_000, tcpTimeout = 7_000_000, tcpKeepAlive = KeepAliveOpts.defaults, - smpPingInterval = 600_000_000 + smpPingInterval = 1200_000_000, + smpPingCount = 3 ) val proxyDefaults: NetCfg = @@ -1974,7 +1981,8 @@ data class NetCfg( tcpConnectTimeout = 20_000_000, tcpTimeout = 15_000_000, tcpKeepAlive = KeepAliveOpts.defaults, - smpPingInterval = 600_000_000 + smpPingInterval = 1200_000_000, + smpPingCount = 3 ) } diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/AdvancedNetworkSettings.kt b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/AdvancedNetworkSettings.kt index f3478b6b43..8f3618e4e3 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/AdvancedNetworkSettings.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/AdvancedNetworkSettings.kt @@ -33,6 +33,7 @@ fun AdvancedNetworkSettingsView(chatModel: ChatModel) { val networkTCPConnectTimeout = remember { mutableStateOf(currentCfgVal.tcpConnectTimeout) } val networkTCPTimeout = remember { mutableStateOf(currentCfgVal.tcpTimeout) } val networkSMPPingInterval = remember { mutableStateOf(currentCfgVal.smpPingInterval) } + val networkSMPPingCount = remember { mutableStateOf(currentCfgVal.smpPingCount) } val networkEnableKeepAlive = remember { mutableStateOf(currentCfgVal.enableKeepAlive) } val networkTCPKeepIdle: MutableState val networkTCPKeepIntvl: MutableState @@ -48,10 +49,6 @@ fun AdvancedNetworkSettingsView(chatModel: ChatModel) { } fun buildCfg(): NetCfg { - val socksProxy = currentCfg.value.socksProxy - val tcpConnectTimeout = networkTCPConnectTimeout.value - val tcpTimeout = networkTCPTimeout.value - val smpPingInterval = networkSMPPingInterval.value val enableKeepAlive = networkEnableKeepAlive.value val tcpKeepAlive = if (enableKeepAlive) { val keepIdle = networkTCPKeepIdle.value @@ -62,11 +59,12 @@ fun AdvancedNetworkSettingsView(chatModel: ChatModel) { null } return NetCfg( - socksProxy = socksProxy, - tcpConnectTimeout = tcpConnectTimeout, - tcpTimeout = tcpTimeout, + socksProxy = currentCfg.value.socksProxy, + tcpConnectTimeout = networkTCPConnectTimeout.value, + tcpTimeout = networkTCPTimeout.value, tcpKeepAlive = tcpKeepAlive, - smpPingInterval = smpPingInterval + smpPingInterval = networkSMPPingInterval.value, + smpPingCount = networkSMPPingCount.value ) } @@ -74,6 +72,7 @@ fun AdvancedNetworkSettingsView(chatModel: ChatModel) { networkTCPConnectTimeout.value = cfg.tcpConnectTimeout networkTCPTimeout.value = cfg.tcpTimeout networkSMPPingInterval.value = cfg.smpPingInterval + networkSMPPingCount.value = cfg.smpPingCount networkEnableKeepAlive.value = cfg.enableKeepAlive if (cfg.tcpKeepAlive != null) { networkTCPKeepIdle.value = cfg.tcpKeepAlive.keepIdle @@ -113,6 +112,7 @@ fun AdvancedNetworkSettingsView(chatModel: ChatModel) { networkTCPConnectTimeout, networkTCPTimeout, networkSMPPingInterval, + networkSMPPingCount, networkEnableKeepAlive, networkTCPKeepIdle, networkTCPKeepIntvl, @@ -129,6 +129,7 @@ fun AdvancedNetworkSettingsView(chatModel: ChatModel) { networkTCPConnectTimeout: MutableState, networkTCPTimeout: MutableState, networkSMPPingInterval: MutableState, + networkSMPPingCount: MutableState, networkEnableKeepAlive: MutableState, networkTCPKeepIdle: MutableState, networkTCPKeepIntvl: MutableState, @@ -170,7 +171,14 @@ fun AdvancedNetworkSettingsView(chatModel: ChatModel) { SectionItemView { TimeoutSettingRow( stringResource(R.string.network_option_ping_interval), networkSMPPingInterval, - listOf(120_000000, 300_000000, 600_000000, 1200_000000, 2400_000000), secondsLabel + listOf(120_000000, 300_000000, 600_000000, 1200_000000, 2400_000000, 3600_000000), secondsLabel + ) + } + SectionDivider() + SectionItemView { + IntSettingRow( + stringResource(R.string.network_option_ping_count), networkSMPPingCount, + listOf(1, 2, 3, 5, 8), "" ) } SectionDivider() @@ -412,6 +420,7 @@ fun PreviewAdvancedNetworkSettingsLayout() { networkTCPConnectTimeout = remember { mutableStateOf(10_000000) }, networkTCPTimeout = remember { mutableStateOf(10_000000) }, networkSMPPingInterval = remember { mutableStateOf(10_000000) }, + networkSMPPingCount = remember { mutableStateOf(3) }, networkEnableKeepAlive = remember { mutableStateOf(true) }, networkTCPKeepIdle = remember { mutableStateOf(10) }, networkTCPKeepIntvl = remember { mutableStateOf(10) }, diff --git a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/NetworkAndServers.kt b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/NetworkAndServers.kt index d950981682..cc0a6de7f2 100644 --- a/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/NetworkAndServers.kt +++ b/apps/android/app/src/main/java/chat/simplex/app/views/usersettings/NetworkAndServers.kt @@ -123,10 +123,8 @@ fun NetworkAndServersView( } SectionDivider() UseOnionHosts(onionHosts, networkUseSocksProxy, showSettingsModal, useOnion) - if (developerTools) { - SectionDivider() - SettingsActionItem(Icons.Outlined.Cable, stringResource(R.string.network_settings), showSettingsModal { AdvancedNetworkSettingsView(it) }) - } + SectionDivider() + SettingsActionItem(Icons.Outlined.Cable, stringResource(R.string.network_settings), showSettingsModal { AdvancedNetworkSettingsView(it) }) } Spacer(Modifier.height(8.dp)) SectionView(generalGetString(R.string.settings_section_title_calls)) { diff --git a/apps/android/app/src/main/res/values/strings.xml b/apps/android/app/src/main/res/values/strings.xml index e40198c80a..cc79c17e71 100644 --- a/apps/android/app/src/main/res/values/strings.xml +++ b/apps/android/app/src/main/res/values/strings.xml @@ -952,6 +952,7 @@ TCP connection timeout Protocol timeout PING interval + PING count Enable TCP keep-alive Revert Save diff --git a/apps/ios/Shared/Views/UserSettings/AdvancedNetworkSettings.swift b/apps/ios/Shared/Views/UserSettings/AdvancedNetworkSettings.swift index 5504870ded..8b47f20ba8 100644 --- a/apps/ios/Shared/Views/UserSettings/AdvancedNetworkSettings.swift +++ b/apps/ios/Shared/Views/UserSettings/AdvancedNetworkSettings.swift @@ -53,7 +53,8 @@ struct AdvancedNetworkSettings: View { timeoutSettingPicker("TCP connection timeout", selection: $netCfg.tcpConnectTimeout, values: [2_500000, 5_000000, 7_500000, 10_000000, 15_000000, 20_000000], label: secondsLabel) timeoutSettingPicker("Protocol timeout", selection: $netCfg.tcpTimeout, values: [1_500000, 3_000000, 5_000000, 7_000000, 10_000000, 15_000000], label: secondsLabel) - timeoutSettingPicker("PING interval", selection: $netCfg.smpPingInterval, values: [120_000000, 300_000000, 600_000000, 1200_000000, 2400_000000], label: secondsLabel) + timeoutSettingPicker("PING interval", selection: $netCfg.smpPingInterval, values: [120_000000, 300_000000, 600_000000, 1200_000000, 2400_000000, 3600_000000], label: secondsLabel) + intSettingPicker("PING count", selection: $netCfg.smpPingCount, values: [1, 2, 3, 5, 8], label: "") Toggle("Enable TCP keep-alive", isOn: $enableKeepAlive) if enableKeepAlive { diff --git a/apps/ios/Shared/Views/UserSettings/NetworkAndServers.swift b/apps/ios/Shared/Views/UserSettings/NetworkAndServers.swift index 16d3c9cd0c..b88a18e170 100644 --- a/apps/ios/Shared/Views/UserSettings/NetworkAndServers.swift +++ b/apps/ios/Shared/Views/UserSettings/NetworkAndServers.swift @@ -45,13 +45,11 @@ struct NetworkAndServers: View { } .frame(height: 36) - if developerTools { - NavigationLink { - AdvancedNetworkSettings() - .navigationTitle("Network settings") - } label: { - Text("Advanced network settings") - } + NavigationLink { + AdvancedNetworkSettings() + .navigationTitle("Network settings") + } label: { + Text("Advanced network settings") } } header: { Text("Messages") diff --git a/apps/ios/SimpleX Localizations/de.xcloc/Localized Contents/de.xliff b/apps/ios/SimpleX Localizations/de.xcloc/Localized Contents/de.xliff index 6b38d66b19..f359101580 100644 --- a/apps/ios/SimpleX Localizations/de.xcloc/Localized Contents/de.xliff +++ b/apps/ios/SimpleX Localizations/de.xcloc/Localized Contents/de.xliff @@ -2273,6 +2273,10 @@ Wir werden Serverredundanzen hinzufügen, um verloren gegangene Nachrichten zu v Das Öffnen des Links über den Browser kann die Privatsphäre und Sicherheit der Verbindung reduzieren. SimpleX-Links, denen nicht vertraut wird, werden Rot sein. No comment provided by engineer. + + PING count + No comment provided by engineer. + PING interval PING-Intervall diff --git a/apps/ios/SimpleX Localizations/en.xcloc/Localized Contents/en.xliff b/apps/ios/SimpleX Localizations/en.xcloc/Localized Contents/en.xliff index a4aa59906a..847b3e2878 100644 --- a/apps/ios/SimpleX Localizations/en.xcloc/Localized Contents/en.xliff +++ b/apps/ios/SimpleX Localizations/en.xcloc/Localized Contents/en.xliff @@ -2273,6 +2273,11 @@ We will be adding server redundancy to prevent lost messages. Opening the link in the browser may reduce connection privacy and security. Untrusted SimpleX links will be red. No comment provided by engineer. + + PING count + PING count + No comment provided by engineer. + PING interval PING interval diff --git a/apps/ios/SimpleX Localizations/fr.xcloc/Localized Contents/fr.xliff b/apps/ios/SimpleX Localizations/fr.xcloc/Localized Contents/fr.xliff index bbc1873964..f35a16ed3a 100644 --- a/apps/ios/SimpleX Localizations/fr.xcloc/Localized Contents/fr.xliff +++ b/apps/ios/SimpleX Localizations/fr.xcloc/Localized Contents/fr.xliff @@ -2273,6 +2273,10 @@ Nous allons ajouter une redondance des serveurs pour éviter la perte de message Ouvrir le lien dans le navigateur peut réduire la confidentialité et la sécurité de la connexion. Les liens SimpleX non fiables seront en rouge. No comment provided by engineer. + + PING count + No comment provided by engineer. + PING interval Intervalle de PING diff --git a/apps/ios/SimpleX Localizations/it.xcloc/Localized Contents/it.xliff b/apps/ios/SimpleX Localizations/it.xcloc/Localized Contents/it.xliff index 5c942b9c0a..5841619864 100644 --- a/apps/ios/SimpleX Localizations/it.xcloc/Localized Contents/it.xliff +++ b/apps/ios/SimpleX Localizations/it.xcloc/Localized Contents/it.xliff @@ -2273,6 +2273,10 @@ Aggiungeremo la ridondanza del server per prevenire la perdita di messaggi.Aprire il link nel browser può ridurre la privacy e la sicurezza della connessione. I link SimpleX non fidati saranno in rosso. No comment provided by engineer. + + PING count + No comment provided by engineer. + PING interval Intervallo PING diff --git a/apps/ios/SimpleX Localizations/ru.xcloc/Localized Contents/ru.xliff b/apps/ios/SimpleX Localizations/ru.xcloc/Localized Contents/ru.xliff index 4b7af896f7..af7aa75f75 100644 --- a/apps/ios/SimpleX Localizations/ru.xcloc/Localized Contents/ru.xliff +++ b/apps/ios/SimpleX Localizations/ru.xcloc/Localized Contents/ru.xliff @@ -2273,6 +2273,11 @@ We will be adding server redundancy to prevent lost messages. Использование ссылки в браузере может уменьшить конфиденциальность и безопасность соединения. Ссылки на неизвестные сайты будут красными. No comment provided by engineer. + + PING count + Количество PING + No comment provided by engineer. + PING interval Интервал PING diff --git a/apps/ios/SimpleX.xcodeproj/project.pbxproj b/apps/ios/SimpleX.xcodeproj/project.pbxproj index 21dcf635d1..9aacdc4fa3 100644 --- a/apps/ios/SimpleX.xcodeproj/project.pbxproj +++ b/apps/ios/SimpleX.xcodeproj/project.pbxproj @@ -84,11 +84,6 @@ 5CB0BA90282713D900B3292C /* SimpleXInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CB0BA8F282713D900B3292C /* SimpleXInfo.swift */; }; 5CB0BA92282713FD00B3292C /* CreateProfile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CB0BA91282713FD00B3292C /* CreateProfile.swift */; }; 5CB0BA9A2827FD8800B3292C /* HowItWorks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CB0BA992827FD8800B3292C /* HowItWorks.swift */; }; - 5CB1C5D629772200001292C0 /* libgmp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CB1C5D129772200001292C0 /* libgmp.a */; }; - 5CB1C5D729772200001292C0 /* libgmpxx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CB1C5D229772200001292C0 /* libgmpxx.a */; }; - 5CB1C5D829772200001292C0 /* libffi.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CB1C5D329772200001292C0 /* libffi.a */; }; - 5CB1C5D929772200001292C0 /* libHSsimplex-chat-4.4.4-CqznjuPsbqDLbaIrXhahLF.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CB1C5D429772200001292C0 /* libHSsimplex-chat-4.4.4-CqznjuPsbqDLbaIrXhahLF.a */; }; - 5CB1C5DA29772200001292C0 /* libHSsimplex-chat-4.4.4-CqznjuPsbqDLbaIrXhahLF-ghc8.10.7.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CB1C5D529772200001292C0 /* libHSsimplex-chat-4.4.4-CqznjuPsbqDLbaIrXhahLF-ghc8.10.7.a */; }; 5CB2084F28DA4B4800D024EC /* RTCServers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CB2084E28DA4B4800D024EC /* RTCServers.swift */; }; 5CB2085128DB64CA00D024EC /* CreateLinkView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CB2085028DB64CA00D024EC /* CreateLinkView.swift */; }; 5CB2085328DB7CAF00D024EC /* ConnectViaLinkView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CB2085228DB7CAF00D024EC /* ConnectViaLinkView.swift */; }; @@ -102,6 +97,11 @@ 5CB9250D27A9432000ACCCDD /* ChatListNavLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CB9250C27A9432000ACCCDD /* ChatListNavLink.swift */; }; 5CBD285A295711D700EC2CF4 /* ImageUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CBD2859295711D700EC2CF4 /* ImageUtils.swift */; }; 5CBD285C29575B8E00EC2CF4 /* WhatsNewView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CBD285B29575B8E00EC2CF4 /* WhatsNewView.swift */; }; + 5CBDFB57297A883C00E723C8 /* libHSsimplex-chat-4.4.4-GH5mduSQmlJ14EbWq6Ljca.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CBDFB52297A883C00E723C8 /* libHSsimplex-chat-4.4.4-GH5mduSQmlJ14EbWq6Ljca.a */; }; + 5CBDFB58297A883C00E723C8 /* libgmpxx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CBDFB53297A883C00E723C8 /* libgmpxx.a */; }; + 5CBDFB59297A883C00E723C8 /* libHSsimplex-chat-4.4.4-GH5mduSQmlJ14EbWq6Ljca-ghc8.10.7.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CBDFB54297A883C00E723C8 /* libHSsimplex-chat-4.4.4-GH5mduSQmlJ14EbWq6Ljca-ghc8.10.7.a */; }; + 5CBDFB5A297A883C00E723C8 /* libffi.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CBDFB55297A883C00E723C8 /* libffi.a */; }; + 5CBDFB5B297A883C00E723C8 /* libgmp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5CBDFB56297A883C00E723C8 /* libgmp.a */; }; 5CBE6C12294487F7002D9531 /* VerifyCodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CBE6C11294487F7002D9531 /* VerifyCodeView.swift */; }; 5CBE6C142944CC12002D9531 /* ScanCodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CBE6C132944CC12002D9531 /* ScanCodeView.swift */; }; 5CC1C99227A6C7F5000D9FF6 /* QRCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5CC1C99127A6C7F5000D9FF6 /* QRCode.swift */; }; @@ -308,11 +308,6 @@ 5CB0BA8F282713D900B3292C /* SimpleXInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SimpleXInfo.swift; sourceTree = ""; }; 5CB0BA91282713FD00B3292C /* CreateProfile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateProfile.swift; sourceTree = ""; }; 5CB0BA992827FD8800B3292C /* HowItWorks.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HowItWorks.swift; sourceTree = ""; }; - 5CB1C5D129772200001292C0 /* libgmp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgmp.a; sourceTree = ""; }; - 5CB1C5D229772200001292C0 /* libgmpxx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgmpxx.a; sourceTree = ""; }; - 5CB1C5D329772200001292C0 /* libffi.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libffi.a; sourceTree = ""; }; - 5CB1C5D429772200001292C0 /* libHSsimplex-chat-4.4.4-CqznjuPsbqDLbaIrXhahLF.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libHSsimplex-chat-4.4.4-CqznjuPsbqDLbaIrXhahLF.a"; sourceTree = ""; }; - 5CB1C5D529772200001292C0 /* libHSsimplex-chat-4.4.4-CqznjuPsbqDLbaIrXhahLF-ghc8.10.7.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libHSsimplex-chat-4.4.4-CqznjuPsbqDLbaIrXhahLF-ghc8.10.7.a"; sourceTree = ""; }; 5CB2084E28DA4B4800D024EC /* RTCServers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RTCServers.swift; sourceTree = ""; }; 5CB2085028DB64CA00D024EC /* CreateLinkView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CreateLinkView.swift; sourceTree = ""; }; 5CB2085228DB7CAF00D024EC /* ConnectViaLinkView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConnectViaLinkView.swift; sourceTree = ""; }; @@ -332,6 +327,11 @@ 5CBD285829565D2600EC2CF4 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/InfoPlist.strings; sourceTree = ""; }; 5CBD2859295711D700EC2CF4 /* ImageUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageUtils.swift; sourceTree = ""; }; 5CBD285B29575B8E00EC2CF4 /* WhatsNewView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WhatsNewView.swift; sourceTree = ""; }; + 5CBDFB52297A883C00E723C8 /* libHSsimplex-chat-4.4.4-GH5mduSQmlJ14EbWq6Ljca.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libHSsimplex-chat-4.4.4-GH5mduSQmlJ14EbWq6Ljca.a"; sourceTree = ""; }; + 5CBDFB53297A883C00E723C8 /* libgmpxx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgmpxx.a; sourceTree = ""; }; + 5CBDFB54297A883C00E723C8 /* libHSsimplex-chat-4.4.4-GH5mduSQmlJ14EbWq6Ljca-ghc8.10.7.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libHSsimplex-chat-4.4.4-GH5mduSQmlJ14EbWq6Ljca-ghc8.10.7.a"; sourceTree = ""; }; + 5CBDFB55297A883C00E723C8 /* libffi.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libffi.a; sourceTree = ""; }; + 5CBDFB56297A883C00E723C8 /* libgmp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libgmp.a; sourceTree = ""; }; 5CBE6C11294487F7002D9531 /* VerifyCodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VerifyCodeView.swift; sourceTree = ""; }; 5CBE6C132944CC12002D9531 /* ScanCodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScanCodeView.swift; sourceTree = ""; }; 5CC1C99127A6C7F5000D9FF6 /* QRCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCode.swift; sourceTree = ""; }; @@ -424,12 +424,12 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 5CB1C5D929772200001292C0 /* libHSsimplex-chat-4.4.4-CqznjuPsbqDLbaIrXhahLF.a in Frameworks */, - 5CB1C5D729772200001292C0 /* libgmpxx.a in Frameworks */, + 5CBDFB58297A883C00E723C8 /* libgmpxx.a in Frameworks */, + 5CBDFB5B297A883C00E723C8 /* libgmp.a in Frameworks */, + 5CBDFB5A297A883C00E723C8 /* libffi.a in Frameworks */, 5CE2BA93284534B000EC33A6 /* libiconv.tbd in Frameworks */, - 5CB1C5D629772200001292C0 /* libgmp.a in Frameworks */, - 5CB1C5D829772200001292C0 /* libffi.a in Frameworks */, - 5CB1C5DA29772200001292C0 /* libHSsimplex-chat-4.4.4-CqznjuPsbqDLbaIrXhahLF-ghc8.10.7.a in Frameworks */, + 5CBDFB59297A883C00E723C8 /* libHSsimplex-chat-4.4.4-GH5mduSQmlJ14EbWq6Ljca-ghc8.10.7.a in Frameworks */, + 5CBDFB57297A883C00E723C8 /* libHSsimplex-chat-4.4.4-GH5mduSQmlJ14EbWq6Ljca.a in Frameworks */, 5CE2BA94284534BB00EC33A6 /* libz.tbd in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -488,11 +488,11 @@ 5C764E5C279C70B7000C6508 /* Libraries */ = { isa = PBXGroup; children = ( - 5CB1C5D329772200001292C0 /* libffi.a */, - 5CB1C5D129772200001292C0 /* libgmp.a */, - 5CB1C5D229772200001292C0 /* libgmpxx.a */, - 5CB1C5D529772200001292C0 /* libHSsimplex-chat-4.4.4-CqznjuPsbqDLbaIrXhahLF-ghc8.10.7.a */, - 5CB1C5D429772200001292C0 /* libHSsimplex-chat-4.4.4-CqznjuPsbqDLbaIrXhahLF.a */, + 5CBDFB55297A883C00E723C8 /* libffi.a */, + 5CBDFB56297A883C00E723C8 /* libgmp.a */, + 5CBDFB53297A883C00E723C8 /* libgmpxx.a */, + 5CBDFB54297A883C00E723C8 /* libHSsimplex-chat-4.4.4-GH5mduSQmlJ14EbWq6Ljca-ghc8.10.7.a */, + 5CBDFB52297A883C00E723C8 /* libHSsimplex-chat-4.4.4-GH5mduSQmlJ14EbWq6Ljca.a */, ); path = Libraries; sourceTree = ""; diff --git a/apps/ios/SimpleXChat/APITypes.swift b/apps/ios/SimpleXChat/APITypes.swift index 1c9f99185c..fc1576dec5 100644 --- a/apps/ios/SimpleXChat/APITypes.swift +++ b/apps/ios/SimpleXChat/APITypes.swift @@ -809,6 +809,7 @@ public struct NetCfg: Codable, Equatable { public var tcpTimeout: Int // microseconds public var tcpKeepAlive: KeepAliveOpts? public var smpPingInterval: Int // microseconds + public var smpPingCount: Int // times public var logTLSErrors: Bool public static let defaults: NetCfg = NetCfg( @@ -816,7 +817,8 @@ public struct NetCfg: Codable, Equatable { tcpConnectTimeout: 10_000_000, tcpTimeout: 7_000_000, tcpKeepAlive: KeepAliveOpts.defaults, - smpPingInterval: 600_000_000, + smpPingInterval: 1200_000_000, + smpPingCount: 3, logTLSErrors: false ) @@ -825,7 +827,8 @@ public struct NetCfg: Codable, Equatable { tcpConnectTimeout: 20_000_000, tcpTimeout: 15_000_000, tcpKeepAlive: KeepAliveOpts.defaults, - smpPingInterval: 600_000_000, + smpPingInterval: 1200_000_000, + smpPingCount: 3, logTLSErrors: false ) diff --git a/apps/ios/SimpleXChat/AppGroup.swift b/apps/ios/SimpleXChat/AppGroup.swift index 6ccf51471c..0dd43a2fca 100644 --- a/apps/ios/SimpleXChat/AppGroup.swift +++ b/apps/ios/SimpleXChat/AppGroup.swift @@ -20,6 +20,7 @@ let GROUP_DEFAULT_NETWORK_USE_ONION_HOSTS = "networkUseOnionHosts" let GROUP_DEFAULT_NETWORK_TCP_CONNECT_TIMEOUT = "networkTCPConnectTimeout" let GROUP_DEFAULT_NETWORK_TCP_TIMEOUT = "networkTCPTimeout" let GROUP_DEFAULT_NETWORK_SMP_PING_INTERVAL = "networkSMPPingInterval" +let GROUP_DEFAULT_NETWORK_SMP_PING_COUNT = "networkSMPPingCount" let GROUP_DEFAULT_NETWORK_ENABLE_KEEP_ALIVE = "networkEnableKeepAlive" let GROUP_DEFAULT_NETWORK_TCP_KEEP_IDLE = "networkTCPKeepIdle" let GROUP_DEFAULT_NETWORK_TCP_KEEP_INTVL = "networkTCPKeepIntvl" @@ -38,6 +39,7 @@ public func registerGroupDefaults() { GROUP_DEFAULT_NETWORK_TCP_CONNECT_TIMEOUT: NetCfg.defaults.tcpConnectTimeout, GROUP_DEFAULT_NETWORK_TCP_TIMEOUT: NetCfg.defaults.tcpTimeout, GROUP_DEFAULT_NETWORK_SMP_PING_INTERVAL: NetCfg.defaults.smpPingInterval, + GROUP_DEFAULT_NETWORK_SMP_PING_COUNT: NetCfg.defaults.smpPingCount, GROUP_DEFAULT_NETWORK_ENABLE_KEEP_ALIVE: NetCfg.defaults.enableKeepAlive, GROUP_DEFAULT_NETWORK_TCP_KEEP_IDLE: KeepAliveOpts.defaults.keepIdle, GROUP_DEFAULT_NETWORK_TCP_KEEP_INTVL: KeepAliveOpts.defaults.keepIntvl, @@ -187,6 +189,7 @@ public func getNetCfg() -> NetCfg { let tcpConnectTimeout = groupDefaults.integer(forKey: GROUP_DEFAULT_NETWORK_TCP_CONNECT_TIMEOUT) let tcpTimeout = groupDefaults.integer(forKey: GROUP_DEFAULT_NETWORK_TCP_TIMEOUT) let smpPingInterval = groupDefaults.integer(forKey: GROUP_DEFAULT_NETWORK_SMP_PING_INTERVAL) + let smpPingCount = groupDefaults.integer(forKey: GROUP_DEFAULT_NETWORK_SMP_PING_COUNT) let enableKeepAlive = groupDefaults.bool(forKey: GROUP_DEFAULT_NETWORK_ENABLE_KEEP_ALIVE) var tcpKeepAlive: KeepAliveOpts? if enableKeepAlive { @@ -204,6 +207,7 @@ public func getNetCfg() -> NetCfg { tcpTimeout: tcpTimeout, tcpKeepAlive: tcpKeepAlive, smpPingInterval: smpPingInterval, + smpPingCount: smpPingCount, logTLSErrors: false ) } @@ -213,6 +217,7 @@ public func setNetCfg(_ cfg: NetCfg) { groupDefaults.set(cfg.tcpConnectTimeout, forKey: GROUP_DEFAULT_NETWORK_TCP_CONNECT_TIMEOUT) groupDefaults.set(cfg.tcpTimeout, forKey: GROUP_DEFAULT_NETWORK_TCP_TIMEOUT) groupDefaults.set(cfg.smpPingInterval, forKey: GROUP_DEFAULT_NETWORK_SMP_PING_INTERVAL) + groupDefaults.set(cfg.smpPingCount, forKey: GROUP_DEFAULT_NETWORK_SMP_PING_COUNT) if let tcpKeepAlive = cfg.tcpKeepAlive { groupDefaults.set(true, forKey: GROUP_DEFAULT_NETWORK_ENABLE_KEEP_ALIVE) groupDefaults.set(tcpKeepAlive.keepIdle, forKey: GROUP_DEFAULT_NETWORK_TCP_KEEP_IDLE)