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 = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 108;
|
CURRENT_PROJECT_VERSION = 109;
|
||||||
DEVELOPMENT_TEAM = JND55328G8;
|
DEVELOPMENT_TEAM = JND55328G8;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -511,7 +511,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 108;
|
CURRENT_PROJECT_VERSION = 109;
|
||||||
DEVELOPMENT_TEAM = JND55328G8;
|
DEVELOPMENT_TEAM = JND55328G8;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
@@ -530,7 +530,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 108;
|
CURRENT_PROJECT_VERSION = 109;
|
||||||
DEVELOPMENT_TEAM = JND55328G8;
|
DEVELOPMENT_TEAM = JND55328G8;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
@@ -547,7 +547,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
BUNDLE_LOADER = "$(TEST_HOST)";
|
BUNDLE_LOADER = "$(TEST_HOST)";
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 108;
|
CURRENT_PROJECT_VERSION = 109;
|
||||||
DEVELOPMENT_TEAM = JND55328G8;
|
DEVELOPMENT_TEAM = JND55328G8;
|
||||||
GENERATE_INFOPLIST_FILE = YES;
|
GENERATE_INFOPLIST_FILE = YES;
|
||||||
MARKETING_VERSION = 1.0;
|
MARKETING_VERSION = 1.0;
|
||||||
@@ -679,7 +679,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 108;
|
CURRENT_PROJECT_VERSION = 109;
|
||||||
DEVELOPMENT_TEAM = JND55328G8;
|
DEVELOPMENT_TEAM = JND55328G8;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -702,7 +702,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 108;
|
CURRENT_PROJECT_VERSION = 109;
|
||||||
DEVELOPMENT_TEAM = JND55328G8;
|
DEVELOPMENT_TEAM = JND55328G8;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>108</string>
|
<string>109</string>
|
||||||
<key>LSRequiresIPhoneOS</key>
|
<key>LSRequiresIPhoneOS</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>ITSAppUsesNonExemptEncryption</key>
|
<key>ITSAppUsesNonExemptEncryption</key>
|
||||||
|
|||||||
@@ -128,6 +128,9 @@ class AppProvider with ChangeNotifier {
|
|||||||
Timer? _packetCaptureFlushTimer;
|
Timer? _packetCaptureFlushTimer;
|
||||||
String? _lastPersistedPacketSignature;
|
String? _lastPersistedPacketSignature;
|
||||||
bool _isPersistingPacketCapture = false;
|
bool _isPersistingPacketCapture = false;
|
||||||
|
bool _wasDeviceConnected = false;
|
||||||
|
bool _hasCompletedConnectionBootstrap = false;
|
||||||
|
bool _isReconnectSyncInProgress = false;
|
||||||
|
|
||||||
AppProvider({
|
AppProvider({
|
||||||
required this.connectionProvider,
|
required this.connectionProvider,
|
||||||
@@ -139,6 +142,7 @@ class AppProvider with ChangeNotifier {
|
|||||||
required this.imageProvider,
|
required this.imageProvider,
|
||||||
}) {
|
}) {
|
||||||
_setupCallbacks();
|
_setupCallbacks();
|
||||||
|
_wasDeviceConnected = connectionProvider.deviceInfo.isConnected;
|
||||||
_initializeLocationTracking();
|
_initializeLocationTracking();
|
||||||
_loadMapEnabled();
|
_loadMapEnabled();
|
||||||
_loadContactsEnabled();
|
_loadContactsEnabled();
|
||||||
@@ -1659,12 +1663,42 @@ class AppProvider with ChangeNotifier {
|
|||||||
);
|
);
|
||||||
messagesProvider.syncDrawingsWithProvider(drawingProvider);
|
messagesProvider.syncDrawingsWithProvider(drawingProvider);
|
||||||
|
|
||||||
|
_hasCompletedConnectionBootstrap = true;
|
||||||
|
_wasDeviceConnected = connectionProvider.deviceInfo.isConnected;
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint('Initialization error: $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
|
/// Automatically login to all rooms with saved passwords on cold connect
|
||||||
Future<void> _autoLoginToRooms() async {
|
Future<void> _autoLoginToRooms() async {
|
||||||
if (!connectionProvider.deviceInfo.isConnected) return;
|
if (!connectionProvider.deviceInfo.isConnected) return;
|
||||||
@@ -2637,6 +2671,8 @@ class AppProvider with ChangeNotifier {
|
|||||||
/// Handle connection state changes to manage location tracking
|
/// Handle connection state changes to manage location tracking
|
||||||
void _handleConnectionStateChange() {
|
void _handleConnectionStateChange() {
|
||||||
final isConnected = connectionProvider.deviceInfo.isConnected;
|
final isConnected = connectionProvider.deviceInfo.isConnected;
|
||||||
|
final wasConnected = _wasDeviceConnected;
|
||||||
|
_wasDeviceConnected = isConnected;
|
||||||
final wasTracking = locationTrackingService.isTracking;
|
final wasTracking = locationTrackingService.isTracking;
|
||||||
|
|
||||||
// Only stop tracking on disconnect - DON'T start on connect
|
// Only stop tracking on disconnect - DON'T start on connect
|
||||||
@@ -2648,6 +2684,10 @@ class AppProvider with ChangeNotifier {
|
|||||||
);
|
);
|
||||||
_stopLocationTracking();
|
_stopLocationTracking();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isConnected && !wasConnected && _hasCompletedConnectionBootstrap) {
|
||||||
|
unawaited(_syncAfterReconnect());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Start location tracking
|
/// Start location tracking
|
||||||
|
|||||||
Reference in New Issue
Block a user