From 7033d3a233559f96419111432ff352fe07968319 Mon Sep 17 00:00:00 2001 From: Muhesh7 Date: Tue, 6 Jun 2023 01:27:20 +0530 Subject: [PATCH] migrate(map): osm to mapbox --- .env.example | 2 ++ lib/core/configuration.dart | 3 +++ lib/ui/map/map_screen.dart | 6 +----- lib/ui/map/map_view.dart | 8 ++++++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index 8f446acbf9..329eacea7d 100644 --- a/.env.example +++ b/.env.example @@ -1 +1,3 @@ endpoint=https://api.ente.io/ +urltemplate=YOUR_URL_TEMPLATE +apikey=YOUR_API_KEY diff --git a/lib/core/configuration.dart b/lib/core/configuration.dart index cccc1ecf82..ba7dcf2b9e 100644 --- a/lib/core/configuration.dart +++ b/lib/core/configuration.dart @@ -43,6 +43,9 @@ class Configuration { "endpoint", defaultValue: kDefaultProductionEndpoint, ); + static const urltemplate = String.fromEnvironment("urltemplate"); + static const apikey = String.fromEnvironment("apikey"); + static const emailKey = "email"; static const foldersToBackUpKey = "folders_to_back_up"; static const keyAttributesKey = "key_attributes"; diff --git a/lib/ui/map/map_screen.dart b/lib/ui/map/map_screen.dart index 6d38659f8c..3f995db92d 100644 --- a/lib/ui/map/map_screen.dart +++ b/lib/ui/map/map_screen.dart @@ -9,7 +9,6 @@ import "package:logging/logging.dart"; import "package:photos/models/file.dart"; import "package:photos/ui/map/image_marker.dart"; import 'package:photos/ui/map/image_tile.dart'; -import "package:photos/ui/map/map_credits.dart"; import "package:photos/ui/map/map_view.dart"; class MapScreen extends StatefulWidget { @@ -61,7 +60,7 @@ class _MapScreenState extends State { final List tempMarkers = []; bool hasAnyLocation = false; for (var file in files) { - if (file.location != null) { + if (file.location != null && file.hasLocation) { if (!hasAnyLocation) { minLat = file.location!.latitude!; minLon = file.location!.longitude!; @@ -155,9 +154,6 @@ class _MapScreenState extends State { debounceDuration: debounceDuration, ), ), - const SizedBox( - child: MapCredits(), - ), SizedBox( height: 120, child: Center( diff --git a/lib/ui/map/map_view.dart b/lib/ui/map/map_view.dart index 72dee05160..067c7925e4 100644 --- a/lib/ui/map/map_view.dart +++ b/lib/ui/map/map_view.dart @@ -4,6 +4,7 @@ import "package:flutter/material.dart"; import "package:flutter_map/flutter_map.dart"; import "package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart"; import "package:latlong2/latlong.dart"; +import "package:photos/core/configuration.dart"; import "package:photos/ui/map/image_marker.dart"; import "package:photos/ui/map/map_button.dart"; import 'package:photos/ui/map/map_gallery_tile.dart'; @@ -75,8 +76,11 @@ class _MapViewState extends State { ), layers: [ TileLayerOptions( - urlTemplate: 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', - subdomains: ['a', 'b', 'c'], + urlTemplate: Configuration.urltemplate, + additionalOptions: { + "accessToken": Configuration.apikey, + "id": "mapbox.mapbox-streets-v7", + }, ), MarkerClusterLayerOptions( maxClusterRadius: 100,