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
d5f044f7
Commit
d5f044f7
authored
Nov 01, 2019
by
Vladislav Bogdashkin
🎣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added subscription use case
parent
61a1f848
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
4 deletions
+54
-4
DeviceUtilsContract.kt
...to/visual/roompark/domain/contract/DeviceUtilsContract.kt
+11
-0
Subscribtions.kt
.../biganto/visual/roompark/domain/contract/Subscribtions.kt
+9
-4
subscriptionUseCase.kt
...to/visual/roompark/domain/use_case/subscriptionUseCase.kt
+34
-0
No files found.
app/src/main/java/com/biganto/visual/roompark/domain/contract/DeviceUtilsContract.kt
0 → 100644
View file @
d5f044f7
package
com.biganto.visual.roompark.domain.contract
import
io.reactivex.Observable
/**
* Created by Vladislav Bogdashkin on 24.09.2019.
*/
interface
DeviceUtilsContract
{
fun
getDeviceId
()
:
Observable
<
String
>
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/contract/Subscribtions.kt
View file @
d5f044f7
package
com.biganto.visual.roompark.domain.contract
package
com.biganto.visual.roompark.domain.contract
import
com.biganto.visual.roompark.data.repository.api.retrofit.raw.StatusResponse
import
io.reactivex.Observable
/**
/**
* Created by Vladislav Bogdashkin on 24.09.2019.
* Created by Vladislav Bogdashkin on 24.09.2019.
*/
*/
...
@@ -7,11 +10,13 @@ package com.biganto.visual.roompark.domain.contract
...
@@ -7,11 +10,13 @@ package com.biganto.visual.roompark.domain.contract
interface
SubscriptionContract
{
interface
SubscriptionContract
{
fun
subscribeTopic
(
fun
subscribeTopic
(
deviceToken
:
String
,
deviceToken
:
String
,
topic
:
String
topic
:
String
,
)
topic_id
:
String
?
=
null
)
:
Observable
<
StatusResponse
>
fun
unSubscribeTopic
(
fun
unSubscribeTopic
(
deviceToken
:
String
,
deviceToken
:
String
,
topic
:
String
topic
:
String
,
)
topic_id
:
String
?
=
null
)
:
Observable
<
StatusResponse
>
}
}
\ No newline at end of file
app/src/main/java/com/biganto/visual/roompark/domain/use_case/subscriptionUseCase.kt
0 → 100644
View file @
d5f044f7
package
com.biganto.visual.roompark.domain.use_case
import
com.biganto.visual.roompark.domain.contract.DeviceUtilsContract
import
com.biganto.visual.roompark.domain.contract.SubscriptionContract
import
javax.inject.Inject
/**
* Created by Vladislav Bogdashkin on 01.11.2019.
*/
class
SubscriptionUseCase
@Inject
constructor
(
private
val
subscription
:
SubscriptionContract
,
private
val
utils
:
DeviceUtilsContract
){
fun
subscribeTopic
(
topic
:
String
,
topicId
:
String
?=
null
)
=
utils
.
getDeviceId
()
.
flatMap
{
deviceToken
->
subscription
.
subscribeTopic
(
deviceToken
,
topic
,
topicId
)
}
fun
unSubscribeTopic
(
topic
:
String
,
topicId
:
String
?=
null
)
=
utils
.
getDeviceId
()
.
flatMap
{
deviceToken
->
subscription
.
unSubscribeTopic
(
deviceToken
,
topic
,
topicId
)
}
}
\ No newline at end of file
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