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

actual workaround

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