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
cc0a0a79
Commit
cc0a0a79
authored
Nov 07, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/bindsRepository' into develop
parents
99dff8b6
17420714
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
230 additions
and
145 deletions
+230
-145
build.gradle
app/build.gradle
+4
-0
AuthRepository.kt
...anto/visual/roompark/data/data_provider/AuthRepository.kt
+18
-21
UserHolder.kt
...java/com/biganto/visual/roompark/data/local/UserHolder.kt
+13
-2
RetrofitRepository.kt
...ompark/data/repository/api/retrofit/RetrofitRepository.kt
+2
-2
RetrofitModule.kt
...oompark/data/repository/api/retrofit/di/RetrofitModule.kt
+8
-8
RequeryRepository.kt
.../roompark/data/repository/db/requrey/RequeryRepository.kt
+25
-2
AppComponent.kt
...ava/com/biganto/visual/roompark/di/dagger/AppComponent.kt
+8
-3
ContextModule.kt
...va/com/biganto/visual/roompark/di/dagger/ContextModule.kt
+12
-82
DataModule.kt
.../java/com/biganto/visual/roompark/di/dagger/DataModule.kt
+105
-0
authUseCase.kt
...om/biganto/visual/roompark/domain/use_case/authUseCase.kt
+1
-2
ScreenDI.kt
...anto/visual/roompark/presentation/screen/auth/ScreenDI.kt
+6
-4
ScreenController.kt
...l/roompark/presentation/screen/splash/ScreenController.kt
+11
-9
ScreenDI.kt
...to/visual/roompark/presentation/screen/splash/ScreenDI.kt
+9
-8
ScreenPresenter.kt
...al/roompark/presentation/screen/splash/ScreenPresenter.kt
+6
-1
ScreenViewState.kt
...al/roompark/presentation/screen/splash/ScreenViewState.kt
+2
-1
No files found.
app/build.gradle
View file @
cc0a0a79
...
...
@@ -143,6 +143,10 @@ dependencies {
//RxSharedPreferences
implementation
"com.afollestad:rxkprefs:1.2.5"
implementation
'com.android.support:support-annotations:28.0.0'
implementation
group:
'com.google.code.findbugs'
,
name:
'jsr305'
,
version:
'3.0.2'
//Tests
testImplementation
'junit:junit:4.12'
androidTestImplementation
'androidx.test:runner:1.2.0'
...
...
app/src/main/java/com/biganto/visual/roompark/data/data_provider/AuthRepository.kt
View file @
cc0a0a79
package
com.biganto.visual.roompark.data.data_provider
import
com.biganto.visual.roompark.data.repository.api.IRoomParkApi
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.domain.model.AuthInfoModel
import
io.reactivex.Completable
import
io.reactivex.Observable
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 29.10.2019.
*/
class
AuthRepository
@Inject
constructor
(
val
roomparkApi
:
IRoomParkApi
)
:
AuthContract
{
override
fun
signIn
(
email
:
String
,
password
:
String
):
Observable
<
AuthInfoModel
>
=
roomparkApi
.
authenticate
(
email
,
password
)
.
map
{
AuthInfoModel
(
""
,
2
,
""
,
""
)
}
override
fun
signOut
():
Completable
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
}
}
\ No newline at end of file
//
//class AuthRepository @Inject constructor(
// val roomparkApi:IRoomParkApi
//) : AuthContract{
//
// override fun validateAuthState(): Observable<Boolean> {
// TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
// }
//
// override fun signIn(email: String, password: String): Observable<AuthInfoModel> =
// roomparkApi.authenticate(email,password)
// .map { AuthInfoModel("",2,"","") }
//
// override fun signOut(): Completable {
// TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
// }
//
//}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/local/UserHolder.kt
View file @
cc0a0a79
...
...
@@ -3,18 +3,29 @@ package com.biganto.visual.roompark.data.local
import
android.content.Context
import
com.afollestad.rxkprefs.rxkPrefs
import
com.biganto.visual.androidplayer.data.repository.local.ILocalStore
import
dagger.Binds
import
dagger.Module
import
io.reactivex.Completable
import
io.reactivex.Observable
import
timber.log.Timber
import
javax.inject.Inject
import
javax.inject.Singleton
/**
* Created by Vladislav Bogdashkin on 14.06.2018.
*/
@Singleton
@Module
abstract
class
LocalStorage
(){
@Binds
abstract
fun
provideStore
(
store
:
UserHolder
):
ILocalStore
}
class
UserHolder
@Inject
constructor
(
val
context
:
Context
)
:
ILocalStore
{
init
{
Timber
.
d
(
" inited"
)
}
private
val
prefs
=
rxkPrefs
(
context
)
companion
object
{
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/RetrofitRepository.kt
View file @
cc0a0a79
...
...
@@ -10,6 +10,7 @@ import io.reactivex.ObservableTransformer
import
retrofit2.Response
import
retrofit2.Retrofit
import
timber.log.Timber
import
javax.inject.Inject
import
javax.inject.Singleton
/**
...
...
@@ -18,8 +19,7 @@ import javax.inject.Singleton
const
val
DEFAULT_ARTICLE_PAGE_SIZE
=
10
@Singleton
class
RetrofitRepository
(
retrofit
:
Retrofit
)
:
IRoomParkApi
{
class
RetrofitRepository
@Inject
constructor
(
retrofit
:
Retrofit
)
:
IRoomParkApi
{
private
val
api
=
retrofit
.
create
(
IRoomParkMobileApi
::
class
.
java
)
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/di/RetrofitModule.kt
View file @
cc0a0a79
package
com.biganto.visual.roompark.data.repository.api.retrofit.di
import
android.
app.Application
import
android.
content.Context
import
com.biganto.visual.roompark.data.repository.api.retrofit.IRoomParkMobileApi
import
com.biganto.visual.roompark.data.repository.api.retrofit.raw.ErrorRaw
import
com.biganto.visual.roompark.data.repository.api.retrofit.util.DateSerializer
...
...
@@ -24,8 +24,6 @@ import retrofit2.converter.gson.GsonConverterFactory
import
timber.log.Timber
import
java.util.*
import
java.util.concurrent.TimeUnit
import
javax.inject.Named
import
javax.inject.Singleton
/**
* Created by Vladislav Bogdashkin on 29.10.2019.
...
...
@@ -37,7 +35,7 @@ private const val TIMEOUT_SECONDS=120L
private
const
val
WRITE_SECONDS
=
120L
private
const
val
READ_SECONDS
=
120L
@Module
()
@Module
class
RetrofitModule
{
// var networkMonitor = LiveNetworkMonitor(context)
...
...
@@ -69,7 +67,7 @@ class RetrofitModule{
.
addInterceptor
(
VersionValidationInterceptor
(
appVersionManager
))
.
addInterceptor
(
HttpLoggingInterceptor
{
Timber
.
tag
(
"OkHttp"
).
d
(
"RetroLogger: $it"
)
}
.
setLevel
(
HttpLoggingInterceptor
.
Level
.
NONE
)
.
setLevel
(
HttpLoggingInterceptor
.
Level
.
BODY
)
)
.
addInterceptor
{
it
.
proceed
(
...
...
@@ -93,10 +91,12 @@ class RetrofitModule{
// .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
// .build()
//@Inject
//lateinit var context: RoomParkApplication
@Provides
@Singleton
@Named
(
"roomParkApi"
)
fun
provideRetrofitRoomParkApi
(
context
:
Application
):
Retrofit
=
// @Named("roomParkApi")
fun
provideRetrofitRoomParkApi
(
context
:
Context
):
Retrofit
=
Retrofit
.
Builder
()
.
baseUrl
(
IRoomParkMobileApi
.
BASE_URL
)
.
client
(
client
(
AppVersionManager
(
context
),
LiveNetworkMonitor
(
context
)))
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/RequeryRepository.kt
View file @
cc0a0a79
package
com.biganto.visual.roompark.data.repository.db.requrey
import
android.content.Context
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.model.Models
import
com.biganto.visual.roompark.data.repository.db.requrey.model.UserEntity
import
com.biganto.visual.roompark.di.dagger.DATABASE_VERSION
import
dagger.Module
import
dagger.Provides
import
io.requery.Persistable
import
io.requery.android.sqlite.DatabaseSource
import
io.requery.reactivex.KotlinReactiveEntityStore
import
io.requery.sql.KotlinEntityDataStore
import
timber.log.Timber
import
javax.inject.Inject
import
javax.inject.Singleton
/**
* Created by Vladislav Bogdashkin on 13.06.2018.
*/
@Singleton
@Module
class
DbModule
{
@Provides
fun
provideStore
(
context
:
Context
):
KotlinReactiveEntityStore
<
Persistable
>
{
Timber
.
d
(
"Kotlin store creating.."
)
val
source
=
DatabaseSource
(
context
,
Models
.
DEFAULT
,
"BigantoPerfect"
,
DATABASE_VERSION
)
source
.
setLoggingEnabled
(
false
)
val
store
=
KotlinEntityDataStore
<
Persistable
>(
source
.
configuration
)
Timber
.
d
(
"Kotlin store %s"
,
source
)
return
KotlinReactiveEntityStore
(
store
)
}
}
class
RequeryRepository
@Inject
constructor
(
private
val
store
:
KotlinReactiveEntityStore
<
Persistable
>
)
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/AppComponent.kt
View file @
cc0a0a79
package
com.biganto.visual.roompark.di.dagger
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import
com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import
dagger.Component
import
dagger.android.AndroidInjectionModule
import
dagger.android.AndroidInjector
...
...
@@ -17,7 +19,9 @@ import javax.inject.Singleton
@Component
(
modules
=
[
AppModule
::
class
,
DataModule
::
class
,
// RetrofitModule::class,
RetrofitModule
::
class
,
DbModule
::
class
,
// LocalStorage::class,
// AppVersionModule::class,
AndroidInjectionModule
::
class
,
AndroidSupportInjectionModule
::
class
,
...
...
@@ -38,9 +42,10 @@ interface AppComponent : AndroidInjector<RoomParkApplication>{
// @BindsInstance
// @Named("r
etrofit
")
// @Named("r
oomParkApi
")
// fun retrofit(
// retorfitModule: RetrofitModule):Builder
// retorfitModule: RetrofitModule
// ): DaggerDataComponent.Builder
//
// fun build(): AppComponent
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/ContextModule.kt
View file @
cc0a0a79
package
com.biganto.visual.roompark.di.dagger
import
android.app.Application
import
com.biganto.visual.androidplayer.data.repository.local.ILocalStore
import
com.biganto.visual.roompark.base.RoomParkApplication
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
...
...
@@ -8,13 +10,12 @@ import com.biganto.visual.roompark.data.repository.mapper.fromRaw
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.domain.model.AuthInfoModel
import
com.biganto.visual.roompark.domain.model.fromEntity
import
dagger.Binds
import
dagger.Module
import
dagger.Provides
import
io.reactivex.Completable
import
io.reactivex.Observable
import
timber.log.Timber
import
javax.inject.Inject
import
javax.inject.Singleton
/**
* Created by Vladislav Bogdashkin on 13.06.2018.
...
...
@@ -35,14 +36,17 @@ const val FILES_CACHE_LIMIT_SECONDS_INACTIVE = 60L
const
val
DATABASE_VERSION
=
6
@Module
class
AppModule
()
{
}
abstract
class
AppModule
{
@Binds
abstract
fun
provideAppContext
(
app
:
RoomParkApplication
):
Application
}
class
AuthContractModule
@Inject
constructor
(
val
local
:
ILocalStore
,
val
api
:
IRoomParkApi
,
val
db
:
IDb
class
AuthContractModule
@Inject
constructor
(
private
val
local
:
ILocalStore
,
private
val
api
:
IRoomParkApi
,
private
val
db
:
IDb
):
AuthContract
{
init
{
...
...
@@ -66,77 +70,3 @@ class AppModule() {
}
}
}
@Module
()
class
DataModule
()
{
@Provides
@Singleton
fun
provideAuthContract
()
:
AuthContract
=
AuthContractModule
()
/*
@Provides
@Singleton
fun provieApi(@Named("bigantoApi") retorfit:Retrofit): IApi {
return RetrofitRepository(retorfit)
}
@Provides
@Singleton
fun provieRoomParkApi(@Named("roomParkApi") retorfit:Retrofit): IRoomParkApi {
return RoomParkRetrofitRepository(retorfit)
}
@Provides
@Singleton
fun provideDb(context:Application): IDb {
return RequeryRepository(getRequeryDataStore(context))
}
@Provides
@Singleton
fun provideFileModule(context:Application): FilesModule {
return FilesModule(context)
}
@Provides
@Singleton
fun providesNetworkListener(context:Application): INetworkMonitor {
return LiveNetworkMonitor(context)
}
@Provides
@Singleton
fun getRequeryDataStore(context:Application): KotlinReactiveEntityStore<Persistable> {
Timber.d("Kotlin store creating..")
val source = DatabaseSource(context, Models.DEFAULT, "BigantoPerfect", DATABASE_VERSION)
source.setLoggingEnabled(false)
// if ( BuildConfig.DEBUG) {
// // use this in development mode to drop and recreate the tables on every upgrade
// source.setTableCreationMode(TableCreationMode.DROP_CREATE)
// }
val store = KotlinEntityDataStore<Persistable>(source.configuration)
Timber.d("Kotlin store %s",source)
return KotlinReactiveEntityStore(store)
// // override onUpgrade to handle migrating to a new version
// val configuration = source.configuration
// return ReactiveSupport.toReactiveStore(
// EntityDataStore<Persistable>(configuration))
}
*/
}
//
//@Singleton // <-- YES
//class MyServiceImpl @Inject // <-- YES
//constructor(private val apiService: ApiService)// <-- YES
// : MyService
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/di/dagger/DataModule.kt
0 → 100644
View file @
cc0a0a79
package
com.biganto.visual.roompark.di.dagger
import
com.biganto.visual.androidplayer.data.repository.local.ILocalStore
import
com.biganto.visual.roompark.data.local.UserHolder
import
com.biganto.visual.roompark.data.repository.api.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.api.retrofit.RetrofitRepository
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.RequeryRepository
import
dagger.Binds
import
dagger.Component
import
dagger.Module
@Component
interface
DataComponent
{
}
@Module
abstract
class
DataModule
{
// @Binds
// abstract fun provideAuthContract(contract: AuthContractModule) : AuthContract
// @Binds
// abstract fun provideModule(m:RetrofitModule) : RetrofitModule
// @Binds
// abstract fun provideRpRetrofit(retrofit:Retrofit) : Retrofit
//
@Binds
abstract
fun
provideRoomParkApi
(
api
:
RetrofitRepository
)
:
IRoomParkApi
// @Binds
// abstract fun provideStore(store: KotlinReactiveEntityStore<Persistable>) : KotlinReactiveEntityStore<Persistable>
@Binds
abstract
fun
provideDb
(
db
:
RequeryRepository
)
:
IDb
@Binds
abstract
fun
provideLocalStorage
(
local
:
UserHolder
)
:
ILocalStore
/*
@Provides
@Singleton
fun provieApi(@Named("bigantoApi") retorfit:Retrofit): IApi {
return RetrofitRepository(retorfit)
}
@Provides
@Singleton
fun provieRoomParkApi(@Named("roomParkApi") retorfit:Retrofit): IRoomParkApi {
return RoomParkRetrofitRepository(retorfit)
}
@Provides
@Singleton
fun provideDb(context:Application): IDb {
return RequeryRepository(getRequeryDataStore(context))
}
@Provides
@Singleton
fun provideFileModule(context:Application): FilesModule {
return FilesModule(context)
}
@Provides
@Singleton
fun providesNetworkListener(context:Application): INetworkMonitor {
return LiveNetworkMonitor(context)
}
@Provides
@Singleton
fun getRequeryDataStore(context:Application): KotlinReactiveEntityStore<Persistable> {
Timber.d("Kotlin store creating..")
val source = DatabaseSource(context, Models.DEFAULT, "BigantoPerfect", DATABASE_VERSION)
source.setLoggingEnabled(false)
// if ( BuildConfig.DEBUG) {
// // use this in development mode to drop and recreate the tables on every upgrade
// source.setTableCreationMode(TableCreationMode.DROP_CREATE)
// }
val store = KotlinEntityDataStore<Persistable>(source.configuration)
Timber.d("Kotlin store %s",source)
return KotlinReactiveEntityStore(store)
// // override onUpgrade to handle migrating to a new version
// val configuration = source.configuration
// return ReactiveSupport.toReactiveStore(
// EntityDataStore<Persistable>(configuration))
}
*/
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/use_case/authUseCase.kt
View file @
cc0a0a79
package
com.biganto.visual.roompark.domain.use_case
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
io.reactivex.Observable
import
javax.inject.Inject
/**
...
...
@@ -12,7 +11,7 @@ class AuthUseCase @Inject constructor(
private
val
authContract
:
AuthContract
){
fun
validateAuth
()
=
Observable
.
just
(
true
)
fun
validateAuth
()
=
authContract
.
validateAuthState
(
)
fun
signIn
(
login
:
String
,
pwd
:
String
)
=
authContract
.
signIn
(
login
,
pwd
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenDI.kt
View file @
cc0a0a79
...
...
@@ -2,9 +2,9 @@ package com.biganto.visual.roompark.presentation.screen.auth
import
android.content.Context
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.d
i.dagger.AppComponent
import
com.biganto.visual.roompark.d
i.dagger.AuthContract
Module
import
com.biganto.visual.roompark.di.dagger.
PerScreen
import
com.biganto.visual.roompark.d
ata.repository.api.retrofit.di.RetrofitModule
import
com.biganto.visual.roompark.d
ata.repository.db.requrey.Db
Module
import
com.biganto.visual.roompark.di.dagger.
*
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
dagger.Binds
import
dagger.BindsInstance
...
...
@@ -14,7 +14,8 @@ import dagger.Module
@PerScreen
@Component
(
modules
=
[
AuthScreenModule
::
class
],
modules
=
[
AuthScreenModule
::
class
,
DataModule
::
class
,
RetrofitModule
::
class
,
AppModule
::
class
,
DbModule
::
class
],
dependencies
=
[
AppComponent
::
class
])
interface
AuthScreenComponent
{
...
...
@@ -41,4 +42,5 @@ abstract class AuthScreenModule{
@PerScreen
@Binds
abstract
fun
provideAuth
(
contract
:
AuthContractModule
):
AuthContract
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenController.kt
View file @
cc0a0a79
...
...
@@ -7,9 +7,9 @@ import com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.presentation.screen.auth.AuthScreenController
import
com.biganto.visual.roompark.presentation.screen.home.home_routing.HomeBottomNavigationController
import
com.bluelinelabs.conductor.RouterTransaction
import
com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import
com.google.android.material.snackbar.Snackbar
import
javax.inject.Inject
/**
...
...
@@ -30,9 +30,6 @@ class SplashScreenController :
getComponent
()
}
@Inject
lateinit
var
tb
:
ICollapsingToolBar
@Inject
override
lateinit
var
injectedPresenter
:
SplashScreenPresenter
...
...
@@ -54,7 +51,8 @@ class SplashScreenController :
override
fun
render
(
viewState
:
SplashScreenViewState
)
{
when
(
viewState
){
is
SplashScreenViewState
.
Idle
->
render
(
viewState
)
is
SplashScreenViewState
.
ToScreen
->
render
(
viewState
)
is
SplashScreenViewState
.
ToAuthScreen
->
render
(
viewState
)
is
SplashScreenViewState
.
ToHomeScreen
->
render
(
viewState
)
}
}
...
...
@@ -62,14 +60,18 @@ class SplashScreenController :
}
private
fun
render
(
viewState
:
SplashScreenViewState
.
ToScreen
){
snackbar
.
showSnackBar
(
viewState
.
message
,
Snackbar
.
LENGTH_LONG
)
// tb.hideAll()
private
fun
render
(
viewState
:
SplashScreenViewState
.
ToAuthScreen
){
router
.
pushController
(
RouterTransaction
.
with
(
AuthScreenController
())
.
popChangeHandler
(
FadeChangeHandler
())
.
pushChangeHandler
(
FadeChangeHandler
())
)
// snacky.showSnackBar("lul")
}
private
fun
render
(
viewState
:
SplashScreenViewState
.
ToHomeScreen
){
router
.
setRoot
(
RouterTransaction
.
with
(
HomeBottomNavigationController
())
.
popChangeHandler
(
FadeChangeHandler
())
.
pushChangeHandler
(
FadeChangeHandler
())
)
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenDI.kt
View file @
cc0a0a79
package
com.biganto.visual.roompark.presentation.screen.splash
import
android.content.Context
import
com.biganto.visual.roompark.base.ICollapsingToolBar
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.d
i.dagger.AppComponent
import
com.biganto.visual.roompark.d
i.dagger.AuthContract
Module
import
com.biganto.visual.roompark.di.dagger.
PerScreen
import
com.biganto.visual.roompark.d
ata.repository.api.retrofit.di.RetrofitModule
import
com.biganto.visual.roompark.d
ata.repository.db.requrey.Db
Module
import
com.biganto.visual.roompark.di.dagger.
*
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.presentation.screen.auth.AuthScreenModule
import
dagger.Binds
import
dagger.BindsInstance
import
dagger.Component
...
...
@@ -18,7 +18,7 @@ import dagger.Module
@PerScreen
@Component
(
modules
=
[
SplashScreen
Module
::
class
],
modules
=
[
AuthScreenModule
::
class
,
DataModule
::
class
,
RetrofitModule
::
class
,
AppModule
::
class
,
Db
Module
::
class
],
dependencies
=
[
AppComponent
::
class
])
interface
SplashScreenComponent
{
...
...
@@ -46,7 +46,8 @@ abstract class SplashScreenModule{
@Binds
abstract
fun
provideAuth
(
contract
:
AuthContractModule
):
AuthContract
@PerScreen
@Binds
abstract
fun
provideToolbar
(
activitiy
:
RoomParkMainActivity
):
ICollapsingToolBar
// @PerScreen
// @Binds
// abstract fun provideToolbar(activitiy: RoomParkMainActivity): ICollapsingToolBar
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenPresenter.kt
View file @
cc0a0a79
...
...
@@ -18,9 +18,14 @@ class SplashScreenPresenter @Inject constructor(
:
BigantoBasePresenter
<
SplashScreen
,
SplashScreenViewState
>()
{
override
fun
bindIntents
()
{
val
state
=
restoreStateObservable
.
mergeWith
(
interactor
.
getAuth
()
.
map
{
SplashScreenViewState
.
ToScreen
(
it
.
toString
())
})
.
map
{
if
(
it
)
SplashScreenViewState
.
ToHomeScreen
()
else
SplashScreenViewState
.
ToAuthScreen
()
}
)
subscribeViewState
(
state
.
cast
(
SplashScreenViewState
::
class
.
java
),
SplashScreen
::
render
)
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenViewState.kt
View file @
cc0a0a79
...
...
@@ -9,5 +9,6 @@ import com.biganto.visual.roompark.conductor.BigantoBaseViewState
sealed
class
SplashScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
SplashScreenViewState
()
class
ToScreen
(
val
message
:
String
)
:
SplashScreenViewState
()
class
ToHomeScreen
()
:
SplashScreenViewState
()
class
ToAuthScreen
()
:
SplashScreenViewState
()
}
\ 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