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
1ebfa604
Commit
1ebfa604
authored
Apr 29, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
default preset subs
parent
caf9ff18
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
0 deletions
+67
-0
StartPlansDownloadingDialogController.kt
...onductor/dialogs/StartPlansDownloadingDialogController.kt
+5
-0
StartToursDownloadingDialogController.kt
...ogs/tour_chooser/StartToursDownloadingDialogController.kt
+8
-0
AuthRepository.kt
...anto/visual/roompark/data/data_provider/AuthRepository.kt
+52
-0
tours_download_dialog_screen.xml
app/src/main/res/layout/tours_download_dialog_screen.xml
+1
-0
strings.xml
app/src/main/res/values/strings.xml
+1
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/conductor/dialogs/StartPlansDownloadingDialogController.kt
View file @
1ebfa604
...
@@ -82,7 +82,12 @@ class StartPlansDownloadingDialogController : Controller {
...
@@ -82,7 +82,12 @@ class StartPlansDownloadingDialogController : Controller {
snackbar
=
ActivityModule
.
provideSnackBar
(
rpActivity
)
snackbar
=
ActivityModule
.
provideSnackBar
(
rpActivity
)
view
.
findViewById
<
MaterialTextView
>(
R
.
id
.
download_dialog_title
)
.
text
=
resources
?.
getString
(
R
.
string
.
download_all_plans_notice_text
)
view
.
findViewById
<
MaterialTextView
>(
R
.
id
.
all_tours_size_textView
)
.
text
=
resources
?.
getString
(
R
.
string
.
download_all_plans_size_title
,
"0"
)
file
.
freeSpace
.
bytesToSize
().
let
{
file
.
freeSpace
.
bytesToSize
().
let
{
view
.
findViewById
<
MaterialTextView
>(
R
.
id
.
disk_size_textView
)
view
.
findViewById
<
MaterialTextView
>(
R
.
id
.
disk_size_textView
)
...
...
app/src/main/java/com/biganto/visual/roompark/conductor/dialogs/tour_chooser/StartToursDownloadingDialogController.kt
View file @
1ebfa604
...
@@ -76,6 +76,14 @@ class StartToursDownloadingDialogController : Controller {
...
@@ -76,6 +76,14 @@ class StartToursDownloadingDialogController : Controller {
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
):
View
{
override
fun
onCreateView
(
inflater
:
LayoutInflater
,
container
:
ViewGroup
):
View
{
val
view
=
inflater
.
inflate
(
getLayoutId
(),
container
,
false
)
val
view
=
inflater
.
inflate
(
getLayoutId
(),
container
,
false
)
view
.
findViewById
<
MaterialTextView
>(
R
.
id
.
download_dialog_title
)
.
text
=
resources
?.
getString
(
R
.
string
.
download_all_tours_notice_text
)
view
.
findViewById
<
MaterialTextView
>(
R
.
id
.
all_tours_size_textView
)
.
text
=
resources
?.
getString
(
R
.
string
.
download_all_tours_size_title
,
"0"
)
snackbar
=
ActivityModule
.
provideSnackBar
(
rpActivity
)
snackbar
=
ActivityModule
.
provideSnackBar
(
rpActivity
)
file
.
freeSpace
.
bytesToSize
().
let
{
file
.
freeSpace
.
bytesToSize
().
let
{
...
...
app/src/main/java/com/biganto/visual/roompark/data/data_provider/AuthRepository.kt
View file @
1ebfa604
...
@@ -4,11 +4,13 @@ import com.biganto.visual.androidplayer.data.repository.local.ILocalStore
...
@@ -4,11 +4,13 @@ import com.biganto.visual.androidplayer.data.repository.local.ILocalStore
import
com.biganto.visual.roompark.data.local.UserState
import
com.biganto.visual.roompark.data.local.UserState
import
com.biganto.visual.roompark.data.repository.api.room_park.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.api.room_park.IRoomParkApi
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.IDb
import
com.biganto.visual.roompark.data.repository.db.requrey.model.SubscriptionEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.UserEntity
import
com.biganto.visual.roompark.data.repository.db.requrey.model.UserEntity
import
com.biganto.visual.roompark.data.repository.mapper.fromRaw
import
com.biganto.visual.roompark.data.repository.mapper.fromRaw
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.domain.contract.AuthContract
import
com.biganto.visual.roompark.domain.custom_exception.CustomApiException
import
com.biganto.visual.roompark.domain.custom_exception.CustomApiException
import
com.biganto.visual.roompark.domain.model.AuthInfoModel
import
com.biganto.visual.roompark.domain.model.AuthInfoModel
import
com.biganto.visual.roompark.domain.model.SubscriptionTopic
import
com.biganto.visual.roompark.domain.model.fromEntity
import
com.biganto.visual.roompark.domain.model.fromEntity
import
io.reactivex.Completable
import
io.reactivex.Completable
import
io.reactivex.Observable
import
io.reactivex.Observable
...
@@ -37,6 +39,18 @@ class AuthContractModule @Inject constructor(
...
@@ -37,6 +39,18 @@ class AuthContractModule @Inject constructor(
api
.
authenticate
(
email
,
password
)
api
.
authenticate
(
email
,
password
)
.
map
(
::
fromRaw
)
.
map
(
::
fromRaw
)
.
flatMap
{
db
.
upsertUser
(
it
)
}
.
flatMap
{
db
.
upsertUser
(
it
)
}
.
flatMap
{
user
->
val
userSubs
=
user
.
subscriptions
?.
map
{
it
as
SubscriptionEntity
}
if
(!
userSubs
.
isNullOrEmpty
()){
val
newSubs
=
defaultSubsList
(
user
).
filter
{
defSub
->
!
userSubs
.
map
{
it
.
topic
}.
contains
(
defSub
.
topic
)
}.
toList
()
return
@flatMap
db
.
upsert
(
newSubs
)
.
toObservable
()
.
flatMap
{
db
.
refreshUser
(
user
)
}
}
else
return
@flatMap
Observable
.
just
(
user
)
}
.
doOnNext
{
Timber
.
d
(
"user id: ${it.uuid}"
)}
.
doOnNext
{
Timber
.
d
(
"user id: ${it.uuid}"
)}
.
doOnNext
{
local
.
setRecentUser
(
it
.
uuid
.
toString
()).
blockingAwait
()
}
.
doOnNext
{
local
.
setRecentUser
(
it
.
uuid
.
toString
()).
blockingAwait
()
}
.
map
(
::
fromEntity
)
.
map
(
::
fromEntity
)
...
@@ -60,3 +74,41 @@ class AuthContractModule @Inject constructor(
...
@@ -60,3 +74,41 @@ class AuthContractModule @Inject constructor(
}
}
}
}
}
}
private
fun
defaultSubsList
(
owner
:
UserEntity
)
=
arrayListOf
(
SubscriptionEntity
().
apply
{
setTopic
(
SubscriptionTopic
.
Progress_1
().
topicName
)
setOwner
(
owner
)
setState
(
false
)
}
,
SubscriptionEntity
().
apply
{
setTopic
(
SubscriptionTopic
.
Progress_2
().
topicName
)
setOwner
(
owner
)
setState
(
false
)
}
,
SubscriptionEntity
().
apply
{
setTopic
(
SubscriptionTopic
.
Progress_3
().
topicName
)
setOwner
(
owner
)
setState
(
false
)
}
,
SubscriptionEntity
().
apply
{
setTopic
(
SubscriptionTopic
.
Progress_kindergarden
().
topicName
)
setOwner
(
owner
)
setState
(
false
)
}
,
SubscriptionEntity
().
apply
{
setTopic
(
SubscriptionTopic
.
News
().
topicName
)
setOwner
(
owner
)
setState
(
false
)
}
,
SubscriptionEntity
().
apply
{
setTopic
(
SubscriptionTopic
.
Blog
().
topicName
)
setOwner
(
owner
)
setState
(
false
)
}
,
SubscriptionEntity
().
apply
{
setTopic
(
SubscriptionTopic
.
Construction
().
topicName
)
setOwner
(
owner
)
setState
(
false
)
}
)
\ No newline at end of file
app/src/main/res/layout/tours_download_dialog_screen.xml
View file @
1ebfa604
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
android:orientation=
"vertical"
>
android:orientation=
"vertical"
>
<com.google.android.material.textview.MaterialTextView
<com.google.android.material.textview.MaterialTextView
android:id=
"@+id/download_dialog_title"
style=
"@style/Default_TextView.Header_Text"
style=
"@style/Default_TextView.Header_Text"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
app/src/main/res/values/strings.xml
View file @
1ebfa604
...
@@ -133,6 +133,7 @@
...
@@ -133,6 +133,7 @@
<string
name=
"plan_types_download_completed"
>
Загрузка планов завершена.
</string>
<string
name=
"plan_types_download_completed"
>
Загрузка планов завершена.
</string>
<string
name=
"download_plan_types_screen_title"
>
Cкачиваются планировки
</string>
<string
name=
"download_plan_types_screen_title"
>
Cкачиваются планировки
</string>
<string
name=
"download_all_tours_notice_text"
>
Загрузить все туры?
</string>
<string
name=
"download_all_tours_notice_text"
>
Загрузить все туры?
</string>
<string
name=
"download_all_plans_notice_text"
>
Загрузить все \n планировки?
</string>
<string
name=
"download_all_tours_size_title"
>
Размер всех туров: %s
</string>
<string
name=
"download_all_tours_size_title"
>
Размер всех туров: %s
</string>
<string
name=
"download_all_plans_size_title"
>
Размер всех планировок: %s
</string>
<string
name=
"download_all_plans_size_title"
>
Размер всех планировок: %s
</string>
<string
name=
"download_all_tours_disk_size_title"
>
Размер свободного места на диске: %s
</string>
<string
name=
"download_all_tours_disk_size_title"
>
Размер свободного места на диске: %s
</string>
...
...
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