Move the interactive map into a new MapLibreShim framework

Second step towards loading MapLibre on demand: everything that touches it now
lives in one framework, so that framework can later be left unlinked.

The interactive map view, its annotation view and the coordinate animator move
into MapLibreShim, which reaches the app through MapLibreShimProtocol. The app
side keeps its MapLibreMapView call site and becomes a thin wrapper that builds
a MapViewConfiguration, passing the app-only pieces (map style URLs, marker
views, tint colour) across as closures so the shim needs nothing from the app.

LocationAnnotation loses its MapLibre conformance and becomes a plain struct,
with the shim mapping it onto its own annotation type. MapLibre's log
forwarding moves into the shim as well, since TargetConfiguration can no longer
reach it.
This commit is contained in:
Stefan Ceriu
2026-08-12 11:22:55 +03:00
parent 5724e65d8e
commit 8753fe3980
14 changed files with 778 additions and 381 deletions
@@ -8,9 +8,6 @@
import Combine
import Foundation
#if IS_MAIN_APP
import MapLibre
#endif
import MatrixRustSDK
nonisolated enum Target: String {
@@ -65,8 +62,6 @@ nonisolated enum Target: String {
MXLog.configure(currentTarget: rawValue)
configureMapLibreIfAvailable()
let hookCancellable = rageshakeURL.publisher
.sink { _ in
appHooks.tracingHook.update(tracingConfiguration, with: rageshakeURL)
@@ -75,28 +70,6 @@ nonisolated enum Target: String {
return ConfigurationResult(hookCancellable: hookCancellable)
}
private func configureMapLibreIfAvailable() {
#if IS_MAIN_APP
MLNLoggingConfiguration.shared.loggingLevel = .debug
MLNLoggingConfiguration.shared.handler = { loggingLevel, _, _, message in
switch loggingLevel {
case .error:
MXLog.error(message)
case .warning:
MXLog.warning(message)
case .info:
MXLog.info(message)
case .debug:
MXLog.debug(message)
case .verbose:
MXLog.verbose(message)
default:
break
}
}
#endif
}
/// The result of calling ``configure(logLevel:traceLogPacks:sentryURL:)``.
/// This must be stored - see the docs on the configure method to learn more.
struct ConfigurationResult {