mirror of
https://github.com/kodjodevf/mangayomi.git
synced 2026-04-20 23:22:07 +00:00
added progress for updating the library
This commit is contained in:
parent
58ec9895eb
commit
d4e768f6f7
30 changed files with 101 additions and 42 deletions
|
|
@ -810,7 +810,7 @@ final List<String> _dateFormats = [
|
|||
"MMM dd,yyyy",
|
||||
];
|
||||
|
||||
void botToast(
|
||||
void Function() botToast(
|
||||
String title, {
|
||||
int second = 10,
|
||||
double? fontSize,
|
||||
|
|
@ -818,19 +818,22 @@ void botToast(
|
|||
double alignY = 0.99,
|
||||
bool hasCloudFlare = false,
|
||||
String? url,
|
||||
int animationDuration = 200,
|
||||
List<DismissDirection> dismissDirections = const [DismissDirection.horizontal, DismissDirection.down],
|
||||
bool onlyOne = true,
|
||||
}) {
|
||||
final context = navigatorKey.currentState?.context;
|
||||
final assets = [
|
||||
'assets/app_icons/icon-black.png',
|
||||
'assets/app_icons/icon-red.png',
|
||||
];
|
||||
BotToast.showNotification(
|
||||
onlyOne: true,
|
||||
dismissDirections: [DismissDirection.horizontal, DismissDirection.down],
|
||||
return BotToast.showNotification(
|
||||
onlyOne: onlyOne,
|
||||
dismissDirections: dismissDirections,
|
||||
align: Alignment(alignX, alignY),
|
||||
duration: Duration(seconds: second),
|
||||
animationDuration: const Duration(milliseconds: 200),
|
||||
animationReverseDuration: const Duration(milliseconds: 200),
|
||||
animationDuration: Duration(milliseconds: animationDuration),
|
||||
animationReverseDuration: Duration(milliseconds: animationDuration),
|
||||
leading: (_) => Image.asset((assets..shuffle()).first, height: 25),
|
||||
title: (_) => Text(title, style: TextStyle(fontSize: fontSize)),
|
||||
trailing:
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@
|
|||
"aniskip_button_timeout": "مهلة زر",
|
||||
"fullscreen": "شاشة كاملة",
|
||||
"update_library": "تحديث المكتبة",
|
||||
"updating_library": "جاري تحديث المكتبة",
|
||||
"updating_library": "جاري تحديث المكتبة ({max} / {cur}) - فشل: {failed}",
|
||||
"next_chapter": "الفصل التالي",
|
||||
"next_5_chapters": "الفصول الخمسة التالية",
|
||||
"next_10_chapters": "الفصول العشرة التالية",
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@
|
|||
"skip_ending": "Ending überspringen",
|
||||
"fullscreen": "Vollbild",
|
||||
"update_library": "Bibliothek aktualisieren",
|
||||
"updating_library": "Bibliothek wird aktualisiert",
|
||||
"updating_library": "Bibliothek wird aktualisiert ({cur} / {max}) - Fehlgeschlagen: {failed}",
|
||||
"next_chapter": "Nächstes Kapitel",
|
||||
"next_5_chapters": "Nächsten 5 Kapitel",
|
||||
"next_10_chapters": "Nächsten 10 Kapitel",
|
||||
|
|
|
|||
|
|
@ -365,7 +365,7 @@
|
|||
"skip_ending": "Skip ending",
|
||||
"fullscreen": "Fullscreen",
|
||||
"update_library": "Update library",
|
||||
"updating_library": "Updating library",
|
||||
"updating_library": "Updating library ({cur} / {max}) - Failed: {failed}",
|
||||
"next_chapter": "Next chapter",
|
||||
"next_5_chapters": "Next 5 chapters",
|
||||
"next_10_chapters": "Next 10 chapters",
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@
|
|||
"aniskip_button_timeout": "Tiempo de espera del botón",
|
||||
"fullscreen": "Pantalla completa",
|
||||
"update_library": "Actualizar biblioteca",
|
||||
"updating_library": "Actualizando biblioteca",
|
||||
"updating_library": "Actualizando biblioteca ({cur} / {max}) - Fallido: {failed}",
|
||||
"next_chapter": "Próximo capítulo",
|
||||
"next_5_chapters": "Próximos 5 capítulos",
|
||||
"next_10_chapters": "Próximos 10 capítulos",
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@
|
|||
"aniskip_button_timeout": "Tiempo de espera del botón",
|
||||
"fullscreen": "Pantalla completa",
|
||||
"update_library": "Actualizar biblioteca",
|
||||
"updating_library": "Actualizando biblioteca",
|
||||
"updating_library": "Actualizando biblioteca ({cur} / {max}) - Fallido: {failed}",
|
||||
"next_chapter": "Siguiente capítulo",
|
||||
"next_5_chapters": "Siguientes 5 capítulos",
|
||||
"next_10_chapters": "Siguientes 10 capítulos",
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@
|
|||
"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 ({cur} / {max}) - Échec: {failed}",
|
||||
"next_chapter": "Chapitre suivant",
|
||||
"next_5_chapters": "5 chapitres suivants",
|
||||
"next_10_chapters": "10 chapitres suivants",
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@
|
|||
"aniskip_button_timeout": "Timeout tombol",
|
||||
"fullscreen": "Layar Penuh",
|
||||
"update_library": "Perbarui perpustakaan",
|
||||
"updating_library": "Memperbarui perpustakaan",
|
||||
"updating_library": "Memperbarui perpustakaan ({cur} / {max}) - Gagal: {failed}",
|
||||
"next_chapter": "Berikutnya bab",
|
||||
"next_5_chapters": "5 bab berikutnya",
|
||||
"next_10_chapters": "10 bab berikutnya",
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@
|
|||
"aniskip_button_timeout": "Timeout del pulsante",
|
||||
"fullscreen": "Schermo intero",
|
||||
"update_library": "Aggiorna libreria",
|
||||
"updating_library": "Aggiornamento della libreria",
|
||||
"updating_library": "Aggiornamento della libreria ({cur} / {max}) - Fallito: {failed}",
|
||||
"next_chapter": "Capitolo successivo",
|
||||
"next_5_chapters": "Prossimi 5 capitoli",
|
||||
"next_10_chapters": "Prossimi 10 capitoli",
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@
|
|||
"aniskip_button_timeout": "Tempo limite do botão",
|
||||
"fullscreen": "Tela cheia",
|
||||
"update_library": "Atualizar biblioteca",
|
||||
"updating_library": "Atualizando biblioteca",
|
||||
"updating_library": "Atualizando biblioteca ({cur} / {max}) - Falha: {failed}",
|
||||
"next_chapter": "Próximo capítulo",
|
||||
"next_5_chapters": "Próximos 5 capítulos",
|
||||
"next_10_chapters": "Próximos 10 capítulos",
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@
|
|||
"aniskip_button_timeout": "Timeout do botão",
|
||||
"fullscreen": "Tela cheia",
|
||||
"update_library": "Atualizar biblioteca",
|
||||
"updating_library": "Atualizando biblioteca",
|
||||
"updating_library": "Atualizando biblioteca ({cur} / {max}) - Falha: {failed}",
|
||||
"next_chapter": "Próximo capítulo",
|
||||
"next_5_chapters": "Próximos 5 capítulos",
|
||||
"next_10_chapters": "Próximos 10 capítulos",
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@
|
|||
"aniskip_button_timeout": "Тайм-аут кнопки",
|
||||
"fullscreen": "Полноэкранный режим",
|
||||
"update_library": "Обновить библиотеку",
|
||||
"updating_library": "Обновление библиотеки",
|
||||
"updating_library": "Обновление библиотеки ({cur} / {max}) - Не удалось: {failed}",
|
||||
"next_chapter": "Следующая глава",
|
||||
"next_5_chapters": "Следующие 5 глав",
|
||||
"next_10_chapters": "Следующие 10 глав",
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@
|
|||
"skip_ending": "ข้ามตอนจบ",
|
||||
"fullscreen": "เต็มจอ",
|
||||
"update_library": "อัพเดทชั้นหนังสือ",
|
||||
"updating_library": "กำลังอัพเดทชั้นหนังสือ",
|
||||
"updating_library": "กำลังอัพเดทชั้นหนังสือ ({cur} / {max}) - ล้มเหลว: {failed}",
|
||||
"next_chapter": "ตอนถัดไป",
|
||||
"next_5_chapters": "5 ตอนถัดไป",
|
||||
"next_10_chapters": "10 ตอนถัดไป",
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@
|
|||
"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 ({cur} / {max}) - Başarısız: {failed}",
|
||||
"next_chapter": "Sonraki bölüm",
|
||||
"next_5_chapters": "Sonraki 5 bölüm",
|
||||
"next_10_chapters": "Sonraki 10 bölüm",
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@
|
|||
"skip_ending": "跳过结尾",
|
||||
"fullscreen": "全屏",
|
||||
"update_library": "更新库",
|
||||
"updating_library": "正在更新库",
|
||||
"updating_library": "正在更新库 ({cur} / {max}) - 失败: {failed}",
|
||||
"next_chapter": "下一章",
|
||||
"next_5_chapters": "下5章",
|
||||
"next_10_chapters": "下10章",
|
||||
|
|
|
|||
|
|
@ -2310,8 +2310,8 @@ abstract class AppLocalizations {
|
|||
/// No description provided for @updating_library.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Updating library'**
|
||||
String get updating_library;
|
||||
/// **'Updating library ({cur} / {max}) - Failed: {failed}'**
|
||||
String updating_library(Object cur, Object failed, Object max);
|
||||
|
||||
/// No description provided for @next_chapter.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -1136,7 +1136,9 @@ class AppLocalizationsAr extends AppLocalizations {
|
|||
String get update_library => 'تحديث المكتبة';
|
||||
|
||||
@override
|
||||
String get updating_library => 'جاري تحديث المكتبة';
|
||||
String updating_library(Object cur, Object failed, Object max) {
|
||||
return 'جاري تحديث المكتبة ($max / $cur) - فشل: $failed';
|
||||
}
|
||||
|
||||
@override
|
||||
String get next_chapter => 'الفصل التالي';
|
||||
|
|
|
|||
|
|
@ -1136,7 +1136,9 @@ class AppLocalizationsDe extends AppLocalizations {
|
|||
String get update_library => 'Bibliothek aktualisieren';
|
||||
|
||||
@override
|
||||
String get updating_library => 'Bibliothek wird aktualisiert';
|
||||
String updating_library(Object cur, Object failed, Object max) {
|
||||
return 'Bibliothek wird aktualisiert ($cur / $max) - Fehlgeschlagen: $failed';
|
||||
}
|
||||
|
||||
@override
|
||||
String get next_chapter => 'Nächstes Kapitel';
|
||||
|
|
|
|||
|
|
@ -1136,7 +1136,9 @@ class AppLocalizationsEn extends AppLocalizations {
|
|||
String get update_library => 'Update library';
|
||||
|
||||
@override
|
||||
String get updating_library => 'Updating library';
|
||||
String updating_library(Object cur, Object failed, Object max) {
|
||||
return 'Updating library ($cur / $max) - Failed: $failed';
|
||||
}
|
||||
|
||||
@override
|
||||
String get next_chapter => 'Next chapter';
|
||||
|
|
|
|||
|
|
@ -1136,7 +1136,9 @@ class AppLocalizationsEs extends AppLocalizations {
|
|||
String get update_library => 'Actualizar biblioteca';
|
||||
|
||||
@override
|
||||
String get updating_library => 'Actualizando biblioteca';
|
||||
String updating_library(Object cur, Object failed, Object max) {
|
||||
return 'Actualizando biblioteca ($cur / $max) - Fallido: $failed';
|
||||
}
|
||||
|
||||
@override
|
||||
String get next_chapter => 'Próximo capítulo';
|
||||
|
|
@ -2570,7 +2572,9 @@ class AppLocalizationsEs419 extends AppLocalizationsEs {
|
|||
String get update_library => 'Actualizar biblioteca';
|
||||
|
||||
@override
|
||||
String get updating_library => 'Actualizando biblioteca';
|
||||
String updating_library(Object cur, Object failed, Object max) {
|
||||
return 'Actualizando biblioteca ($cur / $max) - Fallido: $failed';
|
||||
}
|
||||
|
||||
@override
|
||||
String get next_chapter => 'Siguiente capítulo';
|
||||
|
|
|
|||
|
|
@ -1136,7 +1136,9 @@ class AppLocalizationsFr extends AppLocalizations {
|
|||
String get update_library => 'Mettre à jour la bibliothèque';
|
||||
|
||||
@override
|
||||
String get updating_library => 'Mise à jour de la bibliothèque';
|
||||
String updating_library(Object cur, Object failed, Object max) {
|
||||
return 'Mise à jour de la bibliothèque ($cur / $max) - Échec: $failed';
|
||||
}
|
||||
|
||||
@override
|
||||
String get next_chapter => 'Chapitre suivant';
|
||||
|
|
|
|||
|
|
@ -1136,7 +1136,9 @@ class AppLocalizationsId extends AppLocalizations {
|
|||
String get update_library => 'Perbarui perpustakaan';
|
||||
|
||||
@override
|
||||
String get updating_library => 'Memperbarui perpustakaan';
|
||||
String updating_library(Object cur, Object failed, Object max) {
|
||||
return 'Memperbarui perpustakaan ($cur / $max) - Gagal: $failed';
|
||||
}
|
||||
|
||||
@override
|
||||
String get next_chapter => 'Berikutnya bab';
|
||||
|
|
|
|||
|
|
@ -1136,7 +1136,9 @@ class AppLocalizationsIt extends AppLocalizations {
|
|||
String get update_library => 'Aggiorna libreria';
|
||||
|
||||
@override
|
||||
String get updating_library => 'Aggiornamento della libreria';
|
||||
String updating_library(Object cur, Object failed, Object max) {
|
||||
return 'Aggiornamento della libreria ($cur / $max) - Fallito: $failed';
|
||||
}
|
||||
|
||||
@override
|
||||
String get next_chapter => 'Capitolo successivo';
|
||||
|
|
|
|||
|
|
@ -1136,7 +1136,9 @@ class AppLocalizationsPt extends AppLocalizations {
|
|||
String get update_library => 'Atualizar biblioteca';
|
||||
|
||||
@override
|
||||
String get updating_library => 'Atualizando biblioteca';
|
||||
String updating_library(Object cur, Object failed, Object max) {
|
||||
return 'Atualizando biblioteca ($cur / $max) - Falha: $failed';
|
||||
}
|
||||
|
||||
@override
|
||||
String get next_chapter => 'Próximo capítulo';
|
||||
|
|
@ -2570,7 +2572,9 @@ class AppLocalizationsPtBr extends AppLocalizationsPt {
|
|||
String get update_library => 'Atualizar biblioteca';
|
||||
|
||||
@override
|
||||
String get updating_library => 'Atualizando biblioteca';
|
||||
String updating_library(Object cur, Object failed, Object max) {
|
||||
return 'Atualizando biblioteca ($cur / $max) - Falha: $failed';
|
||||
}
|
||||
|
||||
@override
|
||||
String get next_chapter => 'Próximo capítulo';
|
||||
|
|
|
|||
|
|
@ -1136,7 +1136,9 @@ class AppLocalizationsRu extends AppLocalizations {
|
|||
String get update_library => 'Обновить библиотеку';
|
||||
|
||||
@override
|
||||
String get updating_library => 'Обновление библиотеки';
|
||||
String updating_library(Object cur, Object failed, Object max) {
|
||||
return 'Обновление библиотеки ($cur / $max) - Не удалось: $failed';
|
||||
}
|
||||
|
||||
@override
|
||||
String get next_chapter => 'Следующая глава';
|
||||
|
|
|
|||
|
|
@ -1136,7 +1136,9 @@ class AppLocalizationsTh extends AppLocalizations {
|
|||
String get update_library => 'อัพเดทชั้นหนังสือ';
|
||||
|
||||
@override
|
||||
String get updating_library => 'กำลังอัพเดทชั้นหนังสือ';
|
||||
String updating_library(Object cur, Object failed, Object max) {
|
||||
return 'กำลังอัพเดทชั้นหนังสือ ($cur / $max) - ล้มเหลว: $failed';
|
||||
}
|
||||
|
||||
@override
|
||||
String get next_chapter => 'ตอนถัดไป';
|
||||
|
|
|
|||
|
|
@ -1136,7 +1136,9 @@ class AppLocalizationsTr extends AppLocalizations {
|
|||
String get update_library => 'Kütüphaneyi güncelle';
|
||||
|
||||
@override
|
||||
String get updating_library => 'Kütüphaneyi güncelleme';
|
||||
String updating_library(Object cur, Object failed, Object max) {
|
||||
return 'Kütüphaneyi güncelleme ($cur / $max) - Başarısız: $failed';
|
||||
}
|
||||
|
||||
@override
|
||||
String get next_chapter => 'Sonraki bölüm';
|
||||
|
|
|
|||
|
|
@ -1136,7 +1136,9 @@ class AppLocalizationsZh extends AppLocalizations {
|
|||
String get update_library => '更新库';
|
||||
|
||||
@override
|
||||
String get updating_library => '正在更新库';
|
||||
String updating_library(Object cur, Object failed, Object max) {
|
||||
return '正在更新库 ($cur / $max) - 失败: $failed';
|
||||
}
|
||||
|
||||
@override
|
||||
String get next_chapter => '下一章';
|
||||
|
|
|
|||
|
|
@ -73,19 +73,33 @@ class _LibraryScreenState extends ConsumerState<LibraryScreen>
|
|||
|
||||
Future<void> _updateLibrary(List<Manga> mangaList) async {
|
||||
botToast(
|
||||
context.l10n.updating_library,
|
||||
context.l10n.updating_library("0", "0", "0"),
|
||||
fontSize: 13,
|
||||
second: 1600,
|
||||
second: 30,
|
||||
alignY: !context.isTablet ? 0.85 : 1,
|
||||
);
|
||||
int numbers = 0;
|
||||
int failed = 0;
|
||||
for (var manga in mangaList) {
|
||||
try {
|
||||
await ref.read(
|
||||
updateMangaDetailProvider(mangaId: manga.id, isInit: false).future,
|
||||
);
|
||||
} catch (_) {}
|
||||
} catch (_) {
|
||||
failed++;
|
||||
}
|
||||
numbers++;
|
||||
if (context.mounted) {
|
||||
botToast(
|
||||
context.l10n.updating_library(numbers, failed, mangaList.length),
|
||||
fontSize: 13,
|
||||
second: 10,
|
||||
alignY: !context.isTablet ? 0.85 : 1,
|
||||
animationDuration: 0,
|
||||
dismissDirections: [DismissDirection.none],
|
||||
onlyOne: false
|
||||
);
|
||||
}
|
||||
}
|
||||
await Future.doWhile(() async {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
|
|
|
|||
|
|
@ -38,9 +38,9 @@ class _UpdatesScreenState extends ConsumerState<UpdatesScreen>
|
|||
_isLoading = true;
|
||||
});
|
||||
botToast(
|
||||
context.l10n.updating_library,
|
||||
context.l10n.updating_library("0", "0", "0"),
|
||||
fontSize: 13,
|
||||
second: 1600,
|
||||
second: 30,
|
||||
alignY: !context.isTablet ? 0.85 : 1,
|
||||
);
|
||||
final mangaList =
|
||||
|
|
@ -60,6 +60,7 @@ class _UpdatesScreenState extends ConsumerState<UpdatesScreen>
|
|||
.isLocalArchiveEqualTo(false)
|
||||
.findAllSync();
|
||||
int numbers = 0;
|
||||
int failed = 0;
|
||||
|
||||
for (var manga in mangaList) {
|
||||
try {
|
||||
|
|
@ -70,8 +71,21 @@ class _UpdatesScreenState extends ConsumerState<UpdatesScreen>
|
|||
showToast: false,
|
||||
).future,
|
||||
);
|
||||
} catch (_) {}
|
||||
} catch (_) {
|
||||
failed++;
|
||||
}
|
||||
numbers++;
|
||||
if (context.mounted) {
|
||||
botToast(
|
||||
context.l10n.updating_library(numbers, failed, mangaList.length),
|
||||
fontSize: 13,
|
||||
second: 10,
|
||||
alignY: !context.isTablet ? 0.85 : 1,
|
||||
animationDuration: 0,
|
||||
dismissDirections: [DismissDirection.none],
|
||||
onlyOne: false
|
||||
);
|
||||
}
|
||||
}
|
||||
await Future.doWhile(() async {
|
||||
await Future.delayed(const Duration(seconds: 1));
|
||||
|
|
|
|||
Loading…
Reference in a new issue