From ee5af2b46207927628ae550d4226f525f5735950 Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Wed, 8 Jun 2022 16:08:09 +0200 Subject: [PATCH] Added display name fields in assistant for linphone account creation / log in --- CHANGELOG.md | 2 ++ .../viewmodels/AccountLoginViewModel.kt | 4 ++++ .../viewmodels/EmailAccountCreationViewModel.kt | 3 +++ .../viewmodels/PhoneAccountCreationViewModel.kt | 3 +++ .../layout/assistant_account_login_fragment.xml | 16 ++++++++++++++++ ...assistant_email_account_creation_fragment.xml | 16 ++++++++++++++++ ...assistant_phone_account_creation_fragment.xml | 16 ++++++++++++++++ 7 files changed, 60 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f5a3098d5..9ea0185b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Group changes to describe their impact on the project, as follows: - Group calls directly from group chat rooms - Chat rooms can be individually muted (no notification when receiving a chat message) - Image & Video in-app viewers allow for full-screen display +- Display name can be set during assistant when creating / logging in a sip.linphone.org account ### Changed - In-call views have been re-designed @@ -33,6 +34,7 @@ Group changes to describe their impact on the project, as follows: - One to one chat room creation process waiting indefinitely if chat room already exists - "Blinking" in some views when presence is being received - Trying to keep the preferred driver (OpenSLES / AAudio) when switching device +- Issues when storing presence in native contacts + potentially duplicated SIP addresses in contact details ## [4.6.10] - 2022-06-07 diff --git a/app/src/main/java/org/linphone/activities/assistant/viewmodels/AccountLoginViewModel.kt b/app/src/main/java/org/linphone/activities/assistant/viewmodels/AccountLoginViewModel.kt index 3067024b3..5065f10d3 100644 --- a/app/src/main/java/org/linphone/activities/assistant/viewmodels/AccountLoginViewModel.kt +++ b/app/src/main/java/org/linphone/activities/assistant/viewmodels/AccountLoginViewModel.kt @@ -49,6 +49,8 @@ class AccountLoginViewModel(accountCreator: AccountCreator) : AbstractPhoneViewM val waitForServerAnswer = MutableLiveData() + val displayName = MutableLiveData() + val leaveAssistantEvent: MutableLiveData> by lazy { MutableLiveData>() } @@ -151,6 +153,8 @@ class AccountLoginViewModel(accountCreator: AccountCreator) : AbstractPhoneViewM } fun login() { + accountCreator.displayName = displayName.value + if (loginWithUsernamePassword.value == true) { val result = accountCreator.setUsername(username.value) if (result != AccountCreator.UsernameStatus.Ok) { diff --git a/app/src/main/java/org/linphone/activities/assistant/viewmodels/EmailAccountCreationViewModel.kt b/app/src/main/java/org/linphone/activities/assistant/viewmodels/EmailAccountCreationViewModel.kt index 6c9e873ff..24f0a8e20 100644 --- a/app/src/main/java/org/linphone/activities/assistant/viewmodels/EmailAccountCreationViewModel.kt +++ b/app/src/main/java/org/linphone/activities/assistant/viewmodels/EmailAccountCreationViewModel.kt @@ -52,6 +52,8 @@ class EmailAccountCreationViewModel(val accountCreator: AccountCreator) : ViewMo val passwordConfirmation = MutableLiveData() val passwordConfirmationError = MutableLiveData() + val displayName = MutableLiveData() + val createEnabled: MediatorLiveData = MediatorLiveData() val waitForServerAnswer = MutableLiveData() @@ -146,6 +148,7 @@ class EmailAccountCreationViewModel(val accountCreator: AccountCreator) : ViewMo accountCreator.username = username.value accountCreator.password = password.value accountCreator.email = email.value + accountCreator.displayName = displayName.value waitForServerAnswer.value = true val status = accountCreator.isAccountExist diff --git a/app/src/main/java/org/linphone/activities/assistant/viewmodels/PhoneAccountCreationViewModel.kt b/app/src/main/java/org/linphone/activities/assistant/viewmodels/PhoneAccountCreationViewModel.kt index 72a1ce6bd..fa39df29e 100644 --- a/app/src/main/java/org/linphone/activities/assistant/viewmodels/PhoneAccountCreationViewModel.kt +++ b/app/src/main/java/org/linphone/activities/assistant/viewmodels/PhoneAccountCreationViewModel.kt @@ -46,6 +46,8 @@ class PhoneAccountCreationViewModel(accountCreator: AccountCreator) : AbstractPh val useUsername = MutableLiveData() val usernameError = MutableLiveData() + val displayName = MutableLiveData() + val createEnabled: MediatorLiveData = MediatorLiveData() val waitForServerAnswer = MutableLiveData() @@ -141,6 +143,7 @@ class PhoneAccountCreationViewModel(accountCreator: AccountCreator) : AbstractPh } fun create() { + accountCreator.displayName = displayName.value accountCreator.setPhoneNumber(phoneNumber.value, prefix.value) if (useUsername.value == true) { accountCreator.username = username.value diff --git a/app/src/main/res/layout/assistant_account_login_fragment.xml b/app/src/main/res/layout/assistant_account_login_fragment.xml index 02bd16328..0581f29a7 100644 --- a/app/src/main/res/layout/assistant_account_login_fragment.xml +++ b/app/src/main/res/layout/assistant_account_login_fragment.xml @@ -238,6 +238,22 @@ + + + + + + + + + + + + + + + + + +