mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Added a setting to disable UI secure mode preventing screenshots & screen recording
This commit is contained in:
parent
8f1eeebd66
commit
f90b518f43
5 changed files with 55 additions and 0 deletions
|
|
@ -121,6 +121,13 @@ class SettingsFragment : GenericMainFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
viewModel.recreateActivityEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
Log.w("$TAG Recreate Activity")
|
||||
requireActivity().recreate()
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.addLdapServerEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
val action = SettingsFragmentDirections.actionSettingsFragmentToLdapServerConfigurationFragment(
|
||||
|
|
|
|||
|
|
@ -47,9 +47,15 @@ class SettingsViewModel @UiThread constructor() : GenericViewModel() {
|
|||
val expandNetwork = MutableLiveData<Boolean>()
|
||||
val expandUserInterface = MutableLiveData<Boolean>()
|
||||
|
||||
val recreateActivityEvent: MutableLiveData<Event<Boolean>> by lazy {
|
||||
MutableLiveData<Event<Boolean>>()
|
||||
}
|
||||
|
||||
// Security settings
|
||||
val isVfsEnabled = MutableLiveData<Boolean>()
|
||||
|
||||
val isUiSecureModeEnabled = MutableLiveData<Boolean>()
|
||||
|
||||
// Calls settings
|
||||
val echoCancellerEnabled = MutableLiveData<Boolean>()
|
||||
val routeAudioToBluetooth = MutableLiveData<Boolean>()
|
||||
|
|
@ -169,6 +175,8 @@ class SettingsViewModel @UiThread constructor() : GenericViewModel() {
|
|||
}
|
||||
|
||||
coreContext.postOnCoreThread { core ->
|
||||
isUiSecureModeEnabled.postValue(corePreferences.enableSecureMode)
|
||||
|
||||
echoCancellerEnabled.postValue(core.isEchoCancellationEnabled)
|
||||
routeAudioToBluetooth.postValue(corePreferences.routeAudioToBluetoothIfAvailable)
|
||||
videoEnabled.postValue(core.isVideoEnabled)
|
||||
|
|
@ -211,6 +219,16 @@ class SettingsViewModel @UiThread constructor() : GenericViewModel() {
|
|||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun toggleUiSecureMode() {
|
||||
val newValue = isUiSecureModeEnabled.value == false
|
||||
coreContext.postOnCoreThread {
|
||||
corePreferences.enableSecureMode = newValue
|
||||
recreateActivityEvent.postValue(Event(true))
|
||||
isUiSecureModeEnabled.postValue(newValue)
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun toggleCallsExpand() {
|
||||
expandCalls.value = expandCalls.value == false
|
||||
|
|
|
|||
|
|
@ -57,6 +57,34 @@
|
|||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
style="@style/material_switch_style"
|
||||
android:id="@+id/security_ui_switch"
|
||||
android:onClick="@{() -> viewModel.toggleUiSecureMode()}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:checked="@{viewModel.isUiSecureModeEnabled}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/enable_vfs_switch" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/settings_title_style"
|
||||
android:id="@+id/security_ui_title"
|
||||
android:onClick="@{() -> viewModel.toggleUiSecureMode()}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="@string/settings_security_prevent_screenshots_title"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintTop_toTopOf="@id/security_ui_switch"
|
||||
app:layout_constraintBottom_toBottomOf="@id/security_ui_switch"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/security_ui_switch"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -216,6 +216,7 @@
|
|||
<string name="settings_security_title">Securité</string>
|
||||
<string name="settings_security_enable_vfs_title">Chiffrer tous les fichiers</string>
|
||||
<string name="settings_security_enable_vfs_subtitle">Attention, vous ne pourrez pas revenir en arrière !</string>
|
||||
<string name="settings_security_prevent_screenshots_title">Empêcher l\'interface d\'être enregistrée</string>
|
||||
<string name="settings_calls_title">Appels</string>
|
||||
<string name="settings_calls_echo_canceller_title">Utiliser l\'annulateur d\'écho</string>
|
||||
<string name="settings_calls_echo_canceller_subtitle">Évite que de l\'écho soit entendu par votre correspondant</string>
|
||||
|
|
|
|||
|
|
@ -251,6 +251,7 @@
|
|||
<string name="settings_security_title">Security</string>
|
||||
<string name="settings_security_enable_vfs_title">Encrypt everything</string>
|
||||
<string name="settings_security_enable_vfs_subtitle">Warning: once enabled it can\'t be disabled!</string>
|
||||
<string name="settings_security_prevent_screenshots_title">Prevent interface from being recorded</string>
|
||||
<string name="settings_calls_title">Calls</string>
|
||||
<string name="settings_calls_echo_canceller_title">Use echo canceller</string>
|
||||
<string name="settings_calls_echo_canceller_subtitle">Prevents echo from being heard by remote end</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue