Added display name fields in assistant for linphone account creation / log in

This commit is contained in:
Sylvain Berfini 2022-06-08 16:08:09 +02:00
parent ed03a721a5
commit ee5af2b462
7 changed files with 60 additions and 0 deletions

View file

@ -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

View file

@ -49,6 +49,8 @@ class AccountLoginViewModel(accountCreator: AccountCreator) : AbstractPhoneViewM
val waitForServerAnswer = MutableLiveData<Boolean>()
val displayName = MutableLiveData<String>()
val leaveAssistantEvent: MutableLiveData<Event<Boolean>> by lazy {
MutableLiveData<Event<Boolean>>()
}
@ -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) {

View file

@ -52,6 +52,8 @@ class EmailAccountCreationViewModel(val accountCreator: AccountCreator) : ViewMo
val passwordConfirmation = MutableLiveData<String>()
val passwordConfirmationError = MutableLiveData<String>()
val displayName = MutableLiveData<String>()
val createEnabled: MediatorLiveData<Boolean> = MediatorLiveData()
val waitForServerAnswer = MutableLiveData<Boolean>()
@ -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

View file

@ -46,6 +46,8 @@ class PhoneAccountCreationViewModel(accountCreator: AccountCreator) : AbstractPh
val useUsername = MutableLiveData<Boolean>()
val usernameError = MutableLiveData<String>()
val displayName = MutableLiveData<String>()
val createEnabled: MediatorLiveData<Boolean> = MediatorLiveData()
val waitForServerAnswer = MutableLiveData<Boolean>()
@ -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

View file

@ -238,6 +238,22 @@
</LinearLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/assistant_display_name_optional">
<com.google.android.material.textfield.TextInputEditText
android:text="@={viewModel.displayName}"
android:imeOptions="actionDone"
android:singleLine="true"
android:inputType="textPersonName"
android:background="@color/transparent_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:onClick="@{() -> viewModel.login()}"
android:enabled="@{viewModel.loginEnabled, default=false}"

View file

@ -127,6 +127,22 @@
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/assistant_display_name_optional">
<com.google.android.material.textfield.TextInputEditText
android:text="@={viewModel.displayName}"
android:imeOptions="actionDone"
android:singleLine="true"
android:inputType="textPersonName"
android:background="@color/transparent_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:onClick="@{() -> viewModel.create()}"
android:enabled="@{viewModel.createEnabled, default=false}"

View file

@ -184,6 +184,22 @@
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/assistant_display_name_optional">
<com.google.android.material.textfield.TextInputEditText
android:text="@={viewModel.displayName}"
android:imeOptions="actionDone"
android:singleLine="true"
android:inputType="textPersonName"
android:background="@color/transparent_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.google.android.material.textfield.TextInputLayout>
</LinearLayout>
</RelativeLayout>