OTA Update attempt
This commit is contained in:
@@ -18,6 +18,9 @@ import 'utils/location_permission.dart';
|
||||
import 'services/notification_service.dart';
|
||||
import 'services/notification_bridge.dart';
|
||||
import 'services/background_location_service.dart';
|
||||
import 'services/app_update_service.dart';
|
||||
import 'widgets/update_dialog.dart';
|
||||
import 'utils/navigation.dart';
|
||||
import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
||||
import 'dart:convert';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
@@ -594,6 +597,23 @@ Future<void> main() async {
|
||||
),
|
||||
);
|
||||
|
||||
// perform update check once the first frame has rendered; errors are
|
||||
// intentionally swallowed so a network outage doesn't block startup.
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) async {
|
||||
try {
|
||||
final info = await AppUpdateService.instance.checkForUpdate();
|
||||
if (info.isUpdateAvailable) {
|
||||
showDialog(
|
||||
context: globalNavigatorKey.currentContext!,
|
||||
barrierDismissible: !info.isForceUpdate,
|
||||
builder: (_) => UpdateDialog(info: info),
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint('update check failed: $e');
|
||||
}
|
||||
});
|
||||
|
||||
// Post-startup registration removed: token registration is handled
|
||||
// centrally in the auth state change listener to avoid duplicate inserts.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user