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
109c5265
Commit
109c5265
authored
Nov 22, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try to resolve custom scope within singleton
parent
bba046fb
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
78 additions
and
29 deletions
+78
-29
AlbumsRepository.kt
...to/visual/roompark/data/data_provider/AlbumsRepository.kt
+13
-2
IRoomParkMobileApi.kt
...ompark/data/repository/api/retrofit/IRoomParkMobileApi.kt
+1
-1
AppComponent.kt
...ava/com/biganto/visual/roompark/di/dagger/AppComponent.kt
+9
-0
DataModule.kt
.../java/com/biganto/visual/roompark/di/dagger/DataModule.kt
+4
-0
feeds.kt
...va/com/biganto/visual/roompark/domain/interactor/feeds.kt
+6
-5
albumsUseCase.kt
.../biganto/visual/roompark/domain/use_case/albumsUseCase.kt
+21
-0
ScreenController.kt
...ual/roompark/presentation/screen/auth/ScreenController.kt
+4
-1
ScreenDI.kt
...anto/visual/roompark/presentation/screen/auth/ScreenDI.kt
+5
-9
ScreenController.kt
...al/roompark/presentation/screen/feeds/ScreenController.kt
+2
-4
ScreenPresenter.kt
...ual/roompark/presentation/screen/feeds/ScreenPresenter.kt
+13
-7
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/AlbumsRepository.kt
View file @
109c5265
...
...
@@ -25,7 +25,7 @@ class AlbumsContractModule @Inject constructor(
override
fun
getProgressCards
():
Observable
<
List
<
AlbumPreviewModel
>>
=
fetchTopLevelAlbums
()
override
fun
getProgressAlbumList
(
albumId
:
Int
):
Observable
<
List
<
AlbumPreviewModel
>>
=
fetch
TopLevelAlbums
(
)
fetch
Albums
(
albumId
)
override
fun
getAlbumPhoto
(
photoId
:
Int
):
Observable
<
PhotoModel
>
{
TODO
(
"not implemented"
)
//To change body of created functions use File | Settings | File Templates.
...
...
@@ -65,7 +65,7 @@ class AlbumsContractModule @Inject constructor(
).
take
(
1
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
private
fun
fetchAlbums
(
parentAlbumId
:
Int
)
=
private
fun
fetchAlbums
Api
(
parentAlbumId
:
Int
)
=
api
.
getAlbums
(
parentAlbumId
)
.
doOnNext
{
Timber
.
d
(
"raw0 $it"
)
}
.
map
{
fromRawList
(
it
,
::
fromRaw
)
}
...
...
@@ -83,5 +83,16 @@ class AlbumsContractModule @Inject constructor(
}
.
subscribeOn
(
Schedulers
.
io
())
private
fun
fetchAlbumsDb
(
parentAlbumId
:
Int
)
=
db
.
getChildAlbums
(
parentAlbumId
)
.
toList
()
.
toObservable
()
.
subscribeOn
(
Schedulers
.
io
())
private
fun
fetchAlbums
(
parentId
:
Int
):
Observable
<
List
<
AlbumPreviewModel
>>
=
Observable
.
mergeDelayError
(
arrayListOf
(
fetchAlbumsApi
(
parentId
),
fetchAlbumsDb
(
parentId
))
).
take
(
1
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
}
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/IRoomParkMobileApi.kt
View file @
109c5265
...
...
@@ -81,7 +81,7 @@ interface IRoomParkMobileApi{
//region GetFavorites
const
val
GET_ARTICLES_PAGE_METHOD
=
"news.getArticlesList"
const
val
ARTICLES_PAGINATION_ALIAS_PARAM
=
"feed_alias"
const
val
ARTICLES_PAGINATION_PAGE_SIZE_PARAM
=
"pagesize
"
const
val
ARTICLES_PAGINATION_PAGE_SIZE_PARAM
=
"pagesize"
const
val
ARTICLES_PAGINATION_PAGE_PARAM
=
"page"
//endregion
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/AppComponent.kt
View file @
109c5265
package
com.biganto.visual.roompark.di.dagger
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.repository.api.retrofit.di.RetrofitModule
import
com.biganto.visual.roompark.data.repository.db.requrey.DbModule
import
dagger.BindsInstance
import
dagger.Component
import
dagger.android.AndroidInjectionModule
import
dagger.android.AndroidInjector
...
...
@@ -11,6 +14,8 @@ import javax.inject.Singleton
/**
* Created by Vladislav Bogdashkin on 13.06.2018.
*/
...
...
@@ -52,8 +57,12 @@ interface AppComponent : AndroidInjector<RoomParkApplication>{
@BindsInstance
fun
retroApi
(
api
:
RetrofitRepository
)
:
IRoomParkApi
}
// retorfitModule: RetrofitModule
// fun cache(): ICachedStore
// fun context(): Context
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/DataModule.kt
View file @
109c5265
...
...
@@ -9,6 +9,7 @@ import com.biganto.visual.roompark.data.repository.db.requrey.RequeryRepository
import
dagger.Binds
import
dagger.Component
import
dagger.Module
import
javax.inject.Singleton
@Component
interface
DataComponent
{
...
...
@@ -16,6 +17,8 @@ interface DataComponent{
}
@Module
abstract
class
DataModule
{
...
...
@@ -30,6 +33,7 @@ abstract class DataModule {
// abstract fun provideRpRetrofit(retrofit:Retrofit) : Retrofit
//
@Singleton
@Binds
abstract
fun
provideRoomParkApi
(
api
:
RetrofitRepository
)
:
IRoomParkApi
...
...
app/src/main/java/com/biganto/visual/roompark/domain/interactor/feeds.kt
View file @
109c5265
package
com.biganto.visual.roompark.domain.interactor
import
com.biganto.visual.roompark.domain.model.*
import
com.biganto.visual.roompark.domain.use_case.AlbumsUseCase
import
com.biganto.visual.roompark.domain.use_case.FeedUseCase
import
io.reactivex.Observable
import
io.reactivex.Single
import
io.reactivex.schedulers.Schedulers
import
java.util.*
import
javax.inject.Inject
...
...
@@ -13,7 +12,8 @@ import javax.inject.Inject
*/
class
FeedsInteractor
@Inject
constructor
(
private
val
feedsUseCase
:
FeedUseCase
private
val
feedsUseCase
:
FeedUseCase
,
private
val
albumsUseCase
:
AlbumsUseCase
)
{
fun
fetchTopFeeds
():
Observable
<
FeedsHeaderModel
>
=
...
...
@@ -33,9 +33,10 @@ class FeedsInteractor @Inject constructor(
fun
fetchArticles
(
feedId
:
Int
,
pageSize
:
Int
,
startIndex
:
Int
):
Observable
<
ArticlesPreviewModel
>
=
feedsUseCase
.
fetchArticlesPage
(
feedId
,
pageSize
,
startIndex
)
fun
fetchAlbums
():
Single
<
List
<
AlbumPreviewModel
>>
=
Single
.
just
(
albumsPreviews
)
fun
fetchAlbums
():
Observable
<
List
<
AlbumPreviewModel
>>
=
albumsUseCase
.
getProgressAlbums
(
)
fun
fetchCams
():
Single
<
WebCamListModel
>
=
Single
.
just
(
camsList
)
fun
fetchCams
():
Observable
<
WebCamListModel
>
=
Observable
.
just
(
camsList
)
companion
object
{
...
...
app/src/main/java/com/biganto/visual/roompark/domain/use_case/albumsUseCase.kt
0 → 100644
View file @
109c5265
package
com.biganto.visual.roompark.domain.use_case
import
com.biganto.visual.roompark.data.data_provider.AlbumsContractModule
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 24.09.2019.
*/
class
AlbumsUseCase
@Inject
constructor
(
private
val
contract
:
AlbumsContractModule
){
fun
getProgressAlbums
()
=
contract
.
getProgressCards
()
fun
getChildAlbum
(
parentAlbumId
:
Int
)
=
contract
.
getProgressAlbumList
(
parentAlbumId
)
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenController.kt
View file @
109c5265
...
...
@@ -7,6 +7,7 @@ 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
...
...
@@ -92,7 +93,9 @@ class AuthScreenController :
fun
getComponent
()
=
DaggerAuthScreenComponent
.
factory
()
.
create
(
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
)
.
create
(
RoomParkApplication
.
component
,
activity
as
RoomParkMainActivity
)
.
inject
(
this
)
override
fun
render
(
viewState
:
AuthScreenViewState
)
{
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/auth/ScreenDI.kt
View file @
109c5265
...
...
@@ -11,29 +11,25 @@ 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.*
@PerScreen
@
C
omponent
(
@
Subc
omponent
(
modules
=
[
AuthScreenModule
::
class
,
DataModule
::
class
,
RetrofitModule
::
class
,
AppModule
::
class
,
DbModule
::
class
],
dependencies
=
[
AppComponent
::
class
])
])
interface
AuthScreenComponent
{
@Component
.
Factory
interface
Factory
{
fun
create
(
appComponent
:
AppComponent
,
@BindsInstance
activity
:
RoomParkMainActivity
appComponent
:
AppComponent
,
@BindsInstance
activity
:
RoomParkMainActivity
):
AuthScreenComponent
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenController.kt
View file @
109c5265
...
...
@@ -19,7 +19,6 @@ import com.bluelinelabs.conductor.RouterTransaction
import
com.bluelinelabs.conductor.changehandler.FadeChangeHandler
import
com.google.android.material.button.MaterialButton
import
com.google.android.material.tabs.TabLayout
import
com.google.android.material.textview.MaterialTextView
import
com.jakewharton.rxbinding3.material.selections
import
com.jakewharton.rxbinding3.recyclerview.scrollStateChanges
import
com.jakewharton.rxbinding3.view.clicks
...
...
@@ -45,8 +44,7 @@ class FeedsScreenController :
.
map
{
it
.
position
}
.
map
{
storedFeedsList
[
it
].
feedId
}
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
doOnNext
{
feedsBlockView
.
findViewById
<
MaterialButton
>(
R
.
id
.
to_feed_articles
)
.
text
=
"ВСЕ ${allFeedName(it)} →"
}
.
doOnNext
{
allFeedArticles
.
text
=
"ВСЕ ${allFeedName(it)} →"
}
...
...
@@ -70,7 +68,7 @@ class FeedsScreenController :
lateinit
var
feedsBlockView
:
ViewGroup
@BindView
(
R
.
id
.
to_feed_articles
)
lateinit
var
allFeedArticles
:
MaterialTextView
lateinit
var
allFeedArticles
:
MaterialButton
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenPresenter.kt
View file @
109c5265
...
...
@@ -39,44 +39,50 @@ class FeedsScreenPresenter @Inject constructor(
override
fun
bindIntents
()
{
val
fetchCams
=
interactor
.
fetchCams
()
.
map
{
.
map
<
FeedsScreenViewState
>
{
restoreModel
.
cams
=
it
.
items
FeedsScreenViewState
.
CamsList
(
it
.
items
)
}
.
onErrorReturn
(
::
parseError
)
val
fetchAlbums
=
interactor
.
fetchAlbums
()
.
map
{
.
map
<
FeedsScreenViewState
>
{
restoreModel
.
albums
=
it
FeedsScreenViewState
.
AlbumsPages
(
it
)
}
.
onErrorReturn
(
::
parseError
)
val
fetchFeeds
=
interactor
.
fetchTopFeeds
()
.
map
{
.
map
<
FeedsScreenViewState
>
{
restoreModel
.
feeds
=
it
.
feeds
FeedsScreenViewState
.
FeedsPages
(
it
.
feeds
.
toList
())
}
.
onErrorReturn
(
::
parseError
)
val
getFeedArticlesPreview
=
intent
(
FeedsScreen
::
feedsTabSelected
)
.
flatMap
{
interactor
.
fetchArticles
(
it
)
}
.
map
{
.
map
<
FeedsScreenViewState
>
{
restoreModel
.
articles
=
it
.
articles
FeedsScreenViewState
.
GetFeedArticlesPreview
(
it
.
articles
.
toList
())
}
.
onErrorReturn
(
::
parseError
)
val
switchToAllArtiles
=
intent
(
FeedsScreen
::
onAllFeedArticles
)
.
map
{
.
map
<
FeedsScreenViewState
>
{
FeedsScreenViewState
.
ToArticlesScreen
(
it
.
feedId
)
}
.
onErrorReturn
(
::
parseError
)
val
getNewArticlesPage
=
intent
(
FeedsScreen
::
requsetsNewArticles
)
.
flatMap
{
interactor
.
fetchArticles
(
it
.
first
.
feedId
,
FEED_PREVIEW_PAGE_SIZE
,
it
.
second
)
}
.
map
{
.
map
<
FeedsScreenViewState
>
{
restoreModel
.
articles
=
it
.
articles
FeedsScreenViewState
.
ArticlesScrollPage
(
it
.
articles
.
toList
())
}
.
onErrorReturn
(
::
parseError
)
val
state
=
restoreStateObservable
.
mergeWith
(
fetchFeeds
)
//
.mergeWith(fetchFeeds)
.
mergeWith
(
getFeedArticlesPreview
)
.
mergeWith
(
fetchAlbums
)
.
mergeWith
(
fetchCams
)
...
...
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