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
991bfac7
Commit
991bfac7
authored
Jan 16, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
provide cached info into setings presenter
parent
16ec499c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
4 deletions
+67
-4
settings.kt
...com/biganto/visual/roompark/domain/interactor/settings.kt
+34
-1
settings.kt
...java/com/biganto/visual/roompark/domain/model/settings.kt
+1
-1
settingsUseCase.kt
...iganto/visual/roompark/domain/use_case/settingsUseCase.kt
+19
-1
ScreenPresenter.kt
.../roompark/presentation/screen/settings/ScreenPresenter.kt
+7
-1
ScreenViewState.kt
.../roompark/presentation/screen/settings/ScreenViewState.kt
+1
-0
strings.xml
app/src/main/res/values/strings.xml
+5
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/domain/interactor/settings.kt
View file @
991bfac7
package
com.biganto.visual.roompark.domain.interactor
import
android.app.Activity
import
com.biganto.visual.roompark.R
import
com.biganto.visual.roompark.domain.model.CachedDataModel
import
com.biganto.visual.roompark.domain.model.PushSwitchModel
import
com.biganto.visual.roompark.domain.model.SettingsModel
import
com.biganto.visual.roompark.domain.use_case.AuthUseCase
import
com.biganto.visual.roompark.domain.use_case.SettingsUseCase
import
io.reactivex.Observable
import
io.reactivex.schedulers.Schedulers
import
javax.inject.Inject
...
...
@@ -13,9 +16,39 @@ import javax.inject.Inject
*/
class
SettingsInteractor
@Inject
constructor
(
private
val
auth
:
AuthUseCase
private
val
auth
:
AuthUseCase
,
private
val
settingsUseCase
:
SettingsUseCase
,
private
val
activity
:
Activity
){
private
val
plans
get
()
=
settingsUseCase
.
planTypesSize
.
map
{
CachedDataModel
(
activity
.
resources
.
getString
(
R
.
string
.
plans_cache
),
it
,
1
)
}
private
val
tours
get
()
=
settingsUseCase
.
toursSize
.
map
{
CachedDataModel
(
activity
.
resources
.
getString
(
R
.
string
.
tours_cache
),
it
,
2
)
}
private
val
feeds
get
()
=
settingsUseCase
.
feedsSize
.
map
{
CachedDataModel
(
activity
.
resources
.
getString
(
R
.
string
.
feeds_cache
),
it
,
3
)
}
private
val
albums
get
()
=
settingsUseCase
.
albumsSize
.
map
{
CachedDataModel
(
activity
.
resources
.
getString
(
R
.
string
.
albums_cache
),
it
,
4
)
}
private
val
overall
get
()
=
settingsUseCase
.
overallSize
.
map
{
CachedDataModel
(
activity
.
resources
.
getString
(
R
.
string
.
overall_cache
),
it
,
0
)
}
fun
getCacheInfo
()
=
Observable
.
concatArray
(
plans
,
tours
,
feeds
,
albums
,
overall
).
toList
().
toObservable
()
fun
fetchSettings
():
Observable
<
SettingsModel
>
=
Observable
.
just
(
sampleSettings
)
...
...
app/src/main/java/com/biganto/visual/roompark/domain/model/settings.kt
View file @
991bfac7
...
...
@@ -20,6 +20,6 @@ data class CachedDataModel(
data class
SettingsModel
(
val
pushItems
:
List
<
PushSwitchModel
>,
va
l
offlineStoreData
:
List
<
CachedDataModel
>,
va
r
offlineStoreData
:
List
<
CachedDataModel
>,
val
cachedData
:
List
<
CachedDataModel
>
)
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/use_case/settingsUseCase.kt
View file @
991bfac7
package
com.biganto.visual.roompark.domain.use_case
import
com.biganto.visual.roompark.data.data_provider.AuthContractModule
import
com.biganto.visual.roompark.domain.contract.FilesContract
import
io.reactivex.Observable
import
javax.inject.Inject
/**
...
...
@@ -8,9 +10,25 @@ import javax.inject.Inject
*/
class
SettingsUseCase
@Inject
constructor
(
private
val
authContract
:
AuthContractModule
private
val
authContract
:
AuthContractModule
,
private
val
fileContract
:
FilesContract
){
fun
signOut
()
=
authContract
.
signOut
()
val
planTypesSize
get
()
=
Observable
.
just
(
fileContract
.
getPlansSize
())
val
albumsSize
get
()
=
Observable
.
just
(
fileContract
.
getAlbumSize
())
val
feedsSize
get
()
=
Observable
.
just
(
fileContract
.
getFeedSize
())
val
toursSize
get
()
=
Observable
.
just
(
fileContract
.
getToursSize
())
val
overallSize
get
()
=
Observable
.
just
(
fileContract
.
allCacheSize
())
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenPresenter.kt
View file @
991bfac7
package
com.biganto.visual.roompark.presentation.screen.settings
import
android.app.Activity
import
com.biganto.visual.roompark.conductor.BigantoBasePresenter
import
com.biganto.visual.roompark.domain.interactor.SettingsInteractor
import
com.biganto.visual.roompark.util.monades.ExceptionString
...
...
@@ -15,7 +16,8 @@ import javax.inject.Inject
class
SettingsScreenPresenter
@Inject
constructor
(
private
val
interactor
:
SettingsInteractor
private
val
interactor
:
SettingsInteractor
,
private
val
activity
:
Activity
)
:
BigantoBasePresenter
<
SettingsScreen
,
SettingsScreenViewState
>()
{
...
...
@@ -25,6 +27,10 @@ class SettingsScreenPresenter @Inject constructor(
override
fun
bindIntents
()
{
val
fetchSettings
=
interactor
.
fetchSettings
()
.
flatMap
{
settings
->
interactor
.
getCacheInfo
()
.
doOnNext
{
settings
.
offlineStoreData
=
it
}
.
map
{
settings
}}
.
map
{
SettingsScreenViewState
.
LoadSettingsList
(
it
)
}
val
onSignOut
=
intent
(
SettingsScreen
::
signOut
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/settings/ScreenViewState.kt
View file @
991bfac7
...
...
@@ -12,6 +12,7 @@ import com.biganto.visual.roompark.util.monades.ExceptionString
sealed
class
SettingsScreenViewState
:
BigantoBaseViewState
()
{
class
Idle
:
SettingsScreenViewState
()
class
LoadSettingsList
(
val
settings
:
SettingsModel
)
:
SettingsScreenViewState
()
// class LoadCachedInfo(val cached:SettingsModel) : SettingsScreenViewState()
class
SomeError
(
val
exception
:
ExceptionString
)
:
SettingsScreenViewState
()
class
SignOut
()
:
SettingsScreenViewState
()
}
\ No newline at end of file
app/src/main/res/values/strings.xml
View file @
991bfac7
...
...
@@ -71,6 +71,11 @@
<string
name=
"discounted_price"
>
Стоимость со скидкой
</string>
<string
name=
"flat_not_found"
>
В ЭТОМ ДОМЕ НЕТ КВАРТИРЫ С ТАКИМ НОМЕРОМ
</string>
<string
name=
"flat_ready_to_watch"
>
СМОТРЕТЬ
</string>
<string
name=
"plans_cache"
>
Карточки квартир
</string>
<string
name=
"tours_cache"
>
Виртуальные туры
</string>
<string
name=
"feeds_cache"
>
Новости и заметки
</string>
<string
name=
"albums_cache"
>
Фотографии
</string>
<string
name=
"overall_cache"
>
Всего скачано
</string>
<!--endregion-->
</resources>
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