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
65a0a1b2
Commit
65a0a1b2
authored
Apr 28, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
estate add fields, added restore models
parent
ba6db1a2
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
55 additions
and
10 deletions
+55
-10
EstateRepository.kt
...to/visual/roompark/data/data_provider/EstateRepository.kt
+1
-2
response.kt
...al/roompark/data/repository/api/room_park/raw/response.kt
+1
-0
RequeryRepository.kt
.../roompark/data/repository/db/requrey/RequeryRepository.kt
+1
-1
Estate.kt
...isual/roompark/data/repository/db/requrey/model/Estate.kt
+1
-0
raw2entity.kt
...anto/visual/roompark/data/repository/mapper/raw2entity.kt
+1
-0
ScreenController.kt
...al/roompark/presentation/screen/deals/ScreenController.kt
+6
-0
ScreenPresenter.kt
...ual/roompark/presentation/screen/deals/ScreenPresenter.kt
+16
-1
ScreenViewState.kt
...ual/roompark/presentation/screen/deals/ScreenViewState.kt
+1
-0
ScreenController.kt
...oompark/presentation/screen/favorites/ScreenController.kt
+5
-0
ScreenPresenter.kt
...roompark/presentation/screen/favorites/ScreenPresenter.kt
+14
-1
ScreenViewState.kt
...roompark/presentation/screen/favorites/ScreenViewState.kt
+1
-0
ScreenPresenter.kt
.../roompark/presentation/screen/settings/ScreenPresenter.kt
+7
-5
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/EstateRepository.kt
View file @
65a0a1b2
...
@@ -51,14 +51,13 @@ class EstateRepository @Inject constructor(
...
@@ -51,14 +51,13 @@ class EstateRepository @Inject constructor(
return
@zip
apiList
return
@zip
apiList
dbList
dbList
.
filterNotNull
()
.
filterNotNull
()
.
filter
{
dbFav
->
apiList
.
map
{
it
.
id
}.
contains
(
dbFav
.
id
)
}
.
filter
{
dbFav
->!
apiList
.
map
{
it
.
id
}.
contains
(
dbFav
.
id
)
}
.
let
{
db
.
deleteEstate
(
it
)
}
.
let
{
db
.
deleteEstate
(
it
)
}
apiList
.
forEach
{
estate
->
apiList
.
forEach
{
estate
->
estate
.
setFavorite
(
true
)
estate
.
setFavorite
(
true
)
estate
.
user
=
user
estate
.
user
=
user
}
}
return
@zip
apiList
return
@zip
apiList
}
}
.
flatMap
(
db
::
upsertEstates
)
.
flatMap
(
db
::
upsertEstates
)
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/api/room_park/raw/response.kt
View file @
65a0a1b2
...
@@ -41,6 +41,7 @@ data class EstateRaw(
...
@@ -41,6 +41,7 @@ data class EstateRaw(
val
id
:
Int
,
val
id
:
Int
,
val
type
:
String
,
val
type
:
String
,
val
number
:
String
,
val
number
:
String
,
val
available
:
Boolean
,
val
common_info
:
CommonInfoRaw
,
val
common_info
:
CommonInfoRaw
,
val
plan_png
:
PlanRaw
?,
val
plan_png
:
PlanRaw
?,
val
plan_jpg
:
PlanRaw
?,
val
plan_jpg
:
PlanRaw
?,
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/RequeryRepository.kt
View file @
65a0a1b2
...
@@ -30,7 +30,7 @@ import javax.inject.Inject
...
@@ -30,7 +30,7 @@ import javax.inject.Inject
*/
*/
private
const
val
DATABASE_VERSION
=
1
4
private
const
val
DATABASE_VERSION
=
1
5
@Module
@Module
class
DbModule
{
class
DbModule
{
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/db/requrey/model/Estate.kt
View file @
65a0a1b2
...
@@ -15,6 +15,7 @@ interface Estate : Persistable {
...
@@ -15,6 +15,7 @@ interface Estate : Persistable {
val
id
:
Int
val
id
:
Int
val
type
:
String
val
type
:
String
val
number
:
String
val
number
:
String
val
available
:
Boolean
@get
:
Nullable
@get
:
Nullable
val
sectionBegin
:
Int
?
val
sectionBegin
:
Int
?
@get
:
Nullable
@get
:
Nullable
...
...
app/src/main/java/com/biganto/visual/roompark/data/repository/mapper/raw2entity.kt
View file @
65a0a1b2
...
@@ -126,6 +126,7 @@ fun fromRaw(raw:EstateRaw):EstateEntity{
...
@@ -126,6 +126,7 @@ fun fromRaw(raw:EstateRaw):EstateEntity{
entity
.
setId
(
raw
.
id
)
entity
.
setId
(
raw
.
id
)
entity
.
setType
(
raw
.
type
)
entity
.
setType
(
raw
.
type
)
entity
.
setNumber
(
raw
.
number
)
entity
.
setNumber
(
raw
.
number
)
entity
.
setAvailable
(
raw
.
available
)
entity
.
setSectionBegin
(
raw
.
common_info
.
section_begin
)
entity
.
setSectionBegin
(
raw
.
common_info
.
section_begin
)
entity
.
setSectionEnd
(
raw
.
common_info
.
section_end
)
entity
.
setSectionEnd
(
raw
.
common_info
.
section_end
)
entity
.
setPlanJpgUrl
(
raw
.
plan_jpg
?.
url
)
entity
.
setPlanJpgUrl
(
raw
.
plan_jpg
?.
url
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/deals/ScreenController.kt
View file @
65a0a1b2
...
@@ -118,6 +118,7 @@ class DealsScreenController :
...
@@ -118,6 +118,7 @@ class DealsScreenController :
is
DealsScreenViewState
.
DealsLoaded
->
render
(
viewState
)
is
DealsScreenViewState
.
DealsLoaded
->
render
(
viewState
)
is
DealsScreenViewState
.
SomeError
->
render
(
viewState
)
is
DealsScreenViewState
.
SomeError
->
render
(
viewState
)
is
DealsScreenViewState
.
ToursLoaded
->
render
(
viewState
)
is
DealsScreenViewState
.
ToursLoaded
->
render
(
viewState
)
is
DealsScreenViewState
.
RestoreView
->
render
(
viewState
)
}
}
}
}
...
@@ -125,6 +126,11 @@ class DealsScreenController :
...
@@ -125,6 +126,11 @@ class DealsScreenController :
}
}
private
fun
render
(
viewState
:
DealsScreenViewState
.
RestoreView
){
(
dealsRecyclerView
.
adapter
as
DealsListAdapter
).
addItems
(
viewState
.
restore
.
list
)
}
private
fun
render
(
viewState
:
DealsScreenViewState
.
DealsLoaded
){
private
fun
render
(
viewState
:
DealsScreenViewState
.
DealsLoaded
){
(
dealsRecyclerView
.
adapter
as
DealsListAdapter
).
addItems
(
viewState
.
items
)
(
dealsRecyclerView
.
adapter
as
DealsListAdapter
).
addItems
(
viewState
.
items
)
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/deals/ScreenPresenter.kt
View file @
65a0a1b2
...
@@ -25,6 +25,14 @@ class DealsScreenPresenter @Inject constructor(
...
@@ -25,6 +25,14 @@ class DealsScreenPresenter @Inject constructor(
override
fun
defaultErrorViewStateHandler
()
=
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
DealsScreenViewState
.
SomeError
(
e
)
}
{
e
:
ExceptionString
->
DealsScreenViewState
.
SomeError
(
e
)
}
private
val
restoreModel
=
RestoreModel
(
mutableListOf
())
override
fun
detachView
()
{
super
.
detachView
()
restoreStateObservable
.
accept
(
DealsScreenViewState
.
RestoreView
(
restoreModel
))
}
override
fun
bindIntents
()
{
override
fun
bindIntents
()
{
val
getStatusList
=
interactor
.
getStatusList
()
val
getStatusList
=
interactor
.
getStatusList
()
...
@@ -40,6 +48,7 @@ class DealsScreenPresenter @Inject constructor(
...
@@ -40,6 +48,7 @@ class DealsScreenPresenter @Inject constructor(
}
}
}
}
}
}
.
doOnNext
{
restoreModel
.
list
=
it
.
toMutableList
()
}
.
map
<
DealsScreenViewState
>(
DealsScreenViewState
::
DealsLoaded
)
.
map
<
DealsScreenViewState
>(
DealsScreenViewState
::
DealsLoaded
)
.
onErrorReturn
(
::
parseError
)
.
onErrorReturn
(
::
parseError
)
...
@@ -65,3 +74,9 @@ class DealsScreenPresenter @Inject constructor(
...
@@ -65,3 +74,9 @@ class DealsScreenPresenter @Inject constructor(
subscribeViewState
(
state
.
cast
(
DealsScreenViewState
::
class
.
java
),
DealsScreen
::
render
)
subscribeViewState
(
state
.
cast
(
DealsScreenViewState
::
class
.
java
),
DealsScreen
::
render
)
}
}
}
}
data class
RestoreModel
(
var
list
:
MutableList
<
DealPreviewModel
>
)
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/deals/ScreenViewState.kt
View file @
65a0a1b2
...
@@ -15,5 +15,6 @@ sealed class DealsScreenViewState : BigantoBaseViewState() {
...
@@ -15,5 +15,6 @@ sealed class DealsScreenViewState : BigantoBaseViewState() {
class
DealsLoaded
(
val
items
:
List
<
DealPreviewModel
>)
:
DealsScreenViewState
()
class
DealsLoaded
(
val
items
:
List
<
DealPreviewModel
>)
:
DealsScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
DealsScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
DealsScreenViewState
()
class
ToursLoaded
(
val
tours
:
List
<
TourModel
>)
:
DealsScreenViewState
()
class
ToursLoaded
(
val
tours
:
List
<
TourModel
>)
:
DealsScreenViewState
()
class
RestoreView
(
val
restore
:
RestoreModel
)
:
DealsScreenViewState
()
}
}
app/src/main/java/com/biganto/visual/roompark/presentation/screen/favorites/ScreenController.kt
View file @
65a0a1b2
...
@@ -111,6 +111,11 @@ class FavoritesScreenController :
...
@@ -111,6 +111,11 @@ class FavoritesScreenController :
}
}
private
fun
render
(
viewState
:
FavoritesScreenViewState
.
RestoreView
){
(
favoritesRecyclerView
.
adapter
as
FavoritesListAdapter
).
addItems
(
viewState
.
restore
.
list
)
}
private
fun
render
(
viewState
:
FavoritesScreenViewState
.
ToursLoaded
)
{
private
fun
render
(
viewState
:
FavoritesScreenViewState
.
ToursLoaded
)
{
router
.
pushController
(
RouterTransaction
.
with
(
router
.
pushController
(
RouterTransaction
.
with
(
ChooseTourDialogController
(
ArrayList
(
viewState
.
tours
))
ChooseTourDialogController
(
ArrayList
(
viewState
.
tours
))
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/favorites/ScreenPresenter.kt
View file @
65a0a1b2
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.favorites
...
@@ -3,6 +3,7 @@ package com.biganto.visual.roompark.presentation.screen.favorites
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.FavoritesInteractor
import
com.biganto.visual.roompark.domain.interactor.FavoritesInteractor
import
com.biganto.visual.roompark.domain.interactor.ToursInteractor
import
com.biganto.visual.roompark.domain.interactor.ToursInteractor
import
com.biganto.visual.roompark.domain.model.EstateModel
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
com.biganto.visual.roompark.util.monades.ExceptionString
import
io.reactivex.Observable
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.android.schedulers.AndroidSchedulers
...
@@ -24,9 +25,17 @@ class FavoritesScreenPresenter @Inject constructor(
...
@@ -24,9 +25,17 @@ class FavoritesScreenPresenter @Inject constructor(
override
fun
defaultErrorViewStateHandler
()
=
override
fun
defaultErrorViewStateHandler
()
=
{
e
:
ExceptionString
->
FavoritesScreenViewState
.
SomeError
(
e
)
}
{
e
:
ExceptionString
->
FavoritesScreenViewState
.
SomeError
(
e
)
}
private
val
restoreModel
=
RestoreModel
(
mutableListOf
())
override
fun
detachView
()
{
super
.
detachView
()
restoreStateObservable
.
accept
(
FavoritesScreenViewState
.
RestoreView
(
restoreModel
))
}
override
fun
bindIntents
()
{
override
fun
bindIntents
()
{
val
prefetchCards
=
interactor
.
getFavoritesForCurrentUser
()
val
prefetchCards
=
interactor
.
getFavoritesForCurrentUser
()
.
doOnNext
{
restoreModel
.
list
=
it
.
toMutableList
()
}
.
map
{
FavoritesScreenViewState
.
FavoriteEstatesLoaded
(
it
)
}
.
map
{
FavoritesScreenViewState
.
FavoriteEstatesLoaded
(
it
)
}
...
@@ -55,3 +64,7 @@ class FavoritesScreenPresenter @Inject constructor(
...
@@ -55,3 +64,7 @@ class FavoritesScreenPresenter @Inject constructor(
}
}
}
}
data class
RestoreModel
(
var
list
:
MutableList
<
EstateModel
>
)
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/favorites/ScreenViewState.kt
View file @
65a0a1b2
...
@@ -15,4 +15,5 @@ sealed class FavoritesScreenViewState : BigantoBaseViewState() {
...
@@ -15,4 +15,5 @@ sealed class FavoritesScreenViewState : BigantoBaseViewState() {
class
FavoriteEstatesLoaded
(
val
items
:
List
<
EstateModel
>)
:
FavoritesScreenViewState
()
class
FavoriteEstatesLoaded
(
val
items
:
List
<
EstateModel
>)
:
FavoritesScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
FavoritesScreenViewState
()
class
SomeError
(
val
exception
:
ExceptionString
)
:
FavoritesScreenViewState
()
class
ToursLoaded
(
val
tours
:
List
<
TourModel
>)
:
FavoritesScreenViewState
()
class
ToursLoaded
(
val
tours
:
List
<
TourModel
>)
:
FavoritesScreenViewState
()
class
RestoreView
(
val
restore
:
RestoreModel
)
:
FavoritesScreenViewState
()
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenPresenter.kt
View file @
65a0a1b2
...
@@ -66,9 +66,9 @@ class SettingsScreenPresenter @Inject constructor(
...
@@ -66,9 +66,9 @@ class SettingsScreenPresenter @Inject constructor(
val
onSubChecked
=
intent
(
SettingsScreen
::
onSubscription
)
val
onSubChecked
=
intent
(
SettingsScreen
::
onSubscription
)
.
flatMap
{
sub
->
.
flatMap
{
sub
->
interactor
.
switchSubscription
(
sub
,
!
sub
.
state
)
interactor
.
switchSubscription
(
sub
,
!
sub
.
state
)
.
map
<
SettingsScreenViewState
>
{
.
map
<
SettingsScreenViewState
>
{
list
->
restoreModel
.
subs
=
i
t
.
sortedBy
{
it
.
subModel
.
id
}.
toMutableList
()
restoreModel
.
subs
=
lis
t
.
sortedBy
{
it
.
subModel
.
id
}.
toMutableList
()
SettingsScreenViewState
.
LoadSubscriptions
(
it
)
SettingsScreenViewState
.
LoadSubscriptions
(
restoreModel
.
subs
)
}
}
.
doOnError
{
Timber
.
e
(
it
)
}
.
doOnError
{
Timber
.
e
(
it
)
}
.
onErrorReturn
{
SettingsScreenViewState
.
SubscriptionError
(
sub
.
id
,
sub
.
state
)
}
.
onErrorReturn
{
SettingsScreenViewState
.
SubscriptionError
(
sub
.
id
,
sub
.
state
)
}
...
@@ -85,8 +85,10 @@ class SettingsScreenPresenter @Inject constructor(
...
@@ -85,8 +85,10 @@ class SettingsScreenPresenter @Inject constructor(
.
doOnNext
{
cacheSizeRefresher
.
accept
(
1
)
}
.
doOnNext
{
cacheSizeRefresher
.
accept
(
1
)
}
val
fetchSubscriptions
=
interactor
.
getSubscriptions
()
val
fetchSubscriptions
=
interactor
.
getSubscriptions
()
.
doOnNext
{
restoreModel
.
subs
=
it
.
toMutableList
()
}
.
map
{
list
->
.
map
{
SettingsScreenViewState
.
LoadSubscriptions
(
it
)
}
restoreModel
.
subs
=
list
.
sortedBy
{
it
.
subModel
.
id
}.
toMutableList
()
SettingsScreenViewState
.
LoadSubscriptions
(
restoreModel
.
subs
)
}
val
onSignOut
=
intent
(
SettingsScreen
::
signOut
)
val
onSignOut
=
intent
(
SettingsScreen
::
signOut
)
.
flatMap
{
.
flatMap
{
...
...
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