mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Hide account creation form when device doesn't support push notifications
This commit is contained in:
parent
994344a511
commit
5989c932e8
7 changed files with 125 additions and 25 deletions
|
|
@ -140,16 +140,6 @@ class RegisterFragment : GenericFragment() {
|
|||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
|
||||
})
|
||||
|
||||
viewModel.pushNotificationsAvailable.observe(viewLifecycleOwner) { available ->
|
||||
if (!available) {
|
||||
val text = getString(R.string.assistant_account_register_unavailable_no_push_toast)
|
||||
(requireActivity() as GenericActivity).showRedToast(
|
||||
text,
|
||||
R.drawable.warning_circle
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.normalizedPhoneNumberEvent.observe(viewLifecycleOwner) {
|
||||
it.consume { number ->
|
||||
showPhoneNumberConfirmationDialog(number)
|
||||
|
|
|
|||
|
|
@ -37,6 +37,18 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="username_label, username, phone_number_label, phone_number, prefix, prefix_caret, password_label, password, eye, create, create_email_account_label, create_email_account"
|
||||
android:visibility="@{viewModel.pushNotificationsAvailable ? View.VISIBLE : View.GONE}"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="no_push, no_push_label, create_email_account_no_push"
|
||||
android:visibility="@{viewModel.pushNotificationsAvailable ? View.GONE : View.VISIBLE, default=gone}"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/logo"
|
||||
android:layout_width="wrap_content"
|
||||
|
|
@ -80,6 +92,59 @@
|
|||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/back"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/no_push"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginTop="68dp"
|
||||
android:background="@drawable/circle_light_blue_button_background"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/bell_simple_slash"
|
||||
android:contentDescription="@null"
|
||||
app:tint="?attr/color_main2_500"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="@id/title"
|
||||
app:layout_constraintEnd_toEndOf="@id/title"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
app:layout_constraintBottom_toTopOf="@id/no_push_label"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/header_style"
|
||||
android:id="@+id/no_push_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginStart="48dp"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:textAlignment="center"
|
||||
android:text="@string/assistant_account_register_unavailable_no_push_warning"
|
||||
app:layout_constraintTop_toBottomOf="@id/no_push"
|
||||
app:layout_constraintBottom_toTopOf="@id/create_email_account_no_push"
|
||||
app:layout_constraintStart_toStartOf="@id/title"
|
||||
app:layout_constraintEnd_toEndOf="@id/title"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{openSubscribeWebPageClickListener}"
|
||||
style="@style/default_text_style_600"
|
||||
android:id="@+id/create_email_account_no_push"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="20dp"
|
||||
android:layout_marginTop="32dp"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:paddingStart="12dp"
|
||||
android:paddingEnd="12dp"
|
||||
android:text="@string/assistant_web_platform_link"
|
||||
android:textSize="13sp"
|
||||
android:textColor="@color/secondary_button_label_color"
|
||||
android:gravity="center"
|
||||
android:background="@drawable/secondary_button_background"
|
||||
app:layout_constraintStart_toStartOf="@id/title"
|
||||
app:layout_constraintEnd_toEndOf="@id/title"
|
||||
app:layout_constraintTop_toBottomOf="@id/no_push_label"
|
||||
app:layout_constraintBottom_toTopOf="@id/mountains" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/header_style"
|
||||
android:id="@+id/username_label"
|
||||
|
|
@ -96,7 +161,7 @@
|
|||
<androidx.appcompat.widget.AppCompatEditText
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/username"
|
||||
android:enabled="@{viewModel.pushNotificationsAvailable && !viewModel.lockUsernameAndPassword}"
|
||||
android:enabled="@{!viewModel.lockUsernameAndPassword}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="16dp"
|
||||
|
|
@ -186,7 +251,6 @@
|
|||
<androidx.appcompat.widget.AppCompatEditText
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/phone_number"
|
||||
android:enabled="@{viewModel.pushNotificationsAvailable}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="5dp"
|
||||
|
|
@ -235,7 +299,7 @@
|
|||
<androidx.appcompat.widget.AppCompatEditText
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/password"
|
||||
android:enabled="@{viewModel.pushNotificationsAvailable && !viewModel.lockUsernameAndPassword}"
|
||||
android:enabled="@{!viewModel.lockUsernameAndPassword}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="16dp"
|
||||
|
|
@ -284,7 +348,7 @@
|
|||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> viewModel.phoneNumberConfirmedByUser()}"
|
||||
android:enabled="@{viewModel.createEnabled && viewModel.pushNotificationsAvailable && !viewModel.operationInProgress, default=false}"
|
||||
android:enabled="@{viewModel.createEnabled && !viewModel.operationInProgress, default=false}"
|
||||
style="@style/primary_button_label_style"
|
||||
android:id="@+id/create"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@
|
|||
android:id="@+id/message"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:text="@string/assistant_third_party_sip_account_warning_explanation"
|
||||
android:textSize="14sp"
|
||||
android:gravity="start"
|
||||
|
|
|
|||
|
|
@ -37,6 +37,25 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="username_label, username, phone_number_label, phone_number, prefix, prefix_caret, password_label, password, eye, create, create_email_account_label"
|
||||
android:visibility="@{viewModel.pushNotificationsAvailable ? View.VISIBLE : View.GONE}"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Group
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:constraint_referenced_ids="no_push, no_push_label"
|
||||
android:visibility="@{viewModel.pushNotificationsAvailable ? View.GONE : View.VISIBLE, default=gone}"/>
|
||||
|
||||
<androidx.constraintlayout.widget.Barrier
|
||||
android:id="@+id/subscribe_barrier"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:barrierDirection="bottom"
|
||||
app:constraint_referenced_ids="create_email_account_label, no_push_label" />
|
||||
|
||||
<ImageView
|
||||
android:onClick="@{backClickListener}"
|
||||
android:id="@+id/back"
|
||||
|
|
@ -61,6 +80,34 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/no_push"
|
||||
android:layout_width="56dp"
|
||||
android:layout_height="56dp"
|
||||
android:layout_marginTop="68dp"
|
||||
android:background="@drawable/circle_light_blue_button_background"
|
||||
android:padding="16dp"
|
||||
android:src="@drawable/bell_simple_slash"
|
||||
android:contentDescription="@null"
|
||||
app:tint="?attr/color_main2_500"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/header_style"
|
||||
android:id="@+id/no_push_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginStart="48dp"
|
||||
android:layout_marginEnd="48dp"
|
||||
android:textAlignment="center"
|
||||
android:text="@string/assistant_account_register_unavailable_no_push_warning"
|
||||
app:layout_constraintTop_toBottomOf="@id/no_push"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/header_style"
|
||||
android:id="@+id/username_label"
|
||||
|
|
@ -75,7 +122,7 @@
|
|||
<androidx.appcompat.widget.AppCompatEditText
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/username"
|
||||
android:enabled="@{viewModel.pushNotificationsAvailable && !viewModel.lockUsernameAndPassword}"
|
||||
android:enabled="@{!viewModel.lockUsernameAndPassword}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="16dp"
|
||||
|
|
@ -162,7 +209,6 @@
|
|||
<androidx.appcompat.widget.AppCompatEditText
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/phone_number"
|
||||
android:enabled="@{viewModel.pushNotificationsAvailable}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="5dp"
|
||||
|
|
@ -208,7 +254,7 @@
|
|||
<androidx.appcompat.widget.AppCompatEditText
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/password"
|
||||
android:enabled="@{viewModel.pushNotificationsAvailable && !viewModel.lockUsernameAndPassword}"
|
||||
android:enabled="@{!viewModel.lockUsernameAndPassword}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginStart="16dp"
|
||||
|
|
@ -255,7 +301,7 @@
|
|||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:onClick="@{() -> viewModel.phoneNumberConfirmedByUser()}"
|
||||
android:enabled="@{viewModel.createEnabled && viewModel.pushNotificationsAvailable && !viewModel.operationInProgress, default=false}"
|
||||
android:enabled="@{viewModel.createEnabled && !viewModel.operationInProgress, default=false}"
|
||||
style="@style/primary_button_label_style"
|
||||
android:id="@+id/create"
|
||||
android:layout_width="0dp"
|
||||
|
|
@ -274,7 +320,7 @@
|
|||
android:id="@+id/create_email_account_label"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="34dp"
|
||||
android:layout_marginTop="40dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/assistant_create_account_using_email_on_our_web_platform"
|
||||
android:textSize="14sp"
|
||||
|
|
@ -301,7 +347,7 @@
|
|||
android:background="@drawable/secondary_button_background"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/create_email_account_label" />
|
||||
app:layout_constraintTop_toBottomOf="@id/subscribe_barrier" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/default_text_style"
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@
|
|||
android:id="@+id/message"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="42dp"
|
||||
android:layout_marginTop="24dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:text="@string/assistant_third_party_sip_account_warning_explanation"
|
||||
|
|
@ -105,7 +105,7 @@
|
|||
android:id="@+id/contact"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="42dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingBottom="6dp"
|
||||
android:paddingStart="12dp"
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@
|
|||
<string name="assistant_third_party_sip_account_warning_explanation">Certaines fonctionnalités telles que les conversations de groupe, les vidéo-conférences, etc… nécessitent un compte &appName;.\n\nCes fonctionnalités seront masquées si vous utilisez un compte SIP tiers.\n\nPour les activer dans un projet commercial, merci de nous contacter.</string>
|
||||
<string name="assistant_third_party_sip_account_create_linphone_account">Je préfère créer un compte &appName;</string>
|
||||
<string name="assistant_third_party_sip_account_warning_ok">J\'ai compris</string>
|
||||
<string name="assistant_account_register_unavailable_no_push_toast">Notifications push indisponible, la création de compte est donc désactivée.</string>
|
||||
<string name="assistant_account_register_unavailable_no_push_warning">Les notifications push ne semblent pas être disponibles sur votre appareil. Celles-ci sont nécessaires à la création d’un compte sur l’application mobile.\n\nNous vous invitons à créer un compte depuis notre plateforme web :</string>
|
||||
<string name="assistant_account_register_push_notification_not_received_error">Notification push non reçue, merci de réessayer plus tard</string>
|
||||
<string name="assistant_account_register_unexpected_error">Un erreur inattendue est survenue, merci de réessayer plus tard</string>
|
||||
<string name="assistant_account_login_forbidden_error">Mauvais nom d\'utilisateur ou mot de passe</string>
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@
|
|||
<string name="assistant_third_party_sip_account_warning_explanation">Some features require a &appName; account, such as group messaging, video conferences…\n\nThese features are hidden when you register with a third party SIP account.\n\nTo enable it in a commercial project, please contact us.</string>
|
||||
<string name="assistant_third_party_sip_account_create_linphone_account">I prefer to create a &appName; account</string>
|
||||
<string name="assistant_third_party_sip_account_warning_ok">I understand</string>
|
||||
<string name="assistant_account_register_unavailable_no_push_toast">Push notifications not available, account creation disabled</string>
|
||||
<string name="assistant_account_register_unavailable_no_push_warning">Push notifications do not seem to be available on your device, but they are mandatory for creating an account in the mobile app.\n\nWe invite you to create an account on our web platform instead:</string>
|
||||
<string name="assistant_account_register_push_notification_not_received_error">Push notification with auth token not received in 5 seconds, please try again later</string>
|
||||
<string name="assistant_account_register_unexpected_error">Unexpected error occurred, please try again later</string>
|
||||
<string name="assistant_account_login_forbidden_error">Wrong username or password</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue