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
95fa0705
Commit
95fa0705
authored
Nov 06, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added auth validate method
parent
323bf812
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
0 deletions
+9
-0
ContextModule.kt
...va/com/biganto/visual/roompark/di/dagger/ContextModule.kt
+8
-0
AuthContract.kt
...m/biganto/visual/roompark/domain/contract/AuthContract.kt
+1
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/di/dagger/ContextModule.kt
View file @
95fa0705
package
com.biganto.visual.roompark.di.dagger
import
com.biganto.visual.androidplayer.data.repository.local.ILocalStore
import
com.biganto.visual.roompark.data.local.UserState
import
com.biganto.visual.roompark.data.repository.api.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.mapper.fromRaw
...
...
@@ -56,6 +57,13 @@ class AppModule() {
.
flatMap
{
db
.
upsertUser
(
it
)
}
.
doOnNext
{
local
.
setRecentUser
(
it
.
uuid
.
toString
())
}
.
map
(
::
fromEntity
)
override
fun
validateAuthState
():
Observable
<
Boolean
>
=
local
.
recentUser
()
.
map
{
when
(
it
){
is
UserState
.
NotAuthenticated
->
false
is
UserState
.
Authenticated
->
true
else
->
false
}
}
}
@Module
()
...
...
app/src/main/java/com/biganto/visual/roompark/domain/contract/AuthContract.kt
View file @
95fa0705
...
...
@@ -11,4 +11,5 @@ import io.reactivex.Observable
interface
AuthContract
{
fun
signIn
(
email
:
String
,
password
:
String
)
:
Observable
<
AuthInfoModel
>
fun
signOut
()
:
Completable
fun
validateAuthState
():
Observable
<
Boolean
>
}
\ No newline at end of file
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