Skip to content

Commit

Permalink
Little cleanup, and preparing 5.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
Zverik committed Dec 4, 2024
1 parent 54ec091 commit a789e70
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 38 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion lib/constants.dart
Original file line number Diff line number Diff line change
@@ -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 = <double>[59.42, 24.71];
const kDatabaseName = 'every_door.db';
Expand Down
44 changes: 14 additions & 30 deletions lib/providers/app_links_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -27,43 +28,26 @@ 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();
_ref.read(effectiveLocationProvider.notifier).set(location);
}
}
}
}

final uriLinkStreamProvider = StreamProvider<Uri?>((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<Uri?> 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;
}
}
6 changes: 0 additions & 6 deletions lib/providers/navigation_provider.dart

This file was deleted.

3 changes: 3 additions & 0 deletions metadata/en-US/changelogs/48.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Added cycle barriers and xmas features.
* Support "geo:" links.
* New adaptive icon.
3 changes: 3 additions & 0 deletions metadata/ru/changelogs/48.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* Добавил велопреграды и рождественские штуки.
* Поддержка ссылок "geo:".
* Новая адаптивная иконка.

0 comments on commit a789e70

Please sign in to comment.