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
0a690861
Commit
0a690861
authored
Mar 27, 2020
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
up database version due subscriptions table changes
parent
3c99913b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
2 deletions
+8
-2
AuthRepository.kt
...anto/visual/roompark/data/data_provider/AuthRepository.kt
+1
-0
ContextModule.kt
...va/com/biganto/visual/roompark/di/dagger/ContextModule.kt
+1
-1
AuthContract.kt
...m/biganto/visual/roompark/domain/contract/AuthContract.kt
+1
-1
subscriptionUseCase.kt
...to/visual/roompark/domain/use_case/subscriptionUseCase.kt
+3
-0
ScreenPresenter.kt
...roompark/presentation/screen/feed_list/ScreenPresenter.kt
+2
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/data/data_provider/AuthRepository.kt
View file @
0a690861
...
...
@@ -50,6 +50,7 @@ class AuthContractModule @Inject constructor(
override
fun
currentUser
():
Observable
<
UserEntity
>
=
local
.
recentUser
()
.
doOnNext
{
Timber
.
w
(
"recentUSer: $it"
)
}
.
flatMap
{
when
(
it
){
is
UserState
.
NotAuthenticated
->
throw
CustomApiException
.
NotAuthorizedException
()
is
UserState
.
Authenticated
->
db
.
fetchUser
(
it
.
uuid
.
toInt
())
...
...
app/src/main/java/com/biganto/visual/roompark/di/dagger/ContextModule.kt
View file @
0a690861
...
...
@@ -21,7 +21,7 @@ const val ESTATES_CACHE_LIMIT_SECONDS_INACTIVE = 200L
const
val
FILES_CACHE_LIMIT_SIZE
=
10000
const
val
FILES_CACHE_LIMIT_SECONDS_INACTIVE
=
60L
const
val
DATABASE_VERSION
=
1
1
const
val
DATABASE_VERSION
=
1
2
@Module
abstract
class
AppModule
{
...
...
app/src/main/java/com/biganto/visual/roompark/domain/contract/AuthContract.kt
View file @
0a690861
...
...
@@ -13,5 +13,5 @@ interface AuthContract {
fun
signIn
(
email
:
String
,
password
:
String
)
:
Observable
<
AuthInfoModel
>
fun
signOut
()
:
Completable
fun
validateAuthState
():
Observable
<
Boolean
>
fun
currentUser
():
Observable
<
UserEntity
>
fun
currentUser
():
Observable
<
UserEntity
>
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/use_case/subscriptionUseCase.kt
View file @
0a690861
...
...
@@ -10,6 +10,7 @@ import com.biganto.visual.roompark.domain.model.SubscriptionTopic
import
com.biganto.visual.roompark.domain.model.fromEntity
import
io.reactivex.Observable
import
io.reactivex.rxkotlin.Observables
import
timber.log.Timber
import
javax.inject.Inject
//import io.reactivex.rxkotlin
...
...
@@ -47,6 +48,7 @@ class SubscriptionUseCase @Inject constructor(
fun
getSubscriptions
(
topic
:
SubscriptionTopic
):
Observable
<
SubscriptionModel
>
=
auth
.
currentUser
()
.
map
{
Timber
.
w
(
"user is : $it"
)
var
sub
=
it
.
subscriptions
?.
firstOrNull
{
it
.
topic
==
topic
.
topicName
&&
it
.
number
==
topic
.
topicId
}
if
(
sub
==
null
)
{
...
...
@@ -56,6 +58,7 @@ class SubscriptionUseCase @Inject constructor(
sub
.
setNumber
(
topic
.
topicId
)
sub
.
setState
(
false
)
}
Timber
.
w
(
"sub is : $sub"
)
subscription
.
saveSubscribeState
(
sub
as
SubscriptionEntity
).
blockingFirst
()
}
.
map
(
::
fromEntity
)
...
...
app/src/main/java/com/biganto/visual/roompark/presentation/screen/feed_list/ScreenPresenter.kt
View file @
0a690861
...
...
@@ -38,6 +38,7 @@ class ArticlesScreenPresenter @Inject constructor(
Timber
.
d
(
"feedId : $feedId"
)
val
onSubChecked
=
intent
(
ArticlesScreen
::
feedSubscription
)
.
filter
{
restoreModel
.
sub
!=
null
}
.
flatMap
{
newState
->
interactor
.
switchSubscription
(
restoreModel
.
sub
!!
,
newState
)
.
andThen
(
Observable
.
just
<
ArticlesScreenViewState
>(
ArticlesScreenViewState
.
SubscriptionStatus
(
newState
)))
...
...
@@ -61,6 +62,7 @@ class ArticlesScreenPresenter @Inject constructor(
.
onErrorReturn
(
::
parseError
)
val
fetchSubscription
=
interactor
.
getSubscriptions
(
feedId
)
.
doOnNext
{
Timber
.
w
(
"got smthng: $it"
)
}
.
doAfterNext
{
restoreModel
.
sub
=
it
}
.
map
<
ArticlesScreenViewState
>
{
ArticlesScreenViewState
.
SubscriptionStatus
(
it
.
state
)
}
.
startWith
(
Observable
.
just
<
ArticlesScreenViewState
>(
ArticlesScreenViewState
.
Idle
()))
...
...
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