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
cc82fe5f
Commit
cc82fe5f
authored
Apr 20, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
provide plan sizes to presentation;
fix di invalid name
parent
53a5764f
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
58 additions
and
18 deletions
+58
-18
PlanRepository.kt
...anto/visual/roompark/data/data_provider/PlanRepository.kt
+3
-2
DataModule.kt
.../java/com/biganto/visual/roompark/di/dagger/DataModule.kt
+1
-1
FlatPlanContract.kt
...ganto/visual/roompark/domain/contract/FlatPlanContract.kt
+3
-0
settings.kt
...com/biganto/visual/roompark/domain/interactor/settings.kt
+4
-1
planTypesUseCase.kt
...ganto/visual/roompark/domain/use_case/planTypesUseCase.kt
+32
-14
ScreenController.kt
...roompark/presentation/screen/settings/ScreenController.kt
+9
-0
ScreenPresenter.kt
.../roompark/presentation/screen/settings/ScreenPresenter.kt
+5
-0
ScreenViewState.kt
.../roompark/presentation/screen/settings/ScreenViewState.kt
+1
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/PlanRepository.kt
View file @
cc82fe5f
...
@@ -78,7 +78,7 @@ class PlanRepository @Inject constructor(
...
@@ -78,7 +78,7 @@ class PlanRepository @Inject constructor(
.
subscribeOn
(
Schedulers
.
io
())
.
subscribeOn
(
Schedulers
.
io
())
privat
e
fun
getPlanFile
(
featuresVariant
:
PlanFeaturesVariant
)
overrid
e
fun
getPlanFile
(
featuresVariant
:
PlanFeaturesVariant
)
=
getPlanFile
(
=
getPlanFile
(
estateId
=
featuresVariant
.
estateId
,
estateId
=
featuresVariant
.
estateId
,
planId
=
featuresVariant
.
planId
,
planId
=
featuresVariant
.
planId
,
...
@@ -88,7 +88,7 @@ class PlanRepository @Inject constructor(
...
@@ -88,7 +88,7 @@ class PlanRepository @Inject constructor(
electric
=
featuresVariant
.
electric
electric
=
featuresVariant
.
electric
)
)
private
fun
getPlanFile
(
estateId
:
Int
fun
getPlanFile
(
estateId
:
Int
,
planId
:
Int
,
planId
:
Int
,
furniture
:
Boolean
?
=
null
,
furniture
:
Boolean
?
=
null
,
sizes
:
Boolean
?
=
null
,
sizes
:
Boolean
?
=
null
...
@@ -136,6 +136,7 @@ class PlanRepository @Inject constructor(
...
@@ -136,6 +136,7 @@ class PlanRepository @Inject constructor(
// fun getPlanRequestString(estateId: Int
// fun getPlanRequestString(estateId: Int
// , planId:Int
// , planId:Int
// , furniture:Boolean
// , furniture:Boolean
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/DataModule.kt
View file @
cc82fe5f
...
@@ -62,7 +62,7 @@ abstract class ContractRepositoryModule {
...
@@ -62,7 +62,7 @@ abstract class ContractRepositoryModule {
@Binds
@Binds
@Singleton
@Singleton
abstract
fun
provide
Tour
Contract
(
impl
:
PlanRepository
):
FlatPlanContract
abstract
fun
provide
Plan
Contract
(
impl
:
PlanRepository
):
FlatPlanContract
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/domain/contract/FlatPlanContract.kt
View file @
cc82fe5f
package
com.biganto.visual.roompark.domain.contract
package
com.biganto.visual.roompark.domain.contract
import
com.biganto.visual.roompark.data.data_provider.PlanFeaturesVariant
import
com.biganto.visual.roompark.domain.model.PlanPresetModel
import
com.biganto.visual.roompark.domain.model.PlanPresetModel
import
io.reactivex.Observable
import
io.reactivex.Observable
import
java.io.File
/**
/**
* Created by Vladislav Bogdashkin on 20.04.2020.
* Created by Vladislav Bogdashkin on 20.04.2020.
...
@@ -18,4 +20,5 @@ interface FlatPlanContract{
...
@@ -18,4 +20,5 @@ interface FlatPlanContract{
,
walls
:
Boolean
?
,
walls
:
Boolean
?
,
electric
:
Boolean
?):
Observable
<
String
>
,
electric
:
Boolean
?):
Observable
<
String
>
fun
getPlanFile
(
featuresVariant
:
PlanFeaturesVariant
):
File
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/interactor/settings.kt
View file @
cc82fe5f
...
@@ -28,11 +28,14 @@ class SettingsInteractor @Inject constructor(
...
@@ -28,11 +28,14 @@ class SettingsInteractor @Inject constructor(
private
val
settingsUseCase
:
SettingsUseCase
,
private
val
settingsUseCase
:
SettingsUseCase
,
private
val
activity
:
BaseRoomParkActivity
,
private
val
activity
:
BaseRoomParkActivity
,
private
val
subUc
:
SubscriptionUseCase
,
private
val
subUc
:
SubscriptionUseCase
,
private
val
toursUc
:
TourPreviewsUseCase
private
val
toursUc
:
TourPreviewsUseCase
,
private
val
planTypes
:
PlanTypesUseCase
){
){
fun
fetchToursSizes
()
=
toursUc
.
fetchToursSizes
()
fun
fetchToursSizes
()
=
toursUc
.
fetchToursSizes
()
fun
fetchPlanTypesSizes
()
=
planTypes
.
fetchNotDownloadedPlansSizes
()
private
fun
startDownloadService
()
{
private
fun
startDownloadService
()
{
val
i
=
Intent
(
activity
,
DownloadManagerService
::
class
.
java
)
val
i
=
Intent
(
activity
,
DownloadManagerService
::
class
.
java
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
...
...
app/src/main/java/com/biganto/visual/roompark/domain/use_case/planTypesUseCase.kt
View file @
cc82fe5f
package
com.biganto.visual.roompark.domain.use_case
package
com.biganto.visual.roompark.domain.use_case
import
com.biganto.visual.roompark.data.data_provider.featuresVariants
import
com.biganto.visual.roompark.data.repository.db.requrey.model.EstateEntity
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.domain.contract.FlatPlanContract
import
com.biganto.visual.roompark.domain.contract.FlatPlanContract
import
io.reactivex.BackpressureStrategy
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
import
javax.inject.Inject
import
javax.inject.Inject
/**
/**
...
@@ -13,20 +18,33 @@ class PlanTypesUseCase @Inject constructor(
...
@@ -13,20 +18,33 @@ class PlanTypesUseCase @Inject constructor(
private
val
auth
:
AuthContract
private
val
auth
:
AuthContract
){
){
// fun fetchNotDownloadedPlansSizes() =
fun
fetchNotDownloadedPlansSizes
()
=
// auth.currentUser()
auth
.
currentUser
()
// .map { user ->
.
map
{
user
->
// val list =
val
list
=
// user.deals?.map { it.estate as EstateEntity }?.toMutableList()
user
.
deals
?.
map
{
it
.
estate
as
EstateEntity
}
?.
toMutableList
()
// ?: mutableListOf()
?:
mutableListOf
()
// list.addAll(user.estates?.map { it as EstateEntity } ?: arrayListOf())
list
.
addAll
(
user
.
estates
?.
map
{
it
as
EstateEntity
}
?:
arrayListOf
())
// list
list
// }
}
// .flatMapIterable { it }
.
flatMapIterable
{
it
}
// .toFlowable(BackpressureStrategy.BUFFER)
.
toFlowable
(
BackpressureStrategy
.
BUFFER
)
// .parallel(4)
.
parallel
(
4
)
// .runOn(Schedulers.io())
.
runOn
(
Schedulers
.
io
())
// .flatMap { planContract.getPlanTypes(it.id) }
.
flatMap
{
planContract
.
getPlanTypes
(
it
.
id
)
.
map
{
plantypes
->
plantypes
.
flatMap
{
plan
->
plan
.
featuresVariants
}
}
.
toFlowable
(
BackpressureStrategy
.
BUFFER
)
}
.
sequential
()
.
toList
()
.
toObservable
()
.
map
{
it
.
flatten
()
}
.
doOnNext
{
Timber
.
d
(
" plaanzz: $it"
)
}
.
map
{
list
->
list
.
sumBy
{
if
(
planContract
.
getPlanFile
(
it
).
exists
())
0
else
1
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenController.kt
View file @
cc82fe5f
...
@@ -155,6 +155,7 @@ class SettingsScreenController :
...
@@ -155,6 +155,7 @@ class SettingsScreenController :
is
SettingsScreenViewState
.
SomeError
->
render
(
viewState
)
is
SettingsScreenViewState
.
SomeError
->
render
(
viewState
)
is
SettingsScreenViewState
.
SignOut
->
render
(
viewState
)
is
SettingsScreenViewState
.
SignOut
->
render
(
viewState
)
is
SettingsScreenViewState
.
OnCacheDeleting
->
render
(
viewState
)
is
SettingsScreenViewState
.
OnCacheDeleting
->
render
(
viewState
)
is
SettingsScreenViewState
.
OnPlanTypesPrefetch
->
render
(
viewState
)
is
SettingsScreenViewState
.
LoadCachInfo
->
render
(
viewState
)
is
SettingsScreenViewState
.
LoadCachInfo
->
render
(
viewState
)
is
SettingsScreenViewState
.
LoadSubscriptions
->
render
(
viewState
)
is
SettingsScreenViewState
.
LoadSubscriptions
->
render
(
viewState
)
is
SettingsScreenViewState
.
SubscriptionStatus
->
render
(
viewState
)
is
SettingsScreenViewState
.
SubscriptionStatus
->
render
(
viewState
)
...
@@ -179,6 +180,14 @@ class SettingsScreenController :
...
@@ -179,6 +180,14 @@ class SettingsScreenController :
)
)
}
}
private
fun
render
(
viewState
:
SettingsScreenViewState
.
OnPlanTypesPrefetch
)
{
flatDownloaderTitle
.
text
=
resources
?.
getString
(
R
.
string
.
download_all_plan_types_settings_with_sizes
,
viewState
.
size
.
bytesToSize
()
)
}
private
fun
render
(
viewState
:
SettingsScreenViewState
.
LoadSubscriptions
){
private
fun
render
(
viewState
:
SettingsScreenViewState
.
LoadSubscriptions
){
(
pushRecycler
.
adapter
as
PushListAdapter
).
setItems
(
viewState
.
list
)
(
pushRecycler
.
adapter
as
PushListAdapter
).
setItems
(
viewState
.
list
)
}
}
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenPresenter.kt
View file @
cc82fe5f
...
@@ -41,6 +41,10 @@ class SettingsScreenPresenter @Inject constructor(
...
@@ -41,6 +41,10 @@ class SettingsScreenPresenter @Inject constructor(
val
fetchToursSize
=
interactor
.
fetchToursSizes
()
val
fetchToursSize
=
interactor
.
fetchToursSizes
()
.
map
{
SettingsScreenViewState
.
OnSizePrefetch
(
it
)
}
.
map
{
SettingsScreenViewState
.
OnSizePrefetch
(
it
)
}
val
fetchPlansSize
=
interactor
.
fetchPlanTypesSizes
()
.
map
{
it
*
1024L
}
.
map
{
SettingsScreenViewState
.
OnPlanTypesPrefetch
(
it
)
}
val
onDownloadTours
=
intent
(
SettingsScreen
::
downloadAllTours
)
val
onDownloadTours
=
intent
(
SettingsScreen
::
downloadAllTours
)
.
flatMap
{
interactor
.
startToursDownloading
()
.
flatMap
{
interactor
.
startToursDownloading
()
.
andThen
(
Observable
.
just
(
SettingsScreenViewState
.
Idle
()))
.
andThen
(
Observable
.
just
(
SettingsScreenViewState
.
Idle
()))
...
@@ -116,6 +120,7 @@ class SettingsScreenPresenter @Inject constructor(
...
@@ -116,6 +120,7 @@ class SettingsScreenPresenter @Inject constructor(
val
state
=
Observable
.
mergeDelayError
(
val
state
=
Observable
.
mergeDelayError
(
arrayListOf
(
arrayListOf
(
restoreStateObservable
,
restoreStateObservable
,
fetchPlansSize
,
fetchSettings
,
fetchSettings
,
onSignOut
,
onSignOut
,
onClearCache
,
onClearCache
,
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenViewState.kt
View file @
cc82fe5f
...
@@ -19,6 +19,7 @@ sealed class SettingsScreenViewState : BigantoBaseViewState() {
...
@@ -19,6 +19,7 @@ sealed class SettingsScreenViewState : BigantoBaseViewState() {
class
SignOut
()
:
SettingsScreenViewState
()
class
SignOut
()
:
SettingsScreenViewState
()
class
OnCacheDeleting
(
val
progress
:
Float
)
:
SettingsScreenViewState
()
class
OnCacheDeleting
(
val
progress
:
Float
)
:
SettingsScreenViewState
()
class
OnSizePrefetch
(
val
size
:
Long
)
:
SettingsScreenViewState
()
class
OnSizePrefetch
(
val
size
:
Long
)
:
SettingsScreenViewState
()
class
OnPlanTypesPrefetch
(
val
size
:
Long
)
:
SettingsScreenViewState
()
class
LoadSubscriptions
(
val
list
:
List
<
TitledSubscriptionModel
>)
:
SettingsScreenViewState
()
class
LoadSubscriptions
(
val
list
:
List
<
TitledSubscriptionModel
>)
:
SettingsScreenViewState
()
class
LoadCachInfo
(
val
list
:
List
<
CachedDataModel
>)
:
SettingsScreenViewState
()
class
LoadCachInfo
(
val
list
:
List
<
CachedDataModel
>)
:
SettingsScreenViewState
()
class
SubscriptionStatus
(
val
subId
:
Int
,
val
subState
:
Boolean
)
:
SettingsScreenViewState
()
class
SubscriptionStatus
(
val
subId
:
Int
,
val
subState
:
Boolean
)
:
SettingsScreenViewState
()
...
...
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