Commit b2b55305 authored by Sylvain Berfini's avatar Sylvain Berfini :cow:
Browse files

Forgot to change the label of sign out button in the confirmation dialog +...

Forgot to change the label of sign out button in the confirmation dialog + hide delete account message for third party accounts
Showing with 13 additions and 7 deletions
......@@ -164,7 +164,8 @@ class AccountProfileFragment : GenericMainFragment() {
val model = ConfirmationDialogModel()
val dialog = DialogUtils.getConfirmAccountRemovalDialog(
requireActivity(),
model
model,
viewModel.isOnDefaultDomain.value == true
)
model.dismissEvent.observe(viewLifecycleOwner) {
......
......@@ -70,7 +70,7 @@ class AccountProfileViewModel @UiThread constructor() : GenericViewModel() {
val expandDevices = MutableLiveData<Boolean>()
val devicesAvailable = MutableLiveData<Boolean>()
val isOnDefaultDomain = MutableLiveData<Boolean>()
val devicesFetchInProgress = MutableLiveData<Boolean>()
......@@ -156,6 +156,7 @@ class AccountProfileViewModel @UiThread constructor() : GenericViewModel() {
expandDevices.value = false
showDeviceId.value = false
devicesFetchInProgress.value = true
isOnDefaultDomain.value = false
coreContext.postOnCoreThread {
hideAccountSettings.postValue(corePreferences.hideAccountSettings)
......@@ -195,12 +196,13 @@ class AccountProfileViewModel @UiThread constructor() : GenericViewModel() {
sipAddress.postValue(account.params.identityAddress?.asStringUriOnly())
displayName.postValue(account.params.identityAddress?.displayName)
showDeviceId.postValue(false)
val identityAddress = account.params.identityAddress
if (identityAddress != null) {
val domain = identityAddress.domain
val defaultDomain = corePreferences.defaultDomain
devicesAvailable.postValue(domain == defaultDomain)
isOnDefaultDomain.postValue(domain == defaultDomain)
if (domain == defaultDomain) {
Log.i(
"$TAG Request list of known devices for account [${identityAddress.asStringUriOnly()}]"
......
......@@ -25,6 +25,7 @@ import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable
import android.text.method.LinkMovementMethod
import android.view.LayoutInflater
import android.view.View
import android.view.Window
import android.view.WindowManager
import androidx.annotation.UiThread
......@@ -122,7 +123,8 @@ class DialogUtils {
@UiThread
fun getConfirmAccountRemovalDialog(
context: Context,
viewModel: ConfirmationDialogModel
viewModel: ConfirmationDialogModel,
showDeleteAccountLink: Boolean
): Dialog {
val binding: DialogRemoveAccountBinding = DataBindingUtil.inflate(
LayoutInflater.from(context),
......@@ -131,6 +133,7 @@ class DialogUtils {
false
)
binding.viewModel = viewModel
binding.message.visibility = if (showDeleteAccountLink) View.VISIBLE else View.GONE
return getDialog(context, binding)
}
......
......@@ -428,7 +428,7 @@
android:layout_marginEnd="26dp"
android:layout_marginTop="32dp"
android:text="@string/manage_account_devices_title"
android:visibility="@{viewModel.devicesAvailable ? View.VISIBLE : View.GONE, default=gone}"
android:visibility="@{viewModel.isOnDefaultDomain ? View.VISIBLE : View.GONE, default=gone}"
android:drawableEnd="@{viewModel.expandDevices ? @drawable/caret_up : @drawable/caret_down, default=@drawable/caret_up}"
android:drawableTint="@color/gray_main2_600"
app:layout_constraintStart_toStartOf="parent"
......@@ -449,7 +449,7 @@
android:paddingEnd="16dp"
android:paddingBottom="20dp"
android:background="@drawable/shape_squircle_white_background"
android:visibility="@{viewModel.devicesAvailable &amp;&amp; viewModel.expandDevices ? View.VISIBLE : View.GONE, default=gone}"
android:visibility="@{viewModel.isOnDefaultDomain &amp;&amp; viewModel.expandDevices ? View.VISIBLE : View.GONE, default=gone}"
app:entries="@{viewModel.devices}"
app:layout="@{@layout/account_profile_device_list_cell}"
app:layout_constraintHeight_min="80dp"
......
......@@ -85,7 +85,7 @@
android:layout_marginTop="16dp"
android:layout_marginStart="15dp"
android:layout_marginEnd="15dp"
android:text="@string/dialog_delete"
android:text="@string/manage_account_delete"
app:layout_constraintStart_toStartOf="@id/dialog_background"
app:layout_constraintEnd_toEndOf="@id/dialog_background"
app:layout_constraintTop_toBottomOf="@id/cancel"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment