Skip to content

Commit

Permalink
Setting lower default accuracy
Browse files Browse the repository at this point in the history
  • Loading branch information
danny committed Sep 12, 2024
1 parent e09b322 commit 7dab887
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion macless_haystack/lib/accessory/accessory_registry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import 'package:macless_haystack/preferences/user_preferences_model.dart';
const accessoryStorageKey = 'ACCESSORIES';
const historStorageKey = 'HISTORY';

const DEFAULT_MIN_ACCURACY = 50;

class AccessoryRegistry extends ChangeNotifier {
var _storage = const FlutterSecureStorage();
List<Accessory> _accessories = [];
Expand Down Expand Up @@ -240,7 +242,7 @@ class AccessoryRegistry extends ChangeNotifier {
//add to history in correct order
for (var i = 0; i < decryptedReports.length; i++) {
FindMyLocationReport report = decryptedReports[i];
if (report.accuracy! >= 110 &&
if (report.accuracy! >= DEFAULT_MIN_ACCURACY &&
report.longitude!.abs() <= 180 &&
report.latitude!.abs() <= 90) {
accessory.addLocationHistoryEntry(report);
Expand Down
3 changes: 2 additions & 1 deletion macless_haystack/lib/findMy/models.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:convert';
import 'dart:typed_data';

import 'package:logger/logger.dart';
import 'package:macless_haystack/accessory/accessory_registry.dart';
import 'package:pointycastle/ecc/api.dart';

// ignore: implementation_imports
Expand Down Expand Up @@ -67,7 +68,7 @@ class FindMyLocationReport {
latitude = correctCoordinate(decryptedReport.latitude!, 90);
longitude = correctCoordinate(decryptedReport.longitude!, 180);
accuracy = decryptedReport.accuracy;
timestamp = accuracy != null && accuracy! >= 110
timestamp = accuracy != null && accuracy! >= DEFAULT_MIN_ACCURACY
? decryptedReport.timestamp
: null;
confidence = decryptedReport.confidence;
Expand Down

0 comments on commit 7dab887

Please sign in to comment.