Added setting for legacy push format + moved some configuration for CoreContext to CorePreferences
This commit is contained in:
parent
38d24fd113
commit
d7f31b79cb
6 changed files with 48 additions and 14 deletions
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
## Start of factory rc
|
## Start of factory rc
|
||||||
|
|
||||||
#This file shall not contain path referencing package name, in order to be portable when app is renamed.
|
# This file shall not contain path referencing package name, in order to be portable when app is renamed.
|
||||||
#Paths to resources must be set from LinphoneManager, after creating LinphoneCore.
|
# Paths to resources must be set from LinphoneManager, after creating LinphoneCore.
|
||||||
|
|
||||||
[net]
|
[net]
|
||||||
mtu=1300
|
mtu=1300
|
||||||
|
|
|
@ -46,6 +46,13 @@ class NetworkSettingsViewModel : GenericSettingsViewModel() {
|
||||||
val pushNotifications = MutableLiveData<Boolean>()
|
val pushNotifications = MutableLiveData<Boolean>()
|
||||||
val pushNotificationsAvailable = MutableLiveData<Boolean>()
|
val pushNotificationsAvailable = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
|
val legacyPushNotificationFormatListener = object : SettingListenerStub() {
|
||||||
|
override fun onBoolValueChanged(newValue: Boolean) {
|
||||||
|
prefs.useLegacyPushNotificationFormat = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val legacyPushNotificationFormat = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
val randomPortsListener = object : SettingListenerStub() {
|
val randomPortsListener = object : SettingListenerStub() {
|
||||||
override fun onBoolValueChanged(newValue: Boolean) {
|
override fun onBoolValueChanged(newValue: Boolean) {
|
||||||
val port = if (newValue) -1 else 5060
|
val port = if (newValue) -1 else 5060
|
||||||
|
@ -71,6 +78,7 @@ class NetworkSettingsViewModel : GenericSettingsViewModel() {
|
||||||
allowIpv6.value = core.ipv6Enabled()
|
allowIpv6.value = core.ipv6Enabled()
|
||||||
pushNotifications.value = core.isPushNotificationEnabled
|
pushNotifications.value = core.isPushNotificationEnabled
|
||||||
pushNotificationsAvailable.value = core.isPushNotificationAvailable
|
pushNotificationsAvailable.value = core.isPushNotificationAvailable
|
||||||
|
legacyPushNotificationFormat.value = prefs.useLegacyPushNotificationFormat
|
||||||
randomPorts.value = getSipPort() == -1
|
randomPorts.value = getSipPort() == -1
|
||||||
sipPort.value = getSipPort()
|
sipPort.value = getSipPort()
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,11 +220,12 @@ class CoreContext(val context: Context, coreConfig: Config) {
|
||||||
notificationsManager.onCoreReady()
|
notificationsManager.onCoreReady()
|
||||||
|
|
||||||
core.addListener(listener)
|
core.addListener(listener)
|
||||||
|
|
||||||
if (isPush) {
|
if (isPush) {
|
||||||
Log.i("[Context] Push received, assume in background")
|
Log.i("[Context] Push received, assume in background")
|
||||||
core.enterBackground()
|
core.enterBackground()
|
||||||
}
|
}
|
||||||
core.config.setBool("net", "use_legacy_push_notification_params", true)
|
|
||||||
core.start()
|
core.start()
|
||||||
|
|
||||||
configureCore()
|
configureCore()
|
||||||
|
@ -252,8 +253,8 @@ class CoreContext(val context: Context, coreConfig: Config) {
|
||||||
private fun configureCore() {
|
private fun configureCore() {
|
||||||
Log.i("[Context] Configuring Core")
|
Log.i("[Context] Configuring Core")
|
||||||
|
|
||||||
core.zrtpSecretsFile = context.filesDir.absolutePath + "/zrtp_secrets"
|
core.zrtpSecretsFile = corePreferences.zrtpSecretsPath
|
||||||
core.callLogsDatabasePath = context.filesDir.absolutePath + "/linphone-log-history.db"
|
core.callLogsDatabasePath = corePreferences.callHistoryDatabasePath
|
||||||
|
|
||||||
initUserCertificates()
|
initUserCertificates()
|
||||||
|
|
||||||
|
@ -297,7 +298,7 @@ class CoreContext(val context: Context, coreConfig: Config) {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun initUserCertificates() {
|
private fun initUserCertificates() {
|
||||||
val userCertsPath = context.filesDir.absolutePath + "/user-certs"
|
val userCertsPath = corePreferences.userCertificatesPath
|
||||||
val f = File(userCertsPath)
|
val f = File(userCertsPath)
|
||||||
if (!f.exists()) {
|
if (!f.exists()) {
|
||||||
if (!f.mkdir()) {
|
if (!f.mkdir()) {
|
||||||
|
|
|
@ -241,6 +241,12 @@ class CorePreferences constructor(private val context: Context) {
|
||||||
config.setInt("app", "version_check_url_last_timestamp", value)
|
config.setInt("app", "version_check_url_last_timestamp", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var useLegacyPushNotificationFormat: Boolean
|
||||||
|
get() = config.getBool("net", "use_legacy_push_notification_params", false)
|
||||||
|
set(value) {
|
||||||
|
config.setBool("net", "use_legacy_push_notification_params", value)
|
||||||
|
}
|
||||||
|
|
||||||
/* Read only application settings, some were previously in non_localizable_custom */
|
/* Read only application settings, some were previously in non_localizable_custom */
|
||||||
|
|
||||||
val defaultDomain: String
|
val defaultDomain: String
|
||||||
|
@ -398,6 +404,15 @@ class CorePreferences constructor(private val context: Context) {
|
||||||
val ringtonePath: String
|
val ringtonePath: String
|
||||||
get() = context.filesDir.absolutePath + "/share/sounds/linphone/rings/notes_of_the_optimistic.mkv"
|
get() = context.filesDir.absolutePath + "/share/sounds/linphone/rings/notes_of_the_optimistic.mkv"
|
||||||
|
|
||||||
|
val userCertificatesPath: String
|
||||||
|
get() = context.filesDir.absolutePath + "/user-certs"
|
||||||
|
|
||||||
|
val zrtpSecretsPath: String
|
||||||
|
get() = context.filesDir.absolutePath + "/zrtp_secrets"
|
||||||
|
|
||||||
|
val callHistoryDatabasePath: String
|
||||||
|
get() = context.filesDir.absolutePath + "/linphone-log-history.db"
|
||||||
|
|
||||||
fun copyAssetsFromPackage() {
|
fun copyAssetsFromPackage() {
|
||||||
copy("linphonerc_default", configPath)
|
copy("linphonerc_default", configPath)
|
||||||
copy("linphonerc_factory", factoryConfigPath, true)
|
copy("linphonerc_factory", factoryConfigPath, true)
|
||||||
|
|
|
@ -68,29 +68,37 @@
|
||||||
<include
|
<include
|
||||||
layout="@layout/settings_widget_switch"
|
layout="@layout/settings_widget_switch"
|
||||||
linphone:title="@{@string/network_settings_wifi_only_title}"
|
linphone:title="@{@string/network_settings_wifi_only_title}"
|
||||||
linphone:subtitle="@{@string/advanced_settings_wifi_only_summary}"
|
linphone:subtitle="@{@string/network_settings_wifi_only_summary}"
|
||||||
linphone:listener="@{viewModel.wifiOnlyListener}"
|
linphone:listener="@{viewModel.wifiOnlyListener}"
|
||||||
linphone:checked="@={viewModel.wifiOnly}"/>
|
linphone:checked="@={viewModel.wifiOnly}"/>
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/settings_widget_switch"
|
layout="@layout/settings_widget_switch"
|
||||||
linphone:title="@{@string/network_settings_allow_ipv6_title}"
|
linphone:title="@{@string/network_settings_allow_ipv6_title}"
|
||||||
linphone:subtitle="@{@string/advanced_settings_allow_ipv6_summary}"
|
linphone:subtitle="@{@string/network_settings_allow_ipv6_summary}"
|
||||||
linphone:listener="@{viewModel.allowIpv6Listener}"
|
linphone:listener="@{viewModel.allowIpv6Listener}"
|
||||||
linphone:checked="@={viewModel.allowIpv6}"/>
|
linphone:checked="@={viewModel.allowIpv6}"/>
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/settings_widget_switch"
|
layout="@layout/settings_widget_switch"
|
||||||
linphone:title="@{@string/network_settings_push_notifications_title}"
|
linphone:title="@{@string/network_settings_push_notifications_title}"
|
||||||
linphone:subtitle="@{@string/advanced_settings_push_notifications_summary}"
|
linphone:subtitle="@{@string/network_settings_push_notifications_summary}"
|
||||||
linphone:listener="@{viewModel.pushNotificationsListener}"
|
linphone:listener="@{viewModel.pushNotificationsListener}"
|
||||||
linphone:checked="@={viewModel.pushNotifications}"
|
linphone:checked="@={viewModel.pushNotifications}"
|
||||||
linphone:enabled="@{viewModel.pushNotificationsAvailable}"/>
|
linphone:enabled="@{viewModel.pushNotificationsAvailable}"/>
|
||||||
|
|
||||||
|
<include
|
||||||
|
layout="@layout/settings_widget_switch"
|
||||||
|
linphone:title="@{@string/network_settings_legacy_push_notification_format_title}"
|
||||||
|
linphone:subtitle="@{@string/network_settings_legacy_push_notification_format_summary}"
|
||||||
|
linphone:listener="@{viewModel.legacyPushNotificationFormatListener}"
|
||||||
|
linphone:checked="@={viewModel.legacyPushNotificationFormat}"
|
||||||
|
linphone:enabled="@{viewModel.pushNotificationsAvailable}"/>
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/settings_widget_switch"
|
layout="@layout/settings_widget_switch"
|
||||||
linphone:title="@{@string/network_settings_random_ports_title}"
|
linphone:title="@{@string/network_settings_random_ports_title}"
|
||||||
linphone:subtitle="@{@string/advanced_settings_random_ports_summary}"
|
linphone:subtitle="@{@string/network_settings_random_ports_summary}"
|
||||||
linphone:listener="@{viewModel.randomPortsListener}"
|
linphone:listener="@{viewModel.randomPortsListener}"
|
||||||
linphone:checked="@={viewModel.randomPorts}"/>
|
linphone:checked="@={viewModel.randomPorts}"/>
|
||||||
|
|
||||||
|
|
|
@ -425,13 +425,15 @@
|
||||||
|
|
||||||
<!-- Network settings -->
|
<!-- Network settings -->
|
||||||
<string name="network_settings_wifi_only_title">Use WiFi only</string>
|
<string name="network_settings_wifi_only_title">Use WiFi only</string>
|
||||||
<string name="advanced_settings_wifi_only_summary"></string>
|
<string name="network_settings_wifi_only_summary"></string>
|
||||||
<string name="network_settings_allow_ipv6_title">Allow IPv6</string>
|
<string name="network_settings_allow_ipv6_title">Allow IPv6</string>
|
||||||
<string name="advanced_settings_allow_ipv6_summary"></string>
|
<string name="network_settings_allow_ipv6_summary"></string>
|
||||||
<string name="network_settings_push_notifications_title">Enable push notifications</string>
|
<string name="network_settings_push_notifications_title">Enable push notifications</string>
|
||||||
<string name="advanced_settings_push_notifications_summary"></string>
|
<string name="network_settings_push_notifications_summary"></string>
|
||||||
|
<string name="network_settings_legacy_push_notification_format_title">Use legacy push notification params</string>
|
||||||
|
<string name="network_settings_legacy_push_notification_format_summary">Required when using Flexisip < 2.0</string>
|
||||||
<string name="network_settings_random_ports_title">Use random ports</string>
|
<string name="network_settings_random_ports_title">Use random ports</string>
|
||||||
<string name="advanced_settings_random_ports_summary"></string>
|
<string name="network_settings_random_ports_summary"></string>
|
||||||
<string name="network_settings_sip_port_title">SIP port to use</string>
|
<string name="network_settings_sip_port_title">SIP port to use</string>
|
||||||
<string name="network_settings_sip_port_summary"></string>
|
<string name="network_settings_sip_port_summary"></string>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue