Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Room Park Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav Bogdashkin
Room Park Android
Commits
5d067764
Commit
5d067764
authored
Nov 18, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
logout
auth view fix toolabr hide on splash and auth screens fix some repostiory behaviour
parent
a25d3111
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
53 additions
and
13 deletions
+53
-13
UserHolder.kt
...java/com/biganto/visual/roompark/data/local/UserHolder.kt
+4
-1
settings.kt
...com/biganto/visual/roompark/domain/interactor/settings.kt
+2
-1
ScreenController.kt
...ual/roompark/presentation/screen/auth/ScreenController.kt
+15
-2
ScreenDI.kt
...anto/visual/roompark/presentation/screen/auth/ScreenDI.kt
+5
-0
ScreenPresenter.kt
...sual/roompark/presentation/screen/auth/ScreenPresenter.kt
+1
-1
HomeBottomNavigationController.kt
...creen/home/home_routing/HomeBottomNavigationController.kt
+0
-1
ScreenController.kt
...roompark/presentation/screen/settings/ScreenController.kt
+7
-3
ScreenPresenter.kt
.../roompark/presentation/screen/settings/ScreenPresenter.kt
+7
-3
ScreenController.kt
...l/roompark/presentation/screen/splash/ScreenController.kt
+5
-0
ScreenDI.kt
...to/visual/roompark/presentation/screen/splash/ScreenDI.kt
+5
-0
authentication_screen.xml
app/src/main/res/layout/authentication_screen.xml
+2
-1
No files found.
app/src/main/java/com/biganto/visual/roompark/data/local/UserHolder.kt
View file @
5d067764
...
@@ -58,7 +58,10 @@ class UserHolder @Inject constructor(val context : Context) : ILocalStore
...
@@ -58,7 +58,10 @@ class UserHolder @Inject constructor(val context : Context) : ILocalStore
}
}
override
fun
setRecentUser
(
uuid
:
String
?)
=
override
fun
setRecentUser
(
uuid
:
String
?)
=
Completable
.
fromCallable
{
userSession
.
set
(
uuid
?:
EMPTY_PREF_VALUE_KEY
)}
Completable
.
defer
{
Completable
.
fromCallable
{
userSession
.
set
(
uuid
?:
EMPTY_PREF_VALUE_KEY
)
}
.
doOnComplete
{
Timber
.
d
(
"complete save null value"
)
}
}
}
}
sealed
class
UserState
{
sealed
class
UserState
{
...
...
app/src/main/java/com/biganto/visual/roompark/domain/interactor/settings.kt
View file @
5d067764
...
@@ -5,6 +5,7 @@ import com.biganto.visual.roompark.domain.model.PushSwitchModel
...
@@ -5,6 +5,7 @@ import com.biganto.visual.roompark.domain.model.PushSwitchModel
import
com.biganto.visual.roompark.domain.model.SettingsModel
import
com.biganto.visual.roompark.domain.model.SettingsModel
import
com.biganto.visual.roompark.domain.use_case.AuthUseCase
import
com.biganto.visual.roompark.domain.use_case.AuthUseCase
import
io.reactivex.Observable
import
io.reactivex.Observable
import
io.reactivex.schedulers.Schedulers
import
javax.inject.Inject
import
javax.inject.Inject
/**
/**
...
@@ -18,7 +19,7 @@ class SettingsInteractor @Inject constructor(
...
@@ -18,7 +19,7 @@ class SettingsInteractor @Inject constructor(
fun
fetchSettings
():
Observable
<
SettingsModel
>
=
Observable
.
just
(
sampleSettings
)
fun
fetchSettings
():
Observable
<
SettingsModel
>
=
Observable
.
just
(
sampleSettings
)
fun
signOut
()
=
auth
.
signOut
()
fun
signOut
()
=
auth
.
signOut
()
.
subscribeOn
(
Schedulers
.
io
())
companion
object
{
companion
object
{
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenController.kt
View file @
5d067764
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.auth
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.auth
import
android.view.View
import
android.view.View
import
butterknife.BindView
import
butterknife.BindView
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.IBottomNavigation
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.conductor.BigantoBaseController
...
@@ -26,14 +27,17 @@ class AuthScreenController :
...
@@ -26,14 +27,17 @@ class AuthScreenController :
,
AuthScreenPresenter
>()
,
AuthScreenPresenter
>()
,
AuthScreen
{
,
AuthScreen
{
override
fun
onViewBound
(
v
:
View
)
{
override
fun
onViewBound
(
v
:
View
)
{
toolBar
.
hideAll
()
bottomNavigation
.
hide
()
}
}
@BindView
(
R
.
id
.
login_text_input
)
lateinit
var
loginInput
:
TextInputLayout
@BindView
(
R
.
id
.
login_text_input
)
lateinit
var
loginInput
:
TextInputLayout
@BindView
(
R
.
id
.
password_text_input
)
lateinit
var
pwdInput
:
TextInputLayout
@BindView
(
R
.
id
.
password_text_input
)
lateinit
var
pwdInput
:
TextInputLayout
@BindView
(
R
.
id
.
sign_in_button
)
lateinit
var
signInButton
:
MaterialButton
@BindView
(
R
.
id
.
sign_in_button
)
lateinit
var
signInButton
:
MaterialButton
override
fun
tryAuth
():
Observable
<
AuthInputModel
>
=
override
fun
tryAuth
():
Observable
<
AuthInputModel
>
=
Observable
.
defer
{
signInButton
.
clicks
()
signInButton
.
clicks
()
.
doOnNext
{
signInButton
.
hideKeyboard
()
}
.
doOnNext
{
signInButton
.
hideKeyboard
()
}
.
map
<
AuthInputModel
>
{
.
map
<
AuthInputModel
>
{
...
@@ -43,12 +47,15 @@ class AuthScreenController :
...
@@ -43,12 +47,15 @@ class AuthScreenController :
)
)
}
}
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
}
override
fun
injectDependencies
()
{
override
fun
injectDependencies
()
{
getComponent
()
getComponent
()
}
}
@Inject
lateinit
var
bottomNavigation
:
IBottomNavigation
@Inject
@Inject
override
lateinit
var
injectedPresenter
:
AuthScreenPresenter
override
lateinit
var
injectedPresenter
:
AuthScreenPresenter
...
@@ -74,6 +81,8 @@ class AuthScreenController :
...
@@ -74,6 +81,8 @@ class AuthScreenController :
is
AuthScreenViewState
.
SignedIn
->
render
(
viewState
)
is
AuthScreenViewState
.
SignedIn
->
render
(
viewState
)
is
AuthScreenViewState
.
SignInError
->
render
(
viewState
)
is
AuthScreenViewState
.
SignInError
->
render
(
viewState
)
is
AuthScreenViewState
.
SomeError
->
render
(
viewState
)
is
AuthScreenViewState
.
SomeError
->
render
(
viewState
)
is
AuthScreenViewState
.
WrongLogin
->
render
(
viewState
)
is
AuthScreenViewState
.
WrongPassword
->
render
(
viewState
)
}
}
}
}
...
@@ -99,6 +108,8 @@ class AuthScreenController :
...
@@ -99,6 +108,8 @@ class AuthScreenController :
private
fun
render
(
viewState
:
AuthScreenViewState
.
WrongLogin
){
private
fun
render
(
viewState
:
AuthScreenViewState
.
WrongLogin
){
// showError(viewState.exception)
// showError(viewState.exception)
loginInput
.
isErrorEnabled
=
true
loginInput
.
errorIconDrawable
=
null
viewState
.
exception
.
selectHandler
(
viewState
.
exception
.
selectHandler
(
{
strId
->
loginInput
.
error
=
resources
?.
getString
(
strId
)},
{
strId
->
loginInput
.
error
=
resources
?.
getString
(
strId
)},
{
message
->
loginInput
.
error
=
message
}
{
message
->
loginInput
.
error
=
message
}
...
@@ -107,6 +118,8 @@ class AuthScreenController :
...
@@ -107,6 +118,8 @@ class AuthScreenController :
}
}
private
fun
render
(
viewState
:
AuthScreenViewState
.
WrongPassword
){
private
fun
render
(
viewState
:
AuthScreenViewState
.
WrongPassword
){
pwdInput
.
isErrorEnabled
=
true
pwdInput
.
errorIconDrawable
=
null
viewState
.
exception
.
selectHandler
(
viewState
.
exception
.
selectHandler
(
{
strId
->
pwdInput
.
error
=
resources
?.
getString
(
strId
)},
{
strId
->
pwdInput
.
error
=
resources
?.
getString
(
strId
)},
{
message
->
pwdInput
.
error
=
message
}
{
message
->
pwdInput
.
error
=
message
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenDI.kt
View file @
5d067764
package
com.biganto.visual.roompark.presentation.screen.auth
package
com.biganto.visual.roompark.presentation.screen.auth
import
android.content.Context
import
android.content.Context
import
com.biganto.visual.roompark.base.IBottomNavigation
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import
com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import
com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import
com.biganto.visual.roompark.data.repository.db.requrey.DbModule
...
@@ -43,4 +44,8 @@ abstract class AuthScreenModule{
...
@@ -43,4 +44,8 @@ abstract class AuthScreenModule{
@Binds
@Binds
abstract
fun
provideAuth
(
contract
:
AuthContractModule
):
AuthContract
abstract
fun
provideAuth
(
contract
:
AuthContractModule
):
AuthContract
@PerScreen
@Binds
abstract
fun
provideBottomNavigation
(
activitiy
:
RoomParkMainActivity
):
IBottomNavigation
}
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenPresenter.kt
View file @
5d067764
...
@@ -37,7 +37,7 @@ class AuthScreenPresenter @Inject constructor(
...
@@ -37,7 +37,7 @@ class AuthScreenPresenter @Inject constructor(
.
doOnNext
{
Timber
.
d
(
"auth returned $it"
)
}
.
doOnNext
{
Timber
.
d
(
"auth returned $it"
)
}
.
map
{
it
}
.
map
{
it
}
.
map
<
AuthScreenViewState
>
{
AuthScreenViewState
.
SignedIn
()
}
.
map
<
AuthScreenViewState
>
{
AuthScreenViewState
.
SignedIn
()
}
//
.onErrorReturn{parseError(it)}
.
onErrorReturn
{
parseError
(
it
)}
}
}
// .startWith(Observable.just(AuthScreenViewState.Authorization()))
// .startWith(Observable.just(AuthScreenViewState.Authorization()))
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/home/home_routing/HomeBottomNavigationController.kt
View file @
5d067764
...
@@ -140,7 +140,6 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
...
@@ -140,7 +140,6 @@ class HomeBottomNavigationController(@IdRes toPage: Int = R.id.tab_feeds)
val
childRouter
=
getChildRouter
(
currentlySelectedItemId
)
val
childRouter
=
getChildRouter
(
currentlySelectedItemId
)
Timber
.
d
(
"in back stack - ${childRouter?.backstackSize}"
)
Timber
.
d
(
"in back stack - ${childRouter?.backstackSize}"
)
if
(
childRouter
!=
null
)
{
if
(
childRouter
!=
null
)
{
if
(
childRouter
.
backstackSize
<
2
)
return
false
if
(
childRouter
.
backstackSize
<
2
)
return
false
if
(
childRouter
.
handleBack
())
if
(
childRouter
.
handleBack
())
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenController.kt
View file @
5d067764
...
@@ -11,11 +11,12 @@ import com.biganto.visual.roompark.R
...
@@ -11,11 +11,12 @@ import com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.presentation.screen.auth.AuthScreenController
import
com.biganto.visual.roompark.presentation.screen.settings.util.CahcedListAdapter
import
com.biganto.visual.roompark.presentation.screen.settings.util.CahcedListAdapter
import
com.biganto.visual.roompark.presentation.screen.settings.util.PushListAdapter
import
com.biganto.visual.roompark.presentation.screen.settings.util.PushListAdapter
import
com.biganto.visual.roompark.presentation.screen.splash.SplashScreenController
import
com.biganto.visual.roompark.util.extensions.bytesToSize
import
com.biganto.visual.roompark.util.extensions.bytesToSize
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import
com.google.android.material.textview.MaterialTextView
import
com.google.android.material.textview.MaterialTextView
import
com.jakewharton.rxbinding3.view.clicks
import
com.jakewharton.rxbinding3.view.clicks
import
io.reactivex.Observable
import
io.reactivex.Observable
...
@@ -35,7 +36,7 @@ class SettingsScreenController :
...
@@ -35,7 +36,7 @@ class SettingsScreenController :
override
fun
signOut
():
Observable
<
Int
>
=
override
fun
signOut
():
Observable
<
Int
>
=
signOutButton
.
clicks
()
signOutButton
.
clicks
()
.
map
{
1
}
.
map
{
Timber
.
d
(
"Clicked sign out button"
);
1
}
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
override
fun
injectDependencies
()
{
override
fun
injectDependencies
()
{
...
@@ -119,7 +120,10 @@ class SettingsScreenController :
...
@@ -119,7 +120,10 @@ class SettingsScreenController :
}
}
private
fun
render
(
viewState
:
SettingsScreenViewState
.
SignOut
){
private
fun
render
(
viewState
:
SettingsScreenViewState
.
SignOut
){
router
.
setRoot
(
RouterTransaction
.
with
(
AuthScreenController
()))
router
.
setRoot
(
RouterTransaction
.
with
(
SplashScreenController
())
.
pushChangeHandler
(
FadeChangeHandler
())
.
popChangeHandler
(
FadeChangeHandler
())
)
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenPresenter.kt
View file @
5d067764
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.settings
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.settings
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.SettingsInteractor
import
com.biganto.visual.roompark.domain.interactor.SettingsInteractor
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
import
timber.log.Timber
...
@@ -27,9 +28,12 @@ class SettingsScreenPresenter @Inject constructor(
...
@@ -27,9 +28,12 @@ class SettingsScreenPresenter @Inject constructor(
.
map
{
SettingsScreenViewState
.
LoadSettingsList
(
it
)
}
.
map
{
SettingsScreenViewState
.
LoadSettingsList
(
it
)
}
val
onSignOut
=
intent
(
SettingsScreen
::
signOut
)
val
onSignOut
=
intent
(
SettingsScreen
::
signOut
)
.
flatMap
{
interactor
.
signOut
()
.
flatMap
{
.
toObservable
<
SettingsScreenViewState
>()
interactor
.
signOut
()
.
map
{
SettingsScreenViewState
.
SignOut
()
}}
.
andThen
(
Observable
.
just
<
SettingsScreenViewState
>(
SettingsScreenViewState
.
SignOut
()))
.
onErrorReturn
(
::
parseError
)
}
val
state
=
restoreStateObservable
val
state
=
restoreStateObservable
.
mergeWith
(
fetchSettings
)
.
mergeWith
(
fetchSettings
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenController.kt
View file @
5d067764
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.splash
...
@@ -2,6 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.splash
import
android.view.View
import
android.view.View
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.base.IBottomNavigation
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.conductor.BigantoBaseController
...
@@ -23,6 +24,8 @@ class SplashScreenController :
...
@@ -23,6 +24,8 @@ class SplashScreenController :
override
fun
onViewBound
(
v
:
View
)
{
override
fun
onViewBound
(
v
:
View
)
{
toolBar
.
hideAll
()
bottomNavigation
.
hide
()
}
}
override
fun
injectDependencies
()
{
override
fun
injectDependencies
()
{
...
@@ -46,6 +49,8 @@ class SplashScreenController :
...
@@ -46,6 +49,8 @@ class SplashScreenController :
// @Inject
// @Inject
// lateinit var ac: RoomParkMainActivity
// lateinit var ac: RoomParkMainActivity
@Inject
lateinit
var
bottomNavigation
:
IBottomNavigation
override
fun
render
(
viewState
:
SplashScreenViewState
)
{
override
fun
render
(
viewState
:
SplashScreenViewState
)
{
when
(
viewState
){
when
(
viewState
){
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenDI.kt
View file @
5d067764
package
com.biganto.visual.roompark.presentation.screen.splash
package
com.biganto.visual.roompark.presentation.screen.splash
import
android.content.Context
import
android.content.Context
import
com.biganto.visual.roompark.base.IBottomNavigation
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import
com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import
com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import
com.biganto.visual.roompark.data.repository.db.requrey.DbModule
...
@@ -50,4 +51,8 @@ abstract class SplashScreenModule{
...
@@ -50,4 +51,8 @@ abstract class SplashScreenModule{
// @Binds
// @Binds
// abstract fun provideToolbar(activitiy: RoomParkMainActivity): ICollapsingToolBar
// abstract fun provideToolbar(activitiy: RoomParkMainActivity): ICollapsingToolBar
@PerScreen
@Binds
abstract
fun
provideBottomNavigation
(
activitiy
:
RoomParkMainActivity
):
IBottomNavigation
}
}
app/src/main/res/layout/authentication_screen.xml
View file @
5d067764
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
<com.google.android.material.textfield.TextInputEditText
<com.google.android.material.textfield.TextInputEditText
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:
maxLength=
"64
"
android:
inputType=
"textEmailAddress
"
android:maxLines=
"1"
/>
android:maxLines=
"1"
/>
</com.google.android.material.textfield.TextInputLayout>
</com.google.android.material.textfield.TextInputLayout>
...
@@ -86,6 +86,7 @@
...
@@ -86,6 +86,7 @@
<com.google.android.material.textfield.TextInputEditText
<com.google.android.material.textfield.TextInputEditText
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:inputType=
"textPassword"
android:maxLength=
"64"
android:maxLength=
"64"
android:maxLines=
"1"
/>
android:maxLines=
"1"
/>
</com.google.android.material.textfield.TextInputLayout>
</com.google.android.material.textfield.TextInputLayout>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment