Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
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
eb714450
Commit
eb714450
authored
Dec 03, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added webCam api impl
parent
4d0a9bdf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
0 deletions
+77
-0
AlbumsRepository.kt
...to/visual/roompark/data/data_provider/AlbumsRepository.kt
+38
-0
IApi.kt
...a/com/biganto/visual/roompark/data/repository/api/IApi.kt
+1
-0
IRoomParkMobileApi.kt
...ompark/data/repository/api/retrofit/IRoomParkMobileApi.kt
+12
-0
RetrofitRepository.kt
...ompark/data/repository/api/retrofit/RetrofitRepository.kt
+5
-0
camsUseCase.kt
...om/biganto/visual/roompark/domain/use_case/camsUseCase.kt
+21
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/AlbumsRepository.kt
View file @
eb714450
...
@@ -45,6 +45,7 @@ class AlbumsContractModule @Inject constructor(
...
@@ -45,6 +45,7 @@ class AlbumsContractModule @Inject constructor(
}
}
//region allAlbums
private
val
fetchTopLevelAlbumsApi
=
private
val
fetchTopLevelAlbumsApi
=
api
.
getAlbums
()
api
.
getAlbums
()
.
doOnNext
{
Timber
.
d
(
"raw0 $it"
)
}
.
doOnNext
{
Timber
.
d
(
"raw0 $it"
)
}
...
@@ -64,7 +65,10 @@ class AlbumsContractModule @Inject constructor(
...
@@ -64,7 +65,10 @@ class AlbumsContractModule @Inject constructor(
arrayListOf
(
fetchTopLevelAlbumsApi
,
fetchTopLevelAlbumsDb
)
arrayListOf
(
fetchTopLevelAlbumsApi
,
fetchTopLevelAlbumsDb
)
).
doOnNext
{
Timber
.
d
(
"got entity $it"
)
}.
map
{
fromEntity
(
it
,
::
fromEntity
)
}
).
doOnNext
{
Timber
.
d
(
"got entity $it"
)
}.
map
{
fromEntity
(
it
,
::
fromEntity
)
}
//endregion allAlbums
//region concrete Albums
private
fun
fetchAlbumsApi
(
parentAlbumId
:
Int
)
=
private
fun
fetchAlbumsApi
(
parentAlbumId
:
Int
)
=
api
.
getAlbums
(
parentAlbumId
)
api
.
getAlbums
(
parentAlbumId
)
.
doOnNext
{
Timber
.
d
(
"raw0 $it"
)
}
.
doOnNext
{
Timber
.
d
(
"raw0 $it"
)
}
...
@@ -94,5 +98,39 @@ class AlbumsContractModule @Inject constructor(
...
@@ -94,5 +98,39 @@ class AlbumsContractModule @Inject constructor(
arrayListOf
(
fetchAlbumsApi
(
parentId
),
fetchAlbumsDb
(
parentId
))
arrayListOf
(
fetchAlbumsApi
(
parentId
),
fetchAlbumsDb
(
parentId
))
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
//endregion concrete Albums
//region cams
private
fun
fetchWebCamsApi
()
=
api
.
get
()
.
doOnNext
{
Timber
.
d
(
"raw0 $it"
)
}
.
map
{
fromRawList
(
it
,
::
fromRaw
)
}
.
doOnNext
(
db
::
blockingUpsert
)
.
doOnNext
{
it
.
asSequence
().
map
{
album
->
if
(
db
.
checkIfExistsAlbumJunction
(
album
.
id
,
parentAlbumId
)
!=
null
)
{
return
@map
null
}
val
entity
=
ImageAlbumJunctionEntity
()
entity
.
setAlbumId
(
album
.
id
)
entity
.
setParentId
(
parentAlbumId
)
entity
}.
filterNotNull
().
toList
().
also
{
junctions
->
db
.
blockingUpsert
(
junctions
)
}
}
.
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
))
).
map
{
fromEntity
(
it
,
::
fromEntity
)
}
//endregion
}
}
app/src/main/java/com/biganto/visual/roompark/data/repository/api/IApi.kt
View file @
eb714450
...
@@ -47,6 +47,7 @@ interface IRoomParkApi {
...
@@ -47,6 +47,7 @@ interface IRoomParkApi {
fun
getAlbums
(
parentId
:
Int
?
=
null
):
Observable
<
List
<
ImageAlbumRaw
>>
fun
getAlbums
(
parentId
:
Int
?
=
null
):
Observable
<
List
<
ImageAlbumRaw
>>
fun
getEstate
(
building
:
Int
,
flat
:
Int
):
Observable
<
EstateRaw
>
fun
getEstate
(
building
:
Int
,
flat
:
Int
):
Observable
<
EstateRaw
>
fun
getWebCamsList
():
Observable
<
List
<
WebCamRaw
>>
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/IRoomParkMobileApi.kt
View file @
eb714450
...
@@ -133,6 +133,9 @@ interface IRoomParkMobileApi{
...
@@ -133,6 +133,9 @@ interface IRoomParkMobileApi{
const
val
ESTATE_FLAT_NUMBER_PARAM
=
"number "
const
val
ESTATE_FLAT_NUMBER_PARAM
=
"number "
//endregion
//endregion
//region Get Web Cams
const
val
GET_WEB_CAMS_METHOD
=
"webcams.getCameras"
//endregion
}
}
...
@@ -193,6 +196,15 @@ interface IRoomParkMobileApi{
...
@@ -193,6 +196,15 @@ interface IRoomParkMobileApi{
@Query
(
API_VERSION_PARAM
)
apiVersion
:
String
=
DEFAULT_API_VERSION
@Query
(
API_VERSION_PARAM
)
apiVersion
:
String
=
DEFAULT_API_VERSION
):
Observable
<
Response
<
List
<
FeedRaw
>>>
):
Observable
<
Response
<
List
<
FeedRaw
>>>
@GET
(
"$API_URL$GET_WEB_CAMS_METHOD$DELIMITER"
)
fun
getWebCams
(
@Query
(
CLIENT_TYPE_PARAM
)
clientType
:
String
=
DEFAULT_CLIENT_TYPE
,
@Query
(
CLIENT_VERSION_PARAM
)
clientVersion
:
String
=
DEFAULT_CLIENT_VERSION
,
@Query
(
API_VERSION_PARAM
)
apiVersion
:
String
=
DEFAULT_API_VERSION
):
Observable
<
Response
<
List
<
WebCamRaw
>>>
@GET
(
"$API_URL$GET_ARTICLES_PAGE_METHOD$DELIMITER"
)
@GET
(
"$API_URL$GET_ARTICLES_PAGE_METHOD$DELIMITER"
)
fun
getArticlesPage
(
fun
getArticlesPage
(
@Query
(
CLIENT_TYPE_PARAM
)
clientType
:
String
=
DEFAULT_CLIENT_TYPE
,
@Query
(
CLIENT_TYPE_PARAM
)
clientType
:
String
=
DEFAULT_CLIENT_TYPE
,
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/retrofit/RetrofitRepository.kt
View file @
eb714450
...
@@ -80,6 +80,11 @@ class RetrofitRepository @Inject constructor(retrofit: Retrofit) : IRoomParkApi
...
@@ -80,6 +80,11 @@ class RetrofitRepository @Inject constructor(retrofit: Retrofit) : IRoomParkApi
.
subscribeOn
(
Schedulers
.
io
())
.
subscribeOn
(
Schedulers
.
io
())
.
compose
(
RetrofitResponseValidation
())
.
compose
(
RetrofitResponseValidation
())
override
fun
getWebCamsList
():
Observable
<
List
<
WebCamRaw
>>
=
api
.
getWebCams
()
.
subscribeOn
(
Schedulers
.
io
())
.
compose
(
RetrofitResponseValidation
())
override
fun
getPhotos
(
parentId
:
Int
):
Observable
<
List
<
NewsPhotoRaw
>>
=
override
fun
getPhotos
(
parentId
:
Int
):
Observable
<
List
<
NewsPhotoRaw
>>
=
api
.
getPhotos
(
id
=
parentId
)
api
.
getPhotos
(
id
=
parentId
)
.
subscribeOn
(
Schedulers
.
io
())
.
subscribeOn
(
Schedulers
.
io
())
...
...
app/src/main/java/com/biganto/visual/roompark/domain/use_case/camsUseCase.kt
0 → 100644
View file @
eb714450
package
com.biganto.visual.roompark.domain.use_case
import
com.biganto.visual.roompark.domain.contract.DevProgressContract
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 24.09.2019.
*/
class
CamsUseCase
@Inject
constructor
(
private
val
contract
:
DevProgressContract
){
fun
getWebCams
()
=
contract
.
getWebCamsList
()
fun
getCam
(
camId
:
Int
)
=
contract
.
getWebCamStream
(
camId
)
}
\ 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