π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Fix OSM tile requests and dynamic map user agent
ashilknc68ac0e09b30
diff --git a/mobile/apps/photos/lib/ui/map/tile/cache.dart b/mobile/apps/photos/lib/ui/map/tile/cache.dartindex 0c7a6c8b58..acaa2f756e 100644--- a/mobile/apps/photos/lib/ui/map/tile/cache.dart+++ b/mobile/apps/photos/lib/ui/map/tile/cache.dart@@ -15,6 +15,8 @@ class TilesCacheManager extends CacheManager with ImageCacheManager {}class CachedNetworkTileProvider extends TileProvider {+ CachedNetworkTileProvider({super.headers});+@overrideImageProvider<Object> getImage(TileCoordinates coordinates,@@ -23,6 +25,7 @@ class CachedNetworkTileProvider extends TileProvider {return CachedNetworkImageProvider(getTileUrl(coordinates, options),cacheManager: TilesCacheManager(),+ headers: headers,);}}diff --git a/mobile/apps/photos/lib/ui/map/tile/layers.dart b/mobile/apps/photos/lib/ui/map/tile/layers.dartindex f67d02daff..f9db544442 100644--- a/mobile/apps/photos/lib/ui/map/tile/layers.dart+++ b/mobile/apps/photos/lib/ui/map/tile/layers.dart@@ -1,14 +1,21 @@import "package:flutter/material.dart";import "package:flutter_map/flutter_map.dart";import "package:photos/generated/l10n.dart";+import "package:photos/service_locator.dart";import "package:photos/theme/ente_theme.dart";import "package:photos/ui/map/tile/attribution/map_attribution.dart";import "package:photos/ui/map/tile/cache.dart";import "package:url_launcher/url_launcher.dart";import "package:url_launcher/url_launcher_string.dart";-const String _userAgent =- "Ente Photos/1.2 (+https://ente.io; contact: [email protected])";+String get _userAgent {+ try {+ final version = ServiceLocator.instance.packageInfo.version;+ return "Ente Photos/$version (+https://ente.io; contact: [email protected])";+ } catch (_) {+ return "Ente Photos/unknown (+https://ente.io; contact: [email protected])";+ }+}class MapAttributionOptions {final double permanentHeight;@@ -28,8 +35,7 @@ class OSMTileLayer extends StatelessWidget {@overrideWidget build(BuildContext context) {return TileLayer(- urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',- subdomains: const ['a', 'b', 'c'],+ urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',userAgentPackageName: _userAgent,tileProvider: CachedNetworkTileProvider(),);@@ -43,7 +49,7 @@ class OSMFranceTileLayer extends StatelessWidget {Widget build(BuildContext context) {return TileLayer(urlTemplate: 'https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png',- fallbackUrl: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',+ fallbackUrl: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',subdomains: const ['a', 'b', 'c'],tileProvider: CachedNetworkTileProvider(),userAgentPackageName: _userAgent,