mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Disable location sharing when no MapTiler config is available
LocationService now exposes the MapTiler config to use: the one provided by the homeserver takes precedence over the build time one, and null means that no map provider is configured. It is now session scoped, and isServiceAvailable() returns a StateFlow derived from this config. When no config is available: - the location sharing option is hidden from the composer, and location events cannot be opened in the location viewer; - the "Location sharing" entry is hidden from the settings; - location events in the timeline render a placeholder, without performing any request to MapTiler. The show and share location screens now get the config from LocationService rather than fetching the homeserver config by themselves. Closes element-hq/element-android-enterprise#69 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -776,7 +776,7 @@ class MessagesFlowNode(
|
||||
assetType = event.content.assetType,
|
||||
)
|
||||
}
|
||||
NavTarget.LocationViewer(mode = mode).takeIf { locationService.isServiceAvailable() }
|
||||
NavTarget.LocationViewer(mode = mode).takeIf { locationService.isServiceAvailable().value }
|
||||
} else {
|
||||
displayVulkanNotSupportedError = true
|
||||
null
|
||||
|
||||
+2
-5
@@ -184,10 +184,7 @@ class MessageComposerPresenter(
|
||||
|
||||
val cameraPermissionState = cameraPermissionPresenter.present()
|
||||
|
||||
val canShareLocation = remember { mutableStateOf(false) }
|
||||
LaunchedEffect(Unit) {
|
||||
canShareLocation.value = locationService.isServiceAvailable()
|
||||
}
|
||||
val canShareLocation by remember { locationService.isServiceAvailable() }.collectAsState()
|
||||
|
||||
val isSendGalleryMessagesEnabled by featureFlagService.isFeatureEnabledFlow(FeatureFlags.SendGalleryMessages)
|
||||
.collectAsState(initial = false)
|
||||
@@ -431,7 +428,7 @@ class MessageComposerPresenter(
|
||||
isInThreadTimeline = isInThread,
|
||||
showAttachmentSourcePicker = showAttachmentSourcePicker,
|
||||
showTextFormatting = showTextFormatting,
|
||||
canShareLocation = canShareLocation.value,
|
||||
canShareLocation = canShareLocation,
|
||||
suggestions = suggestions.toImmutableList(),
|
||||
resolveMentionDisplay = resolveMentionDisplay,
|
||||
resolveAtRoomMentionDisplay = resolveAtRoomMentionDisplay,
|
||||
|
||||
Reference in New Issue
Block a user