Commit 230d45a8 authored by Vladislav Bogdashkin's avatar Vladislav Bogdashkin 🎣

added explanation pipeline sample

parent 7129b223
package com.biganto.visual.roompark.di.dagger package com.biganto.visual.roompark.di.dagger
import com.biganto.visual.roompark.domain.contract.AuthContract
import com.biganto.visual.roompark.domain.model.AuthInfoModel
import dagger.Module import dagger.Module
import dagger.Provides import dagger.Provides
import io.reactivex.rxjava3.core.Completable
import io.reactivex.rxjava3.core.Observable
import javax.inject.Inject
import javax.inject.Singleton
/** /**
* Created by Vladislav Bogdashkin on 13.06.2018. * Created by Vladislav Bogdashkin on 13.06.2018.
...@@ -26,11 +32,25 @@ class AppModule() { ...@@ -26,11 +32,25 @@ class AppModule() {
} }
class AuthContractModule @Inject constructor():AuthContract{
override fun signOut(): Completable = Completable.complete()
override fun signIn(email: String, password: String): Observable<AuthInfoModel> {
return Observable.just(AuthInfoModel("some tokan zzaza",1488, "hi4", "biganto@demo.ru"))
}
fun validateAuthState(): Observable<Boolean> = Observable.just(false)
}
@Module() @Module()
class DataModule() { class DataModule() {
@Provides
@Singleton
fun provideAuthContract() : AuthContract = AuthContractModule()
/* /*
@Provides @Provides
@Singleton @Singleton
......
package com.biganto.visual.roompark.domain.interactor
import com.biganto.visual.roompark.domain.use_case.AuthUseCase
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 09.10.2019.
*/
class SplashInteractor @Inject constructor(
private val uc:AuthUseCase
){
fun getAuth() = uc.validateAuth()
}
\ No newline at end of file
package com.biganto.visual.roompark.domain.use_case package com.biganto.visual.roompark.domain.use_case
import com.biganto.visual.roompark.di.dagger.PerScreen
import com.biganto.visual.roompark.domain.contract.AuthContract import com.biganto.visual.roompark.domain.contract.AuthContract
import io.reactivex.Observable
import javax.inject.Inject
/** /**
* Created by Vladislav Bogdashkin on 24.09.2019. * Created by Vladislav Bogdashkin on 24.09.2019.
*/ */
@PerScreen class AuthUseCase @Inject constructor(
class AuthUseCase( private val authContract: AuthContract
val authContract: AuthContract
){ ){
fun validateAuth() = Observable.just(true)
} }
\ No newline at end of file
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
import android.content.Context import android.content.Context
import com.biganto.visual.roompark.base.ICollapsingToolBar 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.ActivityModule
import com.biganto.visual.roompark.di.dagger.AppActivityModule
import com.biganto.visual.roompark.di.dagger.AppComponent import com.biganto.visual.roompark.di.dagger.AppComponent
import com.biganto.visual.roompark.di.dagger.AuthContractModule
import com.biganto.visual.roompark.di.dagger.PerScreen import com.biganto.visual.roompark.di.dagger.PerScreen
import com.biganto.visual.roompark.domain.contract.AuthContract
import com.biganto.visual.roompark.presentation.screen.splash.SplashScreenController import com.biganto.visual.roompark.presentation.screen.splash.SplashScreenController
import com.biganto.visual.roompark.presentation.screen.splash.SplashScreenPresenter import com.biganto.visual.roompark.presentation.screen.splash.SplashScreenPresenter
import dagger.Binds import dagger.Binds
...@@ -36,13 +36,10 @@ import dagger.Module ...@@ -36,13 +36,10 @@ import dagger.Module
// //
@PerScreen @PerScreen
@Component( @Component(
modules = [RoomParkActivityModule::class,ActivityModule::class, AppActivityModule::class ], modules = [SplashScreenModule::class],
dependencies = [AppComponent::class]) dependencies = [AppComponent::class])
interface SplashScreenComponent { interface SplashScreenComponent {
// fun baseComponent(@BindsInstance appComponent:AppComponent):AppComponent
@Component.Factory @Component.Factory
interface Factory{ interface Factory{
fun create( fun create(
...@@ -54,19 +51,21 @@ interface SplashScreenComponent { ...@@ -54,19 +51,21 @@ interface SplashScreenComponent {
val presenter: SplashScreenPresenter val presenter: SplashScreenPresenter
fun inject(controller: SplashScreenController) fun inject(controller: SplashScreenController)
// val roomParkActivity: RoomParkMainActivity
// val snackBar : ISnackBarProvider
} }
@Module @Module
abstract class RoomParkActivityModule{ abstract class SplashScreenModule{
@PerScreen @PerScreen
@Binds @Binds
abstract fun provideContext(activity: RoomParkMainActivity): Context abstract fun provideContext(activity: RoomParkMainActivity): Context
@PerScreen
@Binds
abstract fun provideAuth(contract: AuthContractModule): AuthContract
// @Binds // @Binds
// abstract fun provideContext(activity: Activity): Context // abstract fun provideContext(activity: Activity): Context
...@@ -74,18 +73,7 @@ abstract class RoomParkActivityModule{ ...@@ -74,18 +73,7 @@ abstract class RoomParkActivityModule{
// @Binds // @Binds
// abstract fun provideSnack(snack:ISnackBarProvider) : ISnackBarProvider // abstract fun provideSnack(snack:ISnackBarProvider) : ISnackBarProvider
@PerScreen @PerScreen
@Binds @Binds
abstract fun provideToolbar(activitiy: RoomParkMainActivity): ICollapsingToolBar abstract fun provideToolbar(activitiy: RoomParkMainActivity): ICollapsingToolBar
// @ContributesAndroidInjector(
// modules = [ActivityModule::class, AppActivityModule.MainActivityModule::class])
// abstract fun contributeMainActivityInjector(): RoomParkMainActivity
// @Binds
// abstract fun provideSnack(activitiy: RoomParkMainActivity):ISnackBarProvider
} }
...@@ -2,7 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.splash ...@@ -2,7 +2,7 @@ package com.biganto.visual.roompark.presentation.screen.splash
import com.biganto.visual.roompark.base.RoomParkMainActivity import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBasePresenter import com.biganto.visual.roompark.conductor.BigantoBasePresenter
import io.reactivex.Observable import com.biganto.visual.roompark.domain.interactor.SplashInteractor
import javax.inject.Inject import javax.inject.Inject
/** /**
...@@ -12,16 +12,15 @@ import javax.inject.Inject ...@@ -12,16 +12,15 @@ import javax.inject.Inject
class SplashScreenPresenter @Inject constructor( class SplashScreenPresenter @Inject constructor(
var acitivityContext: RoomParkMainActivity var acitivityContext: RoomParkMainActivity
,val interactor: SplashInteractor
// ,var context:Context // ,var context:Context
) )
: BigantoBasePresenter<SplashScreen, SplashScreenViewState>() { : BigantoBasePresenter<SplashScreen, SplashScreenViewState>() {
override fun bindIntents() { override fun bindIntents() {
val state = restoreStateObservable val state = restoreStateObservable
.mergeWith(Observable.just(SplashScreenViewState.ToScreen(acitivityContext.javaClass.toString()))) .mergeWith(interactor.getAuth()
.map { SplashScreenViewState.ToScreen(it.toString()) })
subscribeViewState(state.cast(SplashScreenViewState::class.java), SplashScreen::render) subscribeViewState(state.cast(SplashScreenViewState::class.java), SplashScreen::render)
} }
......
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