Added conference factory URIs & LIME server URL to account params

This commit is contained in:
Sylvain Berfini 2023-10-18 09:25:04 +02:00
parent f07a8f6c2b
commit 561c36bfe0
4 changed files with 134 additions and 12 deletions

View file

@ -55,6 +55,12 @@ class AccountSettingsViewModel @UiThread constructor() : ViewModel() {
val expire = MutableLiveData<String>()
val conferenceFactoryUri = MutableLiveData<String>()
val audioVideoConferenceFactoryUri = MutableLiveData<String>()
val limeServerUrl = MutableLiveData<String>()
val accountFoundEvent = MutableLiveData<Event<Boolean>>()
private lateinit var account: Account
@ -94,6 +100,14 @@ class AccountSettingsViewModel @UiThread constructor() : ViewModel() {
expire.postValue(params.expires.toString())
conferenceFactoryUri.postValue(params.conferenceFactoryAddress?.asStringUriOnly())
audioVideoConferenceFactoryUri.postValue(
params.audioVideoConferenceFactoryAddress?.asStringUriOnly()
)
limeServerUrl.postValue(params.limeServerUrl)
accountFoundEvent.postValue(Event(true))
} else {
Log.e("$TAG Failed to find account matching identity [$identity]")
@ -134,6 +148,18 @@ class AccountSettingsViewModel @UiThread constructor() : ViewModel() {
newParams.expires = expire.value?.toInt() ?: 31536000
val conferenceFactoryAddress = Factory.instance().createAddress(
conferenceFactoryUri.value.orEmpty()
)
newParams.conferenceFactoryAddress = conferenceFactoryAddress
val audioVideoConferenceFactoryAddress = Factory.instance().createAddress(
audioVideoConferenceFactoryUri.value.orEmpty()
)
newParams.conferenceFactoryAddress = audioVideoConferenceFactoryAddress
newParams.limeServerUrl = limeServerUrl.value
account.params = newParams
Log.i("$TAG Changes have been saved")
}

View file

@ -130,7 +130,7 @@
android:layout_marginTop="20dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/assistant_sip_account_sip_proxy_url_title"
android:text="@string/account_settings_sip_proxy_url_title"
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintTop_toBottomOf="@id/transport_spinner"
@ -187,7 +187,7 @@
android:layout_marginTop="20dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/assistant_sip_account_stun_server_url_title"
android:text="@string/account_settings_stun_server_url_title"
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintTop_toBottomOf="@id/outbound_proxy_switch"
@ -228,7 +228,7 @@
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="10dp"
android:text="@string/assistant_sip_account_enable_ice_title"
android:text="@string/account_settings_enable_ice_title"
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintTop_toTopOf="@id/ice_switch"
@ -270,7 +270,7 @@
android:layout_marginTop="20dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/assistant_sip_account_expire_title"
android:text="@string/account_settings_expire_title"
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintTop_toBottomOf="@id/avpf_switch"
@ -279,12 +279,11 @@
<androidx.appcompat.widget.AppCompatEditText
style="@style/default_text_style"
android:id="@+id/expire_server"
android:id="@+id/expire"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginBottom="@dimen/screen_bottom_margin"
android:background="@drawable/edit_text_background"
android:paddingStart="20dp"
android:paddingEnd="20dp"
@ -293,9 +292,103 @@
app:layout_constraintVertical_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/expire_title"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"
android:id="@+id/conference_factory_uri_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/account_settings_conference_factory_uri_title"
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintTop_toBottomOf="@id/expire"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<androidx.appcompat.widget.AppCompatEditText
style="@style/default_text_style"
android:id="@+id/conference_factory_uri"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:background="@drawable/edit_text_background"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:text="@={viewModel.conferenceFactoryUri}"
android:inputType="text|textUri"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/conference_factory_uri_title"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"
android:id="@+id/audio_video_conference_factory_uri_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/account_settings_audio_video_conference_factory_uri_title"
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintTop_toBottomOf="@id/conference_factory_uri"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<androidx.appcompat.widget.AppCompatEditText
style="@style/default_text_style"
android:id="@+id/audio_video_conference_factory_uri"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:background="@drawable/edit_text_background"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:text="@={viewModel.audioVideoConferenceFactoryUri}"
android:inputType="text|textUri"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/audio_video_conference_factory_uri_title"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"
android:id="@+id/lime_server_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:text="@string/account_settings_lime_server_url_title"
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintTop_toBottomOf="@id/audio_video_conference_factory_uri"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>
<androidx.appcompat.widget.AppCompatEditText
style="@style/default_text_style"
android:id="@+id/lime_server"
android:layout_width="0dp"
android:layout_height="50dp"
android:layout_marginEnd="16dp"
android:layout_marginStart="16dp"
android:layout_marginBottom="@dimen/screen_bottom_margin"
android:background="@drawable/edit_text_background"
android:paddingStart="20dp"
android:paddingEnd="20dp"
android:text="@={viewModel.limeServerUrl}"
android:inputType="text|textUri"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/lime_server_title"
app:layout_constraintBottom_toBottomOf="parent"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

View file

@ -259,12 +259,15 @@
<string name="manage_account_device_last_connection">Last connection:</string>
<string name="account_settings_push_notification_title">Allow push notifications</string>
<string name="assistant_sip_account_sip_proxy_url_title">SIP proxy server URL</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="assistant_sip_account_stun_server_url_title">STUN server server URL</string>
<string name="assistant_sip_account_enable_ice_title">Enable ICE</string>
<string name="account_settings_stun_server_url_title">STUN server server URL</string>
<string name="account_settings_enable_ice_title">Enable ICE</string>
<string name="account_settings_avpf_title">AVPF</string>
<string name="assistant_sip_account_expire_title">Expire</string>
<string name="account_settings_expire_title">Expire</string>
<string name="account_settings_conference_factory_uri_title">Conference factory URI</string>
<string name="account_settings_audio_video_conference_factory_uri_title">Audio/video conference factory URI</string>
<string name="account_settings_lime_server_url_title">E2E encryption keys server URL</string>
<string name="friend_presence_status_online">Online</string>
<string name="friend_presence_status_was_online_on">Online on %s</string>

View file

@ -96,7 +96,7 @@
<item name="android:textSize">11sp</item>
<item name="android:textColor">@color/gray_main2_600</item>
<item name="android:gravity">center</item>
<item name="maxLines">1</item>
<item name="android:maxLines">1</item>
<item name="android:ellipsize">end</item>
</style>
<style name="context_menu_action_label_style">