When clicking on Fornsök, Wikipedia and DigitaltMuseum on the map, the info window now opens as before the migration. Also fixed so the map updates when layer changes or something is found.
This commit is contained in:
@@ -518,7 +518,44 @@ fun KlottrAppShell(
|
||||
Box(modifier = Modifier.weight(1f).fillMaxWidth()) {
|
||||
MapContent(
|
||||
onKlotterClick = { id, la, lo, label -> openKlotter = OpenKlotter(id, la, lo, label) },
|
||||
onOpenUrl = { _, url -> AppNavigator.openUrl(url) },
|
||||
onOpenUrl = { title, url ->
|
||||
when {
|
||||
url.contains("wikipedia.org") -> {
|
||||
val pageId = url.substringAfter("curid=").toLongOrNull()
|
||||
if (pageId != null) {
|
||||
openWiki = OpenWiki(pageId, null, null)
|
||||
} else {
|
||||
AppNavigator.openUrl(url) // fallback
|
||||
}
|
||||
}
|
||||
url.contains("digitaltmuseum.se") -> {
|
||||
val match = nearbyBundle?.dm?.firstOrNull {
|
||||
it.webUrl == url || it.url == url
|
||||
|| url.contains(it.id, ignoreCase = true)
|
||||
}
|
||||
if (match != null) {
|
||||
openDm = match
|
||||
} else {
|
||||
AppNavigator.openUrl(url)
|
||||
}
|
||||
}
|
||||
url.contains("fornsok") -> {
|
||||
val match = nearbyBundle?.forn?.firstOrNull {
|
||||
it.uri == url || it.id == url || it.title == url
|
||||
|| (it.uri != null && url.contains(it.uri!!, ignoreCase = true))
|
||||
}
|
||||
if (match != null) {
|
||||
openFornsok = OpenFornsok(match)
|
||||
} else {
|
||||
AppNavigator.openUrl(url)
|
||||
}
|
||||
}
|
||||
else -> AppNavigator.openUrl(url)
|
||||
}
|
||||
},
|
||||
onFornsokClick = { item ->
|
||||
openFornsok = OpenFornsok(item)
|
||||
},
|
||||
isKnownNote = { noteId ->
|
||||
FoundStore.getAll().any { it.layer == LAYER_KLOTTER && it.id == noteId.toString() }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user