Add Switch to automatically check for updates

Instead of checking for updates by default, the user now has the choice to disable automatic app update checks.
This commit is contained in:
NBA2K1 2025-06-02 17:49:16 +02:00
parent 88899f6e00
commit 7eec89b1b9
34 changed files with 506 additions and 311 deletions

View file

@ -221,6 +221,7 @@
"check_for_extension_updates": "البحث عن تحديثات الامتداد",
"auto_extensions_updates": "تحديثات الامتداد التلقائية",
"auto_extensions_updates_subtitle": "سيتم تحديث الامتداد تلقائياً عند توفر إصدار جديد.",
"check_for_app_updates": "تحقق من تحديثات التطبيق عند بدء التشغيل",
"reading_mode": "وضع القراءة",
"custom_filter": "فلتر مخصص",
"background_color": "لون الخلفية",

View file

@ -296,6 +296,7 @@
"check_for_extension_updates": "Nach Erweiterungsupdates suchen",
"auto_extensions_updates": "Erweiterungen automatisch aktualisieren",
"auto_extensions_updates_subtitle": "Aktualisiert die Erweiterung automatisch, wenn eine neue Version verfügbar ist.",
"check_for_app_updates": "Beim Start nach App-Updates suchen",
"reading_mode": "Lesemodus",
"custom_filter": "Benutzerdefinierter Filter",
"background_color": "Hintergrundfarbe",

View file

@ -301,6 +301,7 @@
"check_for_extension_updates": "Check for extension updates",
"auto_extensions_updates": "Auto extension updates",
"auto_extensions_updates_subtitle": "Will automatically update the extension when a new version is available.",
"check_for_app_updates": "Check for app updates on startup",
"reading_mode": "Reading mode",
"custom_filter": "Custom filter",
"background_color": "Background color",

View file

@ -221,6 +221,7 @@
"check_for_extension_updates": "Buscar actualizaciones de extensión",
"auto_extensions_updates": "Actualizaciones automáticas de extensión",
"auto_extensions_updates_subtitle": "Actualizará automáticamente la extensión cuando haya una nueva versión disponible.",
"check_for_app_updates": "Buscar actualizaciones de la aplicación al iniciar",
"reading_mode": "Modo de lectura",
"custom_filter": "Filtro personalizado",
"background_color": "Color de fondo",

View file

@ -221,6 +221,7 @@
"check_for_extension_updates": "Buscar actualizaciones de extensión",
"auto_extensions_updates": "Actualizaciones automáticas de extensión",
"auto_extensions_updates_subtitle": "Actualizará automáticamente la extensión cuando haya una nueva versión disponible.",
"check_for_app_updates": "Buscar actualizaciones de la app al iniciar",
"reading_mode": "Modo de lectura",
"custom_filter": "Filtro personalizado",
"background_color": "Color de fondo",

View file

@ -221,6 +221,7 @@
"check_for_extension_updates": "Vérifier les mise à jour d'extensions",
"auto_extensions_updates": "Mises à jour auto des extensions",
"auto_extensions_updates_subtitle": "Mettra automatiquement à jour l'extension lorsqu'une nouvelle version est disponible.",
"check_for_app_updates": "Vérifier les mises à jour de l'application au démarrage",
"reading_mode": "Mode de lecture",
"custom_filter": "Filtre personnalisé",
"background_color": "Couleur de fond",

View file

@ -221,6 +221,7 @@
"check_for_extension_updates": "Periksa pembaruan ekstensi",
"auto_extensions_updates": "Pembaruan ekstensi otomatis",
"auto_extensions_updates_subtitle": "Akan secara otomatis memperbarui ekstensi ketika versi baru tersedia.",
"check_for_app_updates": "Periksa pembaruan aplikasi saat mulai",
"reading_mode": "Mode membaca",
"custom_filter": "Filter khusus",
"background_color": "Warna latar belakang",

View file

@ -221,6 +221,7 @@
"check_for_extension_updates": "Verifica aggiornamenti estensione",
"auto_extensions_updates": "Aggiornamenti automatici delle estensioni",
"auto_extensions_updates_subtitle": "Aggiorna automaticamente l'estensione quando è disponibile una nuova versione.",
"check_for_app_updates": "Controlla gli aggiornamenti dell'app all'avvio",
"reading_mode": "Modalità di lettura",
"custom_filter": "Filtro personalizzato",
"background_color": "Colore di sfondo",

View file

@ -221,6 +221,7 @@
"check_for_extension_updates": "Verificar atualizações de extensão",
"auto_extensions_updates": "Atualizações automáticas de extensões",
"auto_extensions_updates_subtitle": "Atualizará automaticamente a extensão quando uma nova versão estiver disponível.",
"check_for_app_updates": "Verificar atualizações da aplicação ao iniciar",
"reading_mode": "Modo de leitura",
"custom_filter": "Filtro personalizado",
"background_color": "Cor de fundo",

View file

@ -221,6 +221,7 @@
"check_for_extension_updates": "Verificar atualizações de extensões",
"auto_extensions_updates": "Atualizações automáticas de extensões",
"auto_extensions_updates_subtitle": "Atualizará automaticamente a extensão quando uma nova versão estiver disponível.",
"check_for_app_updates": "Verificar atualizações do app na inicialização",
"reading_mode": "Modo de leitura",
"custom_filter": "Filtro personalizado",
"background_color": "Cor de fundo",

View file

@ -221,6 +221,7 @@
"check_for_extension_updates": "Проверить обновления расширений",
"auto_extensions_updates": "Автоматические обновления расширений",
"auto_extensions_updates_subtitle": "Автоматически обновлять расширение при появлении новой версии.",
"check_for_app_updates": "Проверять обновления приложения при запуске",
"reading_mode": "Режим чтения",
"custom_filter": "Пользовательский фильтр",
"background_color": "Цвет фона",

View file

@ -224,6 +224,7 @@
"check_for_extension_updates": "ตรวจสอบการอัพเดทส่วนขยาย",
"auto_extensions_updates": "อัพเดทส่วนขยายอัตโนมัติ",
"auto_extensions_updates_subtitle": "จะทำการอัพเดทส่วนขยายเมื่อมีเวอร์ชั่นใหม่พร้อมใช้งานโดยอัตโนมัติ",
"check_for_app_updates": "ตรวจสอบการอัปเดตแอปเมื่อเริ่มต้น",
"reading_mode": "โหมดการอ่าน",
"custom_filter": "ตัวกรองที่กำหนดเอง",
"background_color": "สีพื้นหลัง",

View file

@ -221,6 +221,7 @@
"check_for_extension_updates": "Uzantı güncellemelerini kontrol et",
"auto_extensions_updates": "Otomatik Uzantı Güncellemeleri",
"auto_extensions_updates_subtitle": "Yeni bir sürümü mevcut olduğunda uzantıyı otomatik olarak günceller.",
"check_for_app_updates": "Uygulama başlatıldığında güncellemeleri kontrol et",
"reading_mode": "Okuma Modu",
"custom_filter": "Özel Filtre",
"background_color": "Arka Plan Rengi",

View file

@ -224,6 +224,7 @@
"check_for_extension_updates": "检查扩展更新",
"auto_extensions_updates": "自动扩展更新",
"auto_extensions_updates_subtitle": "当有新版本可用时,将自动更新扩展。",
"check_for_app_updates": "启动时检查应用更新",
"reading_mode": "阅读模式",
"custom_filter": "自定义筛选",
"background_color": "背景颜色",

View file

@ -1926,6 +1926,12 @@ abstract class AppLocalizations {
/// **'Will automatically update the extension when a new version is available.'**
String get auto_extensions_updates_subtitle;
/// No description provided for @check_for_app_updates.
///
/// In en, this message translates to:
/// **'Check for app updates on startup'**
String get check_for_app_updates;
/// No description provided for @reading_mode.
///
/// In en, this message translates to:

View file

@ -953,6 +953,9 @@ class AppLocalizationsAr extends AppLocalizations {
String get auto_extensions_updates_subtitle =>
'سيتم تحديث الامتداد تلقائياً عند توفر إصدار جديد.';
@override
String get check_for_app_updates => 'تحقق من تحديثات التطبيق عند بدء التشغيل';
@override
String get reading_mode => 'وضع القراءة';

View file

@ -960,6 +960,9 @@ class AppLocalizationsDe extends AppLocalizations {
String get auto_extensions_updates_subtitle =>
'Aktualisiert die Erweiterung automatisch, wenn eine neue Version verfügbar ist.';
@override
String get check_for_app_updates => 'Beim Start nach App-Updates suchen';
@override
String get reading_mode => 'Lesemodus';

View file

@ -955,6 +955,9 @@ class AppLocalizationsEn extends AppLocalizations {
String get auto_extensions_updates_subtitle =>
'Will automatically update the extension when a new version is available.';
@override
String get check_for_app_updates => 'Check for app updates on startup';
@override
String get reading_mode => 'Reading mode';

View file

@ -962,6 +962,10 @@ class AppLocalizationsEs extends AppLocalizations {
String get auto_extensions_updates_subtitle =>
'Actualizará automáticamente la extensión cuando haya una nueva versión disponible.';
@override
String get check_for_app_updates =>
'Buscar actualizaciones de la aplicación al iniciar';
@override
String get reading_mode => 'Modo de lectura';
@ -2485,6 +2489,10 @@ class AppLocalizationsEs419 extends AppLocalizationsEs {
String get auto_extensions_updates_subtitle =>
'Actualizará automáticamente la extensión cuando haya una nueva versión disponible.';
@override
String get check_for_app_updates =>
'Buscar actualizaciones de la app al iniciar';
@override
String get reading_mode => 'Modo de lectura';

View file

@ -968,6 +968,10 @@ class AppLocalizationsFr extends AppLocalizations {
String get auto_extensions_updates_subtitle =>
'Mettra automatiquement à jour l\'extension lorsqu\'une nouvelle version est disponible.';
@override
String get check_for_app_updates =>
'Vérifier les mises à jour de l\'application au démarrage';
@override
String get reading_mode => 'Mode de lecture';

View file

@ -959,6 +959,9 @@ class AppLocalizationsId extends AppLocalizations {
String get auto_extensions_updates_subtitle =>
'Akan secara otomatis memperbarui ekstensi ketika versi baru tersedia.';
@override
String get check_for_app_updates => 'Periksa pembaruan aplikasi saat mulai';
@override
String get reading_mode => 'Mode membaca';

View file

@ -962,6 +962,10 @@ class AppLocalizationsIt extends AppLocalizations {
String get auto_extensions_updates_subtitle =>
'Aggiorna automaticamente l\'estensione quando è disponibile una nuova versione.';
@override
String get check_for_app_updates =>
'Controlla gli aggiornamenti dell\'app all\'avvio';
@override
String get reading_mode => 'Modalità di lettura';

View file

@ -960,6 +960,10 @@ class AppLocalizationsPt extends AppLocalizations {
String get auto_extensions_updates_subtitle =>
'Atualizará automaticamente a extensão quando uma nova versão estiver disponível.';
@override
String get check_for_app_updates =>
'Verificar atualizações da aplicação ao iniciar';
@override
String get reading_mode => 'Modo de leitura';
@ -2479,6 +2483,10 @@ class AppLocalizationsPtBr extends AppLocalizationsPt {
String get auto_extensions_updates_subtitle =>
'Atualizará automaticamente a extensão quando uma nova versão estiver disponível.';
@override
String get check_for_app_updates =>
'Verificar atualizações do app na inicialização';
@override
String get reading_mode => 'Modo de leitura';

View file

@ -961,6 +961,10 @@ class AppLocalizationsRu extends AppLocalizations {
String get auto_extensions_updates_subtitle =>
'Автоматически обновлять расширение при появлении новой версии.';
@override
String get check_for_app_updates =>
'Проверять обновления приложения при запуске';
@override
String get reading_mode => 'Режим чтения';

View file

@ -955,6 +955,9 @@ class AppLocalizationsTh extends AppLocalizations {
String get auto_extensions_updates_subtitle =>
'จะทำการอัพเดทส่วนขยายเมื่อมีเวอร์ชั่นใหม่พร้อมใช้งานโดยอัตโนมัติ';
@override
String get check_for_app_updates => 'ตรวจสอบการอัปเดตแอปเมื่อเริ่มต้น';
@override
String get reading_mode => 'โหมดการอ่าน';

View file

@ -957,6 +957,10 @@ class AppLocalizationsTr extends AppLocalizations {
String get auto_extensions_updates_subtitle =>
'Yeni bir sürümü mevcut olduğunda uzantıyı otomatik olarak günceller.';
@override
String get check_for_app_updates =>
'Uygulama başlatıldığında güncellemeleri kontrol et';
@override
String get reading_mode => 'Okuma Modu';

View file

@ -941,6 +941,9 @@ class AppLocalizationsZh extends AppLocalizations {
@override
String get auto_extensions_updates_subtitle => '当有新版本可用时,将自动更新扩展。';
@override
String get check_for_app_updates => '启动时检查应用更新';
@override
String get reading_mode => '阅读模式';

View file

@ -125,6 +125,8 @@ class Settings {
int? pagePreloadAmount;
bool? checkForAppUpdates;
bool? checkForExtensionUpdates;
@enumerated
@ -292,6 +294,7 @@ class Settings {
this.sortLibraryAnime,
this.pagePreloadAmount = 6,
this.scaleType = ScaleType.fitScreen,
this.checkForAppUpdates = true,
this.checkForExtensionUpdates = true,
this.backgroundColor = BackgroundColor.black,
this.personalPageModeList,
@ -386,6 +389,7 @@ class Settings {
.map((e) => ChapterPageurls.fromJson(e))
.toList();
}
checkForAppUpdates = json['checkForAppUpdates'];
checkForExtensionUpdates = json['checkForExtensionUpdates'];
if (json['cookiesList'] != null) {
cookiesList = (json['cookiesList'] as List)
@ -581,6 +585,7 @@ class Settings {
?.map((v) => v.toJson())
.toList(),
'chapterPageUrlsList': chapterPageUrlsList?.map((v) => v.toJson()).toList(),
'checkForAppUpdates': checkForAppUpdates,
'checkForExtensionUpdates': checkForExtensionUpdates,
'cookiesList': cookiesList,
'cropBorders': cropBorders,

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:mangayomi/main.dart';
import 'package:mangayomi/models/settings.dart';
import 'package:mangayomi/modules/more/about/providers/check_for_update.dart';
import 'package:mangayomi/modules/more/about/providers/get_package_info.dart';
import 'package:mangayomi/modules/widgets/progress_center.dart';
@ -13,6 +15,7 @@ class AboutScreen extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final l10n = l10nLocalizations(context);
final checkForUpdates = ref.watch(checkForAppUpdatesProvider);
return Scaffold(
appBar: AppBar(title: Text(l10n!.about)),
body: ref
@ -43,6 +46,19 @@ class AboutScreen extends ConsumerWidget {
style: const TextStyle(fontSize: 12),
),
),
SwitchListTile(
title: Text(l10n.check_for_app_updates),
value: checkForUpdates,
onChanged: (value) {
isar.writeTxnSync(() {
final settings = isar.settings.getSync(227);
isar.settings.putSync(
settings!..checkForAppUpdates = value,
);
});
ref.invalidate(checkForAppUpdatesProvider);
},
),
ListTile(
onTap: () {
ref.read(

View file

@ -3,6 +3,8 @@ import 'dart:developer';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:mangayomi/main.dart';
import 'package:mangayomi/models/settings.dart';
import 'package:mangayomi/modules/more/about/providers/download_file_screen.dart';
import 'package:mangayomi/providers/l10n_providers.dart';
import 'package:mangayomi/services/fetch_sources_list.dart';
@ -20,7 +22,10 @@ Future<void> checkForUpdate(
bool? manualUpdate,
}) async {
manualUpdate = manualUpdate ?? false;
final checkForUpdates = ref.watch(checkForAppUpdatesProvider);
if (!checkForUpdates && !manualUpdate) return;
final l10n = l10nLocalizations(context!)!;
if (manualUpdate) {
BotToast.showText(text: l10n.searching_for_updates);
}
@ -49,6 +54,11 @@ Future<void> checkForUpdate(
}
}
@riverpod
bool checkForAppUpdates(Ref ref) {
return isar.settings.getSync(227)?.checkForAppUpdates ?? true;
}
Future<(String, String, String, List<dynamic>)> _checkUpdate() async {
final http = MClient.init(reqcopyWith: {'useDartHttpClient': true});
try {

View file

@ -6,7 +6,7 @@ part of 'check_for_update.dart';
// RiverpodGenerator
// **************************************************************************
String _$checkForUpdateHash() => r'cc0baa7eda3bef643e56ea7eed3e2ded87730e3c';
String _$checkForUpdateHash() => r'c59c08b12062030079f9592d907d1009b2681227';
/// Copied from Dart SDK
class _SystemHash {
@ -173,5 +173,24 @@ class _CheckForUpdateProviderElement
@override
bool? get manualUpdate => (origin as CheckForUpdateProvider).manualUpdate;
}
String _$checkForAppUpdatesHash() =>
r'2243b74d748a90847bacff256cb2ef0a344fee80';
/// See also [checkForAppUpdates].
@ProviderFor(checkForAppUpdates)
final checkForAppUpdatesProvider = AutoDisposeProvider<bool>.internal(
checkForAppUpdates,
name: r'checkForAppUpdatesProvider',
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$checkForAppUpdatesHash,
dependencies: null,
allTransitiveDependencies: null,
);
@Deprecated('Will be removed in 3.0. Use Ref instead')
// ignore: unused_element
typedef CheckForAppUpdatesRef = AutoDisposeProviderRef<bool>;
// ignore_for_file: type=lint
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member, deprecated_member_use_from_same_package

View file

@ -173,7 +173,7 @@ class _DoRestoreProviderElement extends AutoDisposeProviderElement<void>
BuildContext get context => (origin as DoRestoreProvider).context;
}
String _$restoreBackupHash() => r'cd8cdf4a40009bb43a9e11ea2781efad2b8dd640';
String _$restoreBackupHash() => r'd4226539077680dac8826ee9b36efff9b07e2ed8';
/// See also [restoreBackup].
@ProviderFor(restoreBackup)

View file

@ -23,7 +23,7 @@ final routerProvider = AutoDisposeProvider<GoRouter>.internal(
// ignore: unused_element
typedef RouterRef = AutoDisposeProviderRef<GoRouter>;
String _$routerCurrentLocationStateHash() =>
r'3d04109aaeded1b2255b1f1d05abe2819fe694de';
r'e3248e9cbfd34a1c0576b28d9bcc01a07f644cb9';
/// See also [RouterCurrentLocationState].
@ProviderFor(RouterCurrentLocationState)