Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Room Park Android
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vladislav Bogdashkin
Room Park Android
Commits
cc0a0a79
Commit
cc0a0a79
authored
Nov 07, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/bindsRepository' into develop
parents
99dff8b6
17420714
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
230 additions
and
145 deletions
+230
-145
build.gradle
app/build.gradle
+4
-0
AuthRepository.kt
...anto/visual/roompark/data/data_provider/AuthRepository.kt
+18
-21
UserHolder.kt
...java/com/biganto/visual/roompark/data/local/UserHolder.kt
+13
-2
RetrofitRepository.kt
...ompark/data/repository/api/retrofit/RetrofitRepository.kt
+2
-2
RetrofitModule.kt
...oompark/data/repository/api/retrofit/di/RetrofitModule.kt
+8
-8
RequeryRepository.kt
.../roompark/data/repository/db/requrey/RequeryRepository.kt
+25
-2
AppComponent.kt
...ava/com/biganto/visual/roompark/di/dagger/AppComponent.kt
+8
-3
ContextModule.kt
...va/com/biganto/visual/roompark/di/dagger/ContextModule.kt
+12
-82
DataModule.kt
.../java/com/biganto/visual/roompark/di/dagger/DataModule.kt
+105
-0
authUseCase.kt
...om/biganto/visual/roompark/domain/use_case/authUseCase.kt
+1
-2
ScreenDI.kt
...anto/visual/roompark/presentation/screen/auth/ScreenDI.kt
+6
-4
ScreenController.kt
...l/roompark/presentation/screen/splash/ScreenController.kt
+11
-9
ScreenDI.kt
...to/visual/roompark/presentation/screen/splash/ScreenDI.kt
+9
-8
ScreenPresenter.kt
...al/roompark/presentation/screen/splash/ScreenPresenter.kt
+6
-1
ScreenViewState.kt
...al/roompark/presentation/screen/splash/ScreenViewState.kt
+2
-1
No files found.
app/build.gradle
View file @
cc0a0a79
...
@@ -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'
...
...
app/src/main/java/com/biganto/visual/roompark/data/data_provider/AuthRepository.kt
View file @
cc0a0a79
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
app/src/main/java/com/biganto/visual/roompark/data/local/UserHolder.kt
View file @
cc0a0a79
...
@@ -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
{
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/RetrofitRepository.kt
View file @
cc0a0a79
...
@@ -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
)
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/di/RetrofitModule.kt
View file @
cc0a0a79
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
)))
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/RequeryRepository.kt
View file @
cc0a0a79
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
>
)
)
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/AppComponent.kt
View file @
cc0a0a79
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("r
etrofit
")
// @Named("r
oomParkApi
")
// fun retrofit(
// fun retrofit(
// retorfitModule: RetrofitModule):Builder
// retorfitModule: RetrofitModule
// ): DaggerDataComponent.Builder
//
//
// fun build(): AppComponent
// fun build(): AppComponent
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/ContextModule.kt
View file @
cc0a0a79
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
...
@@ -8,13 +10,12 @@ import com.biganto.visual.roompark.data.repository.mapper.fromRaw
...
@@ -8,13 +10,12 @@ import com.biganto.visual.roompark.data.repository.mapper.fromRaw
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.domain.model.AuthInfoModel
import
com.biganto.visual.roompark.domain.model.AuthInfoModel
import
com.biganto.visual.roompark.domain.model.fromEntity
import
com.biganto.visual.roompark.domain.model.fromEntity
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 13.06.2018.
* Created by Vladislav Bogdashkin on 13.06.2018.
...
@@ -35,14 +36,17 @@ const val FILES_CACHE_LIMIT_SECONDS_INACTIVE = 60L
...
@@ -35,14 +36,17 @@ 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
(
val
local
:
ILocalStore
,
private
val
local
:
ILocalStore
,
val
api
:
IRoomParkApi
,
private
val
api
:
IRoomParkApi
,
val
db
:
IDb
private
val
db
:
IDb
):
AuthContract
{
):
AuthContract
{
init
{
init
{
...
@@ -66,77 +70,3 @@ class AppModule() {
...
@@ -66,77 +70,3 @@ class AppModule() {
}
}
}
}
}
}
@Module
()
class
DataModule
()
{
@Provides
@Singleton
fun
provideAuthContract
()
:
AuthContract
=
AuthContractModule
()
/*
@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
app/src/main/java/com/biganto/visual/roompark/di/dagger/DataModule.kt
0 → 100644
View file @
cc0a0a79
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
app/src/main/java/com/biganto/visual/roompark/domain/use_case/authUseCase.kt
View file @
cc0a0a79
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.domain.contract.AuthContract
import
io.reactivex.Observable
import
javax.inject.Inject
import
javax.inject.Inject
/**
/**
...
@@ -12,7 +11,7 @@ class AuthUseCase @Inject constructor(
...
@@ -12,7 +11,7 @@ class AuthUseCase @Inject constructor(
private
val
authContract
:
AuthContract
private
val
authContract
:
AuthContract
){
){
fun
validateAuth
()
=
Observable
.
just
(
true
)
fun
validateAuth
()
=
authContract
.
validateAuthState
(
)
fun
signIn
(
login
:
String
,
pwd
:
String
)
=
authContract
.
signIn
(
login
,
pwd
)
fun
signIn
(
login
:
String
,
pwd
:
String
)
=
authContract
.
signIn
(
login
,
pwd
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenDI.kt
View file @
cc0a0a79
...
@@ -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.d
i.dagger.AppComponent
import
com.biganto.visual.roompark.d
ata.repository.api.retrofit.di.RetrofitModule
import
com.biganto.visual.roompark.d
i.dagger.AuthContract
Module
import
com.biganto.visual.roompark.d
ata.repository.db.requrey.Db
Module
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
}
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenController.kt
View file @
cc0a0a79
...
@@ -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
())
)
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenDI.kt
View file @
cc0a0a79
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.d
i.dagger.AppComponent
import
com.biganto.visual.roompark.d
ata.repository.api.retrofit.di.RetrofitModule
import
com.biganto.visual.roompark.d
i.dagger.AuthContract
Module
import
com.biganto.visual.roompark.d
ata.repository.db.requrey.Db
Module
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
=
[
SplashScreen
Module
::
class
],
modules
=
[
AuthScreenModule
::
class
,
DataModule
::
class
,
RetrofitModule
::
class
,
AppModule
::
class
,
Db
Module
::
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
}
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenPresenter.kt
View file @
cc0a0a79
...
@@ -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
)
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenViewState.kt
View file @
cc0a0a79
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment