diff --git a/vector/src/main/java/im/vector/app/features/location/LocationSharingFragment.kt b/vector/src/main/java/im/vector/app/features/location/LocationSharingFragment.kt
index d131ff3f74..17e53e63d1 100644
--- a/vector/src/main/java/im/vector/app/features/location/LocationSharingFragment.kt
+++ b/vector/src/main/java/im/vector/app/features/location/LocationSharingFragment.kt
@@ -175,9 +175,7 @@ class LocationSharingFragment @Inject constructor(
MaterialAlertDialogBuilder(requireActivity())
.setTitle(R.string.live_location_not_enough_permission_dialog_title)
.setMessage(R.string.live_location_not_enough_permission_dialog_description)
- .setPositiveButton(R.string.ok) { dialogInterface, _ ->
- dialogInterface.dismiss()
- }
+ .setPositiveButton(R.string.ok, null)
.show()
}
diff --git a/vector/src/main/java/im/vector/app/features/location/LocationSharingViewModel.kt b/vector/src/main/java/im/vector/app/features/location/LocationSharingViewModel.kt
index 8e166ee350..8056b72d57 100644
--- a/vector/src/main/java/im/vector/app/features/location/LocationSharingViewModel.kt
+++ b/vector/src/main/java/im/vector/app/features/location/LocationSharingViewModel.kt
@@ -75,22 +75,21 @@ class LocationSharingViewModel @AssistedInject constructor(
setUserItem()
updatePin()
compareTargetAndUserLocation()
- checkPowerLevelsForLiveLocationSharing()
+ observePowerLevelsForLiveLocationSharing()
}
- private fun checkPowerLevelsForLiveLocationSharing() {
+ private fun observePowerLevelsForLiveLocationSharing() {
PowerLevelsFlowFactory(room).createFlow()
.distinctUntilChanged()
- .onEach {
+ .setOnEach {
val powerLevelsHelper = PowerLevelsHelper(it)
val canShareLiveLocation = EventType.STATE_ROOM_BEACON_INFO
- .map { beaconInfoType ->
+ .all { beaconInfoType ->
powerLevelsHelper.isUserAllowedToSend(session.myUserId, true, beaconInfoType)
}
- .all { isUserAllowed -> isUserAllowed }
- setState { copy(canShareLiveLocation = canShareLiveLocation) }
- }.launchIn(viewModelScope)
+ copy(canShareLiveLocation = canShareLiveLocation)
+ }
}
private fun initLocationTracking() {
diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml
index bd5860c1ab..69ea15ea9b 100644
--- a/vector/src/main/res/values/strings.xml
+++ b/vector/src/main/res/values/strings.xml
@@ -3054,8 +3054,8 @@
Stop sharing
Updated %1$s ago
- You don’t have permission to share locations
- You need to have the right permissions in order to share locations in this room.
+ You don’t have permission to share live location
+ You need to have the right permissions in order to share live location in this room.
Show Message bubbles