mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Reworked dialog confirmation model
This commit is contained in:
parent
3a3518b2a5
commit
4b0fcd38d7
45 changed files with 90 additions and 336 deletions
|
|
@ -44,8 +44,9 @@ import org.linphone.core.tools.Log
|
|||
import org.linphone.databinding.AssistantRegisterFragmentBinding
|
||||
import org.linphone.ui.GenericActivity
|
||||
import org.linphone.ui.GenericFragment
|
||||
import org.linphone.ui.assistant.model.ConfirmPhoneNumberDialogModel
|
||||
import org.linphone.ui.assistant.viewmodel.AccountCreationViewModel
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.utils.AppUtils
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.PhoneNumberUtils
|
||||
|
||||
|
|
@ -210,7 +211,8 @@ class RegisterFragment : GenericFragment() {
|
|||
}
|
||||
|
||||
private fun showPhoneNumberConfirmationDialog(number: String) {
|
||||
val model = ConfirmPhoneNumberDialogModel(number)
|
||||
val label = AppUtils.getFormattedString(R.string.assistant_dialog_confirm_phone_number_message, number)
|
||||
val model = ConfirmationDialogModel(label)
|
||||
val dialog = DialogUtils.getAccountCreationPhoneNumberConfirmationDialog(
|
||||
requireActivity(),
|
||||
model
|
||||
|
|
@ -222,7 +224,7 @@ class RegisterFragment : GenericFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
model.confirmPhoneNumberEvent.observe(viewLifecycleOwner) {
|
||||
model.confirmEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
viewModel.startAccountCreation()
|
||||
dialog.dismiss()
|
||||
|
|
|
|||
|
|
@ -1,50 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-android
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.linphone.ui.assistant.model
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.utils.AppUtils
|
||||
import org.linphone.utils.Event
|
||||
import org.linphone.R
|
||||
|
||||
class ConfirmPhoneNumberDialogModel
|
||||
@UiThread
|
||||
constructor(phoneNumber: String) {
|
||||
val message = MutableLiveData<String>()
|
||||
|
||||
val dismissEvent = MutableLiveData<Event<Boolean>>()
|
||||
|
||||
val confirmPhoneNumberEvent = MutableLiveData<Event<Boolean>>()
|
||||
|
||||
init {
|
||||
message.value = AppUtils.getFormattedString(R.string.assistant_dialog_confirm_phone_number_message, phoneNumber)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun dismiss() {
|
||||
dismissEvent.value = Event(true)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun confirmPhoneNumber() {
|
||||
confirmPhoneNumberEvent.value = Event(true)
|
||||
}
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ import org.linphone.ui.GenericActivity
|
|||
import org.linphone.ui.call.adapter.ConferenceParticipantsListAdapter
|
||||
import org.linphone.ui.call.fragment.GenericCallFragment
|
||||
import org.linphone.ui.call.viewmodel.CurrentCallViewModel
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.utils.DialogUtils
|
||||
|
||||
class ConferenceParticipantsListFragment : GenericCallFragment() {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ import org.linphone.core.tools.Log
|
|||
import org.linphone.databinding.CallsListFragmentBinding
|
||||
import org.linphone.ui.call.adapter.CallsListAdapter
|
||||
import org.linphone.ui.call.viewmodel.CallsViewModel
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.utils.DialogUtils
|
||||
|
||||
class CallsListFragment : GenericCallFragment() {
|
||||
|
|
|
|||
|
|
@ -38,14 +38,15 @@ import org.linphone.core.tools.Log
|
|||
import org.linphone.databinding.CallTransferFragmentBinding
|
||||
import org.linphone.ui.call.adapter.CallsListAdapter
|
||||
import org.linphone.ui.call.model.CallModel
|
||||
import org.linphone.ui.call.model.ConfirmCallTransferDialogModel
|
||||
import org.linphone.ui.call.viewmodel.CallsViewModel
|
||||
import org.linphone.ui.call.viewmodel.CurrentCallViewModel
|
||||
import org.linphone.ui.main.adapter.ConversationsContactsAndSuggestionsListAdapter
|
||||
import org.linphone.ui.main.contacts.model.ContactNumberOrAddressClickListener
|
||||
import org.linphone.ui.main.contacts.model.ContactNumberOrAddressModel
|
||||
import org.linphone.ui.main.history.viewmodel.StartCallViewModel
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.ui.main.model.ConversationContactOrSuggestionModel
|
||||
import org.linphone.utils.AppUtils
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.RecyclerViewHeaderDecoration
|
||||
import org.linphone.utils.hideKeyboard
|
||||
|
|
@ -256,10 +257,12 @@ class TransferCallFragment : GenericCallFragment() {
|
|||
}
|
||||
|
||||
private fun showConfirmAttendedTransferDialog(callModel: CallModel) {
|
||||
val model = ConfirmCallTransferDialogModel(
|
||||
val label = AppUtils.getFormattedString(
|
||||
org.linphone.R.string.call_transfer_confirm_dialog_message,
|
||||
callViewModel.displayedName.value.orEmpty(),
|
||||
callModel.displayName.value.orEmpty()
|
||||
)
|
||||
val model = ConfirmationDialogModel(label)
|
||||
val dialog = DialogUtils.getConfirmCallTransferCallDialog(
|
||||
requireActivity(),
|
||||
model
|
||||
|
|
@ -290,10 +293,12 @@ class TransferCallFragment : GenericCallFragment() {
|
|||
}
|
||||
|
||||
private fun showConfirmBlindTransferDialog(contactModel: ConversationContactOrSuggestionModel) {
|
||||
val model = ConfirmCallTransferDialogModel(
|
||||
val label = AppUtils.getFormattedString(
|
||||
org.linphone.R.string.call_transfer_confirm_dialog_message,
|
||||
callViewModel.displayedName.value.orEmpty(),
|
||||
contactModel.name
|
||||
)
|
||||
val model = ConfirmationDialogModel(label)
|
||||
val dialog = DialogUtils.getConfirmCallTransferCallDialog(
|
||||
requireActivity(),
|
||||
model
|
||||
|
|
|
|||
|
|
@ -1,56 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2024 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-android
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.linphone.ui.call.model
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.utils.AppUtils
|
||||
import org.linphone.utils.Event
|
||||
|
||||
class ConfirmCallTransferDialogModel
|
||||
@UiThread
|
||||
constructor(
|
||||
toTransfer: String,
|
||||
toReceiveTransfer: String
|
||||
) {
|
||||
val cancelEvent = MutableLiveData<Event<Boolean>>()
|
||||
|
||||
val confirmEvent = MutableLiveData<Event<Boolean>>()
|
||||
|
||||
val message = MutableLiveData<String>()
|
||||
|
||||
init {
|
||||
message.value = AppUtils.getFormattedString(
|
||||
org.linphone.R.string.call_transfer_confirm_dialog_message,
|
||||
toTransfer,
|
||||
toReceiveTransfer
|
||||
)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun cancel() {
|
||||
cancelEvent.value = Event(true)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun confirm() {
|
||||
confirmEvent.value = Event(true)
|
||||
}
|
||||
}
|
||||
|
|
@ -64,11 +64,12 @@ import org.linphone.ui.GenericActivity
|
|||
import org.linphone.ui.assistant.AssistantActivity
|
||||
import org.linphone.ui.main.chat.fragment.ConversationsListFragmentDirections
|
||||
import org.linphone.ui.main.help.fragment.DebugFragmentDirections
|
||||
import org.linphone.ui.main.model.AuthRequestedDialogModel
|
||||
import org.linphone.utils.PasswordDialogModel
|
||||
import org.linphone.ui.main.sso.fragment.SingleSignOnFragmentDirections
|
||||
import org.linphone.ui.main.viewmodel.MainViewModel
|
||||
import org.linphone.ui.main.viewmodel.SharedMainViewModel
|
||||
import org.linphone.ui.welcome.WelcomeActivity
|
||||
import org.linphone.utils.AppUtils
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.Event
|
||||
import org.linphone.utils.FileUtils
|
||||
|
|
@ -752,7 +753,11 @@ class MainActivity : GenericActivity() {
|
|||
private fun showAuthenticationRequestedDialog(identity: String) {
|
||||
currentlyDisplayedAuthDialog?.dismiss()
|
||||
|
||||
val model = AuthRequestedDialogModel(identity)
|
||||
val label = AppUtils.getFormattedString(
|
||||
R.string.account_settings_dialog_invalid_password_message,
|
||||
identity
|
||||
)
|
||||
val model = PasswordDialogModel(label)
|
||||
val dialog = DialogUtils.getAuthRequestedDialog(this, model)
|
||||
|
||||
model.dismissEvent.observe(this) {
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ import org.linphone.ui.main.chat.viewmodel.ChatMessageLongPressViewModel
|
|||
import org.linphone.ui.main.chat.viewmodel.ConversationViewModel
|
||||
import org.linphone.ui.main.chat.viewmodel.SendMessageInConversationViewModel
|
||||
import org.linphone.ui.main.fragment.SlidingPaneChildFragment
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.Event
|
||||
import org.linphone.utils.FileUtils
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import org.linphone.ui.main.chat.adapter.ConversationParticipantsAdapter
|
|||
import org.linphone.ui.main.chat.model.ParticipantModel
|
||||
import org.linphone.ui.main.chat.viewmodel.ConversationInfoViewModel
|
||||
import org.linphone.ui.main.fragment.SlidingPaneChildFragment
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.ui.main.model.GroupSetOrEditSubjectDialogModel
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.Event
|
||||
|
|
|
|||
|
|
@ -46,10 +46,10 @@ import org.linphone.databinding.ContactFragmentBinding
|
|||
import org.linphone.ui.GenericActivity
|
||||
import org.linphone.ui.main.contacts.model.ContactTrustDialogModel
|
||||
import org.linphone.ui.main.contacts.model.NumberOrAddressPickerDialogModel
|
||||
import org.linphone.ui.main.contacts.model.TrustCallDialogModel
|
||||
import org.linphone.ui.main.contacts.viewmodel.ContactViewModel
|
||||
import org.linphone.ui.main.fragment.SlidingPaneChildFragment
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.utils.AppUtils
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.Event
|
||||
|
||||
|
|
@ -318,7 +318,12 @@ class ContactFragment : SlidingPaneChildFragment() {
|
|||
}
|
||||
|
||||
private fun showConfirmTrustCallDialog(contactName: String, deviceSipUri: String) {
|
||||
val model = TrustCallDialogModel(contactName, deviceSipUri)
|
||||
val label = AppUtils.getFormattedString(
|
||||
org.linphone.R.string.contact_dialog_increase_trust_level_message,
|
||||
contactName,
|
||||
deviceSipUri
|
||||
)
|
||||
val model = ConfirmationDialogModel(label)
|
||||
val dialog = DialogUtils.getContactTrustCallConfirmationDialog(requireActivity(), model)
|
||||
|
||||
model.dismissEvent.observe(viewLifecycleOwner) {
|
||||
|
|
@ -327,7 +332,7 @@ class ContactFragment : SlidingPaneChildFragment() {
|
|||
}
|
||||
}
|
||||
|
||||
model.confirmCallEvent.observe(viewLifecycleOwner) {
|
||||
model.confirmEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
coreContext.postOnCoreThread {
|
||||
if (model.doNotShowAnymore.value == true) {
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ import org.linphone.ui.main.contacts.adapter.ContactsListAdapter
|
|||
import org.linphone.ui.main.contacts.model.ContactAvatarModel
|
||||
import org.linphone.ui.main.contacts.viewmodel.ContactsListViewModel
|
||||
import org.linphone.ui.main.fragment.AbstractMainFragment
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.Event
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import org.linphone.ui.main.MainActivity
|
|||
import org.linphone.ui.main.contacts.model.NewOrEditNumberOrAddressModel
|
||||
import org.linphone.ui.main.contacts.viewmodel.ContactNewOrEditViewModel
|
||||
import org.linphone.ui.main.fragment.SlidingPaneChildFragment
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.FileUtils
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import org.linphone.ui.main.MainActivity
|
|||
import org.linphone.ui.main.contacts.model.NewOrEditNumberOrAddressModel
|
||||
import org.linphone.ui.main.contacts.viewmodel.ContactNewOrEditViewModel
|
||||
import org.linphone.ui.main.fragment.GenericMainFragment
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.Event
|
||||
import org.linphone.utils.FileUtils
|
||||
|
|
|
|||
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-android
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.linphone.ui.main.contacts.model
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.utils.AppUtils
|
||||
import org.linphone.utils.Event
|
||||
|
||||
class TrustCallDialogModel
|
||||
@UiThread
|
||||
constructor(contact: String, device: String) {
|
||||
val message = MutableLiveData<String>()
|
||||
|
||||
val doNotShowAnymore = MutableLiveData<Boolean>()
|
||||
|
||||
val dismissEvent = MutableLiveData<Event<Boolean>>()
|
||||
|
||||
val confirmCallEvent = MutableLiveData<Event<Boolean>>()
|
||||
|
||||
init {
|
||||
message.value = AppUtils.getFormattedString(
|
||||
org.linphone.R.string.contact_dialog_increase_trust_level_message,
|
||||
contact,
|
||||
device
|
||||
)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun dismiss() {
|
||||
dismissEvent.value = Event(true)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun confirmCall() {
|
||||
confirmCallEvent.value = Event(true)
|
||||
}
|
||||
}
|
||||
|
|
@ -34,7 +34,7 @@ import org.linphone.databinding.HelpFragmentBinding
|
|||
import org.linphone.ui.GenericActivity
|
||||
import org.linphone.ui.main.fragment.GenericMainFragment
|
||||
import org.linphone.ui.main.help.viewmodel.HelpViewModel
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.utils.DialogUtils
|
||||
|
||||
@UiThread
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ import org.linphone.databinding.HistoryPopupMenuBinding
|
|||
import org.linphone.ui.GenericActivity
|
||||
import org.linphone.ui.main.fragment.SlidingPaneChildFragment
|
||||
import org.linphone.ui.main.history.adapter.ContactHistoryListAdapter
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.ui.main.history.viewmodel.HistoryViewModel
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.Event
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ import org.linphone.databinding.HistoryListPopupMenuBinding
|
|||
import org.linphone.ui.GenericActivity
|
||||
import org.linphone.ui.main.fragment.AbstractMainFragment
|
||||
import org.linphone.ui.main.history.adapter.HistoryListAdapter
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.ui.main.history.viewmodel.HistoryListViewModel
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.Event
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ import org.linphone.databinding.MeetingFragmentBinding
|
|||
import org.linphone.databinding.MeetingPopupMenuBinding
|
||||
import org.linphone.ui.GenericActivity
|
||||
import org.linphone.ui.main.fragment.SlidingPaneChildFragment
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.ui.main.meetings.adapter.MeetingParticipantsAdapter
|
||||
import org.linphone.ui.main.meetings.viewmodel.MeetingViewModel
|
||||
import org.linphone.utils.DialogUtils
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import org.linphone.core.tools.Log
|
|||
import org.linphone.databinding.MeetingsListFragmentBinding
|
||||
import org.linphone.ui.GenericActivity
|
||||
import org.linphone.ui.main.fragment.AbstractMainFragment
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.ui.main.meetings.adapter.MeetingsListAdapter
|
||||
import org.linphone.ui.main.meetings.model.MeetingModel
|
||||
import org.linphone.ui.main.meetings.viewmodel.MeetingsListViewModel
|
||||
|
|
|
|||
|
|
@ -1,63 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-android
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.linphone.ui.main.model
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.R
|
||||
import org.linphone.utils.AppUtils
|
||||
import org.linphone.utils.Event
|
||||
|
||||
class AuthRequestedDialogModel
|
||||
@UiThread
|
||||
constructor(identity: String) {
|
||||
val message = MutableLiveData<String>()
|
||||
|
||||
val password = MutableLiveData<String>()
|
||||
|
||||
val showPassword = MutableLiveData<Boolean>()
|
||||
|
||||
val dismissEvent = MutableLiveData<Event<Boolean>>()
|
||||
|
||||
val confirmEvent = MutableLiveData<Event<String>>()
|
||||
|
||||
init {
|
||||
showPassword.value = false
|
||||
message.value = AppUtils.getFormattedString(
|
||||
R.string.account_settings_dialog_invalid_password_message,
|
||||
identity
|
||||
)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun toggleShowPassword() {
|
||||
showPassword.value = showPassword.value == false
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun dismiss() {
|
||||
dismissEvent.value = Event(true)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun confirm() {
|
||||
confirmEvent.value = Event(password.value.orEmpty())
|
||||
}
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ import org.linphone.core.tools.Log
|
|||
import org.linphone.databinding.AccountProfileFragmentBinding
|
||||
import org.linphone.ui.GenericActivity
|
||||
import org.linphone.ui.main.fragment.GenericMainFragment
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.ui.main.settings.viewmodel.AccountProfileViewModel
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.Event
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import org.linphone.core.tools.Log
|
|||
import org.linphone.databinding.AccountSettingsFragmentBinding
|
||||
import org.linphone.ui.GenericActivity
|
||||
import org.linphone.ui.main.fragment.GenericMainFragment
|
||||
import org.linphone.ui.main.settings.model.UpdatePasswordDialogModel
|
||||
import org.linphone.utils.PasswordDialogModel
|
||||
import org.linphone.ui.main.settings.viewmodel.AccountSettingsViewModel
|
||||
import org.linphone.utils.DialogUtils
|
||||
import org.linphone.utils.Event
|
||||
|
|
@ -153,7 +153,7 @@ class AccountSettingsFragment : GenericMainFragment() {
|
|||
}
|
||||
|
||||
private fun showUpdatePasswordDialog() {
|
||||
val model = UpdatePasswordDialogModel()
|
||||
val model = PasswordDialogModel()
|
||||
val dialog = DialogUtils.getUpdatePasswordDialog(requireContext(), model)
|
||||
|
||||
model.dismissEvent.observe(viewLifecycleOwner) {
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ import org.linphone.compatibility.Compatibility
|
|||
import org.linphone.core.tools.Log
|
||||
import org.linphone.databinding.SettingsFragmentBinding
|
||||
import org.linphone.ui.main.fragment.GenericMainFragment
|
||||
import org.linphone.ui.main.settings.model.ConfirmVfsDialogModel
|
||||
import org.linphone.utils.ConfirmationDialogModel
|
||||
import org.linphone.ui.main.settings.viewmodel.SettingsViewModel
|
||||
import org.linphone.utils.DialogUtils
|
||||
|
||||
|
|
@ -288,7 +288,7 @@ class SettingsFragment : GenericMainFragment() {
|
|||
}
|
||||
|
||||
private fun showConfirmVfsDialog() {
|
||||
val model = ConfirmVfsDialogModel()
|
||||
val model = ConfirmationDialogModel()
|
||||
val dialog = DialogUtils.getConfirmTurningOnVfsDialog(
|
||||
requireActivity(),
|
||||
model
|
||||
|
|
|
|||
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2025 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-android
|
||||
* (see https://www.linphone.org).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.linphone.ui.main.settings.model
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.utils.Event
|
||||
|
||||
class ConfirmVfsDialogModel
|
||||
@UiThread
|
||||
constructor() {
|
||||
val cancelEvent = MutableLiveData<Event<Boolean>>()
|
||||
|
||||
val confirmEvent = MutableLiveData<Event<Boolean>>()
|
||||
|
||||
@UiThread
|
||||
fun cancel() {
|
||||
cancelEvent.value = Event(true)
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun confirm() {
|
||||
confirmEvent.value = Event(true)
|
||||
}
|
||||
}
|
||||
|
|
@ -17,21 +17,28 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.linphone.ui.main.history.model
|
||||
package org.linphone.utils
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.utils.Event
|
||||
|
||||
class ConfirmationDialogModel
|
||||
@UiThread
|
||||
constructor() {
|
||||
constructor(text: String = "") {
|
||||
val message = MutableLiveData<String>()
|
||||
|
||||
val doNotShowAnymore = MutableLiveData<Boolean>()
|
||||
|
||||
val dismissEvent = MutableLiveData<Event<Boolean>>()
|
||||
|
||||
val cancelEvent = MutableLiveData<Event<Boolean>>()
|
||||
|
||||
val confirmEvent = MutableLiveData<Event<Boolean>>()
|
||||
|
||||
init {
|
||||
message.value = text
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun dismiss() {
|
||||
dismissEvent.value = Event(true)
|
||||
|
|
@ -60,18 +60,11 @@ import org.linphone.databinding.DialogUpdateAvailableBinding
|
|||
import org.linphone.databinding.DialogZrtpSasValidationBinding
|
||||
import org.linphone.databinding.DialogZrtpSecurityAlertBinding
|
||||
import org.linphone.ui.assistant.model.AcceptConditionsAndPolicyDialogModel
|
||||
import org.linphone.ui.assistant.model.ConfirmPhoneNumberDialogModel
|
||||
import org.linphone.ui.call.model.ConfirmCallTransferDialogModel
|
||||
import org.linphone.ui.call.model.ZrtpAlertDialogModel
|
||||
import org.linphone.ui.call.model.ZrtpSasConfirmationDialogModel
|
||||
import org.linphone.ui.main.contacts.model.ContactTrustDialogModel
|
||||
import org.linphone.ui.main.contacts.model.NumberOrAddressPickerDialogModel
|
||||
import org.linphone.ui.main.contacts.model.TrustCallDialogModel
|
||||
import org.linphone.ui.main.history.model.ConfirmationDialogModel
|
||||
import org.linphone.ui.main.model.AuthRequestedDialogModel
|
||||
import org.linphone.ui.main.model.GroupSetOrEditSubjectDialogModel
|
||||
import org.linphone.ui.main.settings.model.ConfirmVfsDialogModel
|
||||
import org.linphone.ui.main.settings.model.UpdatePasswordDialogModel
|
||||
|
||||
class DialogUtils {
|
||||
companion object {
|
||||
|
|
@ -95,7 +88,7 @@ class DialogUtils {
|
|||
@UiThread
|
||||
fun getAccountCreationPhoneNumberConfirmationDialog(
|
||||
context: Context,
|
||||
viewModel: ConfirmPhoneNumberDialogModel
|
||||
viewModel: ConfirmationDialogModel
|
||||
): Dialog {
|
||||
val binding: DialogAssistantCreateAccountConfirmPhoneNumberBinding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(context),
|
||||
|
|
@ -146,7 +139,7 @@ class DialogUtils {
|
|||
@UiThread
|
||||
fun getConfirmTurningOnVfsDialog(
|
||||
context: Context,
|
||||
viewModel: ConfirmVfsDialogModel
|
||||
viewModel: ConfirmationDialogModel
|
||||
): Dialog {
|
||||
val binding: DialogConfirmTurningOnVfsBinding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(context),
|
||||
|
|
@ -178,7 +171,7 @@ class DialogUtils {
|
|||
@UiThread
|
||||
fun getContactTrustCallConfirmationDialog(
|
||||
context: Context,
|
||||
viewModel: TrustCallDialogModel
|
||||
viewModel: ConfirmationDialogModel
|
||||
): Dialog {
|
||||
val binding: DialogContactConfirmTrustCallBinding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(context),
|
||||
|
|
@ -371,7 +364,7 @@ class DialogUtils {
|
|||
@UiThread
|
||||
fun getAuthRequestedDialog(
|
||||
context: Context,
|
||||
viewModel: AuthRequestedDialogModel
|
||||
viewModel: PasswordDialogModel
|
||||
): Dialog {
|
||||
val binding: DialogUpdateAccountPasswordAfterRegisterFailureBinding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(context),
|
||||
|
|
@ -388,7 +381,7 @@ class DialogUtils {
|
|||
@UiThread
|
||||
fun getUpdatePasswordDialog(
|
||||
context: Context,
|
||||
viewModel: UpdatePasswordDialogModel
|
||||
viewModel: PasswordDialogModel
|
||||
): Dialog {
|
||||
val binding: DialogUpdateAccountPasswordBinding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(context),
|
||||
|
|
@ -453,7 +446,7 @@ class DialogUtils {
|
|||
@UiThread
|
||||
fun getConfirmCallTransferCallDialog(
|
||||
context: Context,
|
||||
viewModel: ConfirmCallTransferDialogModel
|
||||
viewModel: ConfirmationDialogModel
|
||||
): Dialog {
|
||||
val binding: DialogCallConfirmTransferBinding = DataBindingUtil.inflate(
|
||||
LayoutInflater.from(context),
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2010-2024 Belledonne Communications SARL.
|
||||
* Copyright (c) 2010-2023 Belledonne Communications SARL.
|
||||
*
|
||||
* This file is part of linphone-android
|
||||
* (see https://www.linphone.org).
|
||||
|
|
@ -17,14 +17,16 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.linphone.ui.main.settings.model
|
||||
package org.linphone.utils
|
||||
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import org.linphone.utils.Event
|
||||
|
||||
@UiThread
|
||||
class UpdatePasswordDialogModel {
|
||||
class PasswordDialogModel
|
||||
@UiThread
|
||||
constructor(text: String = "") {
|
||||
val message = MutableLiveData<String>()
|
||||
|
||||
val password = MutableLiveData<String>()
|
||||
|
||||
val showPassword = MutableLiveData<Boolean>()
|
||||
|
|
@ -35,6 +37,7 @@ class UpdatePasswordDialogModel {
|
|||
|
||||
init {
|
||||
showPassword.value = false
|
||||
message.value = text
|
||||
}
|
||||
|
||||
@UiThread
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.assistant.model.ConfirmPhoneNumberDialogModel" />
|
||||
type="org.linphone.utils.ConfirmationDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
app:layout_constraintBottom_toTopOf="@id/confirm"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> viewModel.confirmPhoneNumber()}"
|
||||
android:onClick="@{() -> viewModel.confirm()}"
|
||||
style="@style/primary_button_label_style"
|
||||
android:id="@+id/confirm"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.call.model.ConfirmCallTransferDialogModel" />
|
||||
type="org.linphone.utils.ConfirmationDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.history.model.ConfirmationDialogModel" />
|
||||
type="org.linphone.utils.ConfirmationDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.history.model.ConfirmationDialogModel" />
|
||||
type="org.linphone.utils.ConfirmationDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.settings.model.ConfirmVfsDialogModel" />
|
||||
type="org.linphone.utils.ConfirmationDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.contacts.model.TrustCallDialogModel" />
|
||||
type="org.linphone.utils.ConfirmationDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
app:layout_constraintBottom_toTopOf="@id/confirm"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> viewModel.confirmCall()}"
|
||||
android:onClick="@{() -> viewModel.confirm()}"
|
||||
style="@style/primary_button_label_style"
|
||||
android:id="@+id/confirm"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.history.model.ConfirmationDialogModel" />
|
||||
type="org.linphone.utils.ConfirmationDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.history.model.ConfirmationDialogModel" />
|
||||
type="org.linphone.utils.ConfirmationDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.history.model.ConfirmationDialogModel" />
|
||||
type="org.linphone.utils.ConfirmationDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.history.model.ConfirmationDialogModel" />
|
||||
type="org.linphone.utils.ConfirmationDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.history.model.ConfirmationDialogModel" />
|
||||
type="org.linphone.utils.ConfirmationDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.history.model.ConfirmationDialogModel" />
|
||||
type="org.linphone.utils.ConfirmationDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.history.model.ConfirmationDialogModel" />
|
||||
type="org.linphone.utils.ConfirmationDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.history.model.ConfirmationDialogModel" />
|
||||
type="org.linphone.utils.ConfirmationDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.history.model.ConfirmationDialogModel" />
|
||||
type="org.linphone.utils.ConfirmationDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<import type="android.text.InputType" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.settings.model.UpdatePasswordDialogModel" />
|
||||
type="org.linphone.utils.PasswordDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<import type="android.text.InputType" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.model.AuthRequestedDialogModel" />
|
||||
type="org.linphone.utils.PasswordDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.history.model.ConfirmationDialogModel" />
|
||||
type="org.linphone.utils.ConfirmationDialogModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue