mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-25 10:55:55 +03:00
Refactor location sharing view events.
This commit is contained in:
parent
20cdf2bef1
commit
5ec63858ed
3 changed files with 6 additions and 12 deletions
|
@ -83,6 +83,5 @@ sealed class RoomDetailViewEvents : VectorViewEvents {
|
|||
object StopChatEffects : RoomDetailViewEvents()
|
||||
object RoomReplacementStarted : RoomDetailViewEvents()
|
||||
|
||||
object ShowLocationSharingIndicator : RoomDetailViewEvents()
|
||||
object HideLocationSharingIndicator : RoomDetailViewEvents()
|
||||
data class ChangeLocationIndicator(val isVisible: Boolean) : RoomDetailViewEvents()
|
||||
}
|
||||
|
|
|
@ -482,8 +482,7 @@ class TimelineFragment @Inject constructor(
|
|||
RoomDetailViewEvents.StopChatEffects -> handleStopChatEffects()
|
||||
is RoomDetailViewEvents.DisplayAndAcceptCall -> acceptIncomingCall(it)
|
||||
RoomDetailViewEvents.RoomReplacementStarted -> handleRoomReplacement()
|
||||
RoomDetailViewEvents.ShowLocationSharingIndicator -> handleShowLocationSharingIndicator()
|
||||
RoomDetailViewEvents.HideLocationSharingIndicator -> handleHideLocationSharingIndicator()
|
||||
is RoomDetailViewEvents.ChangeLocationIndicator -> handleChangeLocationIndicator(it)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -618,12 +617,8 @@ class TimelineFragment @Inject constructor(
|
|||
)
|
||||
}
|
||||
|
||||
private fun handleShowLocationSharingIndicator() {
|
||||
views.locationLiveStatusIndicator.isVisible = true
|
||||
}
|
||||
|
||||
private fun handleHideLocationSharingIndicator() {
|
||||
views.locationLiveStatusIndicator.isVisible = false
|
||||
private fun handleChangeLocationIndicator(event: RoomDetailViewEvents.ChangeLocationIndicator) {
|
||||
views.locationLiveStatusIndicator.isVisible = event.isVisible
|
||||
}
|
||||
|
||||
private fun displayErrorMessage(error: RoomDetailViewEvents.Failure) {
|
||||
|
|
|
@ -1224,11 +1224,11 @@ class TimelineViewModel @AssistedInject constructor(
|
|||
}
|
||||
|
||||
override fun onLocationServiceRunning() {
|
||||
_viewEvents.post(RoomDetailViewEvents.ShowLocationSharingIndicator)
|
||||
_viewEvents.post(RoomDetailViewEvents.ChangeLocationIndicator(isVisible = true))
|
||||
}
|
||||
|
||||
override fun onLocationServiceStopped() {
|
||||
_viewEvents.post(RoomDetailViewEvents.HideLocationSharingIndicator)
|
||||
_viewEvents.post(RoomDetailViewEvents.ChangeLocationIndicator(isVisible = false))
|
||||
// Bind again in case user decides to share live location without leaving the room
|
||||
locationSharingServiceConnection.bind(this)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue