Moved some settings around, removed ADB logcat toggle

This commit is contained in:
Sylvain Berfini 2024-06-04 16:45:50 +02:00
parent 01f6ac29e9
commit 12e7041c57
10 changed files with 40 additions and 221 deletions

View file

@ -26,11 +26,9 @@ import androidx.lifecycle.viewModelScope
import kotlinx.coroutines.launch
import org.linphone.BuildConfig
import org.linphone.LinphoneApplication.Companion.coreContext
import org.linphone.LinphoneApplication.Companion.corePreferences
import org.linphone.R
import org.linphone.core.Core
import org.linphone.core.CoreListenerStub
import org.linphone.core.Factory
import org.linphone.core.VersionUpdateCheckResult
import org.linphone.core.tools.Log
import org.linphone.ui.GenericViewModel
@ -49,8 +47,6 @@ class HelpViewModel @UiThread constructor() : GenericViewModel() {
val sdkVersion = MutableLiveData<String>()
val printLogInLogcatEnabled = MutableLiveData<Boolean>()
val checkUpdateAvailable = MutableLiveData<Boolean>()
val uploadLogsAvailable = MutableLiveData<Boolean>()
@ -139,7 +135,6 @@ class HelpViewModel @UiThread constructor() : GenericViewModel() {
coreContext.postOnCoreThread { core ->
core.addListener(coreListener)
printLogInLogcatEnabled.postValue(corePreferences.printLogsInLogcat)
val checkUpdateServerUrl = core.config.getString("misc", "version_check_url_root", "")
checkUpdateAvailable.postValue(!checkUpdateServerUrl.isNullOrEmpty())
@ -156,17 +151,6 @@ class HelpViewModel @UiThread constructor() : GenericViewModel() {
}
}
@UiThread
fun togglePrintLogsInLogcat() {
val enabled = printLogInLogcatEnabled.value == false
printLogInLogcatEnabled.value = enabled
coreContext.postOnCoreThread {
corePreferences.printLogsInLogcat = enabled
Factory.instance().enableLogcatLogs(corePreferences.printLogsInLogcat)
}
}
@UiThread
fun cleanLogs() {
coreContext.postOnCoreThread { core ->

View file

@ -33,7 +33,6 @@ import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.lifecycle.LifecycleOwner
import org.linphone.R
import org.linphone.databinding.DialogAccountModesExplanationBinding
import org.linphone.databinding.DialogAssistantAcceptConditionsAndPolicyBinding
import org.linphone.databinding.DialogAssistantCreateAccountConfirmPhoneNumberBinding
import org.linphone.databinding.DialogCancelContactChangesBinding
@ -115,28 +114,6 @@ class DialogUtils {
return dialog
}
@UiThread
fun getAccountModeExplanationDialog(
context: Context,
defaultMode: Boolean
): Dialog {
lateinit var dialog: Dialog
val binding: DialogAccountModesExplanationBinding = DataBindingUtil.inflate(
LayoutInflater.from(context),
R.layout.dialog_account_modes_explanation,
null,
false
)
binding.defaultMode = defaultMode
binding.setDismissClickListener {
dialog.dismiss()
}
dialog = getDialog(context, binding)
return dialog
}
@UiThread
fun getConfirmAccountRemovalDialog(
context: Context,

View file

@ -54,7 +54,7 @@
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginTop="10dp"
android:text="@{viewModel.message, default=@string/call_dialog_zrtp_validate_trust_message}"
android:text="@{viewModel.message, default=@string/call_dialog_zrtp_validate_trust_subtitle}"
android:textSize="14sp"
app:layout_constraintBottom_toTopOf="@id/letters_1"
app:layout_constraintStart_toStartOf="@id/dialog_background"

View file

@ -1,91 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<import type="android.view.View" />
<variable
name="dismissClickListener"
type="View.OnClickListener" />
<variable
name="defaultMode"
type="Boolean" />
</data>
<androidx.constraintlayout.widget.ConstraintLayout
android:onClick="@{dismissClickListener}"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:id="@+id/dialog_background"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="12dp"
android:layout_marginEnd="12dp"
android:layout_marginBottom="2dp"
android:src="@drawable/shape_dialog_background"
android:contentDescription="@null"
app:layout_constraintWidth_max="@dimen/dialog_max_width"
app:layout_constraintBottom_toBottomOf="@id/anchor"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@id/title" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/section_header_style"
android:id="@+id/title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:paddingTop="@dimen/dialog_top_bottom_margin"
android:text="@{defaultMode ? @string/manage_account_e2e_encrypted_mode_default_title : @string/manage_account_e2e_encrypted_mode_interoperable_title, default=@string/manage_account_e2e_encrypted_mode_default_title}"
app:layout_constraintVertical_chainStyle="packed"
app:layout_constraintBottom_toTopOf="@id/message"
app:layout_constraintStart_toStartOf="@id/dialog_background"
app:layout_constraintEnd_toEndOf="@id/dialog_background"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:id="@+id/message"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginTop="10dp"
android:text="@{defaultMode ? @string/manage_account_dialog_e2e_encrypted_mode_default_message : @string/manage_account_dialog_e2e_encrypted_mode_interoperable_message, default=@string/manage_account_dialog_e2e_encrypted_mode_default_message}"
android:textSize="14sp"
app:layout_constraintBottom_toTopOf="@id/confirm"
app:layout_constraintStart_toStartOf="@id/dialog_background"
app:layout_constraintEnd_toEndOf="@id/dialog_background"
app:layout_constraintTop_toBottomOf="@id/title" />
<androidx.appcompat.widget.AppCompatTextView
android:onClick="@{dismissClickListener}"
style="@style/primary_button_label_style"
android:id="@+id/confirm"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="32dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:text="@string/dialog_close"
app:layout_constraintStart_toStartOf="@id/dialog_background"
app:layout_constraintEnd_toEndOf="@id/dialog_background"
app:layout_constraintTop_toBottomOf="@id/message"
app:layout_constraintBottom_toTopOf="@id/anchor"/>
<View
android:id="@+id/anchor"
android:layout_width="wrap_content"
android:layout_height="@dimen/dialog_top_bottom_margin"
app:layout_constraintTop_toBottomOf="@id/confirm"
app:layout_constraintStart_toStartOf="@id/dialog_background"
app:layout_constraintEnd_toEndOf="@id/dialog_background"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -54,7 +54,7 @@
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:layout_marginTop="10dp"
android:text="@{viewModel.message, default=@string/call_dialog_zrtp_validate_trust_message}"
android:text="@{viewModel.message, default=@string/call_dialog_zrtp_validate_trust_subtitle}"
android:textSize="14sp"
app:layout_constraintBottom_toTopOf="@id/letters_1"
app:layout_constraintStart_toStartOf="@id/dialog_background"

View file

@ -48,57 +48,15 @@
app:layout_constraintStart_toEndOf="@id/back"
app:layout_constraintTop_toTopOf="parent"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/header_style"
android:id="@+id/print_logs_in_logcat_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="24dp"
android:text="@string/help_troubleshooting_debug_title"
app:layout_constraintTop_toBottomOf="@id/title"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/print_logs_in_logcat_switch"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/default_text_style"
android:id="@+id/print_logs_in_logcat_subtitle"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/help_troubleshooting_debug_subtitle"
android:textSize="14sp"
android:textColor="?attr/color_main2_600"
app:layout_constraintTop_toBottomOf="@id/print_logs_in_logcat_title"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/print_logs_in_logcat_switch" />
<com.google.android.material.materialswitch.MaterialSwitch
style="@style/material_switch_style"
android:onClick="@{() -> viewModel.togglePrintLogsInLogcat()}"
android:id="@+id/print_logs_in_logcat_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:checked="@{viewModel.printLogInLogcatEnabled, default=true}"
app:layout_constraintStart_toEndOf="@id/print_logs_in_logcat_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@id/print_logs_in_logcat_title"
app:layout_constraintBottom_toBottomOf="@id/print_logs_in_logcat_subtitle" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/tertiary_button_label_style"
android:onClick="@{() -> viewModel.cleanLogs()}"
android:id="@+id/clean_logs"
android:enabled="@{viewModel.printLogInLogcatEnabled}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="32dp"
android:layout_marginTop="20dp"
android:background="@drawable/tertiary_button_background"
android:paddingStart="12dp"
android:paddingEnd="12dp"
@ -109,18 +67,17 @@
android:maxLines="1"
android:ellipsize="end"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/print_logs_in_logcat_subtitle"/>
app:layout_constraintTop_toBottomOf="@id/title"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/tertiary_button_label_style"
android:onClick="@{() -> viewModel.shareLogs()}"
android:id="@+id/send_logs"
android:enabled="@{viewModel.printLogInLogcatEnabled}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:layout_marginTop="32dp"
android:layout_marginTop="20dp"
android:background="@drawable/tertiary_button_background"
android:paddingStart="12dp"
android:paddingEnd="12dp"
@ -132,7 +89,7 @@
android:ellipsize="end"
android:visibility="@{viewModel.uploadLogsAvailable ? View.VISIBLE : View.GONE}"
app:layout_constraintStart_toEndOf="@id/clean_logs"
app:layout_constraintTop_toBottomOf="@id/print_logs_in_logcat_subtitle"/>
app:layout_constraintTop_toBottomOf="@id/title"/>
<ImageView
android:id="@+id/app_version_icon"

View file

@ -62,13 +62,44 @@
android:id="@+id/keep_alive_service_switch"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="16dp"
android:checked="@{viewModel.keepAliveThirdPartyAccountsService}"
android:onClick="@{() -> viewModel.toggleKeepAliveThirdPartyAccountService()}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"
android:onClick="@{() -> viewModel.toggleEnableVideoFec()}"
android:id="@+id/enable_fec_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="10dp"
android:text="@string/settings_calls_enable_fec_title"
android:maxLines="2"
android:ellipsize="end"
android:visibility="@{viewModel.videoEnabled ? View.VISIBLE : View.GONE}"
app:layout_constraintTop_toTopOf="@id/enable_fec_switch"
app:layout_constraintBottom_toBottomOf="@id/enable_fec_switch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/enable_fec_switch"/>
<com.google.android.material.materialswitch.MaterialSwitch
style="@style/material_switch_style"
android:id="@+id/enable_fec_switch"
android:onClick="@{() -> viewModel.toggleEnableVideoFec()}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginEnd="16dp"
android:visibility="@{viewModel.videoEnabled ? View.VISIBLE : View.GONE}"
android:enabled="@{viewModel.videoEnabled}"
android:checked="@{viewModel.videoEnabled &amp;&amp; viewModel.videoFecEnabled}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/keep_alive_service_switch" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/header_style"
android:id="@+id/push_notifications_title"
@ -95,7 +126,7 @@
android:paddingBottom="8dp"
android:text="@string/settings_advanced_remote_provisioning_url"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/keep_alive_service_switch"/>
app:layout_constraintTop_toBottomOf="@id/enable_fec_switch"/>
<androidx.appcompat.widget.AppCompatEditText
style="@style/default_text_style"

View file

@ -86,35 +86,6 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/echo_canceller_switch" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"
android:onClick="@{() -> viewModel.toggleEnableVideoFec()}"
android:id="@+id/enable_fec_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="10dp"
android:text="@string/settings_calls_enable_fec_title"
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintTop_toTopOf="@id/enable_fec_switch"
app:layout_constraintBottom_toBottomOf="@id/enable_fec_switch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/enable_fec_switch"/>
<com.google.android.material.materialswitch.MaterialSwitch
style="@style/material_switch_style"
android:id="@+id/enable_fec_switch"
android:onClick="@{() -> viewModel.toggleEnableVideoFec()}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginEnd="16dp"
android:enabled="@{viewModel.videoEnabled}"
android:checked="@{viewModel.videoEnabled &amp;&amp; viewModel.videoFecEnabled}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/enable_video_switch" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"
android:onClick="@{() -> viewModel.toggleVibrateOnIncomingCalls()}"
@ -143,7 +114,7 @@
android:layout_marginEnd="16dp"
android:checked="@{viewModel.vibrateDuringIncomingCall}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/enable_fec_switch" />
app:layout_constraintTop_toBottomOf="@id/enable_video_switch" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"

View file

@ -200,8 +200,6 @@
<string name="help_dialog_update_available_title">Mise à jour disponible</string>
<string name="help_dialog_update_available_message">Une nouvelle version %s est disponible. Voulez-vous mettre à jour ?</string>
<string name="help_troubleshooting_title">Dépannage</string>
<string name="help_troubleshooting_debug_title">Activer/désactiver les messages dans ADB</string>
<string name="help_troubleshooting_debug_subtitle">Blah blah blah?</string> <!-- TODO -->
<string name="help_troubleshooting_clean_logs">Nettoyer les journaux</string>
<string name="help_troubleshooting_share_logs">Partager les journaux</string>
<string name="help_troubleshooting_app_version_title">Version de l\'application</string>
@ -312,8 +310,6 @@
<string name="manage_account_e2e_encrypted_mode_interoperable_summary">Ce mode vous permet de profiter de toutes les fonctionnalités de &appName; tout en restant interopérable avec nimporte quelle autre service SIP.</string>
<string name="manage_account_device_remove">Supprimer</string>
<string name="manage_account_device_last_connection">Dernière connexion :</string>
<string name="manage_account_dialog_e2e_encrypted_mode_default_message">Blah</string> <!-- TODO -->
<string name="manage_account_dialog_e2e_encrypted_mode_interoperable_message">Blah</string> <!-- TODO -->
<string name="manage_account_dialog_remove_account_title">Supprimer %s ?</string>
<string name="manage_account_dialog_remove_account_message">Vous pouvez vous reconnecter à tout moment en cliquant sur "Ajouter un compte".Cependant toutes les informations stockées sur ce périphérique seront supprimées.</string>
@ -598,7 +594,6 @@
<string name="call_dialog_zrtp_validate_trust_title">Valider l\'appareil</string>
<string name="call_dialog_zrtp_validate_trust_subtitle">Dites %s puis cliquez sur les lettres données par votre correspondant :</string>
<string name="call_dialog_zrtp_validate_trust_message">Blah</string> <!-- TODO FIXME -->
<string name="call_dialog_zrtp_validate_trust_letters_do_not_match">Je ne trouve pas</string>
<string name="call_audio_device_type_earpiece">Oreilette</string>

View file

@ -235,8 +235,6 @@
<string name="help_dialog_update_available_title">Update available</string>
<string name="help_dialog_update_available_message">A new version %s is available. Do you want to update?</string>
<string name="help_troubleshooting_title">Troubleshooting</string>
<string name="help_troubleshooting_debug_title">Enable/disable printing logs in ADB</string>
<string name="help_troubleshooting_debug_subtitle">Blah blah blah?</string> <!-- TODO -->
<string name="help_troubleshooting_clean_logs">Clean logs</string>
<string name="help_troubleshooting_share_logs">Share logs</string>
<string name="help_troubleshooting_app_version_title">App version</string>
@ -347,8 +345,6 @@
<string name="manage_account_e2e_encrypted_mode_interoperable_summary">This mode allows you to enjoy all &appName; features while staying interoperable with any SIP service through point-to-point encryption.</string>
<string name="manage_account_device_remove">Remove</string>
<string name="manage_account_device_last_connection">Last connection:</string>
<string name="manage_account_dialog_e2e_encrypted_mode_default_message">Blah</string> <!-- TODO -->
<string name="manage_account_dialog_e2e_encrypted_mode_interoperable_message">Blah</string> <!-- TODO -->
<string name="manage_account_dialog_remove_account_title">Delete %s?</string>
<string name="manage_account_dialog_remove_account_message">You can reconnect at any time by clicking “Add an account”. However, all data on this phone will be deleted.</string>
@ -634,7 +630,6 @@
<string name="call_dialog_zrtp_validate_trust_title">Validate the device</string>
<string name="call_dialog_zrtp_validate_trust_subtitle">Say %s and click on the letters given by your correspondent:</string>
<string name="call_dialog_zrtp_validate_trust_message">Blah</string> <!-- TODO FIXME -->
<string name="call_dialog_zrtp_validate_trust_letters_do_not_match">Letters don\'t match!</string>
<string name="call_audio_device_type_earpiece">Earpiece</string>