Commit 58e4df01 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

Merge branch 'feature/flat_fix' into develop

parents 5d7e5a33 5b1541a9
...@@ -63,24 +63,22 @@ class AuthScreenController : ...@@ -63,24 +63,22 @@ class AuthScreenController :
super.onAttach(view) super.onAttach(view)
detachDisposable.addAll( detachDisposable.addAll(
loginInput.editText?.textChanges() loginInput.editText?.textChanges()
?.doOnNext { Timber.d("loginInput.isErrorEnabled ${loginInput.isErrorEnabled}")}
?.filter { loginInput.isErrorEnabled } ?.filter { loginInput.isErrorEnabled }
?.subscribe { ?.subscribe {
Timber.d("got key $it")
loginInput.isErrorEnabled = false loginInput.isErrorEnabled = false
loginInput.error = null loginInput.error = null
signInButton.isEnabled=true signInButton.isEnabled=true
}, },
pwdInput.editText?.textChanges() pwdInput.editText?.textChanges()
?.filter { pwdInput.isErrorEnabled } ?.filter { pwdInput.isErrorEnabled }
?.subscribe { pwdInput.isErrorEnabled = false ?.subscribe {
pwdInput.isErrorEnabled = false
pwdInput.error = null
signInButton.isEnabled=true signInButton.isEnabled=true
} }
) )
} }
@Inject @Inject
lateinit var bottomNavigation: IBottomNavigation lateinit var bottomNavigation: IBottomNavigation
...@@ -97,9 +95,6 @@ class AuthScreenController : ...@@ -97,9 +95,6 @@ class AuthScreenController :
.create(RoomParkApplication.component,activity as RoomParkMainActivity) .create(RoomParkApplication.component,activity as RoomParkMainActivity)
.inject(this) .inject(this)
// @Inject
// lateinit var ac: RoomParkMainActivity
override fun render(viewState: AuthScreenViewState) { override fun render(viewState: AuthScreenViewState) {
super.render(viewState) super.render(viewState)
Timber.d("Render state $viewState") Timber.d("Render state $viewState")
...@@ -115,7 +110,11 @@ class AuthScreenController : ...@@ -115,7 +110,11 @@ class AuthScreenController :
} }
private fun render(viewState: AuthScreenViewState.Idle){ private fun render(viewState: AuthScreenViewState.Idle){
loginInput.isErrorEnabled = false
loginInput.error = null
pwdInput.isErrorEnabled = false
pwdInput.error = null
signInButton.isEnabled=true
} }
private fun render(viewState: AuthScreenViewState.Authorization){ private fun render(viewState: AuthScreenViewState.Authorization){
...@@ -154,9 +153,10 @@ class AuthScreenController : ...@@ -154,9 +153,10 @@ class AuthScreenController :
} }
private fun render(viewState: AuthScreenViewState.SomeError) {
private fun render(viewState: AuthScreenViewState.SomeError) =
showError(viewState.exception) showError(viewState.exception)
signInButton.isEnabled=true
}
override fun getLayoutId(): Int = R.layout.authentication_screen override fun getLayoutId(): Int = R.layout.authentication_screen
......
...@@ -19,24 +19,11 @@ class AuthScreenPresenter @Inject constructor( ...@@ -19,24 +19,11 @@ class AuthScreenPresenter @Inject constructor(
) )
: BigantoBasePresenter<AuthScreen, AuthScreenViewState>() { : BigantoBasePresenter<AuthScreen, AuthScreenViewState>() {
override fun attachView(view: AuthScreen) {
super.attachView(view)
Timber.d("on AttachView")
restoreStateObservable.accept(AuthScreenViewState.Idle())
}
override fun detachView() {
super.detachView()
Timber.d("on DetachView")
restoreStateObservable }
override fun defaultErrorViewStateHandler() = override fun defaultErrorViewStateHandler() =
{e:ExceptionString -> AuthScreenViewState.SomeError(e)} {e:ExceptionString -> AuthScreenViewState.SomeError(e)}
override fun vsByCode(code: Int): (ExceptionString) -> AuthScreenViewState = override fun vsByCode(code: Int): (ExceptionString) -> AuthScreenViewState =
when (code) { when (code) {
101 -> {e:ExceptionString -> AuthScreenViewState.SignInError(e)}
111 -> {e:ExceptionString -> AuthScreenViewState.WrongLogin(e)} 111 -> {e:ExceptionString -> AuthScreenViewState.WrongLogin(e)}
112 -> {e:ExceptionString -> AuthScreenViewState.WrongPassword(e)} 112 -> {e:ExceptionString -> AuthScreenViewState.WrongPassword(e)}
else -> {e:ExceptionString -> AuthScreenViewState.SomeError(e)} else -> {e:ExceptionString -> AuthScreenViewState.SomeError(e)}
......
...@@ -102,6 +102,7 @@ class FindFlatScreenController : ...@@ -102,6 +102,7 @@ class FindFlatScreenController :
when(viewState){ when(viewState){
is FindFlatScreenViewState.Idle -> render(viewState) is FindFlatScreenViewState.Idle -> render(viewState)
is FindFlatScreenViewState.StartTour -> render(viewState) is FindFlatScreenViewState.StartTour -> render(viewState)
is FindFlatScreenViewState.SomeError -> render(viewState)
} }
} }
......
...@@ -26,6 +26,7 @@ class FindFlatScreenPresenter @Inject constructor( ...@@ -26,6 +26,7 @@ class FindFlatScreenPresenter @Inject constructor(
override fun bindIntents() { override fun bindIntents() {
val startTourIntent = intent(FindFlatScreen::startTour) val startTourIntent = intent(FindFlatScreen::startTour)
.filter { false }
.map { FindFlatScreenViewState.StartTour(it) } .map { FindFlatScreenViewState.StartTour(it) }
val getFlatIntent = intent(FindFlatScreen::getFlat) val getFlatIntent = intent(FindFlatScreen::getFlat)
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:cursorVisible="true" android:cursorVisible="true"
android:includeFontPadding="false" android:includeFontPadding="false"
android:inputType="number"
android:maxLength="4"
android:singleLine="true" /> android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout> </com.google.android.material.textfield.TextInputLayout>
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimary">@color/colorPrimary</item>
<item name="colorSecondary">@color/colorAccent</item> <item name="colorSecondary">@color/colorAccent</item>
<item name="colorSecondaryVariant">@color/colorAccentSecondary</item> <item name="colorSecondaryVariant">@color/colorAccentSecondary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorPrimaryDark">@color/colorAccentSecondary</item>
<item name="colorAccent">@color/colorAccent</item> <item name="colorAccent">@color/colorAccent</item>
<item name="materialCardViewStyle">@style/Widget.Biganto.MaterialCardView</item> <item name="materialCardViewStyle">@style/Widget.Biganto.MaterialCardView</item>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment