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(
.
subscribeOn
(
Schedulers
.
io
())
privat
e
fun
getPlanFile
(
featuresVariant
:
PlanFeaturesVariant
)
overrid
e
fun
getPlanFile
(
featuresVariant
:
PlanFeaturesVariant
)
=
getPlanFile
(
estateId
=
featuresVariant
.
estateId
,
planId
=
featuresVariant
.
planId
,
...
...
@@ -88,7 +88,7 @@ class PlanRepository @Inject constructor(
electric
=
featuresVariant
.
electric
)
private
fun
getPlanFile
(
estateId
:
Int
fun
getPlanFile
(
estateId
:
Int
,
planId
:
Int
,
furniture
:
Boolean
?
=
null
,
sizes
:
Boolean
?
=
null
...
...
@@ -136,6 +136,7 @@ class PlanRepository @Inject constructor(
// fun getPlanRequestString(estateId: Int
// , planId:Int
// , furniture:Boolean
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/DataModule.kt
View file @
cc82fe5f
...
...
@@ -62,7 +62,7 @@ abstract class ContractRepositoryModule {
@Binds
@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
import
com.biganto.visual.roompark.data.data_provider.PlanFeaturesVariant
import
com.biganto.visual.roompark.domain.model.PlanPresetModel
import
io.reactivex.Observable
import
java.io.File
/**
* Created by Vladislav Bogdashkin on 20.04.2020.
...
...
@@ -18,4 +20,5 @@ interface FlatPlanContract{
,
walls
:
Boolean
?
,
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(
private
val
settingsUseCase
:
SettingsUseCase
,
private
val
activity
:
BaseRoomParkActivity
,
private
val
subUc
:
SubscriptionUseCase
,
private
val
toursUc
:
TourPreviewsUseCase
private
val
toursUc
:
TourPreviewsUseCase
,
private
val
planTypes
:
PlanTypesUseCase
){
fun
fetchToursSizes
()
=
toursUc
.
fetchToursSizes
()
fun
fetchPlanTypesSizes
()
=
planTypes
.
fetchNotDownloadedPlansSizes
()
private
fun
startDownloadService
()
{
val
i
=
Intent
(
activity
,
DownloadManagerService
::
class
.
java
)
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
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.FlatPlanContract
import
io.reactivex.BackpressureStrategy
import
io.reactivex.schedulers.Schedulers
import
timber.log.Timber
import
javax.inject.Inject
/**
...
...
@@ -13,20 +18,33 @@ class PlanTypesUseCase @Inject constructor(
private
val
auth
:
AuthContract
){
// fun fetchNotDownloadedPlansSizes() =
// auth.currentUser()
// .map { user ->
// val list =
// user.deals?.map { it.estate as EstateEntity }?.toMutableList()
// ?: mutableListOf()
// list.addAll(user.estates?.map { it as EstateEntity } ?: arrayListOf())
// list
// }
// .flatMapIterable { it }
// .toFlowable(BackpressureStrategy.BUFFER)
// .parallel(4)
// .runOn(Schedulers.io())
// .flatMap { planContract.getPlanTypes(it.id) }
fun
fetchNotDownloadedPlansSizes
()
=
auth
.
currentUser
()
.
map
{
user
->
val
list
=
user
.
deals
?.
map
{
it
.
estate
as
EstateEntity
}
?.
toMutableList
()
?:
mutableListOf
()
list
.
addAll
(
user
.
estates
?.
map
{
it
as
EstateEntity
}
?:
arrayListOf
())
list
}
.
flatMapIterable
{
it
}
.
toFlowable
(
BackpressureStrategy
.
BUFFER
)
.
parallel
(
4
)
.
runOn
(
Schedulers
.
io
())
.
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 :
is
SettingsScreenViewState
.
SomeError
->
render
(
viewState
)
is
SettingsScreenViewState
.
SignOut
->
render
(
viewState
)
is
SettingsScreenViewState
.
OnCacheDeleting
->
render
(
viewState
)
is
SettingsScreenViewState
.
OnPlanTypesPrefetch
->
render
(
viewState
)
is
SettingsScreenViewState
.
LoadCachInfo
->
render
(
viewState
)
is
SettingsScreenViewState
.
LoadSubscriptions
->
render
(
viewState
)
is
SettingsScreenViewState
.
SubscriptionStatus
->
render
(
viewState
)
...
...
@@ -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
){
(
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(
val
fetchToursSize
=
interactor
.
fetchToursSizes
()
.
map
{
SettingsScreenViewState
.
OnSizePrefetch
(
it
)
}
val
fetchPlansSize
=
interactor
.
fetchPlanTypesSizes
()
.
map
{
it
*
1024L
}
.
map
{
SettingsScreenViewState
.
OnPlanTypesPrefetch
(
it
)
}
val
onDownloadTours
=
intent
(
SettingsScreen
::
downloadAllTours
)
.
flatMap
{
interactor
.
startToursDownloading
()
.
andThen
(
Observable
.
just
(
SettingsScreenViewState
.
Idle
()))
...
...
@@ -116,6 +120,7 @@ class SettingsScreenPresenter @Inject constructor(
val
state
=
Observable
.
mergeDelayError
(
arrayListOf
(
restoreStateObservable
,
fetchPlansSize
,
fetchSettings
,
onSignOut
,
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() {
class
SignOut
()
:
SettingsScreenViewState
()
class
OnCacheDeleting
(
val
progress
:
Float
)
:
SettingsScreenViewState
()
class
OnSizePrefetch
(
val
size
:
Long
)
:
SettingsScreenViewState
()
class
OnPlanTypesPrefetch
(
val
size
:
Long
)
:
SettingsScreenViewState
()
class
LoadSubscriptions
(
val
list
:
List
<
TitledSubscriptionModel
>)
:
SettingsScreenViewState
()
class
LoadCachInfo
(
val
list
:
List
<
CachedDataModel
>)
:
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