This commit is contained in:
Schnitzel5 2025-08-07 00:34:08 +02:00
parent e565d14ef3
commit d0974a1da6
19 changed files with 351 additions and 16 deletions

View file

@ -515,5 +515,8 @@
"calendar_no_data": "No data yet.",
"calendar_info": "The calendar is only able to predict the next chapter upload based on the older uploads. Some data might not be 100% accurate!",
"in_n_day": "in {days} day",
"in_n_days": "in {days} days"
"in_n_days": "in {days} days",
"clear_library": "Clear library",
"clear_library_desc": "Choose to clear all manga, anime and/or novel entries",
"clear_library_input": "Type 'manga', 'anime' and/or 'novel' (separated by a comma) to remove all related entries"
}

View file

@ -3170,6 +3170,24 @@ abstract class AppLocalizations {
/// In en, this message translates to:
/// **'in {days} days'**
String in_n_days(Object days);
/// No description provided for @clear_library.
///
/// In en, this message translates to:
/// **'Clear library'**
String get clear_library;
/// No description provided for @clear_library_desc.
///
/// In en, this message translates to:
/// **'Choose to clear all manga, anime and/or novel entries'**
String get clear_library_desc;
/// No description provided for @clear_library_input.
///
/// In en, this message translates to:
/// **'Type \'manga\', \'anime\' and/or \'novel\' (separated by a comma) to remove all related entries'**
String get clear_library_input;
}
class _AppLocalizationsDelegate

View file

@ -1637,4 +1637,15 @@ class AppLocalizationsAr extends AppLocalizations {
String in_n_days(Object days) {
return 'in $days days';
}
@override
String get clear_library => 'Clear library';
@override
String get clear_library_desc =>
'Choose to clear all manga, anime and/or novel entries';
@override
String get clear_library_input =>
'Type \'manga\', \'anime\' and/or \'novel\' (separated by a comma) to remove all related entries';
}

View file

@ -1639,4 +1639,15 @@ class AppLocalizationsAs extends AppLocalizations {
String in_n_days(Object days) {
return 'in $days days';
}
@override
String get clear_library => 'Clear library';
@override
String get clear_library_desc =>
'Choose to clear all manga, anime and/or novel entries';
@override
String get clear_library_input =>
'Type \'manga\', \'anime\' and/or \'novel\' (separated by a comma) to remove all related entries';
}

View file

@ -1650,4 +1650,15 @@ class AppLocalizationsDe extends AppLocalizations {
String in_n_days(Object days) {
return 'in $days days';
}
@override
String get clear_library => 'Clear library';
@override
String get clear_library_desc =>
'Choose to clear all manga, anime and/or novel entries';
@override
String get clear_library_input =>
'Type \'manga\', \'anime\' and/or \'novel\' (separated by a comma) to remove all related entries';
}

View file

@ -1638,4 +1638,15 @@ class AppLocalizationsEn extends AppLocalizations {
String in_n_days(Object days) {
return 'in $days days';
}
@override
String get clear_library => 'Clear library';
@override
String get clear_library_desc =>
'Choose to clear all manga, anime and/or novel entries';
@override
String get clear_library_input =>
'Type \'manga\', \'anime\' and/or \'novel\' (separated by a comma) to remove all related entries';
}

View file

@ -1655,6 +1655,17 @@ class AppLocalizationsEs extends AppLocalizations {
String in_n_days(Object days) {
return 'in $days days';
}
@override
String get clear_library => 'Clear library';
@override
String get clear_library_desc =>
'Choose to clear all manga, anime and/or novel entries';
@override
String get clear_library_input =>
'Type \'manga\', \'anime\' and/or \'novel\' (separated by a comma) to remove all related entries';
}
/// The translations for Spanish Castilian, as used in Latin America and the Caribbean (`es_419`).

View file

@ -1656,4 +1656,15 @@ class AppLocalizationsFr extends AppLocalizations {
String in_n_days(Object days) {
return 'in $days days';
}
@override
String get clear_library => 'Clear library';
@override
String get clear_library_desc =>
'Choose to clear all manga, anime and/or novel entries';
@override
String get clear_library_input =>
'Type \'manga\', \'anime\' and/or \'novel\' (separated by a comma) to remove all related entries';
}

View file

@ -1640,4 +1640,15 @@ class AppLocalizationsHi extends AppLocalizations {
String in_n_days(Object days) {
return 'in $days days';
}
@override
String get clear_library => 'Clear library';
@override
String get clear_library_desc =>
'Choose to clear all manga, anime and/or novel entries';
@override
String get clear_library_input =>
'Type \'manga\', \'anime\' and/or \'novel\' (separated by a comma) to remove all related entries';
}

View file

@ -1644,4 +1644,15 @@ class AppLocalizationsId extends AppLocalizations {
String in_n_days(Object days) {
return 'in $days days';
}
@override
String get clear_library => 'Clear library';
@override
String get clear_library_desc =>
'Choose to clear all manga, anime and/or novel entries';
@override
String get clear_library_input =>
'Type \'manga\', \'anime\' and/or \'novel\' (separated by a comma) to remove all related entries';
}

View file

@ -1653,4 +1653,15 @@ class AppLocalizationsIt extends AppLocalizations {
String in_n_days(Object days) {
return 'in $days days';
}
@override
String get clear_library => 'Clear library';
@override
String get clear_library_desc =>
'Choose to clear all manga, anime and/or novel entries';
@override
String get clear_library_input =>
'Type \'manga\', \'anime\' and/or \'novel\' (separated by a comma) to remove all related entries';
}

View file

@ -1652,6 +1652,17 @@ class AppLocalizationsPt extends AppLocalizations {
String in_n_days(Object days) {
return 'in $days days';
}
@override
String get clear_library => 'Clear library';
@override
String get clear_library_desc =>
'Choose to clear all manga, anime and/or novel entries';
@override
String get clear_library_input =>
'Type \'manga\', \'anime\' and/or \'novel\' (separated by a comma) to remove all related entries';
}
/// The translations for Portuguese, as used in Brazil (`pt_BR`).

View file

@ -1654,4 +1654,15 @@ class AppLocalizationsRu extends AppLocalizations {
String in_n_days(Object days) {
return 'in $days days';
}
@override
String get clear_library => 'Clear library';
@override
String get clear_library_desc =>
'Choose to clear all manga, anime and/or novel entries';
@override
String get clear_library_input =>
'Type \'manga\', \'anime\' and/or \'novel\' (separated by a comma) to remove all related entries';
}

View file

@ -1638,4 +1638,15 @@ class AppLocalizationsTh extends AppLocalizations {
String in_n_days(Object days) {
return 'in $days days';
}
@override
String get clear_library => 'Clear library';
@override
String get clear_library_desc =>
'Choose to clear all manga, anime and/or novel entries';
@override
String get clear_library_input =>
'Type \'manga\', \'anime\' and/or \'novel\' (separated by a comma) to remove all related entries';
}

View file

@ -1644,4 +1644,15 @@ class AppLocalizationsTr extends AppLocalizations {
String in_n_days(Object days) {
return 'in $days days';
}
@override
String get clear_library => 'Clear library';
@override
String get clear_library_desc =>
'Choose to clear all manga, anime and/or novel entries';
@override
String get clear_library_input =>
'Type \'manga\', \'anime\' and/or \'novel\' (separated by a comma) to remove all related entries';
}

View file

@ -1609,4 +1609,15 @@ class AppLocalizationsZh extends AppLocalizations {
String in_n_days(Object days) {
return 'in $days days';
}
@override
String get clear_library => 'Clear library';
@override
String get clear_library_desc =>
'Choose to clear all manga, anime and/or novel entries';
@override
String get clear_library_input =>
'Type \'manga\', \'anime\' and/or \'novel\' (separated by a comma) to remove all related entries';
}

View file

@ -77,12 +77,15 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
color: context.secondaryColor,
),
const SizedBox(width: 10),
Text(
l10n.calendar_info,
softWrap: true,
style: TextStyle(
fontSize: 13,
color: context.secondaryColor,
Flexible(
child: Text(
l10n.calendar_info,
softWrap: true,
overflow: TextOverflow.clip,
style: TextStyle(
fontSize: 13,
color: context.secondaryColor,
),
),
),
],
@ -155,7 +158,9 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
startingDayOfWeek: StartingDayOfWeek.monday,
calendarStyle: CalendarStyle(
outsideDaysVisible: true,
weekendTextStyle: TextStyle(color: context.primaryColor),
weekendTextStyle: TextStyle(
color: context.primaryColor,
),
),
onDaySelected: (selectedDay, focusedDay) =>
_onDaySelected(selectedDay, focusedDay, data),

View file

@ -10,6 +10,7 @@ import 'package:mangayomi/models/history.dart';
import 'package:mangayomi/models/manga.dart';
import 'package:mangayomi/models/source.dart';
import 'package:mangayomi/models/update.dart';
import 'package:mangayomi/modules/more/settings/player/custom_button_screen.dart';
import 'package:mangayomi/modules/more/settings/sync/providers/sync_providers.dart';
import 'package:mangayomi/providers/l10n_providers.dart';
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
@ -146,6 +147,17 @@ class BrowseSScreen extends ConsumerWidget {
),
),
),
ListTile(
onTap: () => _showClearLibraryDialog(context, ref),
title: Text(l10n.clear_library),
subtitle: Text(
l10n.clear_library_desc,
style: TextStyle(
fontSize: 11,
color: context.secondaryColor,
),
),
),
if (checkForExtensionUpdates)
SwitchListTile(
value: autoUpdateExtensions,
@ -332,3 +344,146 @@ void _showCleanNonLibraryDialog(BuildContext context, dynamic l10n) {
},
);
}
void _showClearLibraryDialog(BuildContext context, WidgetRef ref) {
final itemTypes = ItemType.values.map((e) => e.name).toList();
bool isInputError = true;
final textController = TextEditingController();
showDialog(
context: context,
builder: (context) {
return StatefulBuilder(
builder: (context, setState) {
return AlertDialog(
title: Column(
children: [
Text(context.l10n.clear_library),
Text(
context.l10n.clear_library_input,
style: TextStyle(fontSize: 11, color: context.secondaryColor),
),
],
),
content: SizedBox(
width: context.width(0.8),
child: CustomTextFormField(
controller: textController,
context: context,
isMissing: isInputError,
val: (text) => setState(() {
isInputError =
text.trim().isEmpty ||
text.split(",").any((e) => !itemTypes.contains(e));
}),
missing: (_) {},
),
),
actions: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: Text(
context.l10n.cancel,
style: TextStyle(color: context.primaryColor),
),
),
TextButton(
onPressed: isInputError
? null
: () {
final mangasList = isar.mangas
.filter()
.anyOf(
textController.text
.split(",")
.map(
(e) => switch (e) {
"manga" => ItemType.manga,
"anime" => ItemType.anime,
"novel" => ItemType.novel,
_ => null,
},
),
(q, element) => element == null
? q.idIsNull()
: q.itemTypeEqualTo(element),
)
.findAllSync();
final provider = ref.read(
synchingProvider(syncId: 1).notifier,
);
isar.writeTxnSync(() {
for (var manga in mangasList) {
final histories = isar.historys
.filter()
.mangaIdEqualTo(manga.id)
.findAllSync();
for (var history in histories) {
isar.historys.deleteSync(history.id!);
provider.addChangedPart(
ActionType.removeHistory,
history.id,
"{}",
false,
);
}
for (var chapter in manga.chapters) {
final updates = isar.updates
.filter()
.mangaIdEqualTo(chapter.mangaId)
.chapterNameEqualTo(chapter.name)
.findAllSync();
for (var update in updates) {
isar.updates.deleteSync(update.id!);
provider.addChangedPart(
ActionType.removeUpdate,
update.id,
"{}",
false,
);
}
isar.chapters.deleteSync(chapter.id!);
provider.addChangedPart(
ActionType.removeChapter,
chapter.id,
"{}",
false,
);
}
isar.mangas.deleteSync(manga.id!);
provider.addChangedPart(
ActionType.removeItem,
manga.id,
"{}",
false,
);
}
});
botToast(
context.l10n.cleaned_database(mangasList.length),
);
Navigator.pop(context);
},
child: Text(
context.l10n.ok,
style: TextStyle(
color: isInputError
? context.secondaryColor
: context.primaryColor,
),
),
),
],
),
],
);
},
);
},
);
}

View file

@ -1164,7 +1164,7 @@ packages:
description:
path: media_kit
ref: HEAD
resolved-ref: d0e86e0177c4da3786c72a396259be530e4a6354
resolved-ref: "085be0ec40a95f351b2f3c11c0ff017d4e0a1498"
url: "https://github.com/Schnitzel5/media-kit.git"
source: git
version: "1.2.0"
@ -1173,7 +1173,7 @@ packages:
description:
path: "libs/android/media_kit_libs_android_video"
ref: HEAD
resolved-ref: d0e86e0177c4da3786c72a396259be530e4a6354
resolved-ref: "085be0ec40a95f351b2f3c11c0ff017d4e0a1498"
url: "https://github.com/Schnitzel5/media-kit.git"
source: git
version: "1.3.7"
@ -1182,7 +1182,7 @@ packages:
description:
path: "libs/ios/media_kit_libs_ios_video"
ref: HEAD
resolved-ref: d0e86e0177c4da3786c72a396259be530e4a6354
resolved-ref: "085be0ec40a95f351b2f3c11c0ff017d4e0a1498"
url: "https://github.com/Schnitzel5/media-kit.git"
source: git
version: "1.1.4"
@ -1191,7 +1191,7 @@ packages:
description:
path: "libs/linux/media_kit_libs_linux"
ref: HEAD
resolved-ref: d0e86e0177c4da3786c72a396259be530e4a6354
resolved-ref: "085be0ec40a95f351b2f3c11c0ff017d4e0a1498"
url: "https://github.com/Schnitzel5/media-kit.git"
source: git
version: "1.2.1"
@ -1200,7 +1200,7 @@ packages:
description:
path: "libs/macos/media_kit_libs_macos_video"
ref: HEAD
resolved-ref: d0e86e0177c4da3786c72a396259be530e4a6354
resolved-ref: "085be0ec40a95f351b2f3c11c0ff017d4e0a1498"
url: "https://github.com/Schnitzel5/media-kit.git"
source: git
version: "1.1.4"
@ -1209,7 +1209,7 @@ packages:
description:
path: "libs/universal/media_kit_libs_video"
ref: HEAD
resolved-ref: d0e86e0177c4da3786c72a396259be530e4a6354
resolved-ref: "085be0ec40a95f351b2f3c11c0ff017d4e0a1498"
url: "https://github.com/Schnitzel5/media-kit.git"
source: git
version: "1.0.6"
@ -1218,7 +1218,7 @@ packages:
description:
path: "libs/windows/media_kit_libs_windows_video"
ref: HEAD
resolved-ref: d0e86e0177c4da3786c72a396259be530e4a6354
resolved-ref: "085be0ec40a95f351b2f3c11c0ff017d4e0a1498"
url: "https://github.com/Schnitzel5/media-kit.git"
source: git
version: "1.0.11"
@ -1227,7 +1227,7 @@ packages:
description:
path: media_kit_video
ref: HEAD
resolved-ref: d0e86e0177c4da3786c72a396259be530e4a6354
resolved-ref: "085be0ec40a95f351b2f3c11c0ff017d4e0a1498"
url: "https://github.com/Schnitzel5/media-kit.git"
source: git
version: "1.3.0"