Skip to content
This repository has been archived by the owner on Dec 23, 2024. It is now read-only.

Feat/0.15.0 #121

Merged
merged 93 commits into from
Sep 29, 2023
Merged
Changes from 1 commit
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
91b6ca6
refactor: Improve settings code
Myzel394 Sep 3, 2023
3c99088
feat: Add use realtime updates to SettingsService.dart
Myzel394 Sep 4, 2023
51499cb
feat: Add UseRealtimeUpdatesTile.dart to SettingsScreen.dart
Myzel394 Sep 4, 2023
f53884f
refactor: Refactoring manager service
Myzel394 Sep 5, 2023
107cd6a
fix(android): Setup AndroidManifest.xml for background locator
Myzel394 Sep 5, 2023
96fe126
fix(ios): Setup background locator for iOS
Myzel394 Sep 5, 2023
941254a
fix(android): Register on boot completed
Myzel394 Sep 5, 2023
5c84e6f
feat: Register background locator on use realtime and use background …
Myzel394 Sep 5, 2023
e14d92d
refactor: Move task_service.dart into it's own subfolder
Myzel394 Sep 5, 2023
2b095af
feat: Add outstanding location field to task
Myzel394 Sep 5, 2023
2a651bb
feat: Add location point accumulation when sending fails; Closes #109
Myzel394 Sep 5, 2023
3da849b
feat: Change simple list based outstanding location publish service t…
Myzel394 Sep 5, 2023
ac56357
refactor: Create own classes for tasks
Myzel394 Sep 6, 2023
66f5fc0
fix: Fix tasks key
Myzel394 Sep 6, 2023
407abd1
refactor: Add MapCompass.dart
Myzel394 Sep 6, 2023
d2081f6
ui: Add tooltipSpacing to MapCompass.dart
Myzel394 Sep 6, 2023
835fe82
refactor: Add GoToMyLocationMapAction.dart
Myzel394 Sep 6, 2023
e9c3fec
feat: Use zoom on location update in UI when is far zoomed in, otherw…
Myzel394 Sep 6, 2023
a7af971
refactor: Rename MapCompass.dart -> CompassMapAction.dart
Myzel394 Sep 6, 2023
b2acd0b
feat: Improve background location update minimum distance filter
Myzel394 Sep 6, 2023
cd9fddb
feat: Run background locator task
Myzel394 Sep 7, 2023
87c3674
fix: Fix l10n key
Myzel394 Sep 7, 2023
3051093
fix: Improve background location updating
Myzel394 Sep 7, 2023
b731cee
dx: Add task executions to SettingsScreen.dart
Myzel394 Sep 7, 2023
0d118f2
fix: Fix task being identified as a quick share
Myzel394 Sep 7, 2023
b9efb87
feat: Add animation to GoToMyLocationMapAction.dart
Myzel394 Sep 7, 2023
f01f5b2
feat: Improve initial map behavior
Myzel394 Sep 7, 2023
90e6cd8
fix: Fix starting background locator
Myzel394 Sep 7, 2023
b4a88de
Merge pull request #116 from Myzel394/add-realtime-update
Myzel394 Sep 8, 2023
56993ee
refactor: Use new LocationFetchers.dart to fetch locations
Myzel394 Sep 8, 2023
5c20b47
fix: Fix empty location fetcher
Myzel394 Sep 9, 2023
120482b
feat: Show last location circle when all are shown and show all when …
Myzel394 Sep 9, 2023
1dff5e0
chore: Update constraints
Myzel394 Sep 9, 2023
9dcaced
feat: Jump to correct position on location change
Myzel394 Sep 9, 2023
e272f9b
feat: Jump to correct position on location change
Myzel394 Sep 9, 2023
2aecce9
feat: Add absolute date value to ViewDetails.dart
Myzel394 Sep 9, 2023
9d035bd
feat: Remove TaskDetailScreen.dart's map
Myzel394 Sep 9, 2023
5fea95d
refactor: Make LocationFetchers.dart global
Myzel394 Sep 9, 2023
c34a2f5
feat: Improve distance bento element
Myzel394 Sep 9, 2023
797b16e
feat: Improve view details
Myzel394 Sep 9, 2023
e304053
refactor: MapActionsContainer.dart
Myzel394 Sep 9, 2023
bc2f9ba
fix: Use task name as title in TaskDetailScreen.dart
Myzel394 Sep 9, 2023
b422b5f
fix: Improve location fetchers
Myzel394 Sep 9, 2023
d5449fc
fix: Improve location circle preview
Myzel394 Sep 9, 2023
91354a1
Merge pull request #118 from Myzel394/feat/0.15/improve-maps
Myzel394 Sep 9, 2023
a966a19
refactor: Move location_alarm_service.dart into own folder
Myzel394 Sep 9, 2023
a19d055
feat: Add ProximityLocationAlarm.dart
Myzel394 Sep 9, 2023
958c5e7
refactor: Add LocationRadiusSelectorMap.dart
Myzel394 Sep 12, 2023
a98359e
fix: Fix scale mode
Myzel394 Sep 13, 2023
2a489dc
fix: Add realtime update to radius
Myzel394 Sep 13, 2023
f80825f
fix: Disable location set for alarms of proximity type
Myzel394 Sep 13, 2023
92a3f2f
feat: Add current_location_service.dart for better location fetching
Myzel394 Sep 13, 2023
9091e7b
fix: Force center update on location change for proximity based alarms
Myzel394 Sep 13, 2023
c20f4dc
current stand
Myzel394 Sep 16, 2023
44be483
fix: Fix alarm previews
Myzel394 Sep 16, 2023
b8f8e96
fix: Improve alarm previews
Myzel394 Sep 16, 2023
3b9e3cf
feat: Add delete confirmation for view alarms
Myzel394 Sep 16, 2023
0eec2cd
fix: Only check for notification access if alarm is not null
Myzel394 Sep 16, 2023
ceca7aa
chore: Update flutter_logs
Myzel394 Sep 18, 2023
abb57de
fix: Fix alarm checker
Myzel394 Sep 18, 2023
0acd946
refactor: Use OOP for nostr fetching
Myzel394 Sep 23, 2023
7b5f823
feat: Add location point decrypter & improvements
Myzel394 Sep 23, 2023
a56b4b7
test: Add nonexistent nostr fetch test
Myzel394 Sep 23, 2023
2078d4d
test: Add nostr fetch
Myzel394 Sep 23, 2023
c0e7ac0
refactor: Move view_service into its own folder
Myzel394 Sep 23, 2023
064316e
fix: Fix nostr fetching timeout
Myzel394 Sep 23, 2023
8c4a93c
test: Add fetcher test
Myzel394 Sep 23, 2023
60b49f4
refactor: Use new fetchers to fetch locations
Myzel394 Sep 23, 2023
1e97823
fix: Remove unused get-locations.dart
Myzel394 Sep 23, 2023
b5062df
fix: Fix location fetchers
Myzel394 Sep 23, 2023
e863c6f
fix: Fix location fetchers
Myzel394 Sep 24, 2023
dac3042
feat: Add missing permission notification
Myzel394 Sep 24, 2023
f51a873
feat: Add repeatedly-check.dart for RequestBatteryOptimizationsDisabl…
Myzel394 Sep 24, 2023
a498beb
fix: Fix location updates
Myzel394 Sep 24, 2023
9e433ab
refactor: Improve alarm handler
Myzel394 Sep 24, 2023
c1bd92c
chore: Update packages
Myzel394 Sep 24, 2023
006d635
fix: Improve LocationsOverviewScreen.dart for iOS
Myzel394 Sep 25, 2023
6587c0d
fix: Improve map for iOS
Myzel394 Sep 26, 2023
0938858
fix: Make action destructive on iOS
Myzel394 Sep 26, 2023
1827ff0
fix: Improve spacing
Myzel394 Sep 26, 2023
4e1432f
feat: Open maps directly if one map is only available
Myzel394 Sep 26, 2023
b38b59c
Merge pull request #119 from Myzel394/feat-0.15.0-add-proximity-alarm
Myzel394 Sep 26, 2023
23b49d3
current stand
Myzel394 Sep 26, 2023
64c874c
feat: Add get-relays-meta.dart functionality
Myzel394 Sep 26, 2023
c757d00
current stand
Myzel394 Sep 27, 2023
c210024
fix: Improve spacing for iOS
Myzel394 Sep 27, 2023
8de4b32
current stand
Myzel394 Sep 27, 2023
3279cbd
feat: Add hint to relay sheet & improve relay sheet
Myzel394 Sep 27, 2023
b521edb
fix: Improve RelaySelectSheet.dart
Myzel394 Sep 27, 2023
1c6a2a9
fix: Fix out of range
Myzel394 Sep 28, 2023
9a5c31b
Merge pull request #120 from Myzel394/feat-0.15.0-sort-relays
Myzel394 Sep 28, 2023
dfafe41
fix: Fix task / shares overview switcher for iOS
Myzel394 Sep 29, 2023
53aa60e
chore: Update version
Myzel394 Sep 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor: Make LocationFetchers.dart global
  • Loading branch information
Myzel394 committed Sep 9, 2023

Unverified

This user has not yet uploaded their public signing key.
commit 5fea95d136bd5e73921084b23d878fc546eb961b
1 change: 1 addition & 0 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
@@ -167,6 +167,7 @@
"taskAction_generateLink_process_publishing": "Publishing encrypted data...",
"taskAction_generateLink_process_creatingURI": "Creating link...",
"taskAction_generateLink_shareTextSubject": "Here's the link to see my location",
"taskAction_showDetails": "Show Details",
"tasks_action_stopAll": "Stop tasks",
"tasks_action_startAll": "Start tasks",
"tasks_examples_weekend": "Weekend Getaway",
3 changes: 3 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
import 'package:flutter_logs/flutter_logs.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:locus/App.dart';
import 'package:locus/screens/locations_overview_screen_widgets/LocationFetchers.dart';
import 'package:locus/services/app_update_service.dart';
import 'package:locus/services/log_service.dart';
import 'package:locus/services/manager_service/background_fetch.dart';
@@ -84,6 +85,8 @@ void main() async {
ChangeNotifierProvider<LogService>(create: (_) => logService),
ChangeNotifierProvider<AppUpdateService>(
create: (_) => appUpdateService),
ChangeNotifierProvider<LocationFetchers>(
create: (_) => LocationFetchers()),
],
child: const App(),
),
98 changes: 54 additions & 44 deletions lib/screens/LocationsOverviewScreen.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:async';
import 'dart:convert';
import 'dart:core';
import 'dart:core';
import 'dart:io';
import 'dart:math';

@@ -91,7 +90,6 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>
AutomaticKeepAliveClientMixin,
WidgetsBindingObserver,
TickerProviderStateMixin {
final _fetchers = LocationFetchers()..enableLocationsUpdates();
MapController? flutterMapController;
PopupController? flutterMapPopupController;
apple_maps.AppleMapController? appleMapController;
@@ -146,12 +144,16 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>
final logService = context.read<LogService>();
final settings = context.read<SettingsService>();
final appUpdateService = context.read<AppUpdateService>();
final locationFetchers = context.read<LocationFetchers>();

_handleViewAlarmChecker();
_handleNotifications();

locationFetchers.addAll(viewService.views);

settings.addListener(_updateBackgroundListeners);
taskService.addListener(_updateBackgroundListeners);
locationFetchers.addLocationUpdatesListener(_rebuild);

WidgetsBinding.instance
..addObserver(this)
@@ -162,7 +164,7 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>
_initUniLinks();
_updateLocaleToSettings();
_showUpdateDialogIfRequired();
_initFetchers();
locationFetchers.fetchPreviewLocations();

taskService.checkup(logService);

@@ -202,8 +204,10 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>

@override
dispose() {
final appUpdateService = context.read<AppUpdateService>();
final locationFetchers = context.read<LocationFetchers>();

flutterMapController?.dispose();
_fetchers.dispose();

_viewsAlarmCheckerTimer?.cancel();
_uniLinksStream?.cancel();
@@ -213,8 +217,8 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>

WidgetsBinding.instance.removeObserver(this);

final appUpdateService = context.read<AppUpdateService>();
appUpdateService.removeListener(_rebuild);
locationFetchers.removeLocationUpdatesListener(_rebuild);

super.dispose();
}
@@ -232,21 +236,14 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>
}
}

void _initFetchers() {
final viewService = context.read<ViewService>();

_fetchers.addListener(_rebuild);

_fetchers.addAll(viewService.views);
_fetchers.fetchPreviewLocations();
}

void _handleViewServiceChange() {
final viewService = context.read<ViewService>();
final locationFetchers = context.read<LocationFetchers>();

final newView = viewService.views.last;

_fetchers.add(newView);
_fetchers.fetchPreviewLocations();
locationFetchers.add(newView);
locationFetchers.fetchPreviewLocations();
}

void _setLocationFromSettings() async {
@@ -737,17 +734,19 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>
Widget buildMap() {
final settings = context.read<SettingsService>();
final viewService = context.read<ViewService>();
final locationFetchers = context.read<LocationFetchers>();

final shades = getPrimaryColorShades(context);

final Iterable<(TaskView, LocationPointService)> circleLocations =
selectedViewID == null
? _fetchers.fetchers
? locationFetchers.fetchers
.where((fetcher) => fetcher.locations.isNotEmpty)
.map((fetcher) => (fetcher.view, fetcher.locations.last))
: viewService.views
.map(
(view) => mergeLocationsIfRequired(
_fetchers
locationFetchers
.getLocations(view)
.whereNot((location) => location == visibleLocation)
.toList(),
@@ -784,25 +783,26 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>
.where(
(view) => selectedViewID == null || view.id == selectedViewID)
.map(
(view) => mergeLocationsIfRequired(_fetchers.getLocations(view))
.map(
(location) => apple_maps.Circle(
circleId: apple_maps.CircleId(location.id),
center: apple_maps.LatLng(
location.latitude,
location.longitude,
),
radius: location.accuracy,
fillColor: view.color.withOpacity(0.2),
strokeColor: view.color,
strokeWidth: location.accuracy < 10 ? 1 : 3),
)
.toList(),
(view) =>
mergeLocationsIfRequired(locationFetchers.getLocations(view))
.map(
(location) => apple_maps.Circle(
circleId: apple_maps.CircleId(location.id),
center: apple_maps.LatLng(
location.latitude,
location.longitude,
),
radius: location.accuracy,
fillColor: view.color.withOpacity(0.2),
strokeColor: view.color,
strokeWidth: location.accuracy < 10 ? 1 : 3),
)
.toList(),
)
.expand((element) => element)
.toSet(),
polylines: Set<apple_maps.Polyline>.from(
_fetchers.fetchers
locationFetchers.fetchers
.where((fetcher) =>
selectedViewID == null || fetcher.view.id == selectedViewID)
.map(
@@ -823,7 +823,8 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>
});
},
// TODO
points: mergeLocationsIfRequired(_fetchers.getLocations(view))
points: mergeLocationsIfRequired(
locationFetchers.getLocations(view))
.reversed
.map(
(location) => apple_maps.LatLng(
@@ -885,14 +886,14 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>
),
PolylineLayer(
polylines: List<Polyline>.from(
_fetchers.fetchers
locationFetchers.fetchers
.where((fetcher) =>
selectedViewID == null || fetcher.view.id == selectedViewID)
.map(
(fetcher) {
final view = fetcher.view;
final locations = mergeLocationsIfRequired(
_fetchers.getLocations(view),
locationFetchers.getLocations(view),
);

return Polyline(
@@ -943,9 +944,9 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>
markers: viewService.views
.where((view) =>
(selectedViewID == null || view.id == selectedViewID) &&
_fetchers.getLocations(view).isNotEmpty)
locationFetchers.getLocations(view).isNotEmpty)
.map((view) {
final latestLocation = _fetchers.getLocations(view).last;
final latestLocation = locationFetchers.getLocations(view).last;

return Marker(
key: Key(view.id),
@@ -975,8 +976,10 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>
}

Widget buildOutOfBoundsMarkers() {
final locationFetchers = context.read<LocationFetchers>();

return Stack(
children: _fetchers.fetchers
children: locationFetchers.fetchers
.where((fetcher) =>
(selectedViewID == null || fetcher.view.id == selectedViewID) &&
fetcher.locations.isNotEmpty)
@@ -996,8 +999,12 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>
);
}

void showViewLocations(final TaskView view,
{final bool jumpToLatestLocation = true}) async {
void showViewLocations(
final TaskView view, {
final bool jumpToLatestLocation = true,
}) async {
final locationFetchers = context.read<LocationFetchers>();

setState(() {
showFAB = false;
selectedViewID = view.id;
@@ -1007,7 +1014,7 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>
return;
}

final locations = _fetchers.getLocations(view);
final locations = locationFetchers.getLocations(view);

if (locations.isEmpty) {
return;
@@ -1250,11 +1257,13 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>
}

LocationPointService? get lastLocation {
final locationFetchers = context.read<LocationFetchers>();

if (selectedView == null) {
return null;
}

final locations = _fetchers.getLocations(selectedView!);
final locations = locationFetchers.getLocations(selectedView!);
if (locations.isEmpty) {
return null;
}
@@ -1393,6 +1402,7 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>
super.build(context);

final settings = context.watch<SettingsService>();
final locationFetchers = context.watch<LocationFetchers>();
final l10n = AppLocalizations.of(context);

return PlatformScaffold(
@@ -1479,7 +1489,7 @@ class _LocationsOverviewScreenState extends State<LocationsOverviewScreen>
view: selectedView,
locations: selectedViewID == null
? []
: _fetchers.getLocations(selectedView!),
: locationFetchers.getLocations(selectedView!),
onGoToPosition: (position) {
if (flutterMapController != null) {
// Get zoom based of accuracy
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:collection';

import 'package:collection/collection.dart';
import 'package:flutter/foundation.dart';
import 'package:locus/services/location_fetcher_service/Fetcher.dart';
@@ -13,9 +11,19 @@ class LocationFetchers extends ChangeNotifier {

LocationFetchers();

void enableLocationsUpdates() {
void addLocationUpdatesListener(
final VoidCallback callback,
) {
for (final fetcher in _fetchers) {
fetcher.addListener(callback);
}
}

void removeLocationUpdatesListener(
final VoidCallback callback,
) {
for (final fetcher in _fetchers) {
fetcher.addListener(notifyListeners);
fetcher.removeListener(callback);
}
}

@@ -27,6 +35,15 @@ class LocationFetchers extends ChangeNotifier {
_fetchers.add(Fetcher(view));
}

void remove(final TaskView view) {
final fetcher = _findFetcher(view);

if (fetcher != null) {
fetcher.dispose();
_fetchers.remove(fetcher);
}
}

void addAll(final List<TaskView> views) {
for (final view in views) {
add(view);
Loading