Skip to content

Commit cac94ce

Browse files
committed
Switch to openstreetmap.org for tile server
1 parent 9fe42e0 commit cac94ce

File tree

3 files changed

+39
-5
lines changed

3 files changed

+39
-5
lines changed

mobile/apps/photos/lib/ui/map/map_view.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class _MapViewState extends State<MapView> {
101101
},
102102
),
103103
children: [
104-
const OSMFranceTileLayer(),
104+
const OSMTileLayer(),
105105
MarkerClusterLayerWidget(
106106
options: MarkerClusterLayerOptions(
107107
alignment: Alignment.topCenter,
@@ -136,7 +136,7 @@ class _MapViewState extends State<MapView> {
136136
padding: EdgeInsets.only(
137137
bottom: widget.bottomSheetDraggableAreaHeight,
138138
),
139-
child: OSMFranceTileAttributes(
139+
child: OSMTileAttributes(
140140
options: widget.mapAttributionOptions,
141141
),
142142
),

mobile/apps/photos/lib/ui/map/tile/layers.dart

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import "package:photos/ui/map/tile/cache.dart";
77
import "package:url_launcher/url_launcher.dart";
88
import "package:url_launcher/url_launcher_string.dart";
99

10-
const String _userAgent = "io.ente.photos";
10+
const String _userAgent =
11+
"Ente Photos/1.2 (+https://ente.io; contact: [email protected])";
1112

1213
class MapAttributionOptions {
1314
final double permanentHeight;
@@ -51,6 +52,39 @@ class OSMFranceTileLayer extends StatelessWidget {
5152
}
5253
}
5354

55+
class OSMTileAttributes extends StatelessWidget {
56+
final MapAttributionOptions options;
57+
const OSMTileAttributes({
58+
this.options = const MapAttributionOptions(),
59+
super.key,
60+
});
61+
62+
@override
63+
Widget build(BuildContext context) {
64+
final textTheme = getEnteTextTheme(context).tinyBold;
65+
return MapAttributionWidget(
66+
alignment: AttributionAlignment.bottomLeft,
67+
showFlutterMapAttribution: false,
68+
permanentHeight: options.permanentHeight,
69+
popupBackgroundColor: getEnteColorScheme(context).backgroundElevated,
70+
popupBorderRadius: options.popupBorderRadius,
71+
iconSize: options.iconSize,
72+
attributions: [
73+
TextSourceAttribution(
74+
AppLocalizations.of(context).openstreetmapContributors,
75+
textStyle: textTheme,
76+
onTap: () => launchUrlString('https://openstreetmap.org/copyright'),
77+
),
78+
TextSourceAttribution(
79+
'HOT Tiles',
80+
textStyle: textTheme,
81+
onTap: () => launchUrl(Uri.parse('https://www.hotosm.org/')),
82+
),
83+
],
84+
);
85+
}
86+
}
87+
5488
class OSMFranceTileAttributes extends StatelessWidget {
5589
final MapAttributionOptions options;
5690
const OSMFranceTileAttributes({

mobile/apps/photos/lib/ui/viewer/location/update_location_data_widget.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ class _UpdateLocationDataWidgetState extends State<UpdateLocationDataWidget> {
7878
},
7979
),
8080
children: const [
81-
OSMFranceTileLayer(),
82-
OSMFranceTileAttributes(),
81+
OSMTileLayer(),
82+
OSMTileAttributes(),
8383
],
8484
),
8585
Positioned(

0 commit comments

Comments
 (0)