Commit 17420714 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

fix dagger flow

parent e8069009
...@@ -143,6 +143,10 @@ dependencies { ...@@ -143,6 +143,10 @@ dependencies {
//RxSharedPreferences //RxSharedPreferences
implementation "com.afollestad:rxkprefs:1.2.5" 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 //Tests
testImplementation 'junit:junit:4.12' testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test:runner:1.2.0'
......
package com.biganto.visual.roompark.data.data_provider 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. * Created by Vladislav Bogdashkin on 29.10.2019.
*/ */
//
class AuthRepository @Inject constructor( //class AuthRepository @Inject constructor(
val roomparkApi:IRoomParkApi // val roomparkApi:IRoomParkApi
) : AuthContract{ //) : AuthContract{
//
override fun signIn(email: String, password: String): Observable<AuthInfoModel> = // override fun validateAuthState(): Observable<Boolean> {
roomparkApi.authenticate(email,password) // TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
.map { AuthInfoModel("",2,"","") } // }
//
override fun signOut(): Completable { // override fun signIn(email: String, password: String): Observable<AuthInfoModel> =
TODO("not implemented") //To change body of created functions use File | Settings | File Templates. // roomparkApi.authenticate(email,password)
} // .map { AuthInfoModel("",2,"","") }
//
} // override fun signOut(): Completable {
\ No newline at end of file // TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
// }
//
//}
\ No newline at end of file
...@@ -3,18 +3,29 @@ package com.biganto.visual.roompark.data.local ...@@ -3,18 +3,29 @@ package com.biganto.visual.roompark.data.local
import android.content.Context import android.content.Context
import com.afollestad.rxkprefs.rxkPrefs import com.afollestad.rxkprefs.rxkPrefs
import com.biganto.visual.androidplayer.data.repository.local.ILocalStore import com.biganto.visual.androidplayer.data.repository.local.ILocalStore
import dagger.Binds
import dagger.Module
import io.reactivex.Completable import io.reactivex.Completable
import io.reactivex.Observable import io.reactivex.Observable
import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton
/** /**
* Created by Vladislav Bogdashkin on 14.06.2018. * 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 class UserHolder @Inject constructor(val context : Context) : ILocalStore
{ {
init {
Timber.d(" inited")
}
private val prefs = rxkPrefs(context) private val prefs = rxkPrefs(context)
companion object { companion object {
......
...@@ -10,6 +10,7 @@ import io.reactivex.ObservableTransformer ...@@ -10,6 +10,7 @@ import io.reactivex.ObservableTransformer
import retrofit2.Response import retrofit2.Response
import retrofit2.Retrofit import retrofit2.Retrofit
import timber.log.Timber import timber.log.Timber
import javax.inject.Inject
import javax.inject.Singleton import javax.inject.Singleton
/** /**
...@@ -18,8 +19,7 @@ import javax.inject.Singleton ...@@ -18,8 +19,7 @@ import javax.inject.Singleton
const val DEFAULT_ARTICLE_PAGE_SIZE = 10 const val DEFAULT_ARTICLE_PAGE_SIZE = 10
@Singleton class RetrofitRepository @Inject constructor(retrofit: Retrofit) : IRoomParkApi {
class RetrofitRepository(retrofit: Retrofit) : IRoomParkApi {
private val api = retrofit.create(IRoomParkMobileApi::class.java) private val api = retrofit.create(IRoomParkMobileApi::class.java)
......
package com.biganto.visual.roompark.data.repository.api.retrofit.di 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.IRoomParkMobileApi
import com.biganto.visual.roompark.data.repository.api.retrofit.raw.ErrorRaw import com.biganto.visual.roompark.data.repository.api.retrofit.raw.ErrorRaw
import com.biganto.visual.roompark.data.repository.api.retrofit.util.DateSerializer import com.biganto.visual.roompark.data.repository.api.retrofit.util.DateSerializer
...@@ -24,8 +24,6 @@ import retrofit2.converter.gson.GsonConverterFactory ...@@ -24,8 +24,6 @@ import retrofit2.converter.gson.GsonConverterFactory
import timber.log.Timber import timber.log.Timber
import java.util.* import java.util.*
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import javax.inject.Named
import javax.inject.Singleton
/** /**
* Created by Vladislav Bogdashkin on 29.10.2019. * Created by Vladislav Bogdashkin on 29.10.2019.
...@@ -37,7 +35,7 @@ private const val TIMEOUT_SECONDS=120L ...@@ -37,7 +35,7 @@ private const val TIMEOUT_SECONDS=120L
private const val WRITE_SECONDS=120L private const val WRITE_SECONDS=120L
private const val READ_SECONDS=120L private const val READ_SECONDS=120L
@Module() @Module
class RetrofitModule{ class RetrofitModule{
// var networkMonitor = LiveNetworkMonitor(context) // var networkMonitor = LiveNetworkMonitor(context)
...@@ -69,7 +67,7 @@ class RetrofitModule{ ...@@ -69,7 +67,7 @@ class RetrofitModule{
.addInterceptor(VersionValidationInterceptor(appVersionManager)) .addInterceptor(VersionValidationInterceptor(appVersionManager))
.addInterceptor( .addInterceptor(
HttpLoggingInterceptor { Timber.tag("OkHttp").d("RetroLogger: $it") } HttpLoggingInterceptor { Timber.tag("OkHttp").d("RetroLogger: $it") }
.setLevel(HttpLoggingInterceptor.Level.NONE) .setLevel(HttpLoggingInterceptor.Level.BODY)
) )
.addInterceptor { .addInterceptor {
it.proceed( it.proceed(
...@@ -93,10 +91,12 @@ class RetrofitModule{ ...@@ -93,10 +91,12 @@ class RetrofitModule{
// .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) // .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
// .build() // .build()
//@Inject
//lateinit var context: RoomParkApplication
@Provides @Provides
@Singleton // @Named("roomParkApi")
@Named("roomParkApi") fun provideRetrofitRoomParkApi(context: Context): Retrofit =
fun provideRetrofitRoomParkApi(context: Application): Retrofit =
Retrofit.Builder() Retrofit.Builder()
.baseUrl(IRoomParkMobileApi.BASE_URL) .baseUrl(IRoomParkMobileApi.BASE_URL)
.client(client(AppVersionManager(context), LiveNetworkMonitor(context))) .client(client(AppVersionManager(context), LiveNetworkMonitor(context)))
......
package com.biganto.visual.roompark.data.repository.db.requrey 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.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.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.Persistable
import io.requery.android.sqlite.DatabaseSource
import io.requery.reactivex.KotlinReactiveEntityStore import io.requery.reactivex.KotlinReactiveEntityStore
import io.requery.sql.KotlinEntityDataStore
import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton
/** /**
* Created by Vladislav Bogdashkin on 13.06.2018. * 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( class RequeryRepository @Inject constructor(
private val store: KotlinReactiveEntityStore<Persistable> private val store: KotlinReactiveEntityStore<Persistable>
) )
......
package com.biganto.visual.roompark.di.dagger package com.biganto.visual.roompark.di.dagger
import com.biganto.visual.roompark.base.RoomParkApplication 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.Component
import dagger.android.AndroidInjectionModule import dagger.android.AndroidInjectionModule
import dagger.android.AndroidInjector import dagger.android.AndroidInjector
...@@ -17,7 +19,9 @@ import javax.inject.Singleton ...@@ -17,7 +19,9 @@ import javax.inject.Singleton
@Component(modules = @Component(modules =
[ AppModule::class, [ AppModule::class,
DataModule::class, DataModule::class,
// RetrofitModule::class, RetrofitModule::class,
DbModule::class,
// LocalStorage::class,
// AppVersionModule::class, // AppVersionModule::class,
AndroidInjectionModule::class, AndroidInjectionModule::class,
AndroidSupportInjectionModule::class, AndroidSupportInjectionModule::class,
...@@ -38,9 +42,10 @@ interface AppComponent : AndroidInjector<RoomParkApplication>{ ...@@ -38,9 +42,10 @@ interface AppComponent : AndroidInjector<RoomParkApplication>{
// @BindsInstance // @BindsInstance
// @Named("retrofit") // @Named("roomParkApi")
// fun retrofit( // fun retrofit(
// retorfitModule: RetrofitModule):Builder // retorfitModule: RetrofitModule
// ): DaggerDataComponent.Builder
// //
// fun build(): AppComponent // fun build(): AppComponent
......
package com.biganto.visual.roompark.di.dagger package com.biganto.visual.roompark.di.dagger
import android.app.Application
import com.biganto.visual.androidplayer.data.repository.local.ILocalStore 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.local.UserState
import com.biganto.visual.roompark.data.repository.api.IRoomParkApi 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.db.IDb
...@@ -14,7 +16,6 @@ import io.reactivex.Completable ...@@ -14,7 +16,6 @@ import io.reactivex.Completable
import io.reactivex.Observable import io.reactivex.Observable
import timber.log.Timber import timber.log.Timber
import javax.inject.Inject import javax.inject.Inject
import javax.inject.Singleton
/** /**
* Created by Vladislav Bogdashkin on 13.06.2018. * Created by Vladislav Bogdashkin on 13.06.2018.
...@@ -35,10 +36,14 @@ const val FILES_CACHE_LIMIT_SECONDS_INACTIVE = 60L ...@@ -35,10 +36,14 @@ const val FILES_CACHE_LIMIT_SECONDS_INACTIVE = 60L
const val DATABASE_VERSION = 6 const val DATABASE_VERSION = 6
@Module @Module
class AppModule abstract class AppModule{
@Binds
abstract fun provideAppContext(app: RoomParkApplication): Application
}
class AuthContractModule @Inject constructor(
class AuthContractModule @Inject constructor(
private val local:ILocalStore, private val local:ILocalStore,
private val api:IRoomParkApi, private val api:IRoomParkApi,
private val db:IDb private val db:IDb
...@@ -65,77 +70,3 @@ class AppModule ...@@ -65,77 +70,3 @@ class AppModule
} } } }
} }
@Module
abstract class DataModule {
@Binds
@Singleton
abstract fun provideAuthContract(contract: AuthContractModule) : AuthContract
/*
@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
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
...@@ -2,9 +2,9 @@ package com.biganto.visual.roompark.presentation.screen.auth ...@@ -2,9 +2,9 @@ package com.biganto.visual.roompark.presentation.screen.auth
import android.content.Context import android.content.Context
import com.biganto.visual.roompark.base.RoomParkMainActivity import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.di.dagger.AppComponent import com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import com.biganto.visual.roompark.di.dagger.AuthContractModule import com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import com.biganto.visual.roompark.di.dagger.PerScreen import com.biganto.visual.roompark.di.dagger.*
import com.biganto.visual.roompark.domain.contract.AuthContract import com.biganto.visual.roompark.domain.contract.AuthContract
import dagger.Binds import dagger.Binds
import dagger.BindsInstance import dagger.BindsInstance
...@@ -14,7 +14,8 @@ import dagger.Module ...@@ -14,7 +14,8 @@ import dagger.Module
@PerScreen @PerScreen
@Component( @Component(
modules = [AuthScreenModule::class], modules = [AuthScreenModule::class,DataModule::class,RetrofitModule::class,AppModule::class, DbModule::class
],
dependencies = [AppComponent::class]) dependencies = [AppComponent::class])
interface AuthScreenComponent { interface AuthScreenComponent {
...@@ -41,4 +42,5 @@ abstract class AuthScreenModule{ ...@@ -41,4 +42,5 @@ abstract class AuthScreenModule{
@PerScreen @PerScreen
@Binds @Binds
abstract fun provideAuth(contract: AuthContractModule): AuthContract abstract fun provideAuth(contract: AuthContractModule): AuthContract
} }
...@@ -7,9 +7,9 @@ import com.biganto.visual.roompark.base.RoomParkApplication ...@@ -7,9 +7,9 @@ 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.auth.AuthScreenController
import com.biganto.visual.roompark.presentation.screen.home.home_routing.HomeBottomNavigationController
import com.bluelinelabs.conductor.RouterTransaction import com.bluelinelabs.conductor.RouterTransaction
import com.bluelinelabs.conductor.changehandler.FadeChangeHandler import com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import com.google.android.material.snackbar.Snackbar
import javax.inject.Inject import javax.inject.Inject
/** /**
...@@ -30,9 +30,6 @@ class SplashScreenController : ...@@ -30,9 +30,6 @@ class SplashScreenController :
getComponent() getComponent()
} }
@Inject
lateinit var tb: ICollapsingToolBar
@Inject @Inject
override lateinit var injectedPresenter: SplashScreenPresenter override lateinit var injectedPresenter: SplashScreenPresenter
...@@ -54,7 +51,8 @@ class SplashScreenController : ...@@ -54,7 +51,8 @@ class SplashScreenController :
override fun render(viewState: SplashScreenViewState) { override fun render(viewState: SplashScreenViewState) {
when(viewState){ when(viewState){
is SplashScreenViewState.Idle -> render(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 : ...@@ -62,14 +60,18 @@ class SplashScreenController :
} }
private fun render(viewState: SplashScreenViewState.ToScreen){ private fun render(viewState: SplashScreenViewState.ToAuthScreen){
snackbar.showSnackBar(viewState.message, Snackbar.LENGTH_LONG)
// tb.hideAll()
router.pushController(RouterTransaction.with(AuthScreenController()) router.pushController(RouterTransaction.with(AuthScreenController())
.popChangeHandler(FadeChangeHandler()) .popChangeHandler(FadeChangeHandler())
.pushChangeHandler(FadeChangeHandler()) .pushChangeHandler(FadeChangeHandler())
) )
// snacky.showSnackBar("lul") }
private fun render(viewState: SplashScreenViewState.ToHomeScreen){
router.setRoot(RouterTransaction.with(HomeBottomNavigationController())
.popChangeHandler(FadeChangeHandler())
.pushChangeHandler(FadeChangeHandler())
)
} }
......
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.ICollapsingToolBar
import com.biganto.visual.roompark.base.RoomParkMainActivity import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.di.dagger.AppComponent import com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import com.biganto.visual.roompark.di.dagger.AuthContractModule import com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import com.biganto.visual.roompark.di.dagger.PerScreen import com.biganto.visual.roompark.di.dagger.*
import com.biganto.visual.roompark.domain.contract.AuthContract import com.biganto.visual.roompark.domain.contract.AuthContract
import com.biganto.visual.roompark.presentation.screen.auth.AuthScreenModule
import dagger.Binds import dagger.Binds
import dagger.BindsInstance import dagger.BindsInstance
import dagger.Component import dagger.Component
...@@ -18,7 +18,7 @@ import dagger.Module ...@@ -18,7 +18,7 @@ import dagger.Module
@PerScreen @PerScreen
@Component( @Component(
modules = [SplashScreenModule::class], modules = [AuthScreenModule::class,DataModule::class, RetrofitModule::class, AppModule::class, DbModule::class],
dependencies = [AppComponent::class]) dependencies = [AppComponent::class])
interface SplashScreenComponent { interface SplashScreenComponent {
...@@ -46,7 +46,8 @@ abstract class SplashScreenModule{ ...@@ -46,7 +46,8 @@ abstract class SplashScreenModule{
@Binds @Binds
abstract fun provideAuth(contract: AuthContractModule): AuthContract abstract fun provideAuth(contract: AuthContractModule): AuthContract
@PerScreen // @PerScreen
@Binds // @Binds
abstract fun provideToolbar(activitiy: RoomParkMainActivity): ICollapsingToolBar // abstract fun provideToolbar(activitiy: RoomParkMainActivity): ICollapsingToolBar
} }
...@@ -18,9 +18,14 @@ class SplashScreenPresenter @Inject constructor( ...@@ -18,9 +18,14 @@ class SplashScreenPresenter @Inject constructor(
: BigantoBasePresenter<SplashScreen, SplashScreenViewState>() { : BigantoBasePresenter<SplashScreen, SplashScreenViewState>() {
override fun bindIntents() { override fun bindIntents() {
val state = restoreStateObservable val state = restoreStateObservable
.mergeWith(interactor.getAuth() .mergeWith(interactor.getAuth()
.map { SplashScreenViewState.ToScreen(it.toString()) }) .map {
if (it) SplashScreenViewState.ToHomeScreen()
else SplashScreenViewState.ToAuthScreen()
}
)
subscribeViewState(state.cast(SplashScreenViewState::class.java), SplashScreen::render) subscribeViewState(state.cast(SplashScreenViewState::class.java), SplashScreen::render)
} }
......
...@@ -9,5 +9,6 @@ import com.biganto.visual.roompark.conductor.BigantoBaseViewState ...@@ -9,5 +9,6 @@ import com.biganto.visual.roompark.conductor.BigantoBaseViewState
sealed class SplashScreenViewState : BigantoBaseViewState() { sealed class SplashScreenViewState : BigantoBaseViewState() {
class Idle : SplashScreenViewState() class Idle : SplashScreenViewState()
class ToScreen(val message:String) : SplashScreenViewState() class ToHomeScreen() : SplashScreenViewState()
class ToAuthScreen() : SplashScreenViewState()
} }
\ No newline at end of file
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