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
726ddcfd
Commit
726ddcfd
authored
Nov 26, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
resolve singleton component dependencies
parent
438b5ce5
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
77 additions
and
61 deletions
+77
-61
AlbumsRepository.kt
...to/visual/roompark/data/data_provider/AlbumsRepository.kt
+2
-2
FeedsRepository.kt
...nto/visual/roompark/data/data_provider/FeedsRepository.kt
+2
-2
UserHolder.kt
...java/com/biganto/visual/roompark/data/local/UserHolder.kt
+1
-2
RetrofitRepository.kt
...ompark/data/repository/api/retrofit/RetrofitRepository.kt
+5
-1
RetrofitModule.kt
...oompark/data/repository/api/retrofit/di/RetrofitModule.kt
+6
-2
RequeryRepository.kt
.../roompark/data/repository/db/requrey/RequeryRepository.kt
+2
-2
AppComponent.kt
...ava/com/biganto/visual/roompark/di/dagger/AppComponent.kt
+19
-1
DataModule.kt
.../java/com/biganto/visual/roompark/di/dagger/DataModule.kt
+19
-6
albumsUseCase.kt
.../biganto/visual/roompark/domain/use_case/albumsUseCase.kt
+2
-2
ScreenController.kt
...ual/roompark/presentation/screen/auth/ScreenController.kt
+0
-1
ScreenController.kt
...al/roompark/presentation/screen/feeds/ScreenController.kt
+3
-0
ScreenDI.kt
...nto/visual/roompark/presentation/screen/feeds/ScreenDI.kt
+5
-15
ScreenPresenter.kt
...ual/roompark/presentation/screen/feeds/ScreenPresenter.kt
+1
-1
ScreenDI.kt
.../visual/roompark/presentation/screen/settings/ScreenDI.kt
+5
-12
ScreenDI.kt
...to/visual/roompark/presentation/screen/splash/ScreenDI.kt
+5
-12
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/AlbumsRepository.kt
View file @
726ddcfd
...
...
@@ -62,7 +62,7 @@ class AlbumsContractModule @Inject constructor(
private
fun
fetchTopLevelAlbums
():
Observable
<
List
<
AlbumPreviewModel
>>
=
Observable
.
mergeDelayError
(
arrayListOf
(
fetchTopLevelAlbumsApi
,
fetchTopLevelAlbumsDb
)
).
take
(
1
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
private
fun
fetchAlbumsApi
(
parentAlbumId
:
Int
)
=
...
...
@@ -92,7 +92,7 @@ class AlbumsContractModule @Inject constructor(
private
fun
fetchAlbums
(
parentId
:
Int
):
Observable
<
List
<
AlbumPreviewModel
>>
=
Observable
.
mergeDelayError
(
arrayListOf
(
fetchAlbumsApi
(
parentId
),
fetchAlbumsDb
(
parentId
))
).
take
(
1
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
}
app/src/main/java/com/biganto/visual/roompark/data/data_provider/FeedsRepository.kt
View file @
726ddcfd
...
...
@@ -80,7 +80,7 @@ class FeedsContractModule @Inject constructor(
).
take
(
1
).
map
{
fromEntity
(
feedId
,
it
)
}
private
fun
fetchFeedsApi
()
=
private
val
fetchFeedsApi
=
api
.
getFeeds
()
.
doOnNext
{
Timber
.
d
(
"raw0 $it"
)
}
.
map
{
fromRawList
(
it
,
::
fromRaw
)}
...
...
@@ -95,7 +95,7 @@ class FeedsContractModule @Inject constructor(
fun
fetchAllFeeds
():
Observable
<
List
<
FeedModel
>>
=
Observable
.
mergeDelayError
(
arrayListOf
(
fetchFeedsApi
()
,
fetchFeedsDb
)
arrayListOf
(
fetchFeedsApi
,
fetchFeedsDb
)
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/data/local/UserHolder.kt
View file @
726ddcfd
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
...
...
@@ -30,7 +29,7 @@ class LocalStorage(){
fun
provideStore
(
app
:
Application
):
ILocalStore
=
UserHolder
(
app
)
}
class
UserHolder
@Inject
constructor
(
val
context
:
Context
)
:
ILocalStore
class
UserHolder
@Inject
constructor
(
val
context
:
Application
)
:
ILocalStore
{
init
{
Timber
.
d
(
" inited"
)
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/RetrofitRepository.kt
View file @
726ddcfd
...
...
@@ -23,6 +23,10 @@ class RetrofitRepository @Inject constructor(retrofit: Retrofit) : IRoomParkApi
private
val
api
=
retrofit
.
create
(
IRoomParkMobileApi
::
class
.
java
)
init
{
Timber
.
d
(
"Module inited"
)
}
override
fun
authenticate
(
login
:
String
,
pwd
:
String
):
Observable
<
AuthRaw
>
=
api
.
authoriz
(
email
=
login
,
pwd
=
pwd
)
.
subscribeOn
(
Schedulers
.
io
())
...
...
@@ -118,7 +122,7 @@ enum class PlanTypeCatalog(val planId:Int, val planName:String ){
internal
class
RetrofitResponseValidation
<
T
>
:
ObservableTransformer
<
Response
<
T
>,
T
>
{
override
fun
apply
(
responseObservable
:
Observable
<
Response
<
T
>>):
ObservableSource
<
T
>
{
return
responseObservable
.
switchMap
{
resp
->
//
Timber.d("reutrned code: %s",resp.code())
Timber
.
d
(
"reutrned code: %s"
,
resp
.
code
())
if
(
resp
.
code
()
==
200
||
resp
.
code
()
==
206
)
if
(
resp
.
body
()
==
null
)
return
@switchMap
Completable
.
complete
().
toObservable
<
T
>().
doOnNext
{
Timber
.
d
(
"Completed responseBody"
)}
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/di/RetrofitModule.kt
View file @
726ddcfd
package
com.biganto.visual.roompark.data.repository.api.retrofit.di
import
android.
content.Context
import
android.
app.Application
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.util.*
...
...
@@ -40,6 +40,10 @@ class RetrofitModule{
//
// var versionControl = AppVersionManager(context)
init
{
Timber
.
d
(
"Module inited"
)
}
private
inline
fun
<
reified
T
>
genericType
()
=
object
:
TypeToken
<
T
>()
{}.
type
private
fun
gsonConverterFactory
()
=
GsonConverterFactory
.
create
(
...
...
@@ -96,7 +100,7 @@ class RetrofitModule{
@Provides
@Singleton
// @Named("roomParkApi")
fun
provideRetrofitRoomParkApi
(
context
:
Context
):
Retrofit
=
fun
provideRetrofitRoomParkApi
(
context
:
Application
):
Retrofit
=
Retrofit
.
Builder
()
.
baseUrl
(
IRoomParkMobileApi
.
BASE_URL
)
.
client
(
client
(
AppVersionManager
(
context
),
LiveNetworkMonitor
(
context
)))
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/RequeryRepository.kt
View file @
726ddcfd
package
com.biganto.visual.roompark.data.repository.db.requrey
import
android.
content.Context
import
android.
app.Application
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.model.*
import
com.biganto.visual.roompark.di.dagger.DATABASE_VERSION
...
...
@@ -26,7 +26,7 @@ import javax.inject.Inject
class
DbModule
{
@Provides
fun
provideStore
(
context
:
Context
):
KotlinReactiveEntityStore
<
Persistable
>
{
fun
provideStore
(
context
:
Application
):
KotlinReactiveEntityStore
<
Persistable
>
{
Timber
.
d
(
"Kotlin store creating.."
)
val
source
=
DatabaseSource
(
context
,
Models
.
DEFAULT
,
"BigantoPerfect"
,
DATABASE_VERSION
)
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/AppComponent.kt
View file @
726ddcfd
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.local.LocalStorage
import
com.biganto.visual.roompark.data.repository.api.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.api.retrofit.di.RetrofitModule
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.domain.contract.DevProgressContract
import
com.biganto.visual.roompark.domain.contract.FeedsContract
import
dagger.BindsInstance
import
dagger.Component
import
dagger.android.AndroidInjectionModule
...
...
@@ -33,13 +38,26 @@ import javax.inject.Singleton
AndroidSupportInjectionModule
::
class
,
// MappingProvider::class,
ActivityModule
::
class
,
//
ContractRepositoryModule::class,
ContractRepositoryModule
::
class
,
AppActivityModule
::
class
])
interface
AppComponent
:
AndroidInjector
<
RoomParkApplication
>{
fun
authC
():
AuthContract
fun
feedsC
():
FeedsContract
fun
feedsAlb
():
DevProgressContract
fun
provideLocal
():
ILocalStore
fun
provideApi
():
IRoomParkApi
fun
providedb
():
IDb
@Component
.
Factory
interface
Factory
{
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/DataModule.kt
View file @
726ddcfd
package
com.biganto.visual.roompark.di.dagger
import
com.biganto.visual.roompark.data.data_provider.AlbumsContractModule
import
com.biganto.visual.roompark.data.data_provider.AuthContractModule
import
com.biganto.visual.roompark.data.data_provider.FeedsContractModule
import
com.biganto.visual.roompark.data.local.LocalStorage
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.di.RetrofitModule
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import
com.biganto.visual.roompark.data.repository.db.requrey.RequeryRepository
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.domain.contract.DevProgressContract
import
com.biganto.visual.roompark.domain.contract.FeedsContract
import
dagger.Binds
import
dagger.Component
import
dagger.Module
...
...
@@ -14,14 +23,18 @@ interface DataComponent{
}
//@Module(includes = [DataModule::class,RetrofitModule::class,DbModul
e::class])
//abstract class ContractRepositoryModule @Inject constructor(
// val authC:AuthContract
//){
//
@Module
(
includes
=
[
DataModule
::
class
,
RetrofitModule
::
class
,
DbModule
::
class
,
LocalStorag
e
::
class
])
abstract
class
ContractRepositoryModule
{
@Binds
abstract
fun
provideAuth
(
contract
:
AuthContractModule
):
AuthContract
@Binds
abstract
fun
provideFeedsContract
(
impl
:
FeedsContractModule
):
FeedsContract
//}
@Binds
abstract
fun
provideDevProgressContract
(
impl
:
AlbumsContractModule
):
DevProgressContract
}
...
...
app/src/main/java/com/biganto/visual/roompark/domain/use_case/albumsUseCase.kt
View file @
726ddcfd
package
com.biganto.visual.roompark.domain.use_case
import
com.biganto.visual.roompark.d
ata.data_provider.AlbumsContractModule
import
com.biganto.visual.roompark.d
omain.contract.DevProgressContract
import
javax.inject.Inject
/**
...
...
@@ -8,7 +8,7 @@ import javax.inject.Inject
*/
class
AlbumsUseCase
@Inject
constructor
(
private
val
contract
:
AlbumsContractModule
private
val
contract
:
DevProgressContract
){
fun
getProgressAlbums
()
=
contract
.
getProgressCards
()
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenController.kt
View file @
726ddcfd
...
...
@@ -7,7 +7,6 @@ import com.biganto.visual.roompark.base.IBottomNavigation
import
com.biganto.visual.roompark.base.RoomParkApplication
import
com.biganto.visual.roompark.base.RoomParkMainActivity
import
com.biganto.visual.roompark.conductor.BigantoBaseController
import
com.biganto.visual.roompark.di.dagger.CoreInjectHelper
import
com.biganto.visual.roompark.presentation.screen.home.home_routing.HomeBottomNavigationController
import
com.bluelinelabs.conductor.RouterTransaction
import
com.google.android.material.button.MaterialButton
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenController.kt
View file @
726ddcfd
...
...
@@ -78,6 +78,7 @@ class FeedsScreenController :
.
map
{
feedsRecyclerView
.
layoutManager
as
LinearLayoutManager
}
.
map
{
it
.
findLastCompletelyVisibleItemPosition
()
}
.
doOnNext
{
Timber
.
d
(
"Visible items $it of ${(feedsRecyclerView.adapter?.itemCount?:0) - 3}"
)
}
.
filter
{
feedsRecyclerView
.
adapter
?.
itemCount
?:
0
>
0
}
.
filter
{
it
>(
feedsRecyclerView
.
adapter
?.
itemCount
?:
0
)-
2
}
.
map
{
feedsRecyclerView
.
adapter
?.
itemCount
?:
0
}
.
map
{
Pair
(
storedFeedsList
[
feedsTabs
.
selectedTabPosition
],
it
)}
...
...
@@ -213,8 +214,10 @@ class FeedsScreenController :
feedsTabs
.
addTab
(
tab
)
}
storedFeedsList
=
viewState
.
restore
.
feeds
}
private
fun
getComponent
()
=
DaggerFeedsScreenComponent
.
factory
()
.
create
(
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
)
.
inject
(
this
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenDI.kt
View file @
726ddcfd
...
...
@@ -2,32 +2,24 @@ 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.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
import
com.biganto.visual.roompark.data.service.user_session.UserSessionService
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
dagger.Binds
import
dagger.BindsInstance
import
dagger.Component
import
dagger.Module
import
dagger.Subcomponent
@PerScreen
@Subcomponent
(
modules
=
[
FeedsScreenModule
::
class
,
DataModule
::
class
,
RetrofitModule
::
class
,
AppModule
::
class
,
DbModule
::
class
]
// ,dependencies = [AppComponent::class]
@Component
(
modules
=
[
FeedsScreenModule
::
class
]
,
dependencies
=
[
AppComponent
::
class
]
)
interface
FeedsScreenComponent
{
@
Subc
omponent
.
Factory
@
C
omponent
.
Factory
interface
Factory
{
fun
create
(
appComponent
:
AppComponent
...
...
@@ -35,8 +27,6 @@ interface FeedsScreenComponent {
):
FeedsScreenComponent
}
val
presenter
:
FeedsScreenPresenter
fun
inject
(
controller
:
FeedsScreenController
)
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenPresenter.kt
View file @
726ddcfd
...
...
@@ -82,7 +82,7 @@ class FeedsScreenPresenter @Inject constructor(
.
onErrorReturn
(
::
parseError
)
val
state
=
restoreStateObservable
//
.mergeWith(fetchFeeds)
.
mergeWith
(
fetchFeeds
)
.
mergeWith
(
getFeedArticlesPreview
)
.
mergeWith
(
fetchAlbums
)
.
mergeWith
(
fetchCams
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenDI.kt
View file @
726ddcfd
...
...
@@ -2,27 +2,22 @@ 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.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
dagger.Binds
import
dagger.BindsInstance
import
dagger.Component
import
dagger.Module
import
dagger.Subcomponent
@PerScreen
@Subcomponent
(
modules
=
[
SettingsScreenModule
::
class
,
DataModule
::
class
,
RetrofitModule
::
class
,
AppModule
::
class
,
DbModule
::
class
]
// ,dependencies = [AppComponent::class]
@Component
(
modules
=
[
SettingsScreenModule
::
class
]
,
dependencies
=
[
AppComponent
::
class
]
)
interface
SettingsScreenComponent
{
@
Subc
omponent
.
Factory
@
C
omponent
.
Factory
interface
Factory
{
fun
create
(
appComponent
:
AppComponent
...
...
@@ -30,8 +25,6 @@ interface SettingsScreenComponent {
):
SettingsScreenComponent
}
val
presenter
:
SettingsScreenPresenter
fun
inject
(
controller
:
SettingsScreenController
)
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/splash/ScreenDI.kt
View file @
726ddcfd
...
...
@@ -3,30 +3,25 @@ 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.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.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
@
Subc
omponent
(
modules
=
[
AuthScreenModule
::
class
,
DataModule
::
class
,
RetrofitModule
::
class
,
AppModule
::
class
,
Db
Module
::
class
]
//
,dependencies = [AppComponent::class]
@
C
omponent
(
modules
=
[
SplashScreen
Module
::
class
]
,
dependencies
=
[
AppComponent
::
class
]
)
interface
SplashScreenComponent
{
@
Subc
omponent
.
Factory
@
C
omponent
.
Factory
interface
Factory
{
fun
create
(
appComponent
:
AppComponent
...
...
@@ -34,8 +29,6 @@ interface SplashScreenComponent {
):
SplashScreenComponent
}
val
presenter
:
SplashScreenPresenter
fun
inject
(
controller
:
SplashScreenController
)
}
...
...
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