mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 20:06:51 +03:00
Code review fixes.
This commit is contained in:
parent
ab34bb6df7
commit
320915e0a1
2 changed files with 10 additions and 7 deletions
|
@ -197,11 +197,14 @@ class LocationSharingFragment @Inject constructor(
|
|||
|
||||
private val liveLocationLabsFlagPromotionListener = object : VectorBaseBottomSheetDialogFragment.ResultListener {
|
||||
override fun onBottomSheetResult(resultCode: Int, data: Any?) {
|
||||
// Check if the user wants to enable the labs flag
|
||||
if (resultCode == VectorBaseBottomSheetDialogFragment.ResultListener.RESULT_OK && (data as? Boolean) == true) {
|
||||
vectorPreferences.setLiveLocationLabsEnabled()
|
||||
startLiveLocationSharing()
|
||||
}
|
||||
handleLiveLocationLabsFlagPromotionResult(resultCode, data)
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleLiveLocationLabsFlagPromotionResult(resultCode: Int, data: Any?) {
|
||||
if (resultCode == VectorBaseBottomSheetDialogFragment.ResultListener.RESULT_OK && (data as? Boolean) == true) {
|
||||
vectorPreferences.setLiveLocationLabsEnabled(isEnabled = true)
|
||||
startLiveLocationSharing()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1047,9 +1047,9 @@ class VectorPreferences @Inject constructor(
|
|||
return defaultPrefs.getBoolean(SETTINGS_LABS_ENABLE_LIVE_LOCATION, false)
|
||||
}
|
||||
|
||||
fun setLiveLocationLabsEnabled() {
|
||||
fun setLiveLocationLabsEnabled(isEnabled: Boolean) {
|
||||
defaultPrefs.edit {
|
||||
putBoolean(SETTINGS_LABS_ENABLE_LIVE_LOCATION, true)
|
||||
putBoolean(SETTINGS_LABS_ENABLE_LIVE_LOCATION, isEnabled)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue