mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-01-27 09:31:20 +01:00
Removing Action suffix in ViewAction types
This commit is contained in:
parent
6779fa1175
commit
abd25c2292
@ -19,8 +19,8 @@ package im.vector.app.features.location
|
||||
import im.vector.app.core.platform.VectorViewModelAction
|
||||
|
||||
sealed class LocationSharingAction : VectorViewModelAction {
|
||||
object CurrentUserLocationSharingAction : LocationSharingAction()
|
||||
data class PinnedLocationSharingAction(val locationData: LocationData?) : LocationSharingAction()
|
||||
data class LocationTargetChangeAction(val locationData: LocationData) : LocationSharingAction()
|
||||
object ZoomToUserLocationAction : LocationSharingAction()
|
||||
object CurrentUserLocationSharing : LocationSharingAction()
|
||||
data class PinnedLocationSharing(val locationData: LocationData?) : LocationSharingAction()
|
||||
data class LocationTargetChange(val locationData: LocationData) : LocationSharingAction()
|
||||
object ZoomToUserLocation : LocationSharingAction()
|
||||
}
|
||||
|
@ -120,7 +120,7 @@ class LocationSharingFragment @Inject constructor(
|
||||
}
|
||||
|
||||
override fun onLocationTargetChange(target: LocationData) {
|
||||
viewModel.handle(LocationSharingAction.LocationTargetChangeAction(target))
|
||||
viewModel.handle(LocationSharingAction.LocationTargetChange(target))
|
||||
}
|
||||
|
||||
override fun invalidate() = withState(viewModel) { state ->
|
||||
@ -145,7 +145,7 @@ class LocationSharingFragment @Inject constructor(
|
||||
|
||||
private fun initLocateButton() {
|
||||
views.mapView.locateBtn.setOnClickListener {
|
||||
viewModel.handle(LocationSharingAction.ZoomToUserLocationAction)
|
||||
viewModel.handle(LocationSharingAction.ZoomToUserLocation)
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,10 +158,10 @@ class LocationSharingFragment @Inject constructor(
|
||||
views.shareLocationOptionsPicker.render()
|
||||
views.shareLocationOptionsPicker.optionPinned.debouncedClicks {
|
||||
val targetLocation = views.mapView.getLocationOfMapCenter()
|
||||
viewModel.handle(LocationSharingAction.PinnedLocationSharingAction(targetLocation))
|
||||
viewModel.handle(LocationSharingAction.PinnedLocationSharing(targetLocation))
|
||||
}
|
||||
views.shareLocationOptionsPicker.optionUserCurrent.debouncedClicks {
|
||||
viewModel.handle(LocationSharingAction.CurrentUserLocationSharingAction)
|
||||
viewModel.handle(LocationSharingAction.CurrentUserLocationSharing)
|
||||
}
|
||||
views.shareLocationOptionsPicker.optionUserLive.debouncedClicks {
|
||||
// TODO
|
||||
|
@ -115,10 +115,10 @@ class LocationSharingViewModel @AssistedInject constructor(
|
||||
|
||||
override fun handle(action: LocationSharingAction) {
|
||||
when (action) {
|
||||
LocationSharingAction.CurrentUserLocationSharingAction -> handleCurrentUserLocationSharingAction()
|
||||
is LocationSharingAction.PinnedLocationSharingAction -> handlePinnedLocationSharingAction(action)
|
||||
is LocationSharingAction.LocationTargetChangeAction -> handleLocationTargetChangeAction(action)
|
||||
LocationSharingAction.ZoomToUserLocationAction -> handleZoomToUserLocationAction()
|
||||
LocationSharingAction.CurrentUserLocationSharing -> handleCurrentUserLocationSharingAction()
|
||||
is LocationSharingAction.PinnedLocationSharing -> handlePinnedLocationSharingAction(action)
|
||||
is LocationSharingAction.LocationTargetChange -> handleLocationTargetChangeAction(action)
|
||||
LocationSharingAction.ZoomToUserLocation -> handleZoomToUserLocationAction()
|
||||
}.exhaustive
|
||||
}
|
||||
|
||||
@ -126,7 +126,7 @@ class LocationSharingViewModel @AssistedInject constructor(
|
||||
shareLocation(state.lastKnownUserLocation, isUserLocation = true)
|
||||
}
|
||||
|
||||
private fun handlePinnedLocationSharingAction(action: LocationSharingAction.PinnedLocationSharingAction) {
|
||||
private fun handlePinnedLocationSharingAction(action: LocationSharingAction.PinnedLocationSharing) {
|
||||
shareLocation(action.locationData, isUserLocation = false)
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ class LocationSharingViewModel @AssistedInject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleLocationTargetChangeAction(action: LocationSharingAction.LocationTargetChangeAction) {
|
||||
private fun handleLocationTargetChangeAction(action: LocationSharingAction.LocationTargetChange) {
|
||||
viewModelScope.launch {
|
||||
locationTargetFlow.emit(action.locationData)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user