Login screens: Fix a few bugs

This commit is contained in:
Benoit Marty 2019-11-15 14:39:09 +01:00
parent 2871e4f5b1
commit ca4e75a1a0
5 changed files with 40 additions and 9 deletions

View File

@ -35,9 +35,7 @@ import im.vector.riotx.features.home.createdirect.CreateDirectRoomKnownUsersFrag
import im.vector.riotx.features.home.group.GroupListFragment import im.vector.riotx.features.home.group.GroupListFragment
import im.vector.riotx.features.home.room.detail.RoomDetailFragment import im.vector.riotx.features.home.room.detail.RoomDetailFragment
import im.vector.riotx.features.home.room.list.RoomListFragment import im.vector.riotx.features.home.room.list.RoomListFragment
import im.vector.riotx.features.login.LoginFragment import im.vector.riotx.features.login.*
import im.vector.riotx.features.login.LoginServerUrlFormFragment
import im.vector.riotx.features.login.LoginWebFragment
import im.vector.riotx.features.reactions.EmojiSearchResultFragment import im.vector.riotx.features.reactions.EmojiSearchResultFragment
import im.vector.riotx.features.roomdirectory.PublicRoomsFragment import im.vector.riotx.features.roomdirectory.PublicRoomsFragment
import im.vector.riotx.features.roomdirectory.createroom.CreateRoomFragment import im.vector.riotx.features.roomdirectory.createroom.CreateRoomFragment
@ -116,12 +114,36 @@ interface FragmentModule {
@FragmentKey(LoginFragment::class) @FragmentKey(LoginFragment::class)
fun bindLoginFragment(fragment: LoginFragment): Fragment fun bindLoginFragment(fragment: LoginFragment): Fragment
// TODO Add all other Login Fragments
@Binds @Binds
@IntoMap @IntoMap
@FragmentKey(LoginServerUrlFormFragment::class) @FragmentKey(LoginServerUrlFormFragment::class)
fun bindLoginServerUrlFormFragment(fragment: LoginServerUrlFormFragment): Fragment fun bindLoginServerUrlFormFragment(fragment: LoginServerUrlFormFragment): Fragment
@Binds
@IntoMap
@FragmentKey(LoginResetPasswordFragment::class)
fun bindLoginResetPasswordFragment(fragment: LoginResetPasswordFragment): Fragment
@Binds
@IntoMap
@FragmentKey(LoginResetPasswordSuccessFragment::class)
fun bindLoginResetPasswordSuccessFragment(fragment: LoginResetPasswordSuccessFragment): Fragment
@Binds
@IntoMap
@FragmentKey(LoginServerSelectionFragment::class)
fun bindLoginServerSelectionFragment(fragment: LoginServerSelectionFragment): Fragment
@Binds
@IntoMap
@FragmentKey(LoginSignUpSignInSelectionFragment::class)
fun bindLoginSignUpSignInSelectionFragment(fragment: LoginSignUpSignInSelectionFragment): Fragment
@Binds
@IntoMap
@FragmentKey(LoginSplashFragment::class)
fun bindLoginSplashFragment(fragment: LoginSplashFragment): Fragment
@Binds @Binds
@IntoMap @IntoMap
@FragmentKey(LoginWebFragment::class) @FragmentKey(LoginWebFragment::class)

View File

@ -71,7 +71,7 @@ class LoginResetPasswordFragment @Inject constructor(
.subscribeBy { .subscribeBy {
resetPasswordEmail.error = null resetPasswordEmail.error = null
passwordFieldTil.error = null passwordFieldTil.error = null
loginSubmit.isEnabled = it resetPasswordSubmit.isEnabled = it
} }
.disposeOnDestroy() .disposeOnDestroy()

View File

@ -48,13 +48,14 @@ class LoginSignUpSignInSelectionFragment @Inject constructor() : AbstractLoginFr
ServerType.Modular -> { ServerType.Modular -> {
loginSignupSigninServerIcon.setImageResource(R.drawable.ic_logo_modular) loginSignupSigninServerIcon.setImageResource(R.drawable.ic_logo_modular)
loginSignupSigninServerIcon.isVisible = true loginSignupSigninServerIcon.isVisible = true
// TODO
loginSignupSigninTitle.text = getString(R.string.login_connect_to, "TODO MODULAR NAME") loginSignupSigninTitle.text = getString(R.string.login_connect_to, "TODO MODULAR NAME")
loginSignupSigninText.text = "TODO MODULAR URL" loginSignupSigninText.text = loginViewModel.getHomeServerUrlSimple()
} }
ServerType.Other -> { ServerType.Other -> {
loginSignupSigninServerIcon.isVisible = false loginSignupSigninServerIcon.isVisible = false
loginSignupSigninTitle.text = getString(R.string.login_server_other_title) loginSignupSigninTitle.text = getString(R.string.login_server_other_title)
loginSignupSigninText.text = "TODO SERVER URL" loginSignupSigninText.text = getString(R.string.login_connect_to, loginViewModel.getHomeServerUrlSimple())
} }
} }
} }

View File

@ -309,7 +309,12 @@ class LoginViewModel @AssistedInject constructor(@Assisted initialState: LoginVi
return homeServerConnectionConfig?.homeServerUri?.toString() ?: "" return homeServerConnectionConfig?.homeServerUri?.toString() ?: ""
} }
/**
* Ex: "https://matrix.org/" -> "matrix.org"
*/
fun getHomeServerUrlSimple(): String { fun getHomeServerUrlSimple(): String {
return getHomeServerUrl().substringAfter("://") return getHomeServerUrl()
.substringAfter("://")
.trim { it == '/' }
} }
} }

View File

@ -25,11 +25,14 @@
style="@style/LoginTopIcon" style="@style/LoginTopIcon"
android:layout_gravity="center_horizontal" /> android:layout_gravity="center_horizontal" />
<Space
android:layout_width="wrap_content"
android:layout_height="84dp" />
<ImageView <ImageView
android:id="@+id/loginServerIcon" android:id="@+id/loginServerIcon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="84dp"
tools:src="@drawable/ic_logo_matrix_org" /> tools:src="@drawable/ic_logo_matrix_org" />
<TextView <TextView