mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-05-08 09:30:40 +00:00
optimized sync for library update
This commit is contained in:
parent
9b85654c17
commit
dec2968921
3 changed files with 13 additions and 6 deletions
|
|
@ -107,15 +107,20 @@ Future<dynamic> updateMangaDetail(Ref ref,
|
|||
for (var i = 0; i < oldChapers.length; i++) {
|
||||
final oldChap = oldChapers[i];
|
||||
final newChap = chaps[i];
|
||||
final hasChanged = oldChap.name != newChap.name ||
|
||||
oldChap.url != newChap.url ||
|
||||
oldChap.scanlator != newChap.scanlator;
|
||||
oldChap.name = newChap.name;
|
||||
oldChap.url = newChap.url;
|
||||
oldChap.scanlator = newChap.scanlator;
|
||||
isar.chapters.putSync(oldChap);
|
||||
oldChap.manga.saveSync();
|
||||
ref.read(synchingProvider(syncId: 1).notifier).addChangedPart(
|
||||
ActionType.updateItem, manga.id, manga.toJson(), false);
|
||||
ref.read(synchingProvider(syncId: 1).notifier).addChangedPart(
|
||||
ActionType.updateChapter, oldChap.id, oldChap.toJson(), false);
|
||||
if (!hasChanged) {
|
||||
ref.read(synchingProvider(syncId: 1).notifier).addChangedPart(
|
||||
ActionType.updateItem, manga.id, manga.toJson(), false);
|
||||
ref.read(synchingProvider(syncId: 1).notifier).addChangedPart(
|
||||
ActionType.updateChapter, oldChap.id, oldChap.toJson(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ part of 'update_manga_detail_providers.dart';
|
|||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$updateMangaDetailHash() => r'ebd820d3e9d1900c464aebfbf711f43f6619e586';
|
||||
String _$updateMangaDetailHash() => r'4aed7678d299321491de442c592968df22b62f48';
|
||||
|
||||
/// Copied from Dart SDK
|
||||
class _SystemHash {
|
||||
|
|
|
|||
|
|
@ -540,7 +540,8 @@ class SyncScreen extends ConsumerWidget {
|
|||
changedParts.getChangedParts([
|
||||
ActionType.addHistory,
|
||||
ActionType.clearHistory,
|
||||
ActionType.removeHistory
|
||||
ActionType.removeHistory,
|
||||
ActionType.updateHistory,
|
||||
])),
|
||||
const SizedBox(height: 15),
|
||||
buildChangedItemWidget(
|
||||
|
|
@ -552,6 +553,7 @@ class SyncScreen extends ConsumerWidget {
|
|||
l10n.sync_pending_extension,
|
||||
changedParts.getChangedParts([
|
||||
ActionType.addExtension,
|
||||
ActionType.clearExtension,
|
||||
ActionType.removeExtension,
|
||||
ActionType.updateExtension
|
||||
])),
|
||||
|
|
|
|||
Loading…
Reference in a new issue