mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-25 23:12:37 +01:00
fix: Open geo URIs on iOS
This commit is contained in:
parent
161791a07d
commit
6f676c5a8e
@ -33,9 +33,10 @@ class UrlLauncher {
|
|||||||
if (!{'https', 'http'}.contains(uri.scheme)) {
|
if (!{'https', 'http'}.contains(uri.scheme)) {
|
||||||
// just launch non-https / non-http uris directly
|
// just launch non-https / non-http uris directly
|
||||||
|
|
||||||
// transmute geo URIs on desktop to openstreetmap links, as those usually can't hanlde
|
// we need to transmute geo URIs on desktop and on iOS
|
||||||
// geo URIs
|
if ((!PlatformInfos.isMobile || PlatformInfos.isIOS) &&
|
||||||
if (!PlatformInfos.isMobile && uri.scheme == 'geo' && uri.path != null) {
|
uri.scheme == 'geo' &&
|
||||||
|
uri.path != null) {
|
||||||
final latlong = uri.path
|
final latlong = uri.path
|
||||||
.split(';')
|
.split(';')
|
||||||
.first
|
.first
|
||||||
@ -45,8 +46,18 @@ class UrlLauncher {
|
|||||||
if (latlong.length == 2 &&
|
if (latlong.length == 2 &&
|
||||||
latlong.first != null &&
|
latlong.first != null &&
|
||||||
latlong.last != null) {
|
latlong.last != null) {
|
||||||
launch(
|
if (PlatformInfos.isIOS) {
|
||||||
'https://www.openstreetmap.org/?mlat=${latlong.first}&mlon=${latlong.last}#map=16/${latlong.first}/${latlong.last}');
|
// iOS is great at not following standards, so we need to transmute the geo URI
|
||||||
|
// to an apple maps thingy
|
||||||
|
// https://developer.apple.com/library/archive/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html
|
||||||
|
final ll = '${latlong.first},${latlong.last}';
|
||||||
|
launch('https://maps.apple.com/?q=$ll&sll=$ll');
|
||||||
|
} else {
|
||||||
|
// transmute geo URIs on desktop to openstreetmap links, as those usually can't handle
|
||||||
|
// geo URIs
|
||||||
|
launch(
|
||||||
|
'https://www.openstreetmap.org/?mlat=${latlong.first}&mlon=${latlong.last}#map=16/${latlong.first}/${latlong.last}');
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user