diff --git a/CHANGELOG.md b/CHANGELOG.md index 23f3c4d..28bef33 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,10 @@ ## 5.3 -_Unreleased_ +_Released on 2024-12-04_ * Added cycle barriers and xmas features. +* Support `geo:` links — thanks @ann-who. * New adaptive icon — thanks @RedAuburn. * Updated presets and imagery layers, upgraded libraries. * Major updates to Estonian translation (thanks Priit Jõerüüt). diff --git a/lib/constants.dart b/lib/constants.dart index 03ac9c1..adde9b2 100644 --- a/lib/constants.dart +++ b/lib/constants.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart' show Colors, TextStyle; const kAppTitle = 'Every Door'; -const kAppVersion = '5.3-beta2'; // Also used for presets.db versioning +const kAppVersion = '5.3'; // Also used for presets.db versioning const kDefaultLocation = [59.42, 24.71]; const kDatabaseName = 'every_door.db'; diff --git a/lib/providers/app_links_provider.dart b/lib/providers/app_links_provider.dart index 9081423..eea3df0 100644 --- a/lib/providers/app_links_provider.dart +++ b/lib/providers/app_links_provider.dart @@ -8,6 +8,7 @@ import 'package:logging/logging.dart'; final geoIntentProvider = Provider((ref) => GeoIntentController(ref)); class GeoIntentController { + static final _logger = Logger('GeoIntentController'); final Ref _ref; GeoIntentController(this._ref) { @@ -27,6 +28,7 @@ class GeoIntentController { _handleGeoIntent(Uri uri) { if (uri.scheme == 'geo' && uri.path.isNotEmpty) { + _logger.info('Got geo uri $uri'); final location = _parseLatLngFromGeoUri(uri); if (location != null) { _ref.read(geolocationProvider.notifier).disableTracking(); @@ -34,36 +36,18 @@ class GeoIntentController { } } } -} -final uriLinkStreamProvider = StreamProvider((ref) async* { - await for (final uri in AppLinks().uriLinkStream) { - if (uri.scheme == 'geo' && uri.path.isNotEmpty) { - _handleGeoIntent(uri, ref); - } - - yield uri; - } -}); - -void _handleGeoIntent(Uri uri, StreamProviderRef ref) { - final location = _parseLatLngFromGeoUri(uri); - if (location != null) { - ref.read(geolocationProvider.notifier).disableTracking(); - ref.read(effectiveLocationProvider.notifier).set(location); - } -} - -LatLng? _parseLatLngFromGeoUri(Uri uri) { - try { - final coords = uri.path.split(','); - if (coords.length == 2) { - final lat = double.parse(coords[0]); - final lng = double.parse(coords[1]); - return LatLng(lat, lng); + LatLng? _parseLatLngFromGeoUri(Uri uri) { + try { + final coords = uri.path.split(','); + if (coords.length == 2) { + final lat = double.parse(coords[0]); + final lng = double.parse(coords[1]); + return LatLng(lat, lng); + } + } catch (e) { + _logger.warning('Failed to parse coordinates: $e'); } - } catch (e) { - Logger('AppLinks').warning('Failed to parse coordinates'); + return null; } - return null; -} +} \ No newline at end of file diff --git a/lib/providers/navigation_provider.dart b/lib/providers/navigation_provider.dart deleted file mode 100644 index 0512b88..0000000 --- a/lib/providers/navigation_provider.dart +++ /dev/null @@ -1,6 +0,0 @@ -import 'package:flutter/widgets.dart'; -import 'package:flutter_riverpod/flutter_riverpod.dart'; - -final navigatonKeyProvider = Provider>((ref) { - return GlobalKey(); -}); diff --git a/metadata/en-US/changelogs/48.txt b/metadata/en-US/changelogs/48.txt new file mode 100644 index 0000000..34e78e5 --- /dev/null +++ b/metadata/en-US/changelogs/48.txt @@ -0,0 +1,3 @@ +* Added cycle barriers and xmas features. +* Support "geo:" links. +* New adaptive icon. diff --git a/metadata/ru/changelogs/48.txt b/metadata/ru/changelogs/48.txt new file mode 100644 index 0000000..9d3d1b4 --- /dev/null +++ b/metadata/ru/changelogs/48.txt @@ -0,0 +1,3 @@ +* Добавил велопреграды и рождественские штуки. +* Поддержка ссылок "geo:". +* Новая адаптивная иконка.