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

actual workaround

parent 109c5265
package com.biganto.visual.roompark.data.local package com.biganto.visual.roompark.data.local
import android.app.Application
import android.content.Context import android.content.Context
import com.afollestad.rxkprefs.Pref import com.afollestad.rxkprefs.Pref
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 dagger.Module
import dagger.Provides
import io.reactivex.Completable 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 14.06.2018. * Created by Vladislav Bogdashkin on 14.06.2018.
*/ */
@Module @Module
abstract class LocalStorage(){ class LocalStorage(){
@Binds // @Binds
abstract fun provideStore(store:UserHolder):ILocalStore // @Singleton
// abstract fun provideStore(store:UserHolder):ILocalStore
@Provides
@Singleton
fun provideStore(app : Application):ILocalStore = UserHolder(app)
} }
class UserHolder @Inject constructor(val context : Context) : ILocalStore class UserHolder @Inject constructor(val context : Context) : ILocalStore
......
...@@ -21,6 +21,7 @@ import retrofit2.converter.gson.GsonConverterFactory ...@@ -21,6 +21,7 @@ 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.Singleton
/** /**
* Created by Vladislav Bogdashkin on 29.10.2019. * Created by Vladislav Bogdashkin on 29.10.2019.
...@@ -93,6 +94,7 @@ class RetrofitModule{ ...@@ -93,6 +94,7 @@ class RetrofitModule{
//lateinit var context: RoomParkApplication //lateinit var context: RoomParkApplication
@Provides @Provides
@Singleton
// @Named("roomParkApi") // @Named("roomParkApi")
fun provideRetrofitRoomParkApi(context: Context): Retrofit = fun provideRetrofitRoomParkApi(context: Context): Retrofit =
Retrofit.Builder() Retrofit.Builder()
......
package com.biganto.visual.roompark.di.dagger package com.biganto.visual.roompark.di.dagger
import com.biganto.visual.androidplayer.data.repository.local.ILocalStore
import com.biganto.visual.roompark.base.RoomParkApplication import com.biganto.visual.roompark.base.RoomParkApplication
import com.biganto.visual.roompark.data.repository.api.IRoomParkApi import com.biganto.visual.roompark.data.local.LocalStorage
import com.biganto.visual.roompark.data.repository.api.retrofit.RetrofitRepository
import com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule import com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import com.biganto.visual.roompark.data.repository.db.requrey.DbModule import com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import dagger.BindsInstance import dagger.BindsInstance
...@@ -26,19 +26,23 @@ import javax.inject.Singleton ...@@ -26,19 +26,23 @@ import javax.inject.Singleton
DataModule::class, DataModule::class,
RetrofitModule::class, RetrofitModule::class,
DbModule::class, DbModule::class,
LocalStorage::class,
// LocalStorage::class, // LocalStorage::class,
// AppVersionModule::class, // AppVersionModule::class,
AndroidInjectionModule::class, AndroidInjectionModule::class,
AndroidSupportInjectionModule::class, AndroidSupportInjectionModule::class,
// MappingProvider::class, // MappingProvider::class,
ActivityModule::class, ActivityModule::class,
// ContractRepositoryModule::class,
AppActivityModule ::class]) AppActivityModule ::class])
interface AppComponent : AndroidInjector<RoomParkApplication>{ interface AppComponent : AndroidInjector<RoomParkApplication>{
@Component.Factory @Component.Factory
interface Factory:AndroidInjector.Factory<RoomParkApplication>{ interface Factory:AndroidInjector.Factory<RoomParkApplication>{
// @BindsInstance // @BindsInstance
// fun context(application: Application): Factory // fun context(application: Application): Factory
...@@ -55,10 +59,6 @@ interface AppComponent : AndroidInjector<RoomParkApplication>{ ...@@ -55,10 +59,6 @@ interface AppComponent : AndroidInjector<RoomParkApplication>{
// //
// fun build(): AppComponent // fun build(): AppComponent
@BindsInstance
fun retroApi(api: RetrofitRepository) : IRoomParkApi
} }
// retorfitModule: RetrofitModule // retorfitModule: RetrofitModule
......
package com.biganto.visual.roompark.di.dagger 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.IRoomParkApi
import com.biganto.visual.roompark.data.repository.api.retrofit.RetrofitRepository 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.IDb
...@@ -16,6 +14,14 @@ interface DataComponent{ ...@@ -16,6 +14,14 @@ interface DataComponent{
} }
//@Module(includes = [DataModule::class,RetrofitModule::class,DbModule::class])
//abstract class ContractRepositoryModule @Inject constructor(
// val authC:AuthContract
//){
//
//}
...@@ -23,6 +29,7 @@ interface DataComponent{ ...@@ -23,6 +29,7 @@ interface DataComponent{
abstract class DataModule { abstract class DataModule {
// @Singleton
// @Binds // @Binds
// abstract fun provideAuthContract(contract: AuthContractModule) : AuthContract // abstract fun provideAuthContract(contract: AuthContractModule) : AuthContract
...@@ -41,13 +48,17 @@ abstract class DataModule { ...@@ -41,13 +48,17 @@ abstract class DataModule {
// @Binds // @Binds
// abstract fun provideStore(store: KotlinReactiveEntityStore<Persistable>) : KotlinReactiveEntityStore<Persistable> // abstract fun provideStore(store: KotlinReactiveEntityStore<Persistable>) : KotlinReactiveEntityStore<Persistable>
@Singleton
@Binds @Binds
abstract fun provideDb(db: RequeryRepository) : IDb abstract fun provideDb(db: RequeryRepository) : IDb
@Binds // @Singleton
abstract fun provideLocalStorage(local: UserHolder) : ILocalStore // @Binds
// abstract fun provideLocalStorage(local: UserHolder) : ILocalStore
/* /*
@Provides @Provides
......
package com.biganto.visual.roompark.domain.use_case package com.biganto.visual.roompark.domain.use_case
import com.biganto.visual.roompark.domain.contract.AuthContract import com.biganto.visual.roompark.data.data_provider.AuthContractModule
import javax.inject.Inject import javax.inject.Inject
/** /**
...@@ -8,7 +8,7 @@ import javax.inject.Inject ...@@ -8,7 +8,7 @@ import javax.inject.Inject
*/ */
class AuthUseCase @Inject constructor( class AuthUseCase @Inject constructor(
private val authContract: AuthContract private val authContract: AuthContractModule
){ ){
fun validateAuth() = authContract.validateAuthState() fun validateAuth() = authContract.validateAuthState()
......
...@@ -34,12 +34,8 @@ class AuthScreenController : ...@@ -34,12 +34,8 @@ class AuthScreenController :
override fun onViewBound(v: View) { override fun onViewBound(v: View) {
toolBar.hideAll() toolBar.hideAll()
bottomNavigation.hide() bottomNavigation.hide()
} }
@BindView(R.id.login_text_input) lateinit var loginInput:TextInputLayout @BindView(R.id.login_text_input) lateinit var loginInput:TextInputLayout
@BindView(R.id.password_text_input) lateinit var pwdInput:TextInputLayout @BindView(R.id.password_text_input) lateinit var pwdInput:TextInputLayout
@BindView(R.id.sign_in_button) lateinit var signInButton:MaterialButton @BindView(R.id.sign_in_button) lateinit var signInButton:MaterialButton
......
package com.biganto.visual.roompark.presentation.screen.auth package com.biganto.visual.roompark.presentation.screen.auth
import android.content.Context import android.content.Context
import com.biganto.visual.androidplayer.data.repository.local.ILocalStore
import com.biganto.visual.roompark.base.IBottomNavigation import com.biganto.visual.roompark.base.IBottomNavigation
import com.biganto.visual.roompark.base.RoomParkMainActivity import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.data.data_provider.AuthContractModule
import com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import com.biganto.visual.roompark.di.dagger.AppComponent import com.biganto.visual.roompark.di.dagger.AppComponent
import com.biganto.visual.roompark.di.dagger.AppModule
import com.biganto.visual.roompark.di.dagger.DataModule
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 dagger.Binds
import dagger.* import dagger.BindsInstance
import dagger.Component
import dagger.Module
@PerScreen @PerScreen
@Subcomponent( @Component(
modules = [ modules = [
AuthScreenModule::class AuthScreenModule::class
,DataModule::class ]
,RetrofitModule::class ,dependencies = [AppComponent::class]
,AppModule::class )
,DbModule::class
])
interface AuthScreenComponent { interface AuthScreenComponent {
val _local: ILocalStore
@Component.Factory @Component.Factory
interface Factory{ interface Factory{
fun create( fun create(
...@@ -33,23 +29,24 @@ interface AuthScreenComponent { ...@@ -33,23 +29,24 @@ interface AuthScreenComponent {
): AuthScreenComponent ): AuthScreenComponent
} }
val presenter: AuthScreenPresenter // val presenter: AuthScreenPresenter
fun inject(controller: AuthScreenController) fun inject(controller: AuthScreenController)
} }
@Module @Module(
// includes = [DataModule::class,DbModule::class,RetrofitModule::class]
)
abstract class AuthScreenModule{ abstract class AuthScreenModule{
@PerScreen
@Binds @Binds
abstract fun provideContext(activity: RoomParkMainActivity): Context abstract fun provideContext(activity: RoomParkMainActivity): Context
@PerScreen // @PerScreen
@Binds // @Binds
abstract fun provideAuth(contract: AuthContractModule): AuthContract // abstract fun provideAuth(contract: AuthContractModule): AuthContract
@PerScreen
@Binds @Binds
abstract fun provideBottomNavigation(activitiy: RoomParkMainActivity): IBottomNavigation abstract fun provideBottomNavigation(activitiy: RoomParkMainActivity): IBottomNavigation
......
...@@ -68,7 +68,7 @@ class FeedsScreenController : ...@@ -68,7 +68,7 @@ class FeedsScreenController :
lateinit var feedsBlockView:ViewGroup lateinit var feedsBlockView:ViewGroup
@BindView(R.id.to_feed_articles) @BindView(R.id.to_feed_articles)
lateinit var allFeedArticles: MaterialButton lateinit var allFeedArticles:MaterialButton
......
...@@ -2,7 +2,6 @@ package com.biganto.visual.roompark.presentation.screen.feeds ...@@ -2,7 +2,6 @@ package com.biganto.visual.roompark.presentation.screen.feeds
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.data.data_provider.FeedsContractModule
import com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule import com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import com.biganto.visual.roompark.data.repository.db.requrey.DbModule import com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import com.biganto.visual.roompark.data.service.user_session.IUserSession import com.biganto.visual.roompark.data.service.user_session.IUserSession
...@@ -11,24 +10,24 @@ import com.biganto.visual.roompark.di.dagger.AppComponent ...@@ -11,24 +10,24 @@ import com.biganto.visual.roompark.di.dagger.AppComponent
import com.biganto.visual.roompark.di.dagger.AppModule import com.biganto.visual.roompark.di.dagger.AppModule
import com.biganto.visual.roompark.di.dagger.DataModule import com.biganto.visual.roompark.di.dagger.DataModule
import com.biganto.visual.roompark.di.dagger.PerScreen import com.biganto.visual.roompark.di.dagger.PerScreen
import com.biganto.visual.roompark.domain.contract.FeedsContract
import dagger.Binds import dagger.Binds
import dagger.BindsInstance import dagger.BindsInstance
import dagger.Component
import dagger.Module import dagger.Module
import dagger.Subcomponent
@PerScreen @PerScreen
@Component( @Subcomponent(
modules = [FeedsScreenModule::class modules = [FeedsScreenModule::class
, DataModule::class , DataModule::class
, RetrofitModule::class , RetrofitModule::class
, AppModule::class , AppModule::class
, DbModule::class], , DbModule::class]
dependencies = [AppComponent::class]) // ,dependencies = [AppComponent::class]
)
interface FeedsScreenComponent { interface FeedsScreenComponent {
@Component.Factory @Subcomponent.Factory
interface Factory{ interface Factory{
fun create( fun create(
appComponent: AppComponent appComponent: AppComponent
...@@ -48,9 +47,9 @@ abstract class FeedsScreenModule{ ...@@ -48,9 +47,9 @@ abstract class FeedsScreenModule{
@Binds @Binds
abstract fun provideContext(activity: RoomParkMainActivity): Context abstract fun provideContext(activity: RoomParkMainActivity): Context
@PerScreen // @PerScreen
@Binds // @Binds
abstract fun provideContract(impl: FeedsContractModule): FeedsContract // abstract fun provideContract(impl: FeedsContractModule): FeedsContract
@PerScreen @PerScreen
......
...@@ -2,28 +2,27 @@ package com.biganto.visual.roompark.presentation.screen.settings ...@@ -2,28 +2,27 @@ package com.biganto.visual.roompark.presentation.screen.settings
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.data.data_provider.AuthContractModule
import com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule import com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import com.biganto.visual.roompark.data.repository.db.requrey.DbModule import com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import com.biganto.visual.roompark.di.dagger.AppComponent import com.biganto.visual.roompark.di.dagger.AppComponent
import com.biganto.visual.roompark.di.dagger.AppModule import com.biganto.visual.roompark.di.dagger.AppModule
import com.biganto.visual.roompark.di.dagger.DataModule import com.biganto.visual.roompark.di.dagger.DataModule
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 dagger.Binds import dagger.Binds
import dagger.BindsInstance import dagger.BindsInstance
import dagger.Component
import dagger.Module import dagger.Module
import dagger.Subcomponent
@PerScreen @PerScreen
@Component( @Subcomponent(
modules = [SettingsScreenModule::class, DataModule::class modules = [SettingsScreenModule::class, DataModule::class
, RetrofitModule::class, AppModule::class, DbModule::class], , RetrofitModule::class, AppModule::class, DbModule::class]
dependencies = [AppComponent::class]) // ,dependencies = [AppComponent::class]
)
interface SettingsScreenComponent { interface SettingsScreenComponent {
@Component.Factory @Subcomponent.Factory
interface Factory{ interface Factory{
fun create( fun create(
appComponent: AppComponent appComponent: AppComponent
...@@ -43,8 +42,8 @@ abstract class SettingsScreenModule{ ...@@ -43,8 +42,8 @@ abstract class SettingsScreenModule{
@Binds @Binds
abstract fun provideContext(activity: RoomParkMainActivity): Context abstract fun provideContext(activity: RoomParkMainActivity): Context
@PerScreen // @PerScreen
@Binds // @Binds
abstract fun provideAuth(contract: AuthContractModule): AuthContract // abstract fun provideAuth(contract: AuthContractModule): AuthContract
} }
...@@ -3,31 +3,30 @@ package com.biganto.visual.roompark.presentation.screen.splash ...@@ -3,31 +3,30 @@ package com.biganto.visual.roompark.presentation.screen.splash
import android.content.Context import android.content.Context
import com.biganto.visual.roompark.base.IBottomNavigation import com.biganto.visual.roompark.base.IBottomNavigation
import com.biganto.visual.roompark.base.RoomParkMainActivity import com.biganto.visual.roompark.base.RoomParkMainActivity
import com.biganto.visual.roompark.data.data_provider.AuthContractModule
import com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule import com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import com.biganto.visual.roompark.data.repository.db.requrey.DbModule import com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import com.biganto.visual.roompark.di.dagger.AppComponent import com.biganto.visual.roompark.di.dagger.AppComponent
import com.biganto.visual.roompark.di.dagger.AppModule import com.biganto.visual.roompark.di.dagger.AppModule
import com.biganto.visual.roompark.di.dagger.DataModule import com.biganto.visual.roompark.di.dagger.DataModule
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.auth.AuthScreenModule 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.Module import dagger.Module
import dagger.Subcomponent
///** ///**
// * Created by Vladislav Bogdashkin on 30.09.2019. // * Created by Vladislav Bogdashkin on 30.09.2019.
// */ // */
@PerScreen @PerScreen
@Component( @Subcomponent(
modules = [AuthScreenModule::class,DataModule::class, RetrofitModule::class, AppModule::class, DbModule::class], modules = [AuthScreenModule::class,DataModule::class, RetrofitModule::class, AppModule::class, DbModule::class]
dependencies = [AppComponent::class]) // ,dependencies = [AppComponent::class]
)
interface SplashScreenComponent { interface SplashScreenComponent {
@Component.Factory @Subcomponent.Factory
interface Factory{ interface Factory{
fun create( fun create(
appComponent: AppComponent appComponent: AppComponent
...@@ -47,9 +46,9 @@ abstract class SplashScreenModule{ ...@@ -47,9 +46,9 @@ abstract class SplashScreenModule{
@Binds @Binds
abstract fun provideContext(activity: RoomParkMainActivity): Context abstract fun provideContext(activity: RoomParkMainActivity): Context
@PerScreen // @PerScreen
@Binds // @Binds
abstract fun provideAuth(contract: AuthContractModule): AuthContract // abstract fun provideAuth(contract: AuthContractModule): AuthContract
// @PerScreen // @PerScreen
// @Binds // @Binds
......
...@@ -21,6 +21,6 @@ ext { ...@@ -21,6 +21,6 @@ ext {
rxJavaVersion = '3.0.0-RC3' rxJavaVersion = '3.0.0-RC3'
mosbyMviConductorVersion = '3.1.0' mosbyMviConductorVersion = '3.1.0'
butterKnifeVersion = '10.2.0' butterKnifeVersion = '10.2.0'
daggerVersion = '2.24' daggerVersion = '2.25.2'
rxRelayVersion = '2.1.1' rxRelayVersion = '2.1.1'
} }
\ 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