|
|
|
|
@ -5,7 +5,6 @@ import 'dart:io';
|
|
|
|
|
import 'package:collection/collection.dart';
|
|
|
|
|
import 'package:drift/drift.dart';
|
|
|
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
|
|
import 'package:immich_mobile/domain/models/album/local_album.model.dart';
|
|
|
|
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
|
|
|
|
import 'package:immich_mobile/entities/album.entity.dart';
|
|
|
|
|
@ -23,13 +22,8 @@ import 'package:immich_mobile/infrastructure/entities/store.entity.dart';
|
|
|
|
|
import 'package:immich_mobile/infrastructure/entities/store.entity.drift.dart';
|
|
|
|
|
import 'package:immich_mobile/infrastructure/entities/user.entity.dart';
|
|
|
|
|
import 'package:immich_mobile/infrastructure/repositories/db.repository.dart';
|
|
|
|
|
import 'package:immich_mobile/providers/app_settings.provider.dart';
|
|
|
|
|
import 'package:immich_mobile/providers/background_sync.provider.dart';
|
|
|
|
|
import 'package:immich_mobile/providers/backup/backup.provider.dart';
|
|
|
|
|
import 'package:immich_mobile/services/app_settings.service.dart';
|
|
|
|
|
import 'package:immich_mobile/utils/diff.dart';
|
|
|
|
|
import 'package:isar/isar.dart';
|
|
|
|
|
import 'package:logging/logging.dart';
|
|
|
|
|
// ignore: import_rule_photo_manager
|
|
|
|
|
import 'package:photo_manager/photo_manager.dart';
|
|
|
|
|
|
|
|
|
|
@ -310,25 +304,6 @@ class _DeviceAsset {
|
|
|
|
|
const _DeviceAsset({required this.assetId, this.hash, this.dateTime});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<List<void>> runNewSync(WidgetRef ref, {bool full = false}) {
|
|
|
|
|
ref.read(backupProvider.notifier).cancelBackup();
|
|
|
|
|
|
|
|
|
|
final backgroundManager = ref.read(backgroundSyncProvider);
|
|
|
|
|
final isAlbumLinkedSyncEnable = ref.read(appSettingsServiceProvider).getSetting(AppSettingsEnum.syncAlbums);
|
|
|
|
|
|
|
|
|
|
return Future.wait([
|
|
|
|
|
backgroundManager.syncLocal(full: full).then((_) {
|
|
|
|
|
Logger("runNewSync").fine("Hashing assets after syncLocal");
|
|
|
|
|
return backgroundManager.hashAssets();
|
|
|
|
|
}),
|
|
|
|
|
backgroundManager.syncRemote().then((_) {
|
|
|
|
|
if (isAlbumLinkedSyncEnable) {
|
|
|
|
|
return backgroundManager.syncLinkedAlbum();
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> resetDriftDatabase(Drift drift) async {
|
|
|
|
|
// https://github.com/simolus3/drift/commit/bd80a46264b6dd833ef4fd87fffc03f5a832ab41#diff-3f879e03b4a35779344ef16170b9353608dd9c42385f5402ec6035aac4dd8a04R76-R94
|
|
|
|
|
final database = drift.attachedDatabase;
|
|
|
|
|
|