Add support for zipped APKs - GitHub/HTML only for now (#983)

This commit is contained in:
Imran Remtulla
2025-10-11 18:29:59 -04:00
parent 7cb9ca128b
commit 8bdc0f8d12
32 changed files with 144 additions and 32 deletions

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "هذا الإشعار مطلوب للتحقق من التحديث في الخلفية (يمكن إخفاؤه في إعدادات نظام التشغيل)",
"excludeSecrets": "استبعاد الأسرار",
"GHReqPrefix": "مثيل \"sky22333/hubproxy\" لطلبات GitHub",
"includeZips": "تضمين ملفات ZIP",
"zippedApkFilterRegEx": "تصفية ملفات APK داخل ZIP",
"removeAppQuestion": {
"one": "إزالة التطبيق؟",
"other": "إزالة التطبيقات؟"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "This notification is required for background update checking (it can be hidden in the OS settings)",
"excludeSecrets": "Exclude secrets",
"GHReqPrefix": "'sky22333/hubproxy' instance for GitHub requests",
"includeZips": "Include ZIP files",
"zippedApkFilterRegEx": "Filter APKs inside ZIP",
"removeAppQuestion": {
"one": "Želite li ukloniti aplikaciju?",
"other": "Želite li ukloniti aplikacije?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Aquesta notificació és necessària per comprovar les actualitzacions en segon pla (la pots ocultar als paràmetres del Sistema Operatiu)",
"excludeSecrets": "Exclude secrets",
"GHReqPrefix": "'sky22333/hubproxy' instance for GitHub requests",
"includeZips": "Include ZIP files",
"zippedApkFilterRegEx": "Filter APKs inside ZIP",
"removeAppQuestion": {
"one": "¿Suprimeixo l'aplicació?",
"other": "¿Suprimeixo les aplicacions?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Toto oznámení je nutné pro kontrolu aktualizací na pozadí (lze jej skrýt v nastavení systému)",
"excludeSecrets": "Vyloučit tajemství",
"GHReqPrefix": "instance 'sky22333/hubproxy' pro požadavky GitHubu",
"includeZips": "Zahrnout soubory ZIP",
"zippedApkFilterRegEx": "Filtrování souborů APK uvnitř ZIP",
"removeAppQuestion": {
"one": "Odstranit aplikaci?",
"other": "Odstranit aplikace?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Denne meddelelse er nødvendig for baggrundsopdateringskontrol (den kan skjules i OS-indstillingerne).",
"excludeSecrets": "Udeluk hemmeligheder",
"GHReqPrefix": "'sky22333/hubproxy'-instans til GitHub-anmodninger",
"includeZips": "Inkluder ZIP-filer",
"zippedApkFilterRegEx": "Filtrer APK'er inde i ZIP",
"removeAppQuestion": {
"one": "Fjern app?",
"other": "Fjern apps?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Diese Benachrichtigung ist für die Prüfung von Updates im Hintergrund erforderlich (sie kann in den Betriebssystemeinstellungen ausgeblendet werden)",
"excludeSecrets": "Geheimnisse ausschließen",
"GHReqPrefix": "sky22333/hubproxy'-Instanz für GitHub-Anfragen",
"includeZips": "ZIP-Dateien einbeziehen",
"zippedApkFilterRegEx": "APKs in ZIP filtern",
"removeAppQuestion": {
"one": "App entfernen?",
"other": "Apps entfernen?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "This notification is required for background update checking (it can be hidden in the OS settings)",
"excludeSecrets": "Exclude secrets",
"GHReqPrefix": "'sky22333/hubproxy' instance for GitHub requests",
"includeZips": "Include ZIP files",
"zippedApkFilterRegEx": "Filter APKs inside ZIP",
"removeAppQuestion": {
"one": "Forigi la aplikaĵon?",
"other": "Forigi la aplikaĵojn?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "This notification is required for background update checking (it can be hidden in the OS settings)",
"excludeSecrets": "Exclude secrets",
"GHReqPrefix": "'sky22333/hubproxy' instance for GitHub requests",
"includeZips": "Include ZIP files",
"zippedApkFilterRegEx": "Filter APKs inside ZIP",
"removeAppQuestion": {
"one": "Remove app?",
"other": "Remove apps?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Esta notificación es necesaria para la comprobación de actualizaciones en segundo plano (puede ocultarse en la configuración del sistema operativo).",
"excludeSecrets": "Excluir secretos",
"GHReqPrefix": "Instancia \"sky22333/hubproxy\" para las solicitudes de GitHub",
"includeZips": "Incluir archivos ZIP",
"zippedApkFilterRegEx": "Filtrar APKs dentro de ZIP",
"removeAppQuestion": {
"one": "¿Eliminar aplicación?",
"other": "¿Eliminar aplicaciones?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "This notification is required for background update checking (it can be hidden in the OS settings)",
"excludeSecrets": "Exclude secrets",
"GHReqPrefix": "'sky22333/hubproxy' instance for GitHub requests",
"includeZips": "Include ZIP files",
"zippedApkFilterRegEx": "Filter APKs inside ZIP",
"removeAppQuestion": {
"one": "برنامه حذف شود؟",
"other": "برنامه ها حذف شوند؟"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Cette notification est nécessaire pour la vérification des mises à jour en arrière-plan (elle peut être masquée dans les paramètres du système d'exploitation).",
"excludeSecrets": "Exclure les secrets",
"GHReqPrefix": "instance 'sky22333/hubproxy' pour les requêtes GitHub",
"includeZips": "Inclure les fichiers ZIP",
"zippedApkFilterRegEx": "Filtrer les APK à l'intérieur du ZIP",
"removeAppQuestion": {
"one": "Supprimer l'application ?",
"other": "Supprimer les applications ?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Ez az értesítés a háttérben történő frissítésellenőrzéshez szükséges (a rendszer beállításaiban elrejthető).",
"excludeSecrets": "Érzékeny adatok (például: személyes hozzáférési tokenek) kihagyása",
"GHReqPrefix": "„sky22333/hubproxy” példány a GitHub lekérdezéséhez",
"includeZips": "ZIP fájlok belefoglalása",
"zippedApkFilterRegEx": "APK-k szűrése a ZIP-en belül",
"removeAppQuestion": {
"one": "Eltávolítja az alkalmazást?",
"other": "Eltávolítja az alkalmazásokat?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Pemberitahuan ini diperlukan untuk pemeriksaan pembaruan latar belakang (dapat disembunyikan dalam pengaturan OS)",
"excludeSecrets": "Mengecualikan rahasia",
"GHReqPrefix": "Instance 'sky22333/hubproxy' untuk permintaan GitHub",
"includeZips": "Menyertakan file ZIP",
"zippedApkFilterRegEx": "Saring APK di dalam ZIP",
"removeAppQuestion": {
"one": "Hapus aplikasi?",
"other": "Hapus aplikasi?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Questa notifica è necessaria per il controllo degli aggiornamenti in background (può essere nascosta nelle impostazioni del sistema operativo).",
"excludeSecrets": "Escludere i segreti",
"GHReqPrefix": "istanza 'sky22333/hubproxy' per le richieste a GitHub",
"includeZips": "Includere file ZIP",
"zippedApkFilterRegEx": "Filtrare gli APK all'interno dello ZIP",
"removeAppQuestion": {
"one": "Rimuovere l'app?",
"other": "Rimuovere le app?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "この通知は、バックグラウンドでアップデートを確認するために必要ですOSの設定で非表示にできます。",
"excludeSecrets": "シークレットを除く",
"GHReqPrefix": "GitHub リクエスト用の 'sky22333/hubproxy' インスタンス",
"includeZips": "ZIPファイルを含む",
"zippedApkFilterRegEx": "ZIP内のAPKをフィルタリングする",
"removeAppQuestion": {
"one": "アプリを削除しますか?",
"other": "アプリを削除しますか?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "이 알림은 백그라운드 업데이트 확인에 필요합니다(OS 설정에서 숨길 수 있음).",
"excludeSecrets": "비밀 제외",
"GHReqPrefix": "GitHub 요청을 위한 'sky22333/hubproxy' 인스턴스",
"includeZips": "ZIP 파일 포함",
"zippedApkFilterRegEx": "ZIP 내 APK 필터링",
"removeAppQuestion": {
"one": "앱을 제거하시겠습니까?",
"other": "앱을 제거하시겠습니까?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "This notification is required for background update checking (it can be hidden in the OS settings)",
"excludeSecrets": "Exclude secrets",
"GHReqPrefix": "'sky22333/hubproxy' instance for GitHub requests",
"includeZips": "Include ZIP files",
"zippedApkFilterRegEx": "Filter APKs inside ZIP",
"removeAppQuestion": {
"one": "ആപ്പ് നീക്കം ചെയ്യണോ?",
"other": "ആപ്പുകൾ നീക്കം ചെയ്യണോ?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Deze melding is nodig voor het controleren van updates op de achtergrond (kan worden verborgen in de OS-instellingen)",
"excludeSecrets": "Geheimen uitsluiten",
"GHReqPrefix": "'sky22333/hubproxy' instantie voor GitHub verzoeken",
"includeZips": "ZIP-bestanden opnemen",
"zippedApkFilterRegEx": "APK's filteren in ZIP",
"removeAppQuestion": {
"one": "App verwijderen?",
"other": "Apps verwijderen?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "To powiadomienie jest wymagane do sprawdzania aktualizacji w tle (można je ukryć w ustawieniach systemu operacyjnego).",
"excludeSecrets": "Wyklucz sekrety",
"GHReqPrefix": "Instancja \"sky22333/hubproxy\" dla żądań GitHub",
"includeZips": "Dołączanie plików ZIP",
"zippedApkFilterRegEx": "Filtrowanie plików APK wewnątrz ZIP",
"removeAppQuestion": {
"one": "Usunąć aplikację?",
"few": "Usunąć aplikacje?",

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Essa notificação é necessária para a verificação de atualizações em segundo plano (ela pode ser ocultada nas configurações do sistema operacional)",
"excludeSecrets": "Excluir segredos",
"GHReqPrefix": "Instância \"sky22333/hubproxy\" para solicitações do GitHub",
"includeZips": "Incluir arquivos ZIP",
"zippedApkFilterRegEx": "Filtrar APKs dentro do ZIP",
"removeAppQuestion": {
"one": "Remover app?",
"other": "Remover apps?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Esta notificação é necessária para a verificação de actualizações em segundo plano (pode ser ocultada nas definições do SO)",
"excludeSecrets": "Excluir segredos",
"GHReqPrefix": "Instância 'sky22333/hubproxy' para pedidos de GitHub",
"includeZips": "Incluir ficheiros ZIP",
"zippedApkFilterRegEx": "Filtrar APKs dentro do ZIP",
"removeAppQuestion": {
"one": "Remover aplicação?",
"other": "Remover aplicações?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Это уведомление необходимо для фоновой проверки обновлений (оно может быть скрыто в настройках ОС)",
"excludeSecrets": "Исключить секреты",
"GHReqPrefix": "Экземпляр 'sky22333/hubproxy' для запросов на GitHub",
"includeZips": "Включить ZIP-файлы",
"zippedApkFilterRegEx": "Фильтр APK внутри ZIP",
"removeAppQuestion": {
"one": "Удалить приложение?",
"other": "Удалить приложения?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Detta meddelande krävs för bakgrundsuppdateringskontroll (det kan döljas i OS-inställningarna)",
"excludeSecrets": "Utesluta hemligheter",
"GHReqPrefix": "Instansen \"sky22333/hubproxy\" för GitHub-förfrågningar",
"includeZips": "Inkludera ZIP-filer",
"zippedApkFilterRegEx": "Filtrera APK:er inuti ZIP",
"removeAppQuestion": {
"one": "Ta Bort App?",
"other": "Ta Bort Appar?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Bu bildirim arka planda güncelleme kontrolü için gereklidir (işletim sistemi ayarlarından gizlenebilir)",
"excludeSecrets": "Sırları hariç tut",
"GHReqPrefix": "GitHub istekleri için 'sky22333/hubproxy' örneği",
"includeZips": "ZIP dosyalarını dahil edin",
"zippedApkFilterRegEx": "ZIP içindeki APK'ları filtreleme",
"removeAppQuestion": {
"one": "Uygulamayı Kaldır?",
"other": "Uygulamaları Kaldır?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Це сповіщення необхідне для фонової перевірки оновлень (його можна приховати в налаштуваннях ОС)",
"excludeSecrets": "Виключити секрети",
"GHReqPrefix": "екземпляр 'sky22333/hubproxy' для запитів на GitHub",
"includeZips": "Додайте ZIP-файли",
"zippedApkFilterRegEx": "Фільтруйте APK-файли всередині ZIP",
"removeAppQuestion": {
"one": "Видалити застосунок?",
"other": "Видалити застосунки?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "Thông báo này là bắt buộc để kiểm tra cập nhật nền (có thể ẩn trong cài đặt hệ điều hành).",
"excludeSecrets": "Loại trừ thông tin bí mật",
"GHReqPrefix": "Thực thể 'sky22333/hubproxy' cho các yêu cầu GitHub",
"includeZips": "Ba gồm các tệp ZIP",
"zippedApkFilterRegEx": "Lọc các tệp APK bên trong tệp ZIP",
"removeAppQuestion": {
"one": "Gỡ ứng dụng?",
"other": "Gỡ ứng dụng?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "This notification is required for background update checking (it can be hidden in the OS settings)",
"excludeSecrets": "Exclude secrets",
"GHReqPrefix": "'sky22333/hubproxy' instance for GitHub requests",
"includeZips": "Include ZIP files",
"zippedApkFilterRegEx": "Filter APKs inside ZIP",
"removeAppQuestion": {
"one": "移除應用程式?",
"other": "移除應用程式?"

View File

@@ -337,6 +337,8 @@
"fgServiceNotice": "后台检查更新时需要此通知(可在操作系统设置中隐藏)",
"excludeSecrets": "排除机密",
"GHReqPrefix": "用于 GitHub 请求的 \"sky22333/hubproxy \"实例",
"includeZips": "包含 ZIP 文件",
"zippedApkFilterRegEx": "过滤 ZIP 内的 APK",
"removeAppQuestion": {
"one": "是否删除应用?",
"other": "是否删除应用?"

View File

@@ -18,6 +18,7 @@ class GitHub extends AppSource {
appIdInferIsOptional = true;
showReleaseDateAsVersionToggle = true;
this.hostChanged = hostChanged;
allowIncludeZips = true;
sourceConfigSettingFormItems = [
GeneratedFormTextField(
@@ -370,6 +371,7 @@ class GitHub extends AppSource {
additionalSettings['useLatestAssetDateAsReleaseDate'] == true;
String sortMethod =
additionalSettings['sortMethodChoice'] ?? 'smartname-datefallback';
bool includeZips = additionalSettings['includeZips'] == true;
dynamic latestRelease;
if (verifyLatestTag) {
var temp = requestUrl.split('?');
@@ -402,7 +404,8 @@ class GitHub extends AppSource {
findReleaseAssetUrls(dynamic release) =>
(release['assets'] as List<dynamic>?)?.map((e) {
var url = !e['name'].toString().toLowerCase().endsWith('.apk')
var ext = e['name'].toString().toLowerCase().split('.').last;
var url = !(ext == 'apk' || (includeZips && ext == 'zip'))
? (e['browser_download_url'] ?? e['url'])
: (e['url'] ?? e['browser_download_url']);
url = undoGHProxyMod(url, sourceConfigSettingValues);
@@ -542,14 +545,13 @@ class GitHub extends AppSource {
List<MapEntry<String, String>> allAssetUrls = allAssetsWithUrls
.map((e) => e['final_url'] as MapEntry<String, String>)
.toList();
var apkAssetsWithUrls = allAssetsWithUrls
.where(
(element) => (element['final_url'] as MapEntry<String, String>)
.key
.toLowerCase()
.endsWith('.apk'),
)
.toList();
var apkAssetsWithUrls = allAssetsWithUrls.where((element) {
var ext = (element['final_url'] as MapEntry<String, String>).key
.toLowerCase()
.split('.')
.last;
return ext == 'apk' || (includeZips && ext == 'zip');
}).toList();
var filteredApkUrls = filterApks(
apkAssetsWithUrls

View File

@@ -203,11 +203,11 @@ class AddAppPageState extends State<AddAppPage> {
notificationsProvider: notificationsProvider,
);
DownloadedApk? downloadedFile;
DownloadedXApkDir? downloadedDir;
DownloadedDir? downloadedDir;
if (downloadedArtifact is DownloadedApk) {
downloadedFile = downloadedArtifact;
} else {
downloadedDir = downloadedArtifact as DownloadedXApkDir;
downloadedDir = downloadedArtifact as DownloadedDir;
}
app.id = downloadedFile?.appId ?? downloadedDir!.appId;
}

View File

@@ -62,11 +62,14 @@ class DownloadedApk {
DownloadedApk(this.appId, this.file);
}
class DownloadedXApkDir {
enum DownloadedDirType { XAPK, ZIP }
class DownloadedDir {
String appId;
File file;
Directory extracted;
DownloadedXApkDir(this.appId, this.file, this.extracted);
DownloadedDirType type;
DownloadedDir(this.appId, this.file, this.extracted, this.type);
}
List<String> generateStandardVersionRegExStrings() {
@@ -664,17 +667,18 @@ class AppsProvider with ChangeNotifier {
}
PackageInfo? newInfo;
var isAPK = downloadedFile.path.toLowerCase().endsWith('.apk');
Directory? xapkDir;
var isXAPK = downloadedFile.path.toLowerCase().endsWith('.xapk');
Directory? apkDir;
if (isAPK) {
newInfo = await pm.getPackageArchiveInfo(
archiveFilePath: downloadedFile.path,
);
} else {
// Assume XAPK
String xapkDirPath = '${downloadedFile.path}-dir';
// Assume XAPK or ZIP
String apkDirPath = '${downloadedFile.path}-dir';
await unzipFile(downloadedFile.path, '${downloadedFile.path}-dir');
xapkDir = Directory(xapkDirPath);
var apks = xapkDir
apkDir = Directory(apkDirPath);
var apks = apkDir
.listSync()
.where((e) => e.path.toLowerCase().endsWith('.apk'))
.toList();
@@ -691,6 +695,22 @@ class AppsProvider with ChangeNotifier {
apks = [temp!, ...apks];
}
if (app.additionalSettings['zippedApkFilterRegEx']?.isNotEmpty ==
true) {
var reg = RegExp(app.additionalSettings['zippedApkFilterRegEx']);
apks.removeWhere((apk) {
var shouldDelete = !reg.hasMatch(apk.uri.pathSegments.last);
if (shouldDelete) {
apk.delete();
}
return shouldDelete;
});
}
if (apks.isEmpty) {
throw NoAPKError();
}
for (var i = 0; i < apks.length; i++) {
try {
newInfo = await pm.getPackageArchiveInfo(
@@ -728,7 +748,12 @@ class AppsProvider with ChangeNotifier {
if (isAPK) {
return DownloadedApk(app.id, downloadedFile);
} else {
return DownloadedXApkDir(app.id, downloadedFile, xapkDir!);
return DownloadedDir(
app.id,
downloadedFile,
apkDir!,
isXAPK ? DownloadedDirType.XAPK : DownloadedDirType.ZIP,
);
}
} finally {
notificationsProvider?.cancel(notifId);
@@ -826,15 +851,16 @@ class AppsProvider with ChangeNotifier {
);
}
Future<bool> installXApkDir(
DownloadedXApkDir dir,
Future<bool> installApkDir(
DownloadedDir dir,
BuildContext? firstTimeWithContext, {
bool needsBGWorkaround = false,
bool shizukuPretendToBeGooglePlay = false,
}) async {
// We don't know which APKs in an XAPK are supported by the user's device
// We don't know which APKs in an XAPK or ZIP are supported by the user's device
// So we try installing all of them and assume success if at least one installed
// If 0 APKs installed, throw the first install error encountered
// Obviously this approach is naive and is undesirable in many cases, needs to be improved
var somethingInstalled = false;
try {
MultiAppMultiError errors = MultiAppMultiError();
@@ -863,7 +889,7 @@ class AppsProvider with ChangeNotifier {
}
try {
await installApk(
var wasInstalled = await installApk(
DownloadedApk(dir.appId, APKFiles[0]),
firstTimeWithContext,
needsBGWorkaround: needsBGWorkaround,
@@ -872,10 +898,10 @@ class AppsProvider with ChangeNotifier {
1,
).map((a) => DownloadedApk(dir.appId, a)).toList(),
);
somethingInstalled = true;
somethingInstalled = somethingInstalled || wasInstalled;
dir.file.delete(recursive: true);
} catch (e) {
logs.add('Could not install APKs from XAPK: ${e.toString()}');
logs.add('Could not install APKs from ${dir.type}: ${e.toString()}');
errors.add(dir.appId, e, appName: apps[dir.appId]?.name);
}
if (errors.idsByErrorString.isNotEmpty) {
@@ -1148,7 +1174,7 @@ class AppsProvider with ChangeNotifier {
String id,
bool willBeSilent,
DownloadedApk? downloadedFile,
DownloadedXApkDir? downloadedDir,
DownloadedDir? downloadedDir,
) async {
apps[id]?.downloadProgress = -1;
notifyListeners();
@@ -1183,14 +1209,14 @@ class AppsProvider with ChangeNotifier {
} else {
if (needBGWorkaround) {
// ignore: use_build_context_synchronously
installXApkDir(
installApkDir(
downloadedDir!,
contextIfNewInstall,
needsBGWorkaround: true,
);
} else {
// ignore: use_build_context_synchronously
sayInstalled = await installXApkDir(
sayInstalled = await installApkDir(
downloadedDir!,
contextIfNewInstall,
shizukuPretendToBeGooglePlay: shizukuPretendToBeGooglePlay,
@@ -1227,7 +1253,7 @@ class AppsProvider with ChangeNotifier {
}) async {
bool willBeSilent = false;
DownloadedApk? downloadedFile;
DownloadedXApkDir? downloadedDir;
DownloadedDir? downloadedDir;
try {
var downloadedArtifact =
// ignore: use_build_context_synchronously
@@ -1240,7 +1266,7 @@ class AppsProvider with ChangeNotifier {
if (downloadedArtifact is DownloadedApk) {
downloadedFile = downloadedArtifact;
} else {
downloadedDir = downloadedArtifact as DownloadedXApkDir;
downloadedDir = downloadedArtifact as DownloadedDir;
}
id = downloadedFile?.appId ?? downloadedDir!.appId;
willBeSilent = await canInstallSilently(apps[id]!.app);
@@ -1292,7 +1318,7 @@ class AppsProvider with ChangeNotifier {
res['id'] as String,
res['willBeSilent'] as bool,
res['downloadedFile'] as DownloadedApk?,
res['downloadedDir'] as DownloadedXApkDir?,
res['downloadedDir'] as DownloadedDir?,
);
} catch (e) {
var id = res['id'] as String;

View File

@@ -636,6 +636,7 @@ abstract class AppSource {
bool versionDetectionDisallowed = false;
List<String> excludeCommonSettingKeys = [];
bool urlsAlwaysHaveExtension = false;
bool allowIncludeZips = false;
AppSource() {
name = runtimeType.toString();
@@ -834,7 +835,7 @@ abstract class AppSource {
],
];
// Previous 2 variables combined into one at runtime for convenient usage
// Previous 2 variables combined into one at runtime for convenient usage + additional processing
List<List<GeneratedFormItem>> get combinedAppSpecificSettingFormItems {
if (showReleaseDateAsVersionToggle == true) {
if (additionalAppSpecificSourceAgnosticSettingFormItemsNeverUseDirectly
@@ -878,6 +879,32 @@ abstract class AppSource {
)
.where((e) => e.isNotEmpty)
.toList();
var moreConditionalItems = [];
if (allowIncludeZips) {
moreConditionalItems.addAll([
[
GeneratedFormSwitch(
'includeZips',
label: tr('includeZips'),
defaultValue: false,
),
],
[
GeneratedFormTextField(
'zippedApkFilterRegEx',
label: tr('zippedApkFilterRegEx'),
required: false,
additionalValidators: [
(value) {
return regExValidator(value);
},
],
),
],
]);
}
if (versionDetectionDisallowed) {
overrideAdditionalAppSpecificSourceAgnosticSettingSwitch(
'versionDetection',
@@ -893,6 +920,7 @@ abstract class AppSource {
return [
...additionalSourceAppSpecificSettingFormItems,
...additionalAppSpecificSourceAgnosticSettingFormItemsNeverUseDirectly,
...moreConditionalItems,
];
}