mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-10-25 20:03:44 +02:00
Add "refresh before download" + remove WhatsApp (#1943)
This commit is contained in:
@@ -888,6 +888,11 @@ class AppsProvider with ChangeNotifier {
|
||||
}
|
||||
MapEntry<String, String>? apkUrl;
|
||||
var trackOnly = apps[id]!.app.additionalSettings['trackOnly'] == true;
|
||||
var refreshBeforeDownload =
|
||||
apps[id]!.app.additionalSettings['refreshBeforeDownload'] == true;
|
||||
if (refreshBeforeDownload) {
|
||||
await checkUpdate(apps[id]!.app.id);
|
||||
}
|
||||
if (!trackOnly) {
|
||||
// ignore: use_build_context_synchronously
|
||||
apkUrl = await confirmAppFileUrl(apps[id]!.app, context, false);
|
||||
@@ -1074,6 +1079,11 @@ class AppsProvider with ChangeNotifier {
|
||||
throw ObtainiumError(tr('appNotFound'));
|
||||
}
|
||||
MapEntry<String, String>? fileUrl;
|
||||
var refreshBeforeDownload =
|
||||
apps[id]!.app.additionalSettings['refreshBeforeDownload'] == true;
|
||||
if (refreshBeforeDownload) {
|
||||
await checkUpdate(apps[id]!.app.id);
|
||||
}
|
||||
if (apps[id]!.app.apkUrls.isNotEmpty ||
|
||||
apps[id]!.app.otherAssetUrls.isNotEmpty) {
|
||||
// ignore: use_build_context_synchronously
|
||||
|
||||
@@ -29,7 +29,6 @@ import 'package:obtainium/app_sources/telegramapp.dart';
|
||||
import 'package:obtainium/app_sources/tencent.dart';
|
||||
import 'package:obtainium/app_sources/uptodown.dart';
|
||||
import 'package:obtainium/app_sources/vlc.dart';
|
||||
import 'package:obtainium/app_sources/whatsapp.dart';
|
||||
import 'package:obtainium/components/generated_form.dart';
|
||||
import 'package:obtainium/custom_errors.dart';
|
||||
import 'package:obtainium/mass_app_sources/githubstars.dart';
|
||||
@@ -214,6 +213,21 @@ appJSONCompatibilityModifiers(Map<String, dynamic> json) {
|
||||
'\\d+.\\d+.\\d+';
|
||||
additionalSettings = replacementAdditionalSettings;
|
||||
}
|
||||
// WhatsApp from before it was removed should be converted to HTML (#1943)
|
||||
if (json['url'] == 'https://whatsapp.com' &&
|
||||
json['id'] == 'com.whatsapp' &&
|
||||
json['author'] == 'Meta' &&
|
||||
json['name'] == 'WhatsApp' &&
|
||||
json['overrideSource'] == null &&
|
||||
additionalSettings['trackOnly'] == false &&
|
||||
additionalSettings['versionExtractionRegEx'] == '' &&
|
||||
json['lastUpdateCheck'] != null) {
|
||||
json['url'] = 'https://whatsapp.com/android';
|
||||
var replacementAdditionalSettings = getDefaultValuesFromFormItems(
|
||||
HTML().combinedAppSpecificSettingFormItems);
|
||||
replacementAdditionalSettings['refreshBeforeDownload'] = true;
|
||||
additionalSettings = replacementAdditionalSettings;
|
||||
}
|
||||
}
|
||||
json['additionalSettings'] = jsonEncode(additionalSettings);
|
||||
// F-Droid no longer needs cloudflare exception since override can be used - migrate apps appropriately
|
||||
@@ -586,6 +600,10 @@ abstract class AppSource {
|
||||
label: tr('skipUpdateNotifications'))
|
||||
],
|
||||
[GeneratedFormTextField('about', label: tr('about'), required: false)],
|
||||
[
|
||||
GeneratedFormSwitch('refreshBeforeDownload',
|
||||
label: tr('refreshBeforeDownload'))
|
||||
]
|
||||
];
|
||||
|
||||
// Previous 2 variables combined into one at runtime for convenient usage
|
||||
@@ -809,7 +827,6 @@ class SourceProvider {
|
||||
Jenkins(),
|
||||
APKMirror(),
|
||||
VLC(),
|
||||
WhatsApp(),
|
||||
TelegramApp(),
|
||||
NeutronCode(),
|
||||
DirectAPKLink(),
|
||||
|
||||
Reference in New Issue
Block a user