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

added explanation pipeline sample

parent 7129b223
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.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.
......@@ -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()
class DataModule() {
@Provides
@Singleton
fun provideAuthContract() : AuthContract = AuthContractModule()
/*
@Provides
@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
import com.biganto.visual.roompark.di.dagger.PerScreen
import com.biganto.visual.roompark.domain.contract.AuthContract
import io.reactivex.Observable
import javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 24.09.2019.
*/
@PerScreen
class AuthUseCase(
val authContract: AuthContract
class AuthUseCase @Inject constructor(
private val authContract: AuthContract
){
fun validateAuth() = Observable.just(true)
}
\ No newline at end of file
......@@ -2,10 +2,10 @@
import android.content.Context
import com.biganto.visual.roompark.base.ICollapsingToolBar
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.AuthContractModule
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.SplashScreenPresenter
import dagger.Binds
......@@ -36,13 +36,10 @@ import dagger.Module
//
@PerScreen
@Component(
modules = [RoomParkActivityModule::class,ActivityModule::class, AppActivityModule::class ],
modules = [SplashScreenModule::class],
dependencies = [AppComponent::class])
interface SplashScreenComponent {
// fun baseComponent(@BindsInstance appComponent:AppComponent):AppComponent
@Component.Factory
interface Factory{
fun create(
......@@ -54,19 +51,21 @@ interface SplashScreenComponent {
val presenter: SplashScreenPresenter
fun inject(controller: SplashScreenController)
// val roomParkActivity: RoomParkMainActivity
// val snackBar : ISnackBarProvider
}
@Module
abstract class RoomParkActivityModule{
abstract class SplashScreenModule{
@PerScreen
@Binds
abstract fun provideContext(activity: RoomParkMainActivity): Context
@PerScreen
@Binds
abstract fun provideAuth(contract: AuthContractModule): AuthContract
// @Binds
// abstract fun provideContext(activity: Activity): Context
......@@ -74,18 +73,7 @@ abstract class RoomParkActivityModule{
// @Binds
// abstract fun provideSnack(snack:ISnackBarProvider) : ISnackBarProvider
@PerScreen
@Binds
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
import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.conductor.BigantoBasePresenter
import io.reactivex.Observable
import com.biganto.visual.roompark.domain.interactor.SplashInteractor
import javax.inject.Inject
/**
......@@ -12,16 +12,15 @@ import javax.inject.Inject
class SplashScreenPresenter @Inject constructor(
var acitivityContext: RoomParkMainActivity
,val interactor: SplashInteractor
// ,var context:Context
)
: BigantoBasePresenter<SplashScreen, SplashScreenViewState>() {
override fun bindIntents() {
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)
}
......
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