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
cf0ad03d
Commit
cf0ad03d
authored
Dec 27, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
estate usecase
parent
a3679ba1
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
30 additions
and
3 deletions
+30
-3
EstateRepository.kt
...to/visual/roompark/data/data_provider/EstateRepository.kt
+7
-0
IDb.kt
...ava/com/biganto/visual/roompark/data/repository/db/IDb.kt
+1
-0
RequeryRepository.kt
.../roompark/data/repository/db/requrey/RequeryRepository.kt
+6
-0
DealContract.kt
...m/biganto/visual/roompark/domain/contract/DealContract.kt
+1
-0
estate.kt
...a/com/biganto/visual/roompark/domain/interactor/estate.kt
+3
-1
estateUseCase.kt
.../biganto/visual/roompark/domain/use_case/estateUseCase.kt
+2
-0
ScreenController.kt
...l/roompark/presentation/screen/estate/ScreenController.kt
+3
-0
ScreenDI.kt
...to/visual/roompark/presentation/screen/estate/ScreenDI.kt
+2
-0
ScreenPresenter.kt
...al/roompark/presentation/screen/estate/ScreenPresenter.kt
+5
-2
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/EstateRepository.kt
View file @
cf0ad03d
...
@@ -76,4 +76,11 @@ class EstateRepository @Inject constructor(
...
@@ -76,4 +76,11 @@ class EstateRepository @Inject constructor(
}
}
private
fun
fetchEstateDb
(
id
:
Int
)
=
db
.
getEstate
(
id
)
override
fun
getEstate
(
estateId
:
Int
)
:
Observable
<
EstateModel
>{
return
fetchEstateDb
(
estateId
).
map
(
::
fromEntity
)
}
}
}
app/src/main/java/com/biganto/visual/roompark/data/repository/db/IDb.kt
View file @
cf0ad03d
...
@@ -28,4 +28,5 @@ interface IDb {
...
@@ -28,4 +28,5 @@ interface IDb {
fun
getAlbum
(
albumId
:
Int
):
Observable
<
ImageAlbumEntity
>
fun
getAlbum
(
albumId
:
Int
):
Observable
<
ImageAlbumEntity
>
fun
getUserFavorites
(
uuid
:
Int
):
Observable
<
EstateEntity
>
fun
getUserFavorites
(
uuid
:
Int
):
Observable
<
EstateEntity
>
fun
fetchAllUsers
():
Observable
<
List
<
UserEntity
>>
fun
fetchAllUsers
():
Observable
<
List
<
UserEntity
>>
fun
getEstate
(
estateId
:
Int
):
Observable
<
EstateEntity
>
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/RequeryRepository.kt
View file @
cf0ad03d
...
@@ -95,6 +95,11 @@ class RequeryRepository @Inject constructor(
...
@@ -95,6 +95,11 @@ class RequeryRepository @Inject constructor(
.
where
(
ImageAlbumEntity
.
ID
.
eq
(
albumId
))
.
where
(
ImageAlbumEntity
.
ID
.
eq
(
albumId
))
.
get
().
observable
()
.
get
().
observable
()
override
fun
getEstate
(
estateId
:
Int
):
Observable
<
EstateEntity
>
=
store
.
select
(
EstateEntity
::
class
)
.
where
(
EstateEntity
.
ID
.
eq
(
estateId
))
.
get
().
observable
()
override
fun
getPhotos
(
albumId
:
Int
):
Observable
<
GalleryPhotoEntity
>
=
override
fun
getPhotos
(
albumId
:
Int
):
Observable
<
GalleryPhotoEntity
>
=
store
.
select
(
GalleryPhotoEntity
::
class
)
store
.
select
(
GalleryPhotoEntity
::
class
)
.
where
(
GalleryPhotoEntity
.
ALBUM_ID
.
eq
(
albumId
))
.
where
(
GalleryPhotoEntity
.
ALBUM_ID
.
eq
(
albumId
))
...
@@ -141,5 +146,6 @@ class RequeryRepository @Inject constructor(
...
@@ -141,5 +146,6 @@ class RequeryRepository @Inject constructor(
override
fun
getUserFavorites
(
uuid
:
Int
):
Observable
<
EstateEntity
>
=
override
fun
getUserFavorites
(
uuid
:
Int
):
Observable
<
EstateEntity
>
=
store
.
select
(
EstateEntity
::
class
)
store
.
select
(
EstateEntity
::
class
)
.
where
(
EstateEntity
.
USER_ID
.
eq
(
uuid
))
.
where
(
EstateEntity
.
USER_ID
.
eq
(
uuid
))
.
and
(
EstateEntity
.
FAVORITE
.
eq
(
true
))
.
get
().
observable
()
.
get
().
observable
()
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/contract/DealContract.kt
View file @
cf0ad03d
...
@@ -11,4 +11,5 @@ import io.reactivex.rxjava3.core.Observable
...
@@ -11,4 +11,5 @@ import io.reactivex.rxjava3.core.Observable
interface
DealContract
{
interface
DealContract
{
fun
getFavorites
()
:
io
.
reactivex
.
Observable
<
List
<
EstateModel
>>
fun
getFavorites
()
:
io
.
reactivex
.
Observable
<
List
<
EstateModel
>>
fun
getEstate
(
estateId
:
Int
):
io
.
reactivex
.
Observable
<
EstateModel
>
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/interactor/estate.kt
View file @
cf0ad03d
package
com.biganto.visual.roompark.domain.interactor
package
com.biganto.visual.roompark.domain.interactor
import
com.biganto.visual.roompark.domain.use_case.EstateUseCase
import
javax.inject.Inject
import
javax.inject.Inject
/**
/**
...
@@ -7,8 +8,9 @@ import javax.inject.Inject
...
@@ -7,8 +8,9 @@ import javax.inject.Inject
*/
*/
class
EstateInteractor
@Inject
constructor
(
class
EstateInteractor
@Inject
constructor
(
private
val
useCase
:
EstateUseCase
){
){
fun
getEstate
(
estateId
:
Int
)
=
null
fun
getEstate
(
estateId
:
Int
)
=
useCase
.
getEstate
(
estateId
)
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/use_case/estateUseCase.kt
View file @
cf0ad03d
...
@@ -13,4 +13,6 @@ class EstateUseCase @Inject constructor(
...
@@ -13,4 +13,6 @@ class EstateUseCase @Inject constructor(
fun
fetchFavorites
()
=
contract
.
getFavorites
()
fun
fetchFavorites
()
=
contract
.
getFavorites
()
fun
getEstate
(
estateId
:
Int
)
=
contract
.
getEstate
(
estateId
)
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenController.kt
View file @
cf0ad03d
...
@@ -16,6 +16,9 @@ import javax.inject.Inject
...
@@ -16,6 +16,9 @@ import javax.inject.Inject
* Created by Vladislav Bogdashkin on 30.09.2019.
* Created by Vladislav Bogdashkin on 30.09.2019.
*/
*/
const
val
SELECTED_ESTATE_ID_KEY
=
"SELECTED_ESTATE_INDEX"
class
EstateScreenController
:
class
EstateScreenController
:
BigantoBaseController
<
EstateScreenViewState
BigantoBaseController
<
EstateScreenViewState
,
EstateScreen
,
EstateScreen
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenDI.kt
View file @
cf0ad03d
...
@@ -8,6 +8,7 @@ import dagger.Binds
...
@@ -8,6 +8,7 @@ import dagger.Binds
import
dagger.BindsInstance
import
dagger.BindsInstance
import
dagger.Component
import
dagger.Component
import
dagger.Module
import
dagger.Module
import
javax.inject.Named
@PerScreen
@PerScreen
...
@@ -21,6 +22,7 @@ interface EstateScreenComponent {
...
@@ -21,6 +22,7 @@ interface EstateScreenComponent {
fun
create
(
fun
create
(
appComponent
:
AppComponent
appComponent
:
AppComponent
,
@BindsInstance
activity
:
RoomParkMainActivity
,
@BindsInstance
activity
:
RoomParkMainActivity
,
@BindsInstance
@Named
(
SELECTED_ESTATE_ID_KEY
)
selectedEstateId
:
Int
):
EstateScreenComponent
):
EstateScreenComponent
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/estate/ScreenPresenter.kt
View file @
cf0ad03d
...
@@ -7,6 +7,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
...
@@ -7,6 +7,7 @@ import io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
import
timber.log.Timber
import
javax.inject.Inject
import
javax.inject.Inject
import
javax.inject.Named
/**
/**
* Created by Vladislav Bogdashkin on 30.09.2019.
* Created by Vladislav Bogdashkin on 30.09.2019.
...
@@ -14,7 +15,8 @@ import javax.inject.Inject
...
@@ -14,7 +15,8 @@ import javax.inject.Inject
class
EstateScreenPresenter
@Inject
constructor
(
class
EstateScreenPresenter
@Inject
constructor
(
private
val
interactor
:
EstateInteractor
private
val
interactor
:
EstateInteractor
,
@Named
(
SELECTED_ESTATE_ID_KEY
)
private
val
estateId
:
Int
)
)
:
BigantoBasePresenter
<
EstateScreen
,
EstateScreenViewState
>()
{
:
BigantoBasePresenter
<
EstateScreen
,
EstateScreenViewState
>()
{
...
@@ -23,7 +25,8 @@ class EstateScreenPresenter @Inject constructor(
...
@@ -23,7 +25,8 @@ class EstateScreenPresenter @Inject constructor(
override
fun
bindIntents
()
{
override
fun
bindIntents
()
{
val
prefetchCards
=
interactor
.
getEstate
(
1
)
val
prefetchCards
=
interactor
.
getEstate
(
estateId
)
.
map
{
EstateScreenViewState
.
LoadEstate
(
it
)
}
//.map { EstateScreenViewState.FavoriteEstatesLoaded(it) }
//.map { EstateScreenViewState.FavoriteEstatesLoaded(it) }
val
state
=
restoreStateObservable
val
state
=
restoreStateObservable
...
...
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