High performance self-hosted photo and video management solution.
TypeScript backup-toolfluttergoogle-photosgoogle-photos-alternativejavascriptmobile-appnestjsnodejsphoto-galleryphotosphotos-managementself-hostedsveltesveltekittypescriptvideos
feat(mobile): launch map app from exif info (#3626)
shalong-tanwen57a7103d759e
diff --git a/mobile/android/app/src/main/AndroidManifest.xml b/mobile/android/app/src/main/AndroidManifest.xmlindex da8f8bd220..c3b7f1c928 100644--- a/mobile/android/app/src/main/AndroidManifest.xml+++ b/mobile/android/app/src/main/AndroidManifest.xml@@ -70,5 +70,9 @@<action android:name="android.intent.action.VIEW" /><data android:scheme="https" /></intent>+ <intent>+ <action android:name="android.intent.action.VIEW" />+ <data android:scheme="geo" />+ </intent></queries></manifest>\ No newline at end of filediff --git a/mobile/lib/modules/asset_viewer/ui/exif_bottom_sheet.dart b/mobile/lib/modules/asset_viewer/ui/exif_bottom_sheet.dartindex 1a20ea35e4..6bace49afd 100644--- a/mobile/lib/modules/asset_viewer/ui/exif_bottom_sheet.dart+++ b/mobile/lib/modules/asset_viewer/ui/exif_bottom_sheet.dart@@ -1,3 +1,5 @@+import 'dart:io';+import 'package:easy_localization/easy_localization.dart';import 'package:flutter/material.dart';import 'package:flutter_map/flutter_map.dart';@@ -17,6 +19,33 @@ class ExifBottomSheet extends HookConsumerWidget {bool get showMap =>asset.exifInfo?.latitude != null && asset.exifInfo?.longitude != null;+ Future<Uri> _createCoordinatesUri(double latitude, double longitude) async {+ const zoomLevel = 5;+ if (Platform.isAndroid) {+ Uri uri = Uri(+ scheme: 'geo',+ host: '$latitude,$longitude',+ queryParameters: {'z': '$zoomLevel', 'q': '$latitude,$longitude'},+ );+ if (await canLaunchUrl(uri)) {+ return uri;+ }+ } else if (Platform.isIOS) {+ var params = {+ 'll': '$latitude,$longitude',+ 'q': '$latitude, $longitude',+ };+ Uri uri = Uri.https('maps.apple.com', '/', params);+ if (!await canLaunchUrl(uri)) {+ return uri;+ }+ }+ return Uri.https(+ 'www.google.com',+ '/maps/place/$latitude,$longitude/@$latitude,$longitude,${zoomLevel}z',+ );+ }+@overrideWidget build(BuildContext context, WidgetRef ref) {final exifInfo = asset.exifInfo;@@ -42,6 +71,18 @@ class ExifBottomSheet extends HookConsumerWidget {exifInfo?.longitude ?? 0,),zoom: 16.0,+ onTap: (tapPosition, latLong) async {+ if (exifInfo != null &&+ exifInfo.latitude != null &&+ exifInfo.longitude != null) {+ launchUrl(+ await _createCoordinatesUri(+ exifInfo.latitude!,+ exifInfo.longitude!,+ ),+ );+ }+ },),nonRotatedChildren: [RichAttributionWidget(