mirror of
https://github.com/dz0ny/meshcore-sar.git
synced 2026-08-11 16:30:28 +00:00
Enable iOS background GPS updates
This commit is contained in:
@@ -489,7 +489,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 108;
|
||||
CURRENT_PROJECT_VERSION = 109;
|
||||
DEVELOPMENT_TEAM = JND55328G8;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
@@ -511,7 +511,7 @@
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 108;
|
||||
CURRENT_PROJECT_VERSION = 109;
|
||||
DEVELOPMENT_TEAM = JND55328G8;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
@@ -530,7 +530,7 @@
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 108;
|
||||
CURRENT_PROJECT_VERSION = 109;
|
||||
DEVELOPMENT_TEAM = JND55328G8;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
@@ -547,7 +547,7 @@
|
||||
buildSettings = {
|
||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 108;
|
||||
CURRENT_PROJECT_VERSION = 109;
|
||||
DEVELOPMENT_TEAM = JND55328G8;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
MARKETING_VERSION = 1.0;
|
||||
@@ -679,7 +679,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 108;
|
||||
CURRENT_PROJECT_VERSION = 109;
|
||||
DEVELOPMENT_TEAM = JND55328G8;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
@@ -702,7 +702,7 @@
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = 108;
|
||||
CURRENT_PROJECT_VERSION = 109;
|
||||
DEVELOPMENT_TEAM = JND55328G8;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>108</string>
|
||||
<string>109</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>ITSAppUsesNonExemptEncryption</key>
|
||||
|
||||
@@ -128,6 +128,9 @@ class AppProvider with ChangeNotifier {
|
||||
Timer? _packetCaptureFlushTimer;
|
||||
String? _lastPersistedPacketSignature;
|
||||
bool _isPersistingPacketCapture = false;
|
||||
bool _wasDeviceConnected = false;
|
||||
bool _hasCompletedConnectionBootstrap = false;
|
||||
bool _isReconnectSyncInProgress = false;
|
||||
|
||||
AppProvider({
|
||||
required this.connectionProvider,
|
||||
@@ -139,6 +142,7 @@ class AppProvider with ChangeNotifier {
|
||||
required this.imageProvider,
|
||||
}) {
|
||||
_setupCallbacks();
|
||||
_wasDeviceConnected = connectionProvider.deviceInfo.isConnected;
|
||||
_initializeLocationTracking();
|
||||
_loadMapEnabled();
|
||||
_loadContactsEnabled();
|
||||
@@ -1659,12 +1663,42 @@ class AppProvider with ChangeNotifier {
|
||||
);
|
||||
messagesProvider.syncDrawingsWithProvider(drawingProvider);
|
||||
|
||||
_hasCompletedConnectionBootstrap = true;
|
||||
_wasDeviceConnected = connectionProvider.deviceInfo.isConnected;
|
||||
notifyListeners();
|
||||
} catch (e) {
|
||||
debugPrint('Initialization error: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _syncAfterReconnect() async {
|
||||
if (_isReconnectSyncInProgress ||
|
||||
!connectionProvider.deviceInfo.isConnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
_isReconnectSyncInProgress = true;
|
||||
try {
|
||||
debugPrint(
|
||||
'🔄 [AppProvider] Device reconnected - syncing contacts and missed messages',
|
||||
);
|
||||
|
||||
await contactsProvider.initialize(
|
||||
devicePublicKey: connectionProvider.deviceInfo.publicKey,
|
||||
);
|
||||
await connectionProvider.getContacts();
|
||||
|
||||
final messageCount = await connectionProvider.syncAllMessages();
|
||||
debugPrint(
|
||||
'📥 [AppProvider] Reconnect sync retrieved $messageCount message(s)',
|
||||
);
|
||||
} catch (e) {
|
||||
debugPrint('❌ [AppProvider] Reconnect sync error: $e');
|
||||
} finally {
|
||||
_isReconnectSyncInProgress = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// Automatically login to all rooms with saved passwords on cold connect
|
||||
Future<void> _autoLoginToRooms() async {
|
||||
if (!connectionProvider.deviceInfo.isConnected) return;
|
||||
@@ -2637,6 +2671,8 @@ class AppProvider with ChangeNotifier {
|
||||
/// Handle connection state changes to manage location tracking
|
||||
void _handleConnectionStateChange() {
|
||||
final isConnected = connectionProvider.deviceInfo.isConnected;
|
||||
final wasConnected = _wasDeviceConnected;
|
||||
_wasDeviceConnected = isConnected;
|
||||
final wasTracking = locationTrackingService.isTracking;
|
||||
|
||||
// Only stop tracking on disconnect - DON'T start on connect
|
||||
@@ -2648,6 +2684,10 @@ class AppProvider with ChangeNotifier {
|
||||
);
|
||||
_stopLocationTracking();
|
||||
}
|
||||
|
||||
if (isConnected && !wasConnected && _hasCompletedConnectionBootstrap) {
|
||||
unawaited(_syncAfterReconnect());
|
||||
}
|
||||
}
|
||||
|
||||
/// Start location tracking
|
||||
|
||||
Reference in New Issue
Block a user