update events logic
This commit is contained in:
+10
-14
@@ -1,19 +1,14 @@
|
||||
package ru.shadowsparky.vbox.shared.domain
|
||||
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import ru.shadowsparky.vbox.shared.domain.tag.MovieTagRepository
|
||||
import ru.shadowsparky.vbox.shared.domain.tag.UserTagRepository
|
||||
|
||||
interface RemoteEventHandler {
|
||||
suspend fun notify(eventInfo: RemoteEvent)
|
||||
|
||||
companion object {
|
||||
const val SEARCH_CHANGED = "${SearchRepository.PREFIX}/onChange"
|
||||
const val RECENTLY_CHANGED = "${RecentlyWatchedRepository.PREFIX}/onChange"
|
||||
const val SAVED_CHANGED = "${SavedMovieRepository.PREFIX}/onChange"
|
||||
const val USER_TAG_CHANGED = "${UserTagRepository.PREFIX}/onChange"
|
||||
const val MOVIE_TAG_CHANGED = "${MovieTagRepository.PREFIX}/onChange"
|
||||
const val ON_EVENT = "$DYNAMIC_PREFIX/onEvent"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,26 +21,27 @@ sealed interface RemoteEvent {
|
||||
val userId: Long
|
||||
|
||||
@Serializable
|
||||
@SerialName("OnSearch")
|
||||
data class OnSearch(val millis: Long, override val userId: Long) : RemoteEvent
|
||||
|
||||
@Serializable
|
||||
@SerialName("OnRecent")
|
||||
data class OnRecent(val millis: Long, override val userId: Long, val movieId: Long) :
|
||||
RemoteEvent
|
||||
|
||||
@Serializable
|
||||
@SerialName("OnSaved")
|
||||
data class OnSaved(override val userId: Long, val movieId: Long) : RemoteEvent
|
||||
|
||||
@Serializable
|
||||
@SerialName("OnUserTag")
|
||||
data class OnUserTag(override val userId: Long) : RemoteEvent
|
||||
|
||||
@Serializable
|
||||
@SerialName("OnMovieTag")
|
||||
data class OnMovieTag(override val userId: Long, val movieId: Long) : RemoteEvent
|
||||
}
|
||||
|
||||
object EventType {
|
||||
const val SEARCH = "search"
|
||||
const val RECENT = "recent"
|
||||
const val SAVED = "saved"
|
||||
const val USER_TAG = "user_tag"
|
||||
const val MOVIE_TAG = "movie_tag"
|
||||
@Serializable
|
||||
@SerialName("OnChatUpdate")
|
||||
data class OnChatUpdate(override val userId: Long) : RemoteEvent
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user