mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-03-11 17:25:32 +00:00
feat: Added button for download next n chapters
This commit is contained in:
parent
bdf6ce6a9b
commit
fc2e80f31e
14 changed files with 173 additions and 25 deletions
|
|
@ -283,5 +283,9 @@
|
|||
"aniskip_button_timeout": "مهلة زر",
|
||||
"fullscreen": "شاشة كاملة",
|
||||
"update_library": "تحديث المكتبة",
|
||||
"updating_library": "جاري تحديث المكتبة"
|
||||
"updating_library": "جاري تحديث المكتبة",
|
||||
"next_chapter": "الفصل التالي",
|
||||
"next_5_chapters": "الفصول الخمسة التالية",
|
||||
"next_10_chapters": "الفصول العشرة التالية",
|
||||
"next_25_chapters": "الفصول الخمسة والعشرون التالية"
|
||||
}
|
||||
|
|
@ -283,5 +283,9 @@
|
|||
"aniskip_button_timeout": "Timeout für Taste",
|
||||
"fullscreen": "Vollbild",
|
||||
"update_library": "Bibliothek aktualisieren",
|
||||
"updating_library": "Bibliothek wird aktualisiert"
|
||||
"updating_library": "Bibliothek wird aktualisiert",
|
||||
"next_chapter": "Nächstes Kapitel",
|
||||
"next_5_chapters": "Nächsten 5 Kapitel",
|
||||
"next_10_chapters": "Nächsten 10 Kapitel",
|
||||
"next_25_chapters": "Nächsten 25 Kapitel"
|
||||
}
|
||||
|
|
@ -285,5 +285,9 @@
|
|||
"skip_ending": "Skip ending",
|
||||
"fullscreen": "Fullscreen",
|
||||
"update_library": "Update library",
|
||||
"updating_library": "Updating library"
|
||||
"updating_library": "Updating library",
|
||||
"next_chapter": "Next chapter",
|
||||
"next_5_chapters": "Next 5 chapters",
|
||||
"next_10_chapters": "Next 10 chapters",
|
||||
"next_25_chapters": "Next 25 chapters"
|
||||
}
|
||||
|
|
@ -283,5 +283,9 @@
|
|||
"aniskip_button_timeout": "Tiempo de espera del botón",
|
||||
"fullscreen": "Pantalla completa",
|
||||
"update_library": "Actualizar biblioteca",
|
||||
"updating_library": "Actualizando biblioteca"
|
||||
"updating_library": "Actualizando biblioteca",
|
||||
"next_chapter": "Próximo capítulo",
|
||||
"next_5_chapters": "Próximos 5 capítulos",
|
||||
"next_10_chapters": "Próximos 10 capítulos",
|
||||
"next_25_chapters": "Próximos 25 capítulos"
|
||||
}
|
||||
|
|
@ -283,5 +283,9 @@
|
|||
"aniskip_button_timeout": "Tiempo de espera del botón",
|
||||
"fullscreen": "Pantalla completa",
|
||||
"update_library": "Actualizar biblioteca",
|
||||
"updating_library": "Actualizando biblioteca"
|
||||
"updating_library": "Actualizando biblioteca",
|
||||
"next_chapter": "Siguiente capítulo",
|
||||
"next_5_chapters": "Siguientes 5 capítulos",
|
||||
"next_10_chapters": "Siguientes 10 capítulos",
|
||||
"next_25_chapters": "Siguientes 25 capítulos"
|
||||
}
|
||||
|
|
@ -284,5 +284,9 @@
|
|||
"skip_opening": "Passer l'opening",
|
||||
"skip_ending": "Passer l'ending",
|
||||
"update_library": "Mettre à jour la bibliothèque",
|
||||
"updating_library": "Mise à jour de la bibliothèque"
|
||||
"updating_library": "Mise à jour de la bibliothèque",
|
||||
"next_chapter": "Chapitre suivant",
|
||||
"next_5_chapters": "5 chapitres suivants",
|
||||
"next_10_chapters": "10 chapitres suivants",
|
||||
"next_25_chapters": "25 chapitres suivants"
|
||||
}
|
||||
|
|
@ -283,5 +283,9 @@
|
|||
"aniskip_button_timeout": "Timeout tombol",
|
||||
"fullscreen": "Layar Penuh",
|
||||
"update_library": "Perbarui perpustakaan",
|
||||
"updating_library": "Memperbarui perpustakaan"
|
||||
"updating_library": "Memperbarui perpustakaan",
|
||||
"next_chapter": "Berikutnya bab",
|
||||
"next_5_chapters": "5 bab berikutnya",
|
||||
"next_10_chapters": "10 bab berikutnya",
|
||||
"next_25_chapters": "25 bab berikutnya"
|
||||
}
|
||||
|
|
@ -283,5 +283,9 @@
|
|||
"aniskip_button_timeout": "Timeout del pulsante",
|
||||
"fullscreen": "Schermo intero",
|
||||
"update_library": "Aggiorna libreria",
|
||||
"updating_library": "Aggiornamento della libreria"
|
||||
"updating_library": "Aggiornamento della libreria",
|
||||
"next_chapter": "Capitolo successivo",
|
||||
"next_5_chapters": "Prossimi 5 capitoli",
|
||||
"next_10_chapters": "Prossimi 10 capitoli",
|
||||
"next_25_chapters": "Prossimi 25 capitoli"
|
||||
}
|
||||
|
|
@ -283,5 +283,9 @@
|
|||
"aniskip_button_timeout": "Tempo limite do botão",
|
||||
"fullscreen": "Tela cheia",
|
||||
"update_library": "Atualizar biblioteca",
|
||||
"updating_library": "Atualizando biblioteca"
|
||||
"updating_library": "Atualizando biblioteca",
|
||||
"next_chapter": "Próximo capítulo",
|
||||
"next_5_chapters": "Próximos 5 capítulos",
|
||||
"next_10_chapters": "Próximos 10 capítulos",
|
||||
"next_25_chapters": "Próximos 25 capítulos"
|
||||
}
|
||||
|
|
@ -283,5 +283,9 @@
|
|||
"aniskip_button_timeout": "Timeout do botão",
|
||||
"fullscreen": "Tela cheia",
|
||||
"update_library": "Atualizar biblioteca",
|
||||
"updating_library": "Atualizando biblioteca"
|
||||
"updating_library": "Atualizando biblioteca",
|
||||
"next_chapter": "Próximo capítulo",
|
||||
"next_5_chapters": "Próximos 5 capítulos",
|
||||
"next_10_chapters": "Próximos 10 capítulos",
|
||||
"next_25_chapters": "Próximos 25 capítulos"
|
||||
}
|
||||
|
|
@ -283,5 +283,9 @@
|
|||
"aniskip_button_timeout": "Тайм-аут кнопки",
|
||||
"fullscreen": "Полноэкранный режим",
|
||||
"update_library": "Обновить библиотеку",
|
||||
"updating_library": "Обновление библиотеки"
|
||||
"updating_library": "Обновление библиотеки",
|
||||
"next_chapter": "Следующая глава",
|
||||
"next_5_chapters": "Следующие 5 глав",
|
||||
"next_10_chapters": "Следующие 10 глав",
|
||||
"next_25_chapters": "Следующие 25 глав"
|
||||
}
|
||||
|
|
@ -283,5 +283,9 @@
|
|||
"aniskip_button_timeout": "Düğme Zaman Aşımı",
|
||||
"fullscreen": "Tam ekran",
|
||||
"update_library": "Kütüphaneyi güncelle",
|
||||
"updating_library": "Kütüphaneyi güncelleme"
|
||||
"updating_library": "Kütüphaneyi güncelleme",
|
||||
"next_chapter": "Sonraki bölüm",
|
||||
"next_5_chapters": "Sonraki 5 bölüm",
|
||||
"next_10_chapters": "Sonraki 10 bölüm",
|
||||
"next_25_chapters": "Sonraki 25 bölüm"
|
||||
}
|
||||
|
|
@ -285,5 +285,9 @@
|
|||
"skip_ending": "跳过结尾",
|
||||
"fullscreen": "全屏",
|
||||
"update_library": "更新库",
|
||||
"updating_library": "正在更新库"
|
||||
"updating_library": "正在更新库",
|
||||
"next_chapter": "下一章",
|
||||
"next_5_chapters": "下5章",
|
||||
"next_10_chapters": "下10章",
|
||||
"next_25_chapters": "下25章"
|
||||
}
|
||||
|
|
@ -361,15 +361,109 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
? Colors.transparent
|
||||
: Theme.of(context).scaffoldBackgroundColor,
|
||||
actions: [
|
||||
if (!isLocalArchive)
|
||||
IconButton(
|
||||
splashRadius: 20,
|
||||
onPressed: () {
|
||||
widget.checkForUpdate(true);
|
||||
if (!isLocalArchive) ...[
|
||||
PopupMenuButton(
|
||||
icon: const Icon(Icons.download_outlined),
|
||||
itemBuilder: (context) {
|
||||
return [
|
||||
PopupMenuItem<int>(
|
||||
value: 0,
|
||||
child: Text(
|
||||
context.l10n.next_chapter)),
|
||||
PopupMenuItem<int>(
|
||||
value: 1,
|
||||
child: Text(
|
||||
context.l10n.next_5_chapters)),
|
||||
PopupMenuItem<int>(
|
||||
value: 2,
|
||||
child: Text(
|
||||
context.l10n.next_10_chapters)),
|
||||
PopupMenuItem<int>(
|
||||
value: 3,
|
||||
child: Text(
|
||||
context.l10n.next_25_chapters)),
|
||||
PopupMenuItem<int>(
|
||||
value: 4,
|
||||
child: Text(context.l10n.unread)),
|
||||
];
|
||||
},
|
||||
icon: const Icon(
|
||||
Icons.refresh,
|
||||
)),
|
||||
onSelected: (value) {
|
||||
final chapters = isar.chapters
|
||||
.filter()
|
||||
.idIsNotNull()
|
||||
.mangaIdEqualTo(widget.manga!.id!)
|
||||
.findAllSync();
|
||||
if (value == 0 ||
|
||||
value == 1 ||
|
||||
value == 2 ||
|
||||
value == 3) {
|
||||
final lastChapterReadIndex =
|
||||
chapters.lastIndexWhere((element) =>
|
||||
element.isRead == true);
|
||||
if (lastChapterReadIndex == -1 ||
|
||||
chapters.length == 1) {
|
||||
final chapter = chapters.first;
|
||||
final entry = isar.downloads
|
||||
.filter()
|
||||
.idIsNotNull()
|
||||
.chapterIdEqualTo(chapter.id)
|
||||
.findFirstSync();
|
||||
if (entry == null ||
|
||||
!entry.isDownload!) {
|
||||
ref.watch(downloadChapterProvider(
|
||||
chapter: chapter));
|
||||
}
|
||||
} else {
|
||||
final length = switch (value) {
|
||||
0 => 1,
|
||||
1 => 5,
|
||||
2 => 10,
|
||||
_ => 25,
|
||||
};
|
||||
for (var i = 1; i < length + 1; i++) {
|
||||
if (chapters.length > 1 &&
|
||||
chapters.elementAtOrNull(
|
||||
lastChapterReadIndex +
|
||||
i) !=
|
||||
null) {
|
||||
final chapter = chapters[
|
||||
lastChapterReadIndex + i];
|
||||
final entry = isar.downloads
|
||||
.filter()
|
||||
.idIsNotNull()
|
||||
.chapterIdEqualTo(chapter.id)
|
||||
.findFirstSync();
|
||||
if (entry == null ||
|
||||
!entry.isDownload!) {
|
||||
ref.watch(
|
||||
downloadChapterProvider(
|
||||
chapter: chapter));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (value == 4) {
|
||||
final unreadChapters = isar.chapters
|
||||
.filter()
|
||||
.idIsNotNull()
|
||||
.mangaIdEqualTo(widget.manga!.id!)
|
||||
.isReadEqualTo(false)
|
||||
.findAllSync();
|
||||
for (var chapter in unreadChapters) {
|
||||
final entry = isar.downloads
|
||||
.filter()
|
||||
.idIsNotNull()
|
||||
.chapterIdEqualTo(chapter.id)
|
||||
.findFirstSync();
|
||||
if (entry == null ||
|
||||
!entry.isDownload!) {
|
||||
ref.watch(downloadChapterProvider(
|
||||
chapter: chapter));
|
||||
}
|
||||
}
|
||||
}
|
||||
}),
|
||||
],
|
||||
IconButton(
|
||||
splashRadius: 20,
|
||||
onPressed: () {
|
||||
|
|
@ -382,19 +476,21 @@ class _MangaDetailViewState extends ConsumerState<MangaDetailView>
|
|||
)),
|
||||
PopupMenuButton(itemBuilder: (context) {
|
||||
return [
|
||||
if (!isLocalArchive)
|
||||
PopupMenuItem<int>(
|
||||
value: 3, child: Text(l10n.refresh)),
|
||||
if (widget.manga!.favorite!)
|
||||
PopupMenuItem<int>(
|
||||
value: 0,
|
||||
child: Text(l10n.edit_categories)),
|
||||
// if (!isLocalArchive)
|
||||
// if (widget.manga!.favorite!)
|
||||
// PopupMenuItem<int>(
|
||||
// value: 1, child: Text(l10n.migrate)),
|
||||
if (!isLocalArchive)
|
||||
PopupMenuItem<int>(
|
||||
value: 2, child: Text(l10n.share)),
|
||||
];
|
||||
}, onSelected: (value) {
|
||||
if (value == 3) {
|
||||
widget.checkForUpdate(true);
|
||||
}
|
||||
if (value == 0) {
|
||||
context.push("/categories", extra: (
|
||||
true,
|
||||
|
|
|
|||
Loading…
Reference in a new issue