mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
fix: isar crash on resume from app detach (#16599)
Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
2da9e3152b
commit
3f4bbab4eb
3 changed files with 14 additions and 4 deletions
|
|
@ -17,6 +17,7 @@ import 'package:immich_mobile/providers/server_info.provider.dart';
|
|||
import 'package:immich_mobile/providers/tab.provider.dart';
|
||||
import 'package:immich_mobile/providers/websocket.provider.dart';
|
||||
import 'package:immich_mobile/services/background.service.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
enum AppLifeCycleEnum {
|
||||
|
|
@ -114,11 +115,13 @@ class AppLifeCycleNotifier extends StateNotifier<AppLifeCycleEnum> {
|
|||
_ref.read(websocketProvider.notifier).disconnect();
|
||||
}
|
||||
|
||||
unawaited(LogService.I.flush());
|
||||
LogService.I.flush();
|
||||
}
|
||||
|
||||
void handleAppDetached() {
|
||||
Future<void> handleAppDetached() async {
|
||||
state = AppLifeCycleEnum.detached;
|
||||
LogService.I.flush();
|
||||
await Isar.getInstance()?.close();
|
||||
// no guarantee this is called at all
|
||||
_ref.read(manualUploadProvider.notifier).cancelBackup();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue