mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Improved account profile if push notifications aren't available on the device (or not configured in app)
This commit is contained in:
parent
74ad52e0f5
commit
8e2fc8b6cd
4 changed files with 13 additions and 4 deletions
|
|
@ -50,6 +50,8 @@ class AccountProfileViewModel @UiThread constructor() : ViewModel() {
|
|||
|
||||
val selectedDialPlan = MutableLiveData<Int>()
|
||||
|
||||
val pushNotificationsAvailable = MutableLiveData<Boolean>()
|
||||
|
||||
val pushNotificationsEnabled = MutableLiveData<Boolean>()
|
||||
|
||||
val registerEnabled = MutableLiveData<Boolean>()
|
||||
|
|
@ -78,7 +80,8 @@ class AccountProfileViewModel @UiThread constructor() : ViewModel() {
|
|||
expandDetails.value = true
|
||||
expandDevices.value = false // TODO: set to true when feature will be available
|
||||
|
||||
coreContext.postOnCoreThread {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
pushNotificationsAvailable.postValue(core.isPushNotificationAvailable)
|
||||
hideAccountSettings.postValue(corePreferences.hideAccountSettings)
|
||||
dialPlansLabelList.add("") // To allow removing selected dial plan
|
||||
|
||||
|
|
@ -113,7 +116,9 @@ class AccountProfileViewModel @UiThread constructor() : ViewModel() {
|
|||
accountModel.postValue(AccountModel(account))
|
||||
isCurrentlySelectedModeSecure.postValue(account.isEndToEndEncryptionMandatory())
|
||||
registerEnabled.postValue(account.params.isRegisterEnabled)
|
||||
pushNotificationsEnabled.postValue(account.params.pushNotificationAllowed)
|
||||
pushNotificationsEnabled.postValue(
|
||||
core.isPushNotificationAvailable && account.params.pushNotificationAllowed
|
||||
)
|
||||
|
||||
sipAddress.postValue(account.params.identityAddress?.asStringUriOnly())
|
||||
displayName.postValue(account.params.identityAddress?.displayName)
|
||||
|
|
|
|||
|
|
@ -321,6 +321,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:enabled="@{viewModel.pushNotificationsAvailable}"
|
||||
android:checked="@={viewModel.pushNotificationsEnabled}"
|
||||
app:layout_constraintEnd_toEndOf="@id/details_background"
|
||||
app:layout_constraintTop_toBottomOf="@id/prefix"/>
|
||||
|
|
@ -330,12 +331,13 @@
|
|||
android:id="@+id/push_notifications_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="@string/account_settings_push_notification_title"
|
||||
android:text="@{viewModel.pushNotificationsAvailable ? @string/account_settings_push_notification_title : @string/account_settings_push_notification_not_available_title, default=@string/account_settings_push_notification_title}"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
app:layout_constraintTop_toTopOf="@id/push_notifications_switch"
|
||||
app:layout_constraintTop_toBottomOf="@id/prefix"
|
||||
app:layout_constraintBottom_toBottomOf="@id/push_notifications_switch"
|
||||
app:layout_constraintStart_toStartOf="@id/details_background"
|
||||
app:layout_constraintEnd_toStartOf="@id/push_notifications_switch"/>
|
||||
|
|
|
|||
|
|
@ -297,6 +297,7 @@
|
|||
|
||||
<string name="account_settings_title">Paramètres de compte</string>
|
||||
<string name="account_settings_push_notification_title">Autoriser les notifications poussées</string>
|
||||
<string name="account_settings_push_notification_not_available_title">Les notifications poussées ne sont pas disponibles !</string>
|
||||
<string name="account_settings_sip_proxy_url_title">URL du serveur mandataire</string>
|
||||
<string name="account_settings_outbound_proxy_title">Serveur mandataire sortant</string>
|
||||
<string name="account_settings_stun_server_url_title">URL du serveur STUN</string>
|
||||
|
|
|
|||
|
|
@ -332,6 +332,7 @@
|
|||
|
||||
<string name="account_settings_title">Account settings</string>
|
||||
<string name="account_settings_push_notification_title">Allow push notifications</string>
|
||||
<string name="account_settings_push_notification_not_available_title">Push notifications aren\'t available!</string>
|
||||
<string name="account_settings_sip_proxy_url_title">SIP proxy server URL</string>
|
||||
<string name="account_settings_outbound_proxy_title">Outbound proxy</string>
|
||||
<string name="account_settings_stun_server_url_title">STUN server URL</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue