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
4cf98e8d
Commit
4cf98e8d
authored
Jan 28, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix sql requersts
parent
8d8c226a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
17 deletions
+20
-17
AlbumsRepository.kt
...to/visual/roompark/data/data_provider/AlbumsRepository.kt
+7
-6
FeedsRepository.kt
...nto/visual/roompark/data/data_provider/FeedsRepository.kt
+4
-4
RequeryRepository.kt
.../roompark/data/repository/db/requrey/RequeryRepository.kt
+6
-5
ScreenController.kt
...al/roompark/presentation/screen/feeds/ScreenController.kt
+3
-2
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/AlbumsRepository.kt
View file @
4cf98e8d
...
...
@@ -62,17 +62,18 @@ class AlbumsContractModule @Inject constructor(
.
doOnNext
{
Timber
.
d
(
"raw0 $it"
)
}
.
map
{
fromRawList
(
it
,
::
fromRaw
)
}
.
doOnNext
(
db
::
blockingUpsert
)
.
subscribeOn
(
Schedulers
.
io
())
private
val
fetchTopLevelAlbumsDb
=
db
.
getTopLevelAlbums
()
.
subscribeOn
(
Schedulers
.
io
())
.
doOnNext
{
Timber
.
d
(
"top level albums count : ${it.size}"
)
}
private
fun
fetchTopLevelAlbums
():
Observable
<
List
<
AlbumPreviewModel
>>
=
Observable
.
mergeDelayError
(
arrayListOf
(
fetchTopLevelAlbumsApi
,
fetchTopLevelAlbumsDb
)
).
doOnNext
{
Timber
.
d
(
"got entity $it"
)
}.
map
{
fromEntity
(
it
,
::
fromEntity
)
}
arrayListOf
(
fetchTopLevelAlbumsDb
,
fetchTopLevelAlbumsApi
)
)
.
doOnNext
{
Timber
.
d
(
"got entity $it"
)
}
.
map
{
fromEntity
(
it
,
::
fromEntity
)
}
//endregion allAlbums
//region concrete Albums
...
...
@@ -101,7 +102,7 @@ class AlbumsContractModule @Inject constructor(
private
fun
fetchAlbums
(
parentId
:
Int
):
Observable
<
List
<
AlbumPreviewModel
>>
=
Observable
.
mergeDelayError
(
arrayListOf
(
fetchAlbums
Api
(
parentId
),
fetchAlbumsDb
(
parentId
))
arrayListOf
(
fetchAlbums
Db
(
parentId
),
fetchAlbumsApi
(
parentId
))
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
//endregion concrete Albums
...
...
@@ -134,7 +135,7 @@ class AlbumsContractModule @Inject constructor(
private
fun
fetchAlbumPhotos
(
albumId
:
Int
):
Observable
<
List
<
PhotoModel
>>
=
Observable
.
mergeDelayError
(
arrayListOf
(
fetchAlbum
PhotosApi
(
albumId
),
fetchAlbumsPhotosDb
(
albumId
))
arrayListOf
(
fetchAlbum
sPhotosDb
(
albumId
),
fetchAlbumPhotosApi
(
albumId
))
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
//endregion concrete Albums
...
...
app/src/main/java/com/biganto/visual/roompark/data/data_provider/FeedsRepository.kt
View file @
4cf98e8d
...
...
@@ -70,8 +70,8 @@ class FeedsContractModule @Inject constructor(
private
fun
fetchArticles
(
feedAlias
:
String
,
pageSize
:
Int
=
10
,
startIndex
:
Int
=
0
)
:
Observable
<
ArticlesPreviewModel
>
=
Observable
.
mergeDelayError
(
arrayListOf
(
fetchArticles
sApi
(
feedAlias
,
pageSize
,
startIndex
),
fetchArticlesDb
(
feedAlias
,
pageSize
,
startIndex
)
arrayListOf
(
fetchArticles
Db
(
feedAlias
,
pageSize
,
startIndex
),
fetchArticlessApi
(
feedAlias
,
pageSize
,
startIndex
)
)
).
map
{
fromEntity
(
feedAlias
,
it
)
}
...
...
@@ -91,7 +91,7 @@ class FeedsContractModule @Inject constructor(
private
fun
fetchAllFeeds
():
Observable
<
List
<
FeedModel
>>
=
Observable
.
mergeDelayError
(
arrayListOf
(
fetchFeeds
Api
,
fetchFeedsDb
)
arrayListOf
(
fetchFeeds
Db
,
fetchFeedsApi
)
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
private
fun
fetchArticleApi
(
id
:
Int
)
=
...
...
@@ -120,7 +120,7 @@ class FeedsContractModule @Inject constructor(
private
fun
fetchArticle
(
articleId
:
Int
):
Observable
<
ArticleModel
>
=
Observable
.
mergeDelayError
(
arrayListOf
(
fetchArticle
Api
(
articleId
),
fetchArticleDb
(
articleId
))
arrayListOf
(
fetchArticle
Db
(
articleId
),
fetchArticleApi
(
articleId
))
).
map
{
fromEntity
(
it
,
true
)
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/RequeryRepository.kt
View file @
4cf98e8d
...
...
@@ -82,8 +82,8 @@ class RequeryRepository @Inject constructor(
Observable
.
fromArray
(
store
.
raw
(
ImageAlbumEntity
::
class
,
"SELECT alb.* from ImageAlbum
Junction albJun
"
+
"left join ImageAlbum
alb
on albJun.albumId = alb.id "
+
"SELECT alb.* from ImageAlbum
alb
"
+
"left join ImageAlbum
Junction albJun
on albJun.albumId = alb.id "
+
"WHERE albJun.albumId is null "
).
toList
()
)
...
...
@@ -92,9 +92,10 @@ class RequeryRepository @Inject constructor(
Observable
.
fromArray
(
store
.
raw
(
ImageAlbumEntity
::
class
,
"SELECT alb.* from ImageAlbumJunction albJun "
+
"left join ImageAlbum alb on albJun.albumId = alb.id "
+
"WHERE albJun.albumId is $parentId "
"SELECT alb.* "
+
"from ImageAlbum alb "
+
" left join ImageAlbumJunction albJun on albJun.albumId = alb.id "
+
"WHERE albJun.parentId is $parentId"
).
toList
()
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feeds/ScreenController.kt
View file @
4cf98e8d
...
...
@@ -130,7 +130,6 @@ class FeedsScreenController :
@Inject
override
lateinit
var
injectedPresenter
:
FeedsScreenPresenter
override
fun
onAllFeedArticles
():
Observable
<
FeedModel
>
=
allFeedArticles
.
clicks
()
.
map
{
feedsTabs
.
getTabAt
(
feedsTabs
.
selectedTabPosition
)}
...
...
@@ -140,7 +139,6 @@ class FeedsScreenController :
bottomNavigationController
.
show
()
toolBar
.
setToolbar
()
bindRecycler
()
}
override
fun
render
(
viewState
:
FeedsScreenViewState
)
{
...
...
@@ -221,10 +219,13 @@ class FeedsScreenController :
}
feedsTabs
.
addTab
(
tab
)
}
storedFeedsList
=
viewState
.
items
feedsTabs
.
selectTab
(
feedsTabs
.
getTabAt
(
0
))
}
private
fun
render
(
viewState
:
FeedsScreenViewState
.
AlbumsPages
){
Timber
.
d
(
"got albums pages: ${viewState.items.size}"
)
(
devProgressRecyclerView
.
adapter
as
AlbumsPreviewAdapter
).
setItems
(
viewState
.
items
)
}
...
...
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