Set map tiler URL from well known if available (#5633)

This commit is contained in:
Mauro
2026-05-28 15:24:58 +02:00
committed by GitHub
parent 594d041128
commit 7093d966b4
25 changed files with 291 additions and 88 deletions
@@ -29,4 +29,18 @@ extension ClientProtocol {
return .failure(.sdkError(error))
}
}
/// Reads the homeserver-advertised map tile server (`tile_server.map_style_url`
/// from the matrix client well-known) and applies it to ``AppSettings``.
///
/// Clears any previously applied URL when none is advertised (or the well-known
/// is unavailable), so each session start reflects the latest server-side
/// configuration.
func updateMapTilerSettings(in appSettings: AppSettings) async {
if let url = await tileServer().flatMap({ URL(string: $0.mapStyleUrl) }) {
appSettings.mapTilerSettings.applyRemoteValue(.url(url))
} else {
appSettings.mapTilerSettings.reset()
}
}
}