Added a setting to disable fragment's secure mode
This commit is contained in:
parent
92b1ba16a7
commit
beb9d0db45
5 changed files with 30 additions and 0 deletions
|
@ -31,6 +31,7 @@ import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import org.linphone.LinphoneApplication.Companion.corePreferences
|
||||||
import org.linphone.activities.GenericFragment
|
import org.linphone.activities.GenericFragment
|
||||||
import org.linphone.core.tools.Log
|
import org.linphone.core.tools.Log
|
||||||
|
|
||||||
|
@ -63,6 +64,11 @@ abstract class SecureFragment<T : ViewDataBinding> : GenericFragment<T>() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun enableSecureMode(enable: Boolean) {
|
private fun enableSecureMode(enable: Boolean) {
|
||||||
|
if (corePreferences.disableSecureMode) {
|
||||||
|
Log.d("[Secure Fragment] Disabling secure flag on window due to setting")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
Log.d("[Secure Fragment] ${if (enable) "Enabling" else "Disabling"} secure flag on window")
|
Log.d("[Secure Fragment] ${if (enable) "Enabling" else "Disabling"} secure flag on window")
|
||||||
val window = requireActivity().window
|
val window = requireActivity().window
|
||||||
val windowManager = requireActivity().windowManager
|
val windowManager = requireActivity().windowManager
|
||||||
|
|
|
@ -134,6 +134,13 @@ class AdvancedSettingsViewModel : LogsUploadViewModel() {
|
||||||
}
|
}
|
||||||
val vfs = MutableLiveData<Boolean>()
|
val vfs = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
|
val disableSecureFragmentListener = object : SettingListenerStub() {
|
||||||
|
override fun onBoolValueChanged(newValue: Boolean) {
|
||||||
|
prefs.disableSecureMode = newValue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val disableSecureFragment = MutableLiveData<Boolean>()
|
||||||
|
|
||||||
val goToBatterySettingsListener = object : SettingListenerStub() {
|
val goToBatterySettingsListener = object : SettingListenerStub() {
|
||||||
override fun onClicked() {
|
override fun onClicked() {
|
||||||
goToBatterySettingsEvent.value = Event(true)
|
goToBatterySettingsEvent.value = Event(true)
|
||||||
|
@ -174,6 +181,7 @@ class AdvancedSettingsViewModel : LogsUploadViewModel() {
|
||||||
deviceName.value = prefs.deviceName
|
deviceName.value = prefs.deviceName
|
||||||
remoteProvisioningUrl.value = core.provisioningUri
|
remoteProvisioningUrl.value = core.provisioningUri
|
||||||
vfs.value = prefs.vfsEnabled
|
vfs.value = prefs.vfsEnabled
|
||||||
|
disableSecureFragment.value = prefs.disableSecureMode
|
||||||
|
|
||||||
batterySettingsVisibility.value = Version.sdkAboveOrEqual(Version.API23_MARSHMALLOW_60)
|
batterySettingsVisibility.value = Version.sdkAboveOrEqual(Version.API23_MARSHMALLOW_60)
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,6 +133,13 @@ class CorePreferences constructor(private val context: Context) {
|
||||||
config.setInt("app", "dark_mode", value)
|
config.setInt("app", "dark_mode", value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Allow to make screenshots of encrypted chat rooms, disables fragment's secure mode */
|
||||||
|
var disableSecureMode: Boolean
|
||||||
|
get() = config.getBool("app", "disable_fragment_secure_mode", false)
|
||||||
|
set(value) {
|
||||||
|
config.setBool("app", "disable_fragment_secure_mode", value)
|
||||||
|
}
|
||||||
|
|
||||||
/* Audio */
|
/* Audio */
|
||||||
|
|
||||||
/* Video */
|
/* Video */
|
||||||
|
|
|
@ -163,6 +163,13 @@
|
||||||
linphone:checked="@={viewModel.vfs}"
|
linphone:checked="@={viewModel.vfs}"
|
||||||
linphone:enabled="@{!viewModel.vfs}"/>
|
linphone:enabled="@{!viewModel.vfs}"/>
|
||||||
|
|
||||||
|
<include
|
||||||
|
layout="@layout/settings_widget_switch"
|
||||||
|
linphone:title="@{@string/advanced_settings_disable_fragment_security_title}"
|
||||||
|
linphone:subtitle="@{@string/advanced_settings_disable_fragment_security_summary}"
|
||||||
|
linphone:listener="@{viewModel.disableSecureFragmentListener}"
|
||||||
|
linphone:checked="@={viewModel.disableSecureFragment}"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/settings_category_font"
|
style="@style/settings_category_font"
|
||||||
android:text="@string/advanced_settings_android_title"
|
android:text="@string/advanced_settings_android_title"
|
||||||
|
|
|
@ -491,6 +491,8 @@
|
||||||
<string name="advanced_settings_reset_debug_logs_title">Reset logs</string>
|
<string name="advanced_settings_reset_debug_logs_title">Reset logs</string>
|
||||||
<string name="advanced_settings_debug_title">Debug settings</string>
|
<string name="advanced_settings_debug_title">Debug settings</string>
|
||||||
<string name="advanced_settings_other_title">Other settings</string>
|
<string name="advanced_settings_other_title">Other settings</string>
|
||||||
|
<string name="advanced_settings_disable_fragment_security_title">Disable UI\'s secure mode</string>
|
||||||
|
<string name="advanced_settings_disable_fragment_security_summary">Allow screen capture/recording on sensitive views</string>
|
||||||
|
|
||||||
<!-- Tunnel settings -->
|
<!-- Tunnel settings -->
|
||||||
<string name="tunnel_settings_hostname_url_title">Hostname</string>
|
<string name="tunnel_settings_hostname_url_title">Hostname</string>
|
||||||
|
|
Loading…
Reference in a new issue