Adding build config field

This commit is contained in:
Maxime Naturel 2022-03-14 14:48:18 +01:00
parent ae6040e01e
commit 9c6cd9f630
3 changed files with 16 additions and 10 deletions

View file

@ -229,6 +229,7 @@ android {
buildConfigField "boolean", "LOW_PRIVACY_LOG_ENABLE", "false" buildConfigField "boolean", "LOW_PRIVACY_LOG_ENABLE", "false"
// Set to true if you want to enable strict mode in debug // Set to true if you want to enable strict mode in debug
buildConfigField "boolean", "ENABLE_STRICT_MODE_LOGS", "false" buildConfigField "boolean", "ENABLE_STRICT_MODE_LOGS", "false"
buildConfigField "Boolean", "ENABLE_LIVE_LOCATION_SHARING", "true"
signingConfig signingConfigs.debug signingConfig signingConfigs.debug
} }
@ -238,6 +239,7 @@ android {
buildConfigField "boolean", "LOW_PRIVACY_LOG_ENABLE", "false" buildConfigField "boolean", "LOW_PRIVACY_LOG_ENABLE", "false"
buildConfigField "boolean", "ENABLE_STRICT_MODE_LOGS", "false" buildConfigField "boolean", "ENABLE_STRICT_MODE_LOGS", "false"
buildConfigField "Boolean", "ENABLE_LIVE_LOCATION_SHARING", "false"
postprocessing { postprocessing {
removeUnusedCode true removeUnusedCode true

View file

@ -27,6 +27,7 @@ import com.airbnb.mvrx.fragmentViewModel
import com.airbnb.mvrx.withState import com.airbnb.mvrx.withState
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.mapbox.mapboxsdk.maps.MapView import com.mapbox.mapboxsdk.maps.MapView
import im.vector.app.BuildConfig
import im.vector.app.R import im.vector.app.R
import im.vector.app.core.extensions.exhaustive import im.vector.app.core.extensions.exhaustive
import im.vector.app.core.platform.VectorBaseFragment import im.vector.app.core.platform.VectorBaseFragment
@ -170,16 +171,19 @@ class LocationSharingFragment @Inject constructor(
private fun updateMap(state: LocationSharingViewState) { private fun updateMap(state: LocationSharingViewState) {
// first, update the options view // first, update the options view
when (state.areTargetAndUserLocationEqual) { val options: Set<LocationSharingOption> = when (state.areTargetAndUserLocationEqual) {
// TODO activate USER_LIVE option when implemented true -> {
true -> views.shareLocationOptionsPicker.render( if (BuildConfig.ENABLE_LIVE_LOCATION_SHARING) {
LocationSharingOption.USER_CURRENT setOf(LocationSharingOption.USER_CURRENT, LocationSharingOption.USER_LIVE)
) } else {
false -> views.shareLocationOptionsPicker.render( setOf(LocationSharingOption.USER_CURRENT)
LocationSharingOption.PINNED }
) }
else -> views.shareLocationOptionsPicker.render() false -> setOf(LocationSharingOption.PINNED)
else -> emptySet()
} }
views.shareLocationOptionsPicker.render(options)
// then, update the map using the height of the options view after it has been rendered // then, update the map using the height of the options view after it has been rendered
views.shareLocationOptionsPicker.post { views.shareLocationOptionsPicker.post {
val mapState = state val mapState = state

View file

@ -58,7 +58,7 @@ class LocationSharingOptionPickerView @JvmOverloads constructor(
applyBackground() applyBackground()
} }
fun render(vararg options: LocationSharingOption) { fun render(options: Set<LocationSharingOption> = emptySet()) {
val optionsNumber = options.toSet().size val optionsNumber = options.toSet().size
val isPinnedVisible = options.contains(LocationSharingOption.PINNED) val isPinnedVisible = options.contains(LocationSharingOption.PINNED)
val isUserCurrentVisible = options.contains(LocationSharingOption.USER_CURRENT) val isUserCurrentVisible = options.contains(LocationSharingOption.USER_CURRENT)