mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-11-23 01:45:52 +03:00
Code review fixes.
This commit is contained in:
parent
5fb10ab287
commit
493dc57a29
3 changed files with 9 additions and 12 deletions
|
@ -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()
|
||||
}
|
||||
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -3054,8 +3054,8 @@
|
|||
<!-- TODO remove key -->
|
||||
<string name="live_location_bottom_sheet_stop_sharing" tools:ignore="UnusedResources">Stop sharing</string>
|
||||
<string name="live_location_bottom_sheet_last_updated_at">Updated %1$s ago</string>
|
||||
<string name="live_location_not_enough_permission_dialog_title">You don’t have permission to share locations</string>
|
||||
<string name="live_location_not_enough_permission_dialog_description">You need to have the right permissions in order to share locations in this room.</string>
|
||||
<string name="live_location_not_enough_permission_dialog_title">You don’t have permission to share live location</string>
|
||||
<string name="live_location_not_enough_permission_dialog_description">You need to have the right permissions in order to share live location in this room.</string>
|
||||
|
||||
<string name="message_bubbles">Show Message bubbles</string>
|
||||
|
||||
|
|
Loading…
Reference in a new issue