mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-25 20:03:44 +02:00 
			
		
		
		
	Compare commits
	
		
			47 Commits
		
	
	
		
			v1.1.54
			...
			39b76a41cf
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 39b76a41cf | ||
|  | 377ebeeca2 | ||
|  | c88f55af5a | ||
|  | 2dca74edb2 | ||
|  | e35fd1e01e | ||
|  | 86be6a77d7 | ||
|  | 7d2f215b80 | ||
|  | 7d9a641e24 | ||
|  | e0c69b9cf4 | ||
|  | 5f971dcddb | ||
|  | b539f0a926 | ||
|  | db82fe7b8f | ||
|  | 81c9f4ad47 | ||
|  | 092f81cb00 | ||
|  | fc4596c0bc | ||
|  | f6587ae8da | ||
|  | 0a30bf6d8e | ||
|  | 8bec3cf053 | ||
|  | 43efc044d7 | ||
|  | 63e71624f9 | ||
|  | 3edaa143e4 | ||
|  | 798bddd17f | ||
|  | 4f27e25a23 | ||
|  | a2a1f48310 | ||
|  | c246548436 | ||
|  | f67cfeb231 | ||
|  | 9758f8b391 | ||
|  | c45aaff610 | ||
|  | bd32a10de7 | ||
|  | ef83be07cd | ||
|  | 9fe33737eb | ||
|  | 51c7acf466 | ||
|  | d8490c289d | ||
|  | 1d73d4dcbb | ||
|  | 6d28d15d4f | ||
|  | 3890785fc7 | ||
|  | 38d34c810b | ||
|  | b2d6752b80 | ||
|  | 47a6e0dc7c | ||
|  | 5b6299496f | ||
|  | 369127806f | ||
|  | ee9b0e710c | ||
|  | 6e0819b0a7 | ||
|  | d8c9cd6579 | ||
|  | ae2dad01ff | ||
|  | 3345b26fa9 | ||
|  | 99e3b8ac4f | 
							
								
								
									
										2
									
								
								.flutter
									
									
									
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								.flutter
									
									
									
									
									
								
							 Submodule .flutter updated: ea121f8859...6fba2447e9
									
								
							
							
								
								
									
										4
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.github/workflows/release.yml
									
									
									
									
										vendored
									
									
								
							| @@ -20,7 +20,7 @@ jobs: | ||||
|       - uses: actions/setup-java@v4 | ||||
|         with: | ||||
|           distribution: 'temurin' # See 'Supported distributions' for available options | ||||
|           java-version: '17' | ||||
|           java-version: '21' | ||||
|  | ||||
|       - name: Flutter Doctor | ||||
|         id: flutter_doctor | ||||
| @@ -44,7 +44,7 @@ jobs: | ||||
|  | ||||
|       - name: Build APKs | ||||
|         run: | | ||||
|           sed -i 's/signingConfig signingConfigs.release//g' android/app/build.gradle | ||||
|           sed -i 's/signingConfig = signingConfigs.getByName("release")//g' android/app/build.gradle.kts | ||||
|           flutter build apk --flavor normal && flutter build apk --split-per-abi --flavor normal | ||||
|           for file in build/app/outputs/flutter-apk/app-*normal*.apk*; do mv "$file" "${file//-normal/}"; done | ||||
|           flutter build apk --flavor fdroid -t lib/main_fdroid.dart && flutter build apk --split-per-abi --flavor fdroid -t lib/main_fdroid.dart | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| #  Obtainium | ||||
| <div align="center"><a href="https://github.com/Safouene1/support-palestine-banner/blob/master/Markdown-pages/Support.md"><img src="https://raw.githubusercontent.com/Safouene1/support-palestine-banner/master/banner-support.svg" alt="Support Palestine" style="width: 100%;"></a></div> | ||||
|  | ||||
| [](https://techforpalestine.org/learn-more) | ||||
| #  Obtainium | ||||
|  | ||||
| Get Android app updates straight from the source. | ||||
|  | ||||
| @@ -63,7 +63,7 @@ Or, contribute some configurations to the website by creating a PR at [this repo | ||||
|       | ||||
| Verification info: | ||||
| - Package ID: `dev.imranr.obtainium` | ||||
| - SHA-256 Hash of Signing Certificate: `B3:53:60:1F:6A:1D:5F:D6:60:3A:E2:F5:0B:E8:0C:F3:01:36:7B:86:B6:AB:8B:1F:66:24:3D:A9:6C:D5:73:62` | ||||
| - SHA-256 hash of signing certificate: `B3:53:60:1F:6A:1D:5F:D6:60:3A:E2:F5:0B:E8:0C:F3:01:36:7B:86:B6:AB:8B:1F:66:24:3D:A9:6C:D5:73:62` | ||||
|   - Note: The above signature is also valid for the F-Droid flavour of Obtainium, thanks to [reproducible builds](https://f-droid.org/docs/Reproducible_Builds/). | ||||
| - [PGP Public Key](https://keyserver.ubuntu.com/pks/lookup?search=contact%40imranr.dev&fingerprint=on&op=index) (to verify APK hashes) | ||||
|  | ||||
|   | ||||
| @@ -1,105 +0,0 @@ | ||||
| plugins { | ||||
|     id "com.android.application" | ||||
|     id "kotlin-android" | ||||
|     // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. | ||||
|     id "dev.flutter.flutter-gradle-plugin" | ||||
| } | ||||
|  | ||||
| def localProperties = new Properties() | ||||
| def localPropertiesFile = rootProject.file('local.properties') | ||||
| if (localPropertiesFile.exists()) { | ||||
|     localPropertiesFile.withReader('UTF-8') { reader -> | ||||
|         localProperties.load(reader) | ||||
|     } | ||||
| } | ||||
|  | ||||
| def flutterVersionCode = localProperties.getProperty('flutter.versionCode') | ||||
| if (flutterVersionCode == null) { | ||||
|     flutterVersionCode = '1' | ||||
| } | ||||
|  | ||||
| def flutterVersionName = localProperties.getProperty('flutter.versionName') | ||||
| if (flutterVersionName == null) { | ||||
|     flutterVersionName = '1.0' | ||||
| } | ||||
|  | ||||
| def keystoreProperties = new Properties() | ||||
| def keystorePropertiesFile = rootProject.file('key.properties') | ||||
| if (keystorePropertiesFile.exists()) { | ||||
|     keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) | ||||
| } | ||||
|  | ||||
| android { | ||||
|     namespace = "dev.imranr.obtainium" | ||||
|     compileSdk = flutter.compileSdkVersion | ||||
|     ndkVersion = flutter.ndkVersion | ||||
|  | ||||
|     compileOptions { | ||||
|         sourceCompatibility = JavaVersion.VERSION_1_8 | ||||
|         targetCompatibility = JavaVersion.VERSION_1_8 | ||||
|     } | ||||
|  | ||||
|     kotlinOptions { | ||||
|         jvmTarget = JavaVersion.VERSION_1_8 | ||||
|     } | ||||
|  | ||||
|     defaultConfig { | ||||
|         // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). | ||||
|         applicationId = "dev.imranr.obtainium" | ||||
|         // You can update the following values to match your application needs. | ||||
|         // For more information, see: https://flutter.dev/to/review-gradle-config. | ||||
|         minSdk = 24 | ||||
|         targetSdk = flutter.targetSdkVersion | ||||
|         versionCode = flutter.versionCode | ||||
|         versionName = flutter.versionName | ||||
|     } | ||||
|  | ||||
|     flavorDimensions "flavor" | ||||
|  | ||||
|     productFlavors { | ||||
|         normal { | ||||
|             dimension "flavor" | ||||
|             applicationIdSuffix "" | ||||
|         } | ||||
|         fdroid { | ||||
|             dimension "flavor" | ||||
|             applicationIdSuffix ".fdroid" | ||||
|         } | ||||
|     } | ||||
|      | ||||
|     signingConfigs { | ||||
|         release { | ||||
|             keyAlias keystoreProperties['keyAlias'] | ||||
|             keyPassword keystoreProperties['keyPassword'] | ||||
|             storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null | ||||
|             storePassword keystoreProperties['storePassword'] | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     buildTypes { | ||||
|         release { | ||||
|             signingConfig signingConfigs.release | ||||
|         } | ||||
|         debug { | ||||
|             applicationIdSuffix = ".debug" | ||||
|             versionNameSuffix = "-debug" | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| flutter { | ||||
|     source = "../.." | ||||
| } | ||||
|  | ||||
| ext.abiCodes = ["x86_64": 1, "armeabi-v7a": 2, "arm64-v8a": 3] | ||||
| import com.android.build.OutputFile | ||||
| android.applicationVariants.all { variant -> | ||||
|     variant.outputs.each { output -> | ||||
|         def abiVersionCode = project.ext.abiCodes.get(output.getFilter(OutputFile.ABI)) | ||||
|         if (abiVersionCode != null) { | ||||
|             output.versionCodeOverride = variant.versionCode * 10 + abiVersionCode | ||||
|         } else { | ||||
|             output.versionCodeOverride = variant.versionCode * 10 | ||||
|         } | ||||
|     } | ||||
| } | ||||
							
								
								
									
										107
									
								
								android/app/build.gradle.kts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										107
									
								
								android/app/build.gradle.kts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,107 @@ | ||||
| import java.io.FileInputStream | ||||
| import java.util.Properties | ||||
| import com.android.build.api.variant.FilterConfiguration.FilterType.* | ||||
|  | ||||
| plugins { | ||||
|     id("com.android.application") | ||||
|     id("kotlin-android") | ||||
|     // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. | ||||
|     id("dev.flutter.flutter-gradle-plugin") | ||||
| } | ||||
|  | ||||
| val localProperties = Properties() | ||||
| val localPropertiesFile = rootProject.file("local.properties") | ||||
| if (localPropertiesFile.exists()) { | ||||
|     localPropertiesFile.reader(Charsets.UTF_8).use { reader -> | ||||
|         localProperties.load(reader) | ||||
|     } | ||||
| } | ||||
|  | ||||
| var flutterVersionCode = localProperties.getProperty("flutter.versionCode") ?: "1" | ||||
| var flutterVersionName = localProperties.getProperty("flutter.versionName") ?: "1.0" | ||||
|  | ||||
| val keystoreProperties = Properties() | ||||
| val keystorePropertiesFile = rootProject.file("key.properties") | ||||
| if (keystorePropertiesFile.exists()) { | ||||
|     keystoreProperties.load(FileInputStream(keystorePropertiesFile)) | ||||
| } | ||||
|  | ||||
| android { | ||||
|     namespace = "dev.imranr.obtainium" | ||||
|     compileSdk = flutter.compileSdkVersion | ||||
|     ndkVersion = "27.0.12077973" // 'flutter.ndkVersion' produces warnings (TODO can/should we switch back?) | ||||
|  | ||||
|     compileOptions { | ||||
|         isCoreLibraryDesugaringEnabled = true | ||||
|         sourceCompatibility = JavaVersion.VERSION_11 | ||||
|         targetCompatibility = JavaVersion.VERSION_11 | ||||
|     } | ||||
|  | ||||
|     kotlinOptions { | ||||
|         jvmTarget = JavaVersion.VERSION_11.toString() | ||||
|     } | ||||
|  | ||||
|     defaultConfig { | ||||
|         applicationId = "dev.imranr.obtainium" | ||||
|         // You can update the following values to match your application needs. | ||||
|         // For more information, see: https://flutter.dev/to/review-gradle-config. | ||||
|         minSdk = 24 | ||||
|         targetSdk = flutter.targetSdkVersion | ||||
|         versionCode = flutterVersionCode.toInt() | ||||
|         versionName = flutterVersionName | ||||
|     } | ||||
|  | ||||
|     flavorDimensions("flavor") | ||||
|  | ||||
|     productFlavors { | ||||
|         create("normal") { | ||||
|             dimension = "flavor" | ||||
|             applicationIdSuffix = "" | ||||
|         } | ||||
|         create("fdroid") { | ||||
|             dimension = "flavor" | ||||
|             applicationIdSuffix = ".fdroid" | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     signingConfigs { | ||||
|         create("release") { | ||||
|             keyAlias = keystoreProperties["keyAlias"].toString() | ||||
|             keyPassword = keystoreProperties["keyPassword"].toString() | ||||
|             storeFile = keystoreProperties["storeFile"]?.let { file(it) } | ||||
|             storePassword = keystoreProperties["storePassword"].toString() | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     buildTypes { | ||||
|         getByName("release") { | ||||
|             signingConfig = signingConfigs.getByName("release") | ||||
|         } | ||||
|         getByName("debug") { | ||||
|             applicationIdSuffix = ".debug" | ||||
|             versionNameSuffix = "-debug" | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| val abiCodes = mapOf("x86_64" to 1, "armeabi-v7a" to 2, "arm64-v8a" to 3) | ||||
|  | ||||
| androidComponents { | ||||
|     onVariants { variant -> | ||||
|         variant.outputs.forEach { output -> | ||||
|             val name = output.filters.find { it.filterType == ABI }?.identifier | ||||
|             val baseAbiCode = abiCodes[name] ?: 0 | ||||
|             if (baseAbiCode != null) { | ||||
|                 output.versionCode.set(baseAbiCode + ((output.versionCode.get() ?: 0) * 10)) | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| dependencies { | ||||
|     coreLibraryDesugaring("com.android.tools:desugar_jdk_libs:2.1.5") | ||||
| } | ||||
|  | ||||
| flutter { | ||||
|     source = "../.." | ||||
| } | ||||
| @@ -2,4 +2,4 @@ package dev.imranr.obtainium | ||||
|  | ||||
| import io.flutter.embedding.android.FlutterActivity | ||||
|  | ||||
| class MainActivity: FlutterActivity() | ||||
| class MainActivity : FlutterActivity() | ||||
|   | ||||
| @@ -1,22 +0,0 @@ | ||||
| allprojects { | ||||
|     repositories { | ||||
|         google() | ||||
|         mavenCentral() | ||||
|         maven { | ||||
|             // [required] background_fetch | ||||
|             url "${project(':background_fetch').projectDir}/libs" | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| rootProject.buildDir = "../build" | ||||
| subprojects { | ||||
|     project.buildDir = "${rootProject.buildDir}/${project.name}" | ||||
| } | ||||
| subprojects { | ||||
|     project.evaluationDependsOn(":app") | ||||
| } | ||||
|  | ||||
| tasks.register("clean", Delete) { | ||||
|     delete rootProject.buildDir | ||||
| } | ||||
							
								
								
									
										25
									
								
								android/build.gradle.kts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								android/build.gradle.kts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| allprojects { | ||||
|     repositories { | ||||
|         google() | ||||
|         mavenCentral() | ||||
|         maven { | ||||
|             // [required] background_fetch | ||||
|             url = uri("${project(":background_fetch").projectDir}/libs") | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| val newBuildDir: Directory = rootProject.layout.buildDirectory.dir("../../build").get() | ||||
| rootProject.layout.buildDirectory.value(newBuildDir) | ||||
|  | ||||
| subprojects { | ||||
|     val newSubprojectBuildDir: Directory = newBuildDir.dir(project.name) | ||||
|     project.layout.buildDirectory.value(newSubprojectBuildDir) | ||||
| } | ||||
| subprojects { | ||||
|     project.evaluationDependsOn(":app") | ||||
| } | ||||
|  | ||||
| tasks.register<Delete>("clean") { | ||||
|     delete(rootProject.layout.buildDirectory) | ||||
| } | ||||
| @@ -1,3 +1,3 @@ | ||||
| org.gradle.jvmargs=-Xmx4G -XX:MaxMetaspaceSize=2G -XX:+HeapDumpOnOutOfMemoryError | ||||
| org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError | ||||
| android.useAndroidX=true | ||||
| android.enableJetifier=true | ||||
|   | ||||
| @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME | ||||
| distributionPath=wrapper/dists | ||||
| zipStoreBase=GRADLE_USER_HOME | ||||
| zipStorePath=wrapper/dists | ||||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip | ||||
| distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip | ||||
|   | ||||
| @@ -1,25 +0,0 @@ | ||||
| pluginManagement { | ||||
|     def flutterSdkPath = { | ||||
|         def properties = new Properties() | ||||
|         file("local.properties").withInputStream { properties.load(it) } | ||||
|         def flutterSdkPath = properties.getProperty("flutter.sdk") | ||||
|         assert flutterSdkPath != null, "flutter.sdk not set in local.properties" | ||||
|         return flutterSdkPath | ||||
|     }() | ||||
|  | ||||
|     includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") | ||||
|  | ||||
|     repositories { | ||||
|         google() | ||||
|         mavenCentral() | ||||
|         gradlePluginPortal() | ||||
|     } | ||||
| } | ||||
|  | ||||
| plugins { | ||||
|     id "dev.flutter.flutter-plugin-loader" version "1.0.0" | ||||
|     id "com.android.application" version "8.1.0" apply false | ||||
|     id "org.jetbrains.kotlin.android" version "2.1.21" apply false | ||||
| } | ||||
|  | ||||
| include ":app" | ||||
							
								
								
									
										25
									
								
								android/settings.gradle.kts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								android/settings.gradle.kts
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,25 @@ | ||||
| pluginManagement { | ||||
|     val flutterSdkPath = run { | ||||
|         val properties = java.util.Properties() | ||||
|         file("local.properties").inputStream().use { properties.load(it) } | ||||
|         val flutterSdkPath = properties.getProperty("flutter.sdk") | ||||
|         require(flutterSdkPath != null) { "flutter.sdk not set in local.properties" } | ||||
|         flutterSdkPath | ||||
|     } | ||||
|  | ||||
|     includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") | ||||
|  | ||||
|     repositories { | ||||
|         google() | ||||
|         mavenCentral() | ||||
|         gradlePluginPortal() | ||||
|     } | ||||
| } | ||||
|  | ||||
| plugins { | ||||
|     id("dev.flutter.flutter-plugin-loader") version "1.0.0" | ||||
|     id("com.android.application") version "8.7.3" apply false | ||||
|     id("org.jetbrains.kotlin.android") version "2.1.0" apply false | ||||
| } | ||||
|  | ||||
| include(":app") | ||||
							
								
								
									
										393
									
								
								assets/translations/ar.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										393
									
								
								assets/translations/ar.json
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,393 @@ | ||||
| { | ||||
|     "invalidURLForSource": "رابط تطبيق {} غير صالح", | ||||
|     "noReleaseFound": "تعذر العثور على إصدار مناسب", | ||||
|     "noVersionFound": "تعذر تحديد إصدار التطبيق", | ||||
|     "urlMatchesNoSource": "الرابط لا يتطابق مع مصدر معروف", | ||||
|     "cantInstallOlderVersion": "لا يمكن تثبيت إصدار أقدم من التطبيق", | ||||
|     "appIdMismatch": "معرّف الحزمة المحملة لا يتطابق مع معرّف التطبيق الحالي", | ||||
|     "functionNotImplemented": "هذه الوظيفة غير مطبقة في هذا الصنف", | ||||
|     "placeholder": "عنصر نائب", | ||||
|     "someErrors": "حدثت بعض الأخطاء", | ||||
|     "unexpectedError": "خطأ غير متوقع", | ||||
|     "ok": "موافق", | ||||
|     "and": "و", | ||||
|     "githubPATLabel": "رمز الوصول الشخصي لـ GitHub (يزيد من الحد المسموح)", | ||||
|     "includePrereleases": "تضمين الإصدارات الأولية", | ||||
|     "fallbackToOlderReleases": "الرجوع إلى الإصدارات الأقدم", | ||||
|     "filterReleaseTitlesByRegEx": "تصفية عناوين الإصدارات باستخدام تعبير نمطي", | ||||
|     "invalidRegEx": "تعبير نمطي غير صالح", | ||||
|     "noDescription": "لا يوجد وصف", | ||||
|     "cancel": "إلغاء", | ||||
|     "continue": "متابعة", | ||||
|     "requiredInBrackets": "(مطلوب)", | ||||
|     "dropdownNoOptsError": "خطأ: يجب أن يحتوي القائمة المنسدلة على خيار واحد على الأقل", | ||||
|     "colour": "لون", | ||||
|     "standard": "قياسي", | ||||
|     "custom": "مخصص", | ||||
|     "useMaterialYou": "استخدم Material You", | ||||
|     "githubStarredRepos": "مستودعات GitHub المفضلة", | ||||
|     "uname": "اسم المستخدم", | ||||
|     "wrongArgNum": "عدد وسائط غير صحيح", | ||||
|     "xIsTrackOnly": "{} للتعقب فقط", | ||||
|     "source": "المصدر", | ||||
|     "app": "التطبيق", | ||||
|     "appsFromSourceAreTrackOnly": "تطبيقات هذا المصدر للتعقب فقط.", | ||||
|     "youPickedTrackOnly": "لقد اخترت خيار 'التعقب فقط'.", | ||||
|     "trackOnlyAppDescription": "سيتم تعقب التطبيق للتحديثات، لكن Obtainium لن يتمكن من تنزيله أو تثبيته.", | ||||
|     "cancelled": "تم الإلغاء", | ||||
|     "appAlreadyAdded": "التطبيق مضاف بالفعل", | ||||
|     "alreadyUpToDateQuestion": "التطبيق محدث بالفعل؟", | ||||
|     "addApp": "إضافة تطبيق", | ||||
|     "appSourceURL": "رابط مصدر التطبيق", | ||||
|     "error": "خطأ", | ||||
|     "add": "إضافة", | ||||
|     "searchSomeSourcesLabel": "بحث (بعض المصادر فقط)", | ||||
|     "search": "بحث", | ||||
|     "additionalOptsFor": "خيارات إضافية لـ {}", | ||||
|     "supportedSources": "المصادر المدعومة", | ||||
|     "trackOnlyInBrackets": "(للتعقب فقط)", | ||||
|     "searchableInBrackets": "(قابل للبحث)", | ||||
|     "appsString": "التطبيقات", | ||||
|     "noApps": "لا توجد تطبيقات", | ||||
|     "noAppsForFilter": "لا توجد تطبيقات تطابق الفلتر", | ||||
|     "byX": "بواسطة {}", | ||||
|     "percentProgress": "التقدم: {}%", | ||||
|     "pleaseWait": "يرجى الانتظار", | ||||
|     "updateAvailable": "تحديث متاح", | ||||
|     "notInstalled": "غير مثبت", | ||||
|     "pseudoVersion": "إصدار وهمي", | ||||
|     "selectAll": "تحديد الكل", | ||||
|     "deselectX": "إلغاء تحديد {}", | ||||
|     "xWillBeRemovedButRemainInstalled": "سيتم إزالة {} من Obtainium لكنه سيظل مثبتًا على الجهاز.", | ||||
|     "removeSelectedAppsQuestion": "إزالة التطبيقات المحددة؟", | ||||
|     "removeSelectedApps": "إزالة التطبيقات المحددة", | ||||
|     "updateX": "تحديث {}", | ||||
|     "installX": "تثبيت {}", | ||||
|     "markXTrackOnlyAsUpdated": "تعليم {}\n(للتعقب فقط)\nكمحدث", | ||||
|     "changeX": "تغيير {}", | ||||
|     "installUpdateApps": "تثبيت/تحديث التطبيقات", | ||||
|     "installUpdateSelectedApps": "تثبيت/تحديث التطبيقات المحددة", | ||||
|     "markXSelectedAppsAsUpdated": "تعليم {} تطبيقات محددة كمحدثة؟", | ||||
|     "no": "لا", | ||||
|     "yes": "نعم", | ||||
|     "markSelectedAppsUpdated": "تعليم التطبيقات المحددة كمحدثة", | ||||
|     "pinToTop": "تثبيت في الأعلى", | ||||
|     "unpinFromTop": "إلغاء التثبيت من الأعلى", | ||||
|     "resetInstallStatusForSelectedAppsQuestion": "إعادة تعيين حالة التثبيت للتطبيقات المحددة؟", | ||||
|     "installStatusOfXWillBeResetExplanation": "سيتم إعادة تعيين حالة التثبيت لأي تطبيقات محددة.\n\nقد يساعد هذا عندما يكون إصدار التطبيق المعروض في Obtainium غير صحيح بسبب فشل التحديثات أو مشاكل أخرى.", | ||||
|     "customLinkMessage": "هذه الروابط تعمل على الأجهزة التي بها Obtainium مثبتًا", | ||||
|     "shareAppConfigLinks": "مشاركة تكوين التطبيق كرابط HTML", | ||||
|     "shareSelectedAppURLs": "مشاركة روابط التطبيقات المحددة", | ||||
|     "resetInstallStatus": "إعادة تعيين حالة التثبيت", | ||||
|     "more": "المزيد", | ||||
|     "removeOutdatedFilter": "إزالة فلتر التطبيقات غير المحدثة", | ||||
|     "showOutdatedOnly": "عرض التطبيقات غير المحدثة فقط", | ||||
|     "filter": "تصفية", | ||||
|     "filterApps": "تصفية التطبيقات", | ||||
|     "appName": "اسم التطبيق", | ||||
|     "author": "المؤلف", | ||||
|     "upToDateApps": "تطبيقات محدثة", | ||||
|     "nonInstalledApps": "تطبيقات غير مثبتة", | ||||
|     "importExport": "استيراد/تصدير", | ||||
|     "settings": "الإعدادات", | ||||
|     "exportedTo": "تم التصدير إلى {}", | ||||
|     "obtainiumExport": "تصدير Obtainium", | ||||
|     "invalidInput": "إدخال غير صالح", | ||||
|     "importedX": "تم استيراد {}", | ||||
|     "obtainiumImport": "استيراد Obtainium", | ||||
|     "importFromURLList": "استيراد من قائمة الروابط", | ||||
|     "searchQuery": "استعلام البحث", | ||||
|     "appURLList": "قائمة روابط التطبيقات", | ||||
|     "line": "سطر", | ||||
|     "searchX": "بحث {}", | ||||
|     "noResults": "لا توجد نتائج", | ||||
|     "importX": "استيراد {}", | ||||
|     "importedAppsIdDisclaimer": "قد تظهر التطبيقات المستوردة بشكل غير صحيح كـ \"غير مثبتة\".\nلإصلاح هذا، قم بإعادة تثبيتها عبر Obtainium.\nهذا لا يؤثر على بيانات التطبيق.\n\nينطبق فقط على طرق الاستيراد عبر الروابط أو الطرف الثالث.", | ||||
|     "importErrors": "أخطاء الاستيراد", | ||||
|     "importedXOfYApps": "تم استيراد {} من {} تطبيقات.", | ||||
|     "followingURLsHadErrors": "حدثت أخطاء في الروابط التالية:", | ||||
|     "selectURL": "اختر رابطًا", | ||||
|     "selectURLs": "اختر روابط", | ||||
|     "pick": "اختر", | ||||
|     "theme": "المظهر", | ||||
|     "dark": "مظلم", | ||||
|     "light": "فاتح", | ||||
|     "followSystem": "اتباع النظام", | ||||
|     "followSystemThemeExplanation": "اتباع مظهر النظام ممكن فقط باستخدام تطبيقات طرف ثالث", | ||||
|     "useBlackTheme": "استخدام المظهر الأسود الداكن بالكامل", | ||||
|     "appSortBy": "ترتيب التطبيقات حسب", | ||||
|     "authorName": "المؤلف/الاسم", | ||||
|     "nameAuthor": "الاسم/المؤلف", | ||||
|     "asAdded": "كما تمت إضافتها", | ||||
|     "appSortOrder": "ترتيب التطبيقات", | ||||
|     "ascending": "تصاعدي", | ||||
|     "descending": "تنازلي", | ||||
|     "bgUpdateCheckInterval": "فترة التحقق من التحديثات في الخلفية", | ||||
|     "neverManualOnly": "أبدًا - يدوي فقط", | ||||
|     "appearance": "المظهر", | ||||
|     "showWebInAppView": "عرض صفحة الويب المصدر في عرض التطبيق", | ||||
|     "pinUpdates": "تثبيت التحديثات في أعلى قائمة التطبيقات", | ||||
|     "updates": "التحديثات", | ||||
|     "sourceSpecific": "خاص بالمصدر", | ||||
|     "appSource": "مصدر التطبيق", | ||||
|     "noLogs": "لا توجد سجلات", | ||||
|     "appLogs": "سجلات التطبيق", | ||||
|     "close": "إغلاق", | ||||
|     "share": "مشاركة", | ||||
|     "appNotFound": "التطبيق غير موجود", | ||||
|     "obtainiumExportHyphenatedLowercase": "تصدير-obtainium", | ||||
|     "pickAnAPK": "اختر ملف APK", | ||||
|     "appHasMoreThanOnePackage": "{} يحتوي على أكثر من حزمة:", | ||||
|     "deviceSupportsXArch": "جهازك يدعم بنية المعالج {}.", | ||||
|     "deviceSupportsFollowingArchs": "جهازك يدعم بنى المعالج التالية:", | ||||
|     "warning": "تحذير", | ||||
|     "sourceIsXButPackageFromYPrompt": "مصدر التطبيق هو '{}' لكن الحزمة تأتي من '{}'. هل تتابع؟", | ||||
|     "updatesAvailable": "تحديثات متاحة", | ||||
|     "updatesAvailableNotifDescription": "يخطر المستخدم بوجود تحديثات لواحد أو أكثر من التطبيقات التي يتعقبها Obtainium", | ||||
|     "noNewUpdates": "لا توجد تحديثات جديدة.", | ||||
|     "xHasAnUpdate": "{} لديه تحديث.", | ||||
|     "appsUpdated": "تم تحديث التطبيقات", | ||||
|     "appsNotUpdated": "فشل تحديث التطبيقات", | ||||
|     "appsUpdatedNotifDescription": "يخطر المستخدم بأن تحديثات لواحد أو أكثر من التطبيقات تم تطبيقها في الخلفية", | ||||
|     "xWasUpdatedToY": "تم تحديث {} إلى {}.", | ||||
|     "xWasNotUpdatedToY": "فشل تحديث {} إلى {}.", | ||||
|     "errorCheckingUpdates": "خطأ في التحقق من التحديثات", | ||||
|     "errorCheckingUpdatesNotifDescription": "إشعار يظهر عند فشل التحقق من التحديثات في الخلفية", | ||||
|     "appsRemoved": "تمت إزالة التطبيقات", | ||||
|     "appsRemovedNotifDescription": "يخطر المستخدم بأنه تمت إزالة واحد أو أكثر من التطبيقات بسبب أخطاء أثناء تحميلها", | ||||
|     "xWasRemovedDueToErrorY": "تمت إزالة {} بسبب هذا الخطأ: {}", | ||||
|     "completeAppInstallation": "إكمال تثبيت التطبيق", | ||||
|     "obtainiumMustBeOpenToInstallApps": "يجب فتح Obtainium لتثبيت التطبيقات", | ||||
|     "completeAppInstallationNotifDescription": "يطلب من المستخدم العودة إلى Obtainium لإكمال تثبيت التطبيق", | ||||
|     "checkingForUpdates": "جاري التحقق من التحديثات", | ||||
|     "checkingForUpdatesNotifDescription": "إشعار مؤقت يظهر عند التحقق من التحديثات", | ||||
|     "pleaseAllowInstallPerm": "يرجى السماح لـ Obtainium بتثبيت التطبيقات", | ||||
|     "trackOnly": "للتعقب فقط", | ||||
|     "errorWithHttpStatusCode": "خطأ {}", | ||||
|     "versionCorrectionDisabled": "تعطيل تصحيح الإصدار (يبدو أن الملحق لا يعمل)", | ||||
|     "unknown": "غير معروف", | ||||
|     "none": "لا شيء", | ||||
|     "never": "أبدًا", | ||||
|     "latestVersionX": "الأحدث: {}", | ||||
|     "installedVersionX": "المثبت: {}", | ||||
|     "lastUpdateCheckX": "آخر تحقق من التحديثات: {}", | ||||
|     "remove": "إزالة", | ||||
|     "yesMarkUpdated": "نعم، تعليم كمحدث", | ||||
|     "fdroid": "F-Droid الرسمي", | ||||
|     "appIdOrName": "معرّف التطبيق أو الاسم", | ||||
|     "appId": "معرّف التطبيق", | ||||
|     "appWithIdOrNameNotFound": "لم يتم العثور على تطبيق بهذا المعرّف أو الاسم", | ||||
|     "reposHaveMultipleApps": "قد تحتوي المستودعات على عدة تطبيقات", | ||||
|     "fdroidThirdPartyRepo": "مستودع F-Droid طرف ثالث", | ||||
|     "install": "تثبيت", | ||||
|     "markInstalled": "تعليم كمثبت", | ||||
|     "update": "تحديث", | ||||
|     "markUpdated": "تعليم كمحدث", | ||||
|     "additionalOptions": "خيارات إضافية", | ||||
|     "disableVersionDetection": "تعطيل اكتشاف الإصدار", | ||||
|     "noVersionDetectionExplanation": "يجب استخدام هذا الخيار فقط للتطبيقات التي لا يعمل فيها اكتشاف الإصدار بشكل صحيح.", | ||||
|     "downloadingX": "جاري تنزيل {}", | ||||
|     "downloadX": "تنزيل {}", | ||||
|     "downloadedX": "تم تنزيل {}", | ||||
|     "releaseAsset": "ملف الإصدار", | ||||
|     "downloadNotifDescription": "يخطر المستخدم بالتقدم في تنزيل التطبيق", | ||||
|     "noAPKFound": "لم يتم العثور على ملف APK", | ||||
|     "noVersionDetection": "لا يوجد اكتشاف للإصدار", | ||||
|     "categorize": "تصنيف", | ||||
|     "categories": "التصنيفات", | ||||
|     "category": "تصنيف", | ||||
|     "noCategory": "بدون تصنيف", | ||||
|     "noCategories": "لا توجد تصنيفات", | ||||
|     "deleteCategoriesQuestion": "حذف التصنيفات؟", | ||||
|     "categoryDeleteWarning": "سيتم تعيين جميع التطبيقات في التصنيفات المحذوفة كغير مصنفة.", | ||||
|     "addCategory": "إضافة تصنيف", | ||||
|     "label": "تسمية", | ||||
|     "language": "اللغة", | ||||
|     "copiedToClipboard": "تم النسخ إلى الحافظة", | ||||
|     "storagePermissionDenied": "تم رفض إذن التخزين", | ||||
|     "selectedCategorizeWarning": "سيؤدي هذا إلى استبدال أي إعدادات تصنيف موجودة للتطبيقات المحددة.", | ||||
|     "filterAPKsByRegEx": "تصفية ملفات APK باستخدام تعبير نمطي", | ||||
|     "removeFromObtainium": "إزالة من Obtainium", | ||||
|     "uninstallFromDevice": "إلغاء التثبيت من الجهاز", | ||||
|     "onlyWorksWithNonVersionDetectApps": "يعمل فقط مع التطبيقات التي تم تعطيل اكتشاف الإصدار لها.", | ||||
|     "releaseDateAsVersion": "استخدام تاريخ الإصدار كسلسلة إصدار", | ||||
|     "releaseTitleAsVersion": "استخدام عنوان الإصدار كسلسلة إصدار", | ||||
|     "releaseDateAsVersionExplanation": "يجب استخدام هذا الخيار فقط للتطبيقات التي لا يعمل فيها اكتشاف الإصدار بشكل صحيح، ولكن تاريخ الإصدار متاح.", | ||||
|     "changes": "التغييرات", | ||||
|     "releaseDate": "تاريخ الإصدار", | ||||
|     "importFromURLsInFile": "استيراد من روابط في ملف (مثل OPML)", | ||||
|     "versionDetectionExplanation": "تنسيق سلسلة الإصدار مع الإصدار المكتشف من النظام", | ||||
|     "versionDetection": "اكتشاف الإصدار", | ||||
|     "standardVersionDetection": "اكتشاف الإصدار القياسي", | ||||
|     "groupByCategory": "التجميع حسب التصنيف", | ||||
|     "autoApkFilterByArch": "محاولة تصفية ملفات APK حسب بنية المعالج إذا أمكن", | ||||
|     "autoLinkFilterByArch": "محاولة تصفية الروابط حسب بنية المعالج إذا أمكن", | ||||
|     "overrideSource": "تجاوز المصدر", | ||||
|     "dontShowAgain": "عدم إظهار هذا مرة أخرى", | ||||
|     "dontShowTrackOnlyWarnings": "عدم إظهار تحذيرات 'للتعقب فقط'", | ||||
|     "dontShowAPKOriginWarnings": "عدم إظهار تحذيرات مصدر APK", | ||||
|     "moveNonInstalledAppsToBottom": "نقل التطبيقات غير المثبتة إلى أسفل قائمة التطبيقات", | ||||
|     "gitlabPATLabel": "رمز الوصول الشخصي لـ GitLab", | ||||
|     "about": "حول", | ||||
|     "requiresCredentialsInSettings": "{} يحتاج إلى بيانات اعتماد إضافية (في الإعدادات)", | ||||
|     "checkOnStart": "التحقق من التحديثات عند البدء", | ||||
|     "tryInferAppIdFromCode": "محاولة استنتاج معرّف التطبيق من الكود المصدري", | ||||
|     "removeOnExternalUninstall": "إزالة التطبيقات المثبتة خارجيًا تلقائيًا", | ||||
|     "pickHighestVersionCode": "تحديد أعلى إصدار تلقائيًا", | ||||
|     "checkUpdateOnDetailPage": "التحقق من التحديثات عند فتح صفحة التفاصيل", | ||||
|     "disablePageTransitions": "تعطيل انتقالات الصفحات", | ||||
|     "reversePageTransitions": "عكس انتقالات الصفحات", | ||||
|     "minStarCount": "الحد الأدنى لعدد النجوم", | ||||
|     "addInfoBelow": "أضف هذه المعلومات أدناه.", | ||||
|     "addInfoInSettings": "أضف هذه المعلومات في الإعدادات.", | ||||
|     "githubSourceNote": "يمكن تجنب الحد المسموح لـ GitHub باستخدام مفتاح API.", | ||||
|     "sortByLastLinkSegment": "الفرز حسب الجزء الأخير من الرابط فقط", | ||||
|     "filterReleaseNotesByRegEx": "تصفية ملاحظات الإصدار باستخدام تعبير نمطي", | ||||
|     "customLinkFilterRegex": "تصفية روابط APK المخصصة باستخدام تعبير نمطي (افتراضيًا '.apk$')", | ||||
|     "appsPossiblyUpdated": "تمت محاولة تحديث التطبيقات", | ||||
|     "appsPossiblyUpdatedNotifDescription": "يخطر المستخدم بأن تحديثات لواحد أو أكثر من التطبيقات قد تم تطبيقها في الخلفية", | ||||
|     "xWasPossiblyUpdatedToY": "{} قد تم تحديثه إلى {}.", | ||||
|     "enableBackgroundUpdates": "تمكين التحديثات في الخلفية", | ||||
|     "backgroundUpdateReqsExplanation": "قد لا تكون التحديثات في الخلفية ممكنة لجميع التطبيقات.", | ||||
|     "backgroundUpdateLimitsExplanation": "يمكن تحديد نجاح التثبيت في الخلفية فقط عند فتح Obtainium.", | ||||
|     "verifyLatestTag": "التحقق من علامة 'الأحدث'", | ||||
|     "intermediateLinkRegex": "تصفية للوصول إلى رابط 'وسيط'", | ||||
|     "filterByLinkText": "تصفية الروابط حسب نص الرابط", | ||||
|     "intermediateLinkNotFound": "لم يتم العثور على رابط وسيط", | ||||
|     "intermediateLink": "رابط وسيط", | ||||
|     "exemptFromBackgroundUpdates": "إعفاء من التحديثات في الخلفية (إذا تم تمكينها)", | ||||
|     "bgUpdatesOnWiFiOnly": "تعطيل التحديثات في الخلفية عند عدم الاتصال بشبكة Wi-Fi", | ||||
|     "bgUpdatesWhileChargingOnly": "تعطيل التحديثات في الخلفية عند عدم الشحن", | ||||
|     "autoSelectHighestVersionCode": "تحديد أعلى إصدار تلقائيًا", | ||||
|     "versionExtractionRegEx": "تعبير نمطي لاستخراج الإصدار", | ||||
|     "trimVersionString": "قص سلسلة الإصدار باستخدام تعبير نمطي", | ||||
|     "matchGroupToUseForX": "مجموعة المطابقة لاستخدامها لـ \"{}\"", | ||||
|     "matchGroupToUse": "مجموعة المطابقة لاستخدامها في تعبير استخراج الإصدار", | ||||
|     "highlightTouchTargets": "تمييز أهداف اللمس الأقل وضوحًا", | ||||
|     "pickExportDir": "اختر دليل التصدير", | ||||
|     "autoExportOnChanges": "تصدير تلقائي عند التغييرات", | ||||
|     "includeSettings": "تضمين الإعدادات", | ||||
|     "filterVersionsByRegEx": "تصفية الإصدارات باستخدام تعبير نمطي", | ||||
|     "trySelectingSuggestedVersionCode": "محاولة تحديد الإصدار المقترح تلقائيًا", | ||||
|     "dontSortReleasesList": "الحفاظ على ترتيب الإصدارات من API", | ||||
|     "reverseSort": "فرز عكسي", | ||||
|     "takeFirstLink": "أخذ أول رابط", | ||||
|     "skipSort": "تخطي الفرز", | ||||
|     "debugMenu": "قائمة التصحيح", | ||||
|     "bgTaskStarted": "بدأت المهمة في الخلفية - تحقق من السجلات.", | ||||
|     "runBgCheckNow": "تشغيل التحقق من التحديثات في الخلفية الآن", | ||||
|     "versionExtractWholePage": "تطبيق تعبير استخراج الإصدار على الصفحة بأكملها", | ||||
|     "installing": "جاري التثبيت", | ||||
|     "skipUpdateNotifications": "تخطي إشعارات التحديث", | ||||
|     "updatesAvailableNotifChannel": "تحديثات متاحة", | ||||
|     "appsUpdatedNotifChannel": "تم تحديث التطبيقات", | ||||
|     "appsPossiblyUpdatedNotifChannel": "تمت محاولة تحديث التطبيقات", | ||||
|     "errorCheckingUpdatesNotifChannel": "خطأ في التحقق من التحديثات", | ||||
|     "appsRemovedNotifChannel": "تمت إزالة التطبيقات", | ||||
|     "downloadingXNotifChannel": "جاري تنزيل {}", | ||||
|     "completeAppInstallationNotifChannel": "إكمال تثبيت التطبيق", | ||||
|     "checkingForUpdatesNotifChannel": "جاري التحقق من التحديثات", | ||||
|     "onlyCheckInstalledOrTrackOnlyApps": "التحقق فقط من التطبيقات المثبتة أو للتعقب فقط", | ||||
|     "supportFixedAPKURL": "دعم روابط APK الثابتة", | ||||
|     "selectX": "اختر {}", | ||||
|     "parallelDownloads": "السماح بالتنزيل المتوازي", | ||||
|     "useShizuku": "استخدم Shizuku أو Sui للتثبيت", | ||||
|     "shizukuBinderNotFound": "خدمة Shizuku غير قيد التشغيل", | ||||
|     "shizukuOld": "إصدار قديم من Shizuku (<11) - قم بتحديثه", | ||||
|     "shizukuOldAndroidWithADB": "Shizuku يعمل على إصدار أندرويد < 8.1 مع ADB - قم بتحديث أندرويد أو استخدم Sui بدلاً من ذلك", | ||||
|     "shizukuPretendToBeGooglePlay": "تعيين Google Play كمصدر التثبيت (إذا تم استخدام Shizuku)", | ||||
|     "useSystemFont": "استخدم خط النظام", | ||||
|     "useVersionCodeAsOSVersion": "استخدم versionCode كإصدار مكتشف من النظام", | ||||
|     "requestHeader": "رأس الطلب", | ||||
|     "useLatestAssetDateAsReleaseDate": "استخدام أحدث تاريخ تحميل كتاريخ إصدار", | ||||
|     "defaultPseudoVersioningMethod": "طريقة الإصدار الوهمي الافتراضية", | ||||
|     "partialAPKHash": "جزء من تجزئة APK", | ||||
|     "APKLinkHash": "تجزئة رابط APK", | ||||
|     "directAPKLink": "رابط APK مباشر", | ||||
|     "pseudoVersionInUse": "يتم استخدام إصدار وهمي", | ||||
|     "installed": "مثبت", | ||||
|     "latest": "الأحدث", | ||||
|     "invertRegEx": "عكس التعبير النمطي", | ||||
|     "note": "ملاحظة", | ||||
|     "selfHostedNote": "يمكن استخدام القائمة المنسدلة \"{}\" للوصول إلى نسخ مخصصة/مستضافة ذاتيًا لأي مصدر.", | ||||
|     "badDownload": "تعذر تحليل ملف APK (تنزيل غير متوافق أو غير مكتمل)", | ||||
|     "beforeNewInstallsShareToAppVerifier": "مشاركة التطبيقات الجديدة مع AppVerifier (إذا كان متاحًا)", | ||||
|     "appVerifierInstructionToast": "شارك مع AppVerifier، ثم عد هنا عندما تكون جاهزًا.", | ||||
|     "wiki": "المساعدة/ويكي", | ||||
|     "crowdsourcedConfigsLabel": "تكوينات التطبيقات المقدمة من الجمهور (استخدم على مسؤوليتك)", | ||||
|     "crowdsourcedConfigsShort": "تكوينات التطبيقات المقدمة من الجمهور", | ||||
|     "allowInsecure": "السماح بطلبات HTTP غير الآمنة", | ||||
|     "stayOneVersionBehind": "البقاء بإصدار واحد خلف الأحدث", | ||||
|     "useFirstApkOfVersion": "التحديد التلقائي الأول من بين عدة ملفات APK", | ||||
|     "refreshBeforeDownload": "تحديث تفاصيل التطبيق قبل التنزيل", | ||||
|     "tencentAppStore": "متجر Tencent للتطبيقات", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "متجر vivo للتطبيقات (CN)", | ||||
|     "name": "الاسم", | ||||
|     "smartname": "الاسم (ذكي)", | ||||
|     "sortMethod": "طريقة الفرز", | ||||
|     "welcome": "مرحبًا", | ||||
|     "documentationLinksNote": "تحتوي صفحة Obtainium على GitHub المرتبطة أدناه على روابط لمقاطع فيديو، مقالات، مناقشات وموارد أخرى ستساعدك على فهم كيفية استخدام التطبيق.", | ||||
|     "batteryOptimizationNote": "لاحظ أن التنزيلات في الخلفية قد تعمل بشكل أكثر موثوقية إذا قمت بتعطيل تحسينات بطارية النظام لـ Obtainium.", | ||||
|     "fileDeletionError": "فشل حذف الملف (حاول حذفه يدويًا ثم حاول مرة أخرى): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "إزالة التطبيق؟", | ||||
|         "other": "إزالة التطبيقات؟" | ||||
|     }, | ||||
|     "tooManyRequestsTryAgainInMinutes": { | ||||
|         "one": "طلبات كثيرة جدًا (تم تحديد المعدل) - حاول مرة أخرى بعد {} دقيقة", | ||||
|         "other": "طلبات كثيرة جدًا (تم تحديد المعدل) - حاول مرة أخرى بعد {} دقائق" | ||||
|     }, | ||||
|     "bgUpdateGotErrorRetryInMinutes": { | ||||
|         "one": "واجه التحقق من التحديثات في الخلفية {}، سيتم جدولة محاولة أخرى بعد {} دقيقة", | ||||
|         "other": "واجه التحقق من التحديثات في الخلفية {}، سيتم جدولة محاولة أخرى بعد {} دقائق" | ||||
|     }, | ||||
|     "bgCheckFoundUpdatesWillNotifyIfNeeded": { | ||||
|         "one": "وجد التحقق من التحديثات في الخلفية {} تحديث - سيتم إخطار المستخدم إذا لزم الأمر", | ||||
|         "other": "وجد التحقق من التحديثات في الخلفية {} تحديثات - سيتم إخطار المستخدم إذا لزم الأمر" | ||||
|     }, | ||||
|     "apps": { | ||||
|         "one": "{} تطبيق", | ||||
|         "other": "{} تطبيقات" | ||||
|     }, | ||||
|     "url": { | ||||
|         "one": "{} رابط", | ||||
|         "other": "{} روابط" | ||||
|     }, | ||||
|     "minute": { | ||||
|         "one": "{} دقيقة", | ||||
|         "other": "{} دقائق" | ||||
|     }, | ||||
|     "hour": { | ||||
|         "one": "{} ساعة", | ||||
|         "other": "{} ساعات" | ||||
|     }, | ||||
|     "day": { | ||||
|         "one": "{} يوم", | ||||
|         "other": "{} أيام" | ||||
|     }, | ||||
|     "clearedNLogsBeforeXAfterY": { | ||||
|         "one": "تم مسح {n} سجل (قبل = {before}, بعد = {after})", | ||||
|         "other": "تم مسح {n} سجلات (قبل = {before}, بعد = {after})" | ||||
|     }, | ||||
|     "xAndNMoreUpdatesAvailable": { | ||||
|         "one": "{} وتطبيق واحد آخر لديه تحديثات.", | ||||
|         "other": "{} و{} تطبيقات أخرى لديها تحديثات." | ||||
|     }, | ||||
|     "xAndNMoreUpdatesInstalled": { | ||||
|         "one": "{} وتطبيق واحد آخر تم تحديثه.", | ||||
|         "other": "{} و{} تطبيقات أخرى تم تحديثها." | ||||
|     }, | ||||
|     "xAndNMoreUpdatesFailed": { | ||||
|         "one": "فشل تحديث {} وتطبيق واحد آخر.", | ||||
|         "other": "فشل تحديث {} و{} تطبيقات أخرى." | ||||
|     }, | ||||
|     "xAndNMoreUpdatesPossiblyInstalled": { | ||||
|         "one": "{} وتطبيق واحد آخر قد تم تحديثه.", | ||||
|         "other": "{} و{} تطبيقات أخرى قد تم تحديثها." | ||||
|     }, | ||||
|     "apk": { | ||||
|         "one": "{} APK", | ||||
|         "other": "{} APKs" | ||||
|     } | ||||
| } | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Crowdsourced App Configurations", | ||||
|     "allowInsecure": "Allow insecure HTTP requests", | ||||
|     "stayOneVersionBehind": "Stay one version behind latest", | ||||
|     "useFirstApkOfVersion": "Auto-select first of multiple APKs", | ||||
|     "refreshBeforeDownload": "Refresh app details before download", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Name", | ||||
|     "smartname": "Name (Smart)", | ||||
|     "sortMethod": "Sort Method", | ||||
|     "welcome": "Welcome", | ||||
|     "documentationLinksNote": "The Obtainium GitHub page linked below contains links to videos, articles, discussions and other resources that will help you understand how to use the app.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "fileDeletionError": "Failed to delete file (try deleting it manually then try again): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Želite li ukloniti aplikaciju?", | ||||
|         "other": "Želite li ukloniti aplikacije?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Configuració de les aplicacions crowdsourcing", | ||||
|     "allowInsecure": "Permet les sol·licituds HTTP insegures", | ||||
|     "stayOneVersionBehind": "Roman a la versió anterior a l'última", | ||||
|     "useFirstApkOfVersion": "Auto-select first of multiple APKs", | ||||
|     "refreshBeforeDownload": "Actualitza les dades de l'aplicació abans de descarregar-la", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Nom", | ||||
|     "smartname": "Nom (smart)", | ||||
|     "sortMethod": "Mètode d'ordenació", | ||||
|     "welcome": "Benvinguda", | ||||
|     "documentationLinksNote": "La pàgina GitHub d'Obtainium enllaçada a sota conté enllaços a vídeos, articles, debats i altres recursos que t'ajudaran a entendre com usar l'aplicació.", | ||||
|     "batteryOptimizationNote": "Tingues present que les descàrregues en segon pla funcionaran millor si inhabilites l'optimització de bateria per a Obtainium.", | ||||
|     "fileDeletionError": "No s'ha pogut suprimir el fitxer (intenta suprimir-lo manualment i torna-ho a provar): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "¿Suprimeixo l'aplicació?", | ||||
|         "other": "¿Suprimeixo les aplicacions?" | ||||
|   | ||||
| @@ -36,7 +36,7 @@ | ||||
|     "trackOnlyAppDescription": "Aplikace je sledována kvůli aktualizacím, ale Obtainium ji nebude stahovat ani instalovat.", | ||||
|     "cancelled": "Zrušeno", | ||||
|     "appAlreadyAdded": "Aplikace již přidána", | ||||
|     "alreadyUpToDateQuestion": "App already up to date?", | ||||
|     "alreadyUpToDateQuestion": "Aplikace je již aktualizovaná?", | ||||
|     "addApp": "Přidat aplikaci", | ||||
|     "appSourceURL": "Zdrojová adresa URL aplikace", | ||||
|     "error": "Chyba", | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Konfigurace aplikací s využitím crowdsourcingu", | ||||
|     "allowInsecure": "Povolení nezabezpečených požadavků HTTP", | ||||
|     "stayOneVersionBehind": "Zůstaňte o jednu verzi pozadu za nejnovější", | ||||
|     "useFirstApkOfVersion": "Automatický výběr prvního z více souborů APK", | ||||
|     "refreshBeforeDownload": "Obnovení údajů o aplikaci před stažením", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Název", | ||||
|     "smartname": "Název (Smart)", | ||||
|     "sortMethod": "Metoda třídění", | ||||
|     "welcome": "Vítejte na", | ||||
|     "documentationLinksNote": "Níže odkazovaná stránka Obtainium GitHub obsahuje odkazy na videa, články, diskuse a další zdroje, které vám pomohou pochopit, jak aplikaci používat.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "Všimněte si, že stahování na pozadí může fungovat spolehlivěji, pokud vypnete optimalizaci baterie operačního systému pro Obtainium.", | ||||
|     "fileDeletionError": "Soubor se nepodařilo odstranit (zkuste jej odstranit ručně a pak to zkuste znovu): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Odstranit Apku?", | ||||
|         "other": "Odstranit Apky?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Crowdsourcede app-konfigurationer", | ||||
|     "allowInsecure": "Tillad usikre HTTP-anmodninger", | ||||
|     "stayOneVersionBehind": "Forbliv én version bagud den seneste", | ||||
|     "useFirstApkOfVersion": "Vælg automatisk den første af flere APK'er", | ||||
|     "refreshBeforeDownload": "Opdater app-detaljer før download", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Navn", | ||||
|     "smartname": "Navn (Smart)", | ||||
|     "sortMethod": "Sorteringsmetode", | ||||
|     "welcome": "Velkommen", | ||||
|     "documentationLinksNote": "Obtainiums GitHub-side, som der linkes til nedenfor, indeholder links til videoer, artikler, diskussioner og andre ressourcer, som kan hjælpe dig med at forstå, hvordan du bruger appen.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "Bemærk, at baggrundsdownloads kan fungere mere pålideligt, hvis du deaktiverer OS-batterioptimering for Obtainium.", | ||||
|     "fileDeletionError": "Kunne ikke slette filen (prøv at slette den manuelt og prøv igen): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Fjern app?", | ||||
|         "other": "Fjern apps?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Crowdsourced App-Konfigurationen", | ||||
|     "allowInsecure": "Unsichere HTTP-Anfragen zulassen", | ||||
|     "stayOneVersionBehind": "Eine Version hinter der neuesten Version bleiben", | ||||
|     "useFirstApkOfVersion": "Automatische Auswahl der ersten von mehreren APKs", | ||||
|     "refreshBeforeDownload": "App-Details vor dem Download aktualisieren", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Name", | ||||
|     "smartname": "Name (Smart)", | ||||
|     "sortMethod": "Sortierverfahren", | ||||
|     "welcome": "Willkommen", | ||||
|     "documentationLinksNote": "Die unten verlinkte GitHub-Seite von Obtainium enthält Links zu Videos, Artikeln, Diskussionen und anderen Ressourcen, die Ihnen helfen werden, die Verwendung der App zu verstehen.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "Beachten Sie, dass Downloads im Hintergrund möglicherweise zuverlässiger funktionieren, wenn Sie die Batterieoptimierung des Betriebssystems für Obtainium deaktivieren.", | ||||
|     "fileDeletionError": "Die Datei konnte nicht gelöscht werden (versuchen Sie, sie manuell zu löschen und versuchen Sie es dann erneut): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "App entfernen?", | ||||
|         "other": "Apps entfernen?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Crowdsourced App Configurations", | ||||
|     "allowInsecure": "Allow insecure HTTP requests", | ||||
|     "stayOneVersionBehind": "Stay one version behind latest", | ||||
|     "useFirstApkOfVersion": "Auto-select first of multiple APKs", | ||||
|     "refreshBeforeDownload": "Refresh app details before download", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Name", | ||||
|     "smartname": "Name (Smart)", | ||||
|     "sortMethod": "Sort Method", | ||||
|     "welcome": "Welcome", | ||||
|     "documentationLinksNote": "The Obtainium GitHub page linked below contains links to videos, articles, discussions and other resources that will help you understand how to use the app.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "fileDeletionError": "Failed to delete file (try deleting it manually then try again): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Forigi la aplikaĵon?", | ||||
|         "other": "Forigi la aplikaĵojn?" | ||||
|   | ||||
| @@ -318,6 +318,7 @@ | ||||
|     "crowdsourcedConfigsShort": "Crowdsourced app configurations", | ||||
|     "allowInsecure": "Allow insecure HTTP requests", | ||||
|     "stayOneVersionBehind": "Stay one version behind latest", | ||||
|     "useFirstApkOfVersion": "Auto-select first of multiple APKs", | ||||
|     "refreshBeforeDownload": "Refresh app details before download", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
| @@ -328,6 +329,7 @@ | ||||
|     "welcome": "Welcome", | ||||
|     "documentationLinksNote": "The Obtainium GitHub page linked below contains links to videos, articles, discussions and other resources that will help you understand how to use the app.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "fileDeletionError": "Failed to delete file (try deleting it manually then try again): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Remove app?", | ||||
|         "other": "Remove apps?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Configuración de aplicaciones por crowdsourcing", | ||||
|     "allowInsecure": "Permitir peticiones HTTP inseguras", | ||||
|     "stayOneVersionBehind": "Mantenerse una versión por detrás de la última", | ||||
|     "useFirstApkOfVersion": "Auto-selección del primero de múltiples APKs", | ||||
|     "refreshBeforeDownload": "Actualiza los datos de la aplicación antes de descargarla", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Nombre", | ||||
|     "smartname": "Nombre (Smart)", | ||||
|     "sortMethod": "Método de clasificación", | ||||
|     "welcome": "Bienvenido", | ||||
|     "documentationLinksNote": "La página GitHub de Obtainium enlazada a continuación contiene enlaces a vídeos, artículos, debates y otros recursos que te ayudarán a entender cómo utilizar la aplicación.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "Ten en cuenta que las descargas en segundo plano pueden funcionar de forma más fiable si desactivas las optimizaciones de batería del sistema operativo para Obtainium.", | ||||
|     "fileDeletionError": "No se ha podido eliminar el archivo (intente eliminarlo manualmente y vuelva a intentarlo): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "¿Eliminar aplicación?", | ||||
|         "other": "¿Eliminar aplicaciones?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "تنظیمات برنامه های مشارکت جمعی", | ||||
|     "allowInsecure": "درخواست های HTTP ناامن را مجاز کنید", | ||||
|     "stayOneVersionBehind": "یک نسخه از آخرین نسخه پشت سر بگذارید", | ||||
|     "useFirstApkOfVersion": "Auto-select first of multiple APKs", | ||||
|     "refreshBeforeDownload": "قبل از دانلود، جزئیات برنامه را بازخوانی کنید", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Name", | ||||
|     "smartname": "Name (Smart)", | ||||
|     "sortMethod": "Sort Method", | ||||
|     "welcome": "Welcome", | ||||
|     "documentationLinksNote": "The Obtainium GitHub page linked below contains links to videos, articles, discussions and other resources that will help you understand how to use the app.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "fileDeletionError": "Failed to delete file (try deleting it manually then try again): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "برنامه حذف شود؟", | ||||
|         "other": "برنامه ها حذف شوند؟" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Applications communautaires", | ||||
|     "allowInsecure": "Autoriser les requêtes HTTP non sécurisées", | ||||
|     "stayOneVersionBehind": "Rester une version en arrière de la dernière", | ||||
|     "useFirstApkOfVersion": "Sélection automatique du premier APK parmi plusieurs", | ||||
|     "refreshBeforeDownload": "Actualiser les détails de l'application avant de la télécharger", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Nom", | ||||
|     "smartname": "Nom (Smart)", | ||||
|     "sortMethod": "Méthode de tri", | ||||
|     "welcome": "Bienvenue", | ||||
|     "documentationLinksNote": "La page GitHub d'Obtainium, dont le lien figure ci-dessous, contient des liens vers des vidéos, des articles, des discussions et d'autres ressources qui vous aideront à comprendre comment utiliser l'application.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "Notez que les téléchargements en arrière-plan peuvent fonctionner de manière plus fiable si vous désactivez les optimisations de la batterie du système d'exploitation pour Obtainium.", | ||||
|     "fileDeletionError": "Échec de la suppression du fichier (essayez de le supprimer manuellement puis réessayez) : \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Supprimer l'application ?", | ||||
|         "other": "Supprimer les applications ?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Alkalmazáslista", | ||||
|     "allowInsecure": "Nem biztonságos HTTP-kérések engedélyezése", | ||||
|     "stayOneVersionBehind": "Maradjon egy verzióval a legújabb mögött", | ||||
|     "useFirstApkOfVersion": "A legelső APK automatikus kiválasztása, ha több APK is található", | ||||
|     "refreshBeforeDownload": "Az alkalmazás adatainak frissítése a letöltés előtt", | ||||
|     "tencentAppStore": "Tencent Appstore", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Név", | ||||
|     "smartname": "Név (Okos)", | ||||
|     "sortMethod": "Rendezési eljárás", | ||||
|     "welcome": "Üdvözöljük!", | ||||
|     "documentationLinksNote": "Az alábbi hivatkozás az Obtainium GitHub oldalára vezet, amely további videók, cikkek, beszélgetések és egyéb források hivatkozásait tartalmazza, amelyek segítenek megérteni az alkalmazás használatát.", | ||||
|     "batteryOptimizationNote": "Megjegyzés: A háttérfrissítések megbízhatóbban működhetnek, ha kikapcsolja a rendszer akkumulátor-optimalizálását az Obtainium számára.", | ||||
|     "fileDeletionError": "Nem sikerült törölni a fájlt (próbálja meg kézzel törölni, majd próbálja meg újra): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Eltávolítja az alkalmazást?", | ||||
|         "other": "Eltávolítja az alkalmazásokat?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Konfigurasi Aplikasi Crowdsourced", | ||||
|     "allowInsecure": "Izinkan permintaan HTTP yang tidak aman", | ||||
|     "stayOneVersionBehind": "Tetap satu versi di belakang versi terbaru", | ||||
|     "useFirstApkOfVersion": "Pilih otomatis yang pertama dari beberapa APK", | ||||
|     "refreshBeforeDownload": "Segarkan detail aplikasi sebelum mengunduh", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Nama", | ||||
|     "smartname": "Nama (Cerdas)", | ||||
|     "sortMethod": "Metode Penyortiran", | ||||
|     "welcome": "Selamat datang.", | ||||
|     "documentationLinksNote": "Halaman GitHub Obtainium yang ditautkan di bawah ini berisi tautan ke video, artikel, diskusi, dan sumber daya lain yang akan membantu Anda memahami cara menggunakan aplikasi.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "Perhatikan bahwa unduhan latar belakang dapat bekerja lebih andal jika Anda menonaktifkan optimasi baterai OS untuk Obtainium.", | ||||
|     "fileDeletionError": "Gagal menghapus file (coba hapus secara manual, lalu coba lagi): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Hapus aplikasi?", | ||||
|         "other": "Hapus aplikasi?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Configurazioni di app in crowdsourcing", | ||||
|     "allowInsecure": "Consentire le richieste HTTP non sicure", | ||||
|     "stayOneVersionBehind": "Rimanere una versione indietro rispetto alla più recente", | ||||
|     "useFirstApkOfVersion": "Selezione automatica del primo di più APK", | ||||
|     "refreshBeforeDownload": "Aggiornare i dettagli dell'app prima del download", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Nome", | ||||
|     "smartname": "Nome (intelligente)", | ||||
|     "sortMethod": "Metodo di ordinamento", | ||||
|     "welcome": "Benvenuti", | ||||
|     "documentationLinksNote": "La pagina GitHub di Obtainium collegata qui sotto contiene collegamenti a video, articoli, discussioni e altre risorse che vi aiuteranno a capire come utilizzare l'applicazione.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "Si noti che i download in background potrebbero funzionare in modo più affidabile se si disabilita l'ottimizzazione della batteria del sistema operativo per Obtainium.", | ||||
|     "fileDeletionError": "Errore nell'eliminazione del file (provare a cancellarlo manualmente e poi riprovare): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Rimuovere l'app?", | ||||
|         "other": "Rimuovere le app?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "クラウドソーシングによるアプリの設定", | ||||
|     "allowInsecure": "安全でないHTTPリクエストを許可する", | ||||
|     "stayOneVersionBehind": "最新のバージョンから1つ前のものを使用する", | ||||
|     "useFirstApkOfVersion": "複数のAPKから最初のAPKを自動選択する", | ||||
|     "refreshBeforeDownload": "ダウンロード前にアプリの詳細を更新する", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "coolApk": "クールApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "名称", | ||||
|     "smartname": "名前(スマート)", | ||||
|     "sortMethod": "ソート方法", | ||||
|     "welcome": "ようこそ", | ||||
|     "documentationLinksNote": "以下のリンクにあるObtainium GitHubページには、ビデオ、記事、ディスカッション、その他のリソースへのリンクがあり、アプリの使い方を理解するのに役立ちます。", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "ObtainiumのOSバッテリー最適化を無効にすると、バックグラウンドダウンロードがより確実に動作するようになります。", | ||||
|     "fileDeletionError": "ファイルの削除に失敗しました(手動で削除してから再試行してください):\"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "アプリを削除しますか?", | ||||
|         "other": "アプリを削除しますか?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "크라우드소싱 앱 구성", | ||||
|     "allowInsecure": "안전하지 않은 HTTP 요청 허용", | ||||
|     "stayOneVersionBehind": "최신 버전보다 한 버전 뒤에 머무르기", | ||||
|     "useFirstApkOfVersion": "여러 앱 중 첫 번째 앱 자동 선택", | ||||
|     "refreshBeforeDownload": "다운로드 전에 앱 세부 정보 새로 고침", | ||||
|     "tencentAppStore": "텐센트 앱 스토어", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "이름", | ||||
|     "smartname": "이름(스마트)", | ||||
|     "sortMethod": "정렬 방법", | ||||
|     "welcome": "환영", | ||||
|     "documentationLinksNote": "아래에 링크된 Obtainium 깃허브 페이지에는 앱 사용 방법을 이해하는 데 도움이 되는 동영상, 기사, 토론 및 기타 리소스에 대한 링크가 포함되어 있습니다.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "Obtainium의 OS 배터리 최적화를 비활성화하면 백그라운드 다운로드가 더 안정적으로 작동할 수 있습니다.", | ||||
|     "fileDeletionError": "파일을 삭제하지 못했습니다(수동으로 삭제한 후 다시 시도하세요): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "앱을 제거하시겠습니까?", | ||||
|         "other": "앱을 제거하시겠습니까?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "App-configuraties door menigte", | ||||
|     "allowInsecure": "Onveilige HTTP-verzoeken toestaan", | ||||
|     "stayOneVersionBehind": "Blijf een versie achter op de nieuwste", | ||||
|     "useFirstApkOfVersion": "Automatisch de eerste van meerdere APK's selecteren", | ||||
|     "refreshBeforeDownload": "Vernieuw app details voor download", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Naam", | ||||
|     "smartname": "Naam (Slim)", | ||||
|     "sortMethod": "Sorteermethode", | ||||
|     "welcome": "Welkom", | ||||
|     "documentationLinksNote": "De GitHub pagina van Obtainium waarnaar hieronder wordt gelinkt bevat links naar video's, artikelen, discussies en andere bronnen die je zullen helpen begrijpen hoe je de app kunt gebruiken.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "Merk op dat downloads op de achtergrond mogelijk betrouwbaarder werken als je de batterijoptimalisatie van het besturingssysteem voor Obtainium uitschakelt.", | ||||
|     "fileDeletionError": "Bestand is niet verwijderd (probeer het handmatig te verwijderen en probeer het opnieuw): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "App verwijderen?", | ||||
|         "other": "Apps verwijderen?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Baza konfiguracji", | ||||
|     "allowInsecure": "Zezwalaj na niezabezpieczone żądania HTTP", | ||||
|     "stayOneVersionBehind": "Pozostań jedną wersję w tyle za najnowszą", | ||||
|     "useFirstApkOfVersion": "Automatyczny wybór pierwszego z wielu plików APK", | ||||
|     "refreshBeforeDownload": "Odśwież szczegóły aplikacji przed pobraniem", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Nazwa", | ||||
|     "smartname": "Nazwa (Smart)", | ||||
|     "sortMethod": "Metoda sortowania", | ||||
|     "welcome": "Witamy", | ||||
|     "documentationLinksNote": "Strona Obtainium GitHub, do której link znajduje się poniżej, zawiera linki do filmów, artykułów, dyskusji i innych zasobów, które pomogą ci zrozumieć, jak korzystać z aplikacji.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "Należy pamiętać, że pobieranie w tle może działać bardziej niezawodnie po wyłączeniu optymalizacji baterii systemu operacyjnego dla Obtainium.", | ||||
|     "fileDeletionError": "Nie udało się usunąć pliku (spróbuj usunąć go ręcznie, a następnie spróbuj ponownie): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Usunąć aplikację?", | ||||
|         "few": "Usunąć aplikacje?", | ||||
|   | ||||
| @@ -30,7 +30,7 @@ | ||||
|     "wrongArgNum": "Número errado de argumentos fornecidos", | ||||
|     "xIsTrackOnly": "{} é somente de rastreio", | ||||
|     "source": "Fonte", | ||||
|     "app": "App", | ||||
|     "app": "Aplicativo", | ||||
|     "appsFromSourceAreTrackOnly": "Apps desta fonte são somente para rastreamento.", | ||||
|     "youPickedTrackOnly": "Você selecionou a opção de somente rastreamento.", | ||||
|     "trackOnlyAppDescription": "As atualizações do app serão rastreadas, mas o Obtainium não baixará ou instalará elas.", | ||||
| @@ -47,7 +47,7 @@ | ||||
|     "supportedSources": "Fontes suportadas", | ||||
|     "trackOnlyInBrackets": "(somente rastreamento)", | ||||
|     "searchableInBrackets": "(pesquisável)", | ||||
|     "appsString": "Apps", | ||||
|     "appsString": "Aplicativos", | ||||
|     "noApps": "Nenhum app", | ||||
|     "noAppsForFilter": "Nenhum app pro filtro", | ||||
|     "byX": "Por {}", | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Configurações de app da comunidade", | ||||
|     "allowInsecure": "Permitir solicitações de HTTP inseguras", | ||||
|     "stayOneVersionBehind": "Ficar uma versão antes da mais recente", | ||||
|     "useFirstApkOfVersion": "Seleção automática do primeiro de vários APKs", | ||||
|     "refreshBeforeDownload": "Atualizar detalhes do app antes de baixar", | ||||
|     "tencentAppStore": "Loja de Apps da Tencent", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "Vivo App Store (CN)", | ||||
|     "name": "Nome", | ||||
|     "smartname": "Nome (inteligente)", | ||||
|     "sortMethod": "Método de ordenação", | ||||
|     "welcome": "Boas vindas", | ||||
|     "documentationLinksNote": "A página do Obtainium no GitHub visível abaixo contém links de vídeos, artigos, discussões, e outros recursos que podem te ajudar ao usar o app.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "Observe que os downloads em segundo plano podem funcionar de forma mais confiável se você desativar as otimizações de bateria do sistema operacional para o Obtainium.", | ||||
|     "fileDeletionError": "Falha ao excluir o arquivo (tente excluí-lo manualmente e tente novamente): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Remover app?", | ||||
|         "other": "Remover apps?" | ||||
| @@ -340,8 +343,8 @@ | ||||
|         "other": "A busca de atualizações em segundo plano encontrou um {}, será agendado uma nova tentativa em {} minutos" | ||||
|     }, | ||||
|     "bgCheckFoundUpdatesWillNotifyIfNeeded": { | ||||
|         "one": "BG update checking found {} update - will notify user if needed", | ||||
|         "other": "BG update checking found {} updates - will notify user if needed" | ||||
|         "one": "Verificação da atualização do BG encontrada {} atualização - notificará o usuário se necessário", | ||||
|         "other": "Verificação de atualização do BG encontrou atualizações {} - notificará o usuário se necessário" | ||||
|     }, | ||||
|     "apps": { | ||||
|         "one": "{} app", | ||||
| @@ -364,8 +367,8 @@ | ||||
|         "other": "{} dias" | ||||
|     }, | ||||
|     "clearedNLogsBeforeXAfterY": { | ||||
|         "one": "Cleared {n} log (before = {before}, after = {after})", | ||||
|         "other": "Cleared {n} logs (before = {before}, after = {after})" | ||||
|         "one": "Limpou {n} registros (before = {before}, after = {after})", | ||||
|         "other": "Limpou {n} registros (antes = {before}, depois = {after})" | ||||
|     }, | ||||
|     "xAndNMoreUpdatesAvailable": { | ||||
|         "one": "{} e mais 1 app têm atualizações.", | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Configurações de aplicações com base em crowdsourcing", | ||||
|     "allowInsecure": "Permitir pedidos HTTP inseguros", | ||||
|     "stayOneVersionBehind": "Manter-se uma versão atrás da mais recente", | ||||
|     "useFirstApkOfVersion": "Seleção automática do primeiro de vários APKs", | ||||
|     "refreshBeforeDownload": "Atualizar os detalhes da aplicação antes da transferência", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Nome", | ||||
|     "smartname": "Nome (Smart)", | ||||
|     "sortMethod": "Método de ordenação", | ||||
|     "welcome": "Bem-vindo", | ||||
|     "documentationLinksNote": "A página do Obtainium no GitHub com a ligação abaixo contém ligações para vídeos, artigos, discussões e outros recursos que o ajudarão a compreender como utilizar a aplicação.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "Note que os downloads em segundo plano podem funcionar de forma mais fiável se desativar as optimizações da bateria do SO para o Obtainium.", | ||||
|     "fileDeletionError": "Falha ao eliminar o ficheiro (tente eliminá-lo manualmente e depois tente novamente): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Remover aplicativo?", | ||||
|         "other": "Remover aplicativos?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Конфиги приложений с помощью краудсорсинга", | ||||
|     "allowInsecure": "Разрешить небезопасные HTTP-запросы", | ||||
|     "stayOneVersionBehind": "Не отставайте от последней версии", | ||||
|     "useFirstApkOfVersion": "Автоматический выбор первого из нескольких APK", | ||||
|     "refreshBeforeDownload": "Обновляйте информацию о приложении перед загрузкой", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Имя", | ||||
|     "smartname": "Имя (умное)", | ||||
|     "sortMethod": "Метод сортировки", | ||||
|     "welcome": "Добро пожаловать", | ||||
|     "documentationLinksNote": "На странице Obtainium GitHub, ссылка на которую приведена ниже, содержатся ссылки на видео, статьи, обсуждения и другие ресурсы, которые помогут вам понять, как пользоваться приложением.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "Обратите внимание, что фоновая загрузка может работать более надежно, если отключить оптимизацию батареи ОС для Obtainium.", | ||||
|     "fileDeletionError": "Не удалось удалить файл (попробуйте удалить его вручную, а затем повторите попытку): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Удалить приложение?", | ||||
|         "other": "Удалить приложения?" | ||||
|   | ||||
| @@ -16,6 +16,10 @@ const neverAutoTranslate = { | ||||
|     placeholder: ['pl'], | ||||
|     importExport: ['fr'], | ||||
|     url: ['fr'], | ||||
|     vivoAppStore: ['cs', 'ja', 'ko'], | ||||
|     coolapk: ['ja'], | ||||
|     obtainiumImport: ['nl'], | ||||
|     appLogs: ['nl'], | ||||
|     tencentAppStore: ['*'] | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Appkonfigurationer med hjälp av crowdsourcing", | ||||
|     "allowInsecure": "Tillåt osäkra HTTP-förfrågningar", | ||||
|     "stayOneVersionBehind": "Håll dig en version bakom den senaste", | ||||
|     "useFirstApkOfVersion": "Välj automatiskt den första av flera APK:er", | ||||
|     "refreshBeforeDownload": "Uppdatera appdetaljerna före nedladdning", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Namn", | ||||
|     "smartname": "Namn (Smart)", | ||||
|     "sortMethod": "Sorteringsmetod", | ||||
|     "welcome": "Välkommen", | ||||
|     "documentationLinksNote": "Obtainium GitHub-sidan som länkas nedan innehåller länkar till videor, artiklar, diskussioner och andra resurser som hjälper dig att förstå hur du använder appen.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "Observera att nedladdningar i bakgrunden kan fungera mer tillförlitligt om du inaktiverar OS-batterioptimeringar för Obtainium.", | ||||
|     "fileDeletionError": "Misslyckades med att radera filen (försök radera den manuellt och försök sedan igen): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Ta Bort App?", | ||||
|         "other": "Ta Bort Appar?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Kitle Kaynaklı Uygulama Yapılandırmaları", | ||||
|     "allowInsecure": "Güvensiz HTTP isteklerine izin ver", | ||||
|     "stayOneVersionBehind": "En son sürümün bir sürüm gerisinde kalın", | ||||
|     "useFirstApkOfVersion": "Birden fazla APK arasından ilkini otomatik seçme", | ||||
|     "refreshBeforeDownload": "İndirmeden önce uygulama ayrıntılarını yenileyin", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "İsim", | ||||
|     "smartname": "İsim (Akıllı)", | ||||
|     "sortMethod": "Sıralama Yöntemi", | ||||
|     "welcome": "Hoş geldiniz", | ||||
|     "documentationLinksNote": "Aşağıda bağlantısı verilen Obtainium GitHub sayfası, uygulamayı nasıl kullanacağınızı anlamanıza yardımcı olacak videolara, makalelere, tartışmalara ve diğer kaynaklara bağlantılar içerir.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "Obtainium için işletim sistemi pil optimizasyonlarını devre dışı bırakırsanız arka planda indirmelerin daha güvenilir şekilde çalışabileceğini unutmayın.", | ||||
|     "fileDeletionError": "Dosya silinemedi (elle silmeyi deneyin ve sonra tekrar deneyin): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Uygulamayı Kaldır?", | ||||
|         "other": "Uygulamaları Kaldır?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Налаштування краудсорсингових додатків", | ||||
|     "allowInsecure": "Дозволити незахищені HTTP-запити", | ||||
|     "stayOneVersionBehind": "Залишайтеся на одну версію актуальнішою", | ||||
|     "useFirstApkOfVersion": "Автоматичний вибір першого з декількох APK", | ||||
|     "refreshBeforeDownload": "Оновіть інформацію про програму перед завантаженням", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Ім'я", | ||||
|     "smartname": "Ім'я (Smart)", | ||||
|     "sortMethod": "Метод сортування", | ||||
|     "welcome": "Ласкаво просимо.", | ||||
|     "documentationLinksNote": "Сторінка Obtainium на GitHub, посилання на яку наведено нижче, містить посилання на відео, статті, дискусії та інші ресурси, які допоможуть вам зрозуміти, як користуватися додатком.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "Зауважте, що фонові завантаження можуть працювати надійніше, якщо ви вимкнете оптимізацію батареї ОС для Obtainium.", | ||||
|     "fileDeletionError": "Не вдалося видалити файл (спробуйте видалити його вручну, а потім спробуйте ще раз): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Видалити застосунок?", | ||||
|         "other": "Видалити застосунки?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "Crowdsourced App Configurations", | ||||
|     "allowInsecure": "Allow insecure HTTP requests", | ||||
|     "stayOneVersionBehind": "Stay one version behind latest", | ||||
|     "useFirstApkOfVersion": "Auto-select first of multiple APKs", | ||||
|     "refreshBeforeDownload": "Refresh app details before download", | ||||
|     "tencentAppStore": "Tencent App Store", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "Name", | ||||
|     "smartname": "Name (Smart)", | ||||
|     "sortMethod": "Sort Method", | ||||
|     "welcome": "Welcome", | ||||
|     "documentationLinksNote": "The Obtainium GitHub page linked below contains links to videos, articles, discussions and other resources that will help you understand how to use the app.", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "fileDeletionError": "Failed to delete file (try deleting it manually then try again): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "Gỡ ứng dụng?", | ||||
|         "other": "Gỡ ứng dụng?" | ||||
|   | ||||
| @@ -318,15 +318,18 @@ | ||||
|     "crowdsourcedConfigsShort": "群眾外包的應用程式設定", | ||||
|     "allowInsecure": "允許不安全的 HTTP 請求", | ||||
|     "stayOneVersionBehind": "保持比最新版本落後一個版本", | ||||
|     "useFirstApkOfVersion": "Auto-select first of multiple APKs", | ||||
|     "refreshBeforeDownload": "下載前刷新應用程式詳細資訊", | ||||
|     "tencentAppStore": "騰訊應用寶", | ||||
|     "coolApk": "CoolApk", | ||||
|     "vivoAppStore": "vivo App Store (CN)", | ||||
|     "name": "名稱", | ||||
|     "smartname": "名稱(智慧)", | ||||
|     "sortMethod": "排序方式", | ||||
|     "welcome": "歡迎", | ||||
|     "documentationLinksNote": "下方連結的 Obtainium GitHub 頁面包含影片、文章、討論及其他資源,能幫助你瞭解如何使用這款應用程式。", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "fileDeletionError": "Failed to delete file (try deleting it manually then try again): \"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "移除應用程式?", | ||||
|         "other": "移除應用程式?" | ||||
|   | ||||
| @@ -318,6 +318,7 @@ | ||||
|     "crowdsourcedConfigsShort": "众包应用程序配置", | ||||
|     "allowInsecure": "允许不安全的 HTTP 请求", | ||||
|     "stayOneVersionBehind": "比最新版本晚一个版本", | ||||
|     "useFirstApkOfVersion": "从多个 APK 中自动选择第一个", | ||||
|     "refreshBeforeDownload": "下载前刷新应用程序详细信息", | ||||
|     "tencentAppStore": "腾讯应用宝", | ||||
|     "coolApk": "酷安", | ||||
| @@ -327,7 +328,8 @@ | ||||
|     "sortMethod": "排序方法", | ||||
|     "welcome": "欢迎光临", | ||||
|     "documentationLinksNote": "下面链接的 Obtainium GitHub 页面包含视频、文章、讨论和其他资源的链接,可帮助您了解如何使用该应用程序。", | ||||
|     "batteryOptimizationNote": "Note that background downloads may work more reliably if you disable OS battery optimizations for Obtainium.", | ||||
|     "batteryOptimizationNote": "请注意,如果为 Obtainium 禁用操作系统电池优化功能,后台下载可能会更稳定。", | ||||
|     "fileDeletionError": "删除文件失败(尝试手动删除,然后再试一次):\"{}\"", | ||||
|     "removeAppQuestion": { | ||||
|         "one": "是否删除应用?", | ||||
|         "other": "是否删除应用?" | ||||
|   | ||||
							
								
								
									
										24
									
								
								build.sh
									
									
									
									
									
								
							
							
						
						
									
										24
									
								
								build.sh
									
									
									
									
									
								
							| @@ -2,15 +2,35 @@ | ||||
| # Convenience script | ||||
|  | ||||
| CURR_DIR="$(pwd)" | ||||
| trap "cd "$CURR_DIR"" EXIT | ||||
| SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" | ||||
| trap "cd \"$CURR_DIR\"" EXIT | ||||
| cd "$SCRIPT_DIR" | ||||
|  | ||||
| if [ -z "$1" ]; then | ||||
|     git fetch && git merge origin/main && git push # Typically run after a PR to main, so bring dev up to date | ||||
| fi | ||||
|  | ||||
| # Update local Flutter | ||||
| git submodule update --remote | ||||
| cd .flutter | ||||
| git fetch | ||||
| git checkout "$(flutter --version | head -2 | tail -1 | awk '{print $4}')" # Ensure included Flutter submodule version equals my environment | ||||
| git checkout stable | ||||
| git pull | ||||
| FLUTTER_GIT_URL="https://github.com/flutter/flutter/" ./bin/flutter upgrade | ||||
| cd .. | ||||
|  | ||||
| # Keep global Flutter, if any, in sync | ||||
| if [ -f ~/flutter/bin/flutter ]; then | ||||
|     cd ~/flutter | ||||
|     ./bin/flutter channel stable | ||||
|     ./bin/flutter upgrade | ||||
|     cd "$SCRIPT_DIR" | ||||
| fi | ||||
|  | ||||
| if [ -z "$(which flutter)" ]; then | ||||
|     export PATH="$PATH:$SCRIPT_DIR/.flutter/bin" | ||||
| fi | ||||
|  | ||||
| rm ./build/app/outputs/flutter-apk/* 2>/dev/null                                       # Get rid of older builds if any | ||||
| flutter build apk --flavor normal && flutter build apk --split-per-abi --flavor normal # Build (both split and combined APKs) | ||||
| for file in ./build/app/outputs/flutter-apk/app-*normal*.apk*; do mv "$file" "${file//-normal/}"; done | ||||
|   | ||||
| @@ -51,7 +51,7 @@ RUN \ | ||||
|     mv ${ANDROID_SDK_ROOT}/cmdline-tools/cmdline-tools ${ANDROID_SDK_ROOT}/cmdline-tools/latest && \ | ||||
|     rm -v /tmp/tools.zip && \ | ||||
|     mkdir -p /root/.android/ && touch /root/.android/repositories.cfg &&\ | ||||
|     apt-get install -y --no-install-recommends openjdk-17-jdk openjdk-17-jre &&\ | ||||
|     apt-get install -y --no-install-recommends openjdk-21-jdk openjdk-21-jre &&\ | ||||
|     yes | sdkmanager --licenses &&\ | ||||
|     sdkmanager --update | ||||
|  | ||||
|   | ||||
| @@ -13,7 +13,8 @@ class APKCombo extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     RegExp standardUrlRegEx = RegExp( | ||||
|       '^https?://(www\\.)?${getSourceRegex(hosts)}/+[^/]+/+[^/]+', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     var match = standardUrlRegEx.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -22,25 +23,30 @@ class APKCombo extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<String?> tryInferringAppId(String standardUrl, | ||||
|       {Map<String, dynamic> additionalSettings = const {}}) async { | ||||
|   Future<String?> tryInferringAppId( | ||||
|     String standardUrl, { | ||||
|     Map<String, dynamic> additionalSettings = const {}, | ||||
|   }) async { | ||||
|     return Uri.parse(standardUrl).pathSegments.last; | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<Map<String, String>?> getRequestHeaders( | ||||
|       Map<String, dynamic> additionalSettings, | ||||
|       {bool forAPKDownload = false}) async { | ||||
|     Map<String, dynamic> additionalSettings, { | ||||
|     bool forAPKDownload = false, | ||||
|   }) async { | ||||
|     return { | ||||
|       "User-Agent": "curl/8.0.1", | ||||
|       "Accept": "*/*", | ||||
|       "Connection": "keep-alive", | ||||
|       "Host": hosts[0] | ||||
|       "Host": hosts[0], | ||||
|     }; | ||||
|   } | ||||
|  | ||||
|   Future<List<MapEntry<String, String>>> getApkUrls( | ||||
|       String standardUrl, Map<String, dynamic> additionalSettings) async { | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     var res = await sourceRequest('$standardUrl/download/apk', {}); | ||||
|     if (res.statusCode != 200) { | ||||
|       throw getObtainiumHttpError(res); | ||||
| @@ -65,7 +71,9 @@ class APKCombo extends AppSource { | ||||
|             String verCode = | ||||
|                 e.querySelector('.info .header .vercode')?.text.trim() ?? ''; | ||||
|             return MapEntry<String, String>( | ||||
|                 arch != null ? '$arch-$verCode.apk' : '', url ?? ''); | ||||
|               arch != null ? '$arch-$verCode.apk' : '', | ||||
|               url ?? '', | ||||
|             ); | ||||
|           }).toList(); | ||||
|         }) | ||||
|         .reduce((value, element) => [...value, ...element]) | ||||
| @@ -74,8 +82,11 @@ class APKCombo extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<String> apkUrlPrefetchModifier(String apkUrl, String standardUrl, | ||||
|       Map<String, dynamic> additionalSettings) async { | ||||
|   Future<String> apkUrlPrefetchModifier( | ||||
|     String apkUrl, | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     var freshURLs = await getApkUrls(standardUrl, additionalSettings); | ||||
|     var path2Match = Uri.parse(apkUrl).path; | ||||
|     for (var url in freshURLs) { | ||||
| @@ -119,6 +130,7 @@ class APKCombo extends AppSource { | ||||
|       version, | ||||
|       await getApkUrls(standardUrl, additionalSettings), | ||||
|       AppNames(author, appName), | ||||
|         releaseDate: releaseDate); | ||||
|       releaseDate: releaseDate, | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -17,29 +17,35 @@ class APKMirror extends AppSource { | ||||
|  | ||||
|     additionalSourceAppSpecificSettingFormItems = [ | ||||
|       [ | ||||
|         GeneratedFormSwitch('fallbackToOlderReleases', | ||||
|             label: tr('fallbackToOlderReleases'), defaultValue: true) | ||||
|         GeneratedFormSwitch( | ||||
|           'fallbackToOlderReleases', | ||||
|           label: tr('fallbackToOlderReleases'), | ||||
|           defaultValue: true, | ||||
|         ), | ||||
|       ], | ||||
|       [ | ||||
|         GeneratedFormTextField('filterReleaseTitlesByRegEx', | ||||
|         GeneratedFormTextField( | ||||
|           'filterReleaseTitlesByRegEx', | ||||
|           label: tr('filterReleaseTitlesByRegEx'), | ||||
|           required: false, | ||||
|           additionalValidators: [ | ||||
|             (value) { | ||||
|               return regExValidator(value); | ||||
|               } | ||||
|             ]) | ||||
|       ] | ||||
|             }, | ||||
|           ], | ||||
|         ), | ||||
|       ], | ||||
|     ]; | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<Map<String, String>?> getRequestHeaders( | ||||
|       Map<String, dynamic> additionalSettings, | ||||
|       {bool forAPKDownload = false}) async { | ||||
|     Map<String, dynamic> additionalSettings, { | ||||
|     bool forAPKDownload = false, | ||||
|   }) async { | ||||
|     return { | ||||
|       "User-Agent": | ||||
|           "Obtainium/${(await getInstalledInfo(obtainiumId))?.versionName ?? '1.0.0'}" | ||||
|           "Obtainium/${(await getInstalledInfo(obtainiumId))?.versionName ?? '1.0.0'}", | ||||
|     }; | ||||
|   } | ||||
|  | ||||
| @@ -47,7 +53,8 @@ class APKMirror extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     RegExp standardUrlRegEx = RegExp( | ||||
|       '^https?://(www\\.)?${getSourceRegex(hosts)}/apk/[^/]+/[^/]+', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     RegExpMatch? match = standardUrlRegEx.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -72,8 +79,10 @@ class APKMirror extends AppSource { | ||||
|             true | ||||
|         ? additionalSettings['filterReleaseTitlesByRegEx'] | ||||
|         : null; | ||||
|     Response res = | ||||
|         await sourceRequest('$standardUrl/feed/', additionalSettings); | ||||
|     Response res = await sourceRequest( | ||||
|       '$standardUrl/feed/', | ||||
|       additionalSettings, | ||||
|     ); | ||||
|     if (res.statusCode == 200) { | ||||
|       var items = parse(res.body).querySelectorAll('item'); | ||||
|       dynamic targetRelease; | ||||
| @@ -95,11 +104,14 @@ class APKMirror extends AppSource { | ||||
|           .split(' ') | ||||
|           .sublist(0, 5) | ||||
|           .join(' '); | ||||
|       DateTime? releaseDate = | ||||
|           dateString != null ? HttpDate.parse('$dateString GMT') : null; | ||||
|       DateTime? releaseDate = dateString != null | ||||
|           ? HttpDate.parse('$dateString GMT') | ||||
|           : null; | ||||
|       String? version = titleString | ||||
|           ?.substring(RegExp('[0-9]').firstMatch(titleString)?.start ?? 0, | ||||
|               RegExp(' by ').allMatches(titleString).last.start) | ||||
|           ?.substring( | ||||
|             RegExp('[0-9]').firstMatch(titleString)?.start ?? 0, | ||||
|             RegExp(' by ').allMatches(titleString).last.start, | ||||
|           ) | ||||
|           .trim(); | ||||
|       if (version == null || version.isEmpty) { | ||||
|         version = titleString; | ||||
| @@ -107,8 +119,12 @@ class APKMirror extends AppSource { | ||||
|       if (version == null || version.isEmpty) { | ||||
|         throw NoVersionError(); | ||||
|       } | ||||
|       return APKDetails(version, [], getAppNames(standardUrl), | ||||
|           releaseDate: releaseDate); | ||||
|       return APKDetails( | ||||
|         version, | ||||
|         [], | ||||
|         getAppNames(standardUrl), | ||||
|         releaseDate: releaseDate, | ||||
|       ); | ||||
|     } else { | ||||
|       throw getObtainiumHttpError(res); | ||||
|     } | ||||
|   | ||||
| @@ -1,24 +1,18 @@ | ||||
| import 'dart:convert'; | ||||
|  | ||||
| import 'package:device_info_plus/device_info_plus.dart'; | ||||
| import 'package:easy_localization/easy_localization.dart'; | ||||
| import 'package:html/parser.dart'; | ||||
| import 'package:obtainium/app_sources/html.dart'; | ||||
| import 'package:obtainium/components/generated_form.dart'; | ||||
| import 'package:obtainium/custom_errors.dart'; | ||||
| import 'package:obtainium/providers/source_provider.dart'; | ||||
|  | ||||
| parseDateTimeMMMddCommayyyy(String? dateString) { | ||||
|   DateTime? releaseDate; | ||||
|   try { | ||||
|     releaseDate = dateString != null | ||||
|         ? DateFormat('MMM dd, yyyy').parse(dateString) | ||||
|         : null; | ||||
|     releaseDate = dateString != null && releaseDate == null | ||||
|         ? DateFormat('MMMM dd, yyyy').parse(dateString) | ||||
|         : releaseDate; | ||||
|   } catch (err) { | ||||
|     // ignore | ||||
| extension Unique<E, Id> on List<E> { | ||||
|   List<E> unique([Id Function(E element)? id, bool inplace = true]) { | ||||
|     final ids = <dynamic>{}; | ||||
|     var list = inplace ? this : List<E>.from(this); | ||||
|     list.retainWhere((x) => ids.add(id != null ? id(x) : x as Id)); | ||||
|     return list; | ||||
|   } | ||||
|   return releaseDate; | ||||
| } | ||||
|  | ||||
| class APKPure extends AppSource { | ||||
| @@ -29,13 +23,26 @@ class APKPure extends AppSource { | ||||
|     showReleaseDateAsVersionToggle = true; | ||||
|     additionalSourceAppSpecificSettingFormItems = [ | ||||
|       [ | ||||
|         GeneratedFormSwitch('fallbackToOlderReleases', | ||||
|             label: tr('fallbackToOlderReleases'), defaultValue: true) | ||||
|         GeneratedFormSwitch( | ||||
|           'fallbackToOlderReleases', | ||||
|           label: tr('fallbackToOlderReleases'), | ||||
|           defaultValue: true, | ||||
|         ), | ||||
|       ], | ||||
|       [ | ||||
|         GeneratedFormSwitch('stayOneVersionBehind', | ||||
|             label: tr('stayOneVersionBehind'), defaultValue: false) | ||||
|       ] | ||||
|         GeneratedFormSwitch( | ||||
|           'stayOneVersionBehind', | ||||
|           label: tr('stayOneVersionBehind'), | ||||
|           defaultValue: false, | ||||
|         ), | ||||
|       ], | ||||
|       [ | ||||
|         GeneratedFormSwitch( | ||||
|           'useFirstApkOfVersion', | ||||
|           label: tr('useFirstApkOfVersion'), | ||||
|           defaultValue: true, | ||||
|         ), | ||||
|       ], | ||||
|     ]; | ||||
|   } | ||||
|  | ||||
| @@ -43,7 +50,8 @@ class APKPure extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     RegExp standardUrlRegExB = RegExp( | ||||
|       '^https?://m.${getSourceRegex(hosts)}(/+[^/]{2})?/+[^/]+/+[^/]+', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     RegExpMatch? match = standardUrlRegExB.firstMatch(url); | ||||
|     if (match != null) { | ||||
|       var uri = Uri.parse(url); | ||||
| @@ -51,7 +59,8 @@ class APKPure extends AppSource { | ||||
|     } | ||||
|     RegExp standardUrlRegExA = RegExp( | ||||
|       '^https?://(www\\.)?${getSourceRegex(hosts)}(/+[^/]{2})?/+[^/]+/+[^/]+', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     match = standardUrlRegExA.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -60,114 +69,88 @@ class APKPure extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<String?> tryInferringAppId(String standardUrl, | ||||
|       {Map<String, dynamic> additionalSettings = const {}}) async { | ||||
|   Future<String?> tryInferringAppId( | ||||
|     String standardUrl, { | ||||
|     Map<String, dynamic> additionalSettings = const {}, | ||||
|   }) async { | ||||
|     return Uri.parse(standardUrl).pathSegments.last; | ||||
|   } | ||||
|  | ||||
|   getDetailsForVersionLink( | ||||
|       String standardUrl, | ||||
|       String appId, | ||||
|       String host, | ||||
|   Future<APKDetails> getDetailsForVersion( | ||||
|     List<Map<String, dynamic>> versionVariants, | ||||
|     List<String> supportedArchs, | ||||
|       String link, | ||||
|       Map<String, dynamic> additionalSettings) async { | ||||
|     var res = await sourceRequest(link, additionalSettings); | ||||
|     if (res.statusCode == 200) { | ||||
|       var html = parse(res.body); | ||||
|       var apksDiv = | ||||
|           html.querySelector('#version-list div div.show-more-content'); | ||||
|       DateTime? topReleaseDate; | ||||
|       var apkUrls = apksDiv | ||||
|               ?.querySelectorAll('div.group-title') | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     var apkUrls = versionVariants | ||||
|         .map((e) { | ||||
|                 String architectureString = e.text.trim(); | ||||
|                 if (architectureString.toLowerCase() == 'unlimited' || | ||||
|                     architectureString.toLowerCase() == 'universal') { | ||||
|                   architectureString = ''; | ||||
|           String appId = e['package_name']; | ||||
|           String versionCode = e['version_code']; | ||||
|  | ||||
|           List<String> architectures = e['native_code']?.cast<String>(); | ||||
|           String architectureString = architectures.join(','); | ||||
|           if (architectures.contains("universal") || | ||||
|               architectures.contains("unlimited")) { | ||||
|             architectures = []; | ||||
|           } | ||||
|                 List<String> architectures = architectureString | ||||
|                     .split(',') | ||||
|                     .map((e) => e.trim()) | ||||
|                     .where((e) => e.isNotEmpty) | ||||
|                     .toList(); | ||||
|                 // Only take the first APK for each architecture, ignore others for now, for simplicity | ||||
|                 // Unclear why there can even be multiple APKs for the same version and arch | ||||
|                 var apkInfo = e.nextElementSibling?.querySelector('div.info'); | ||||
|                 String? versionCode = RegExp('[0-9]+') | ||||
|                     .firstMatch( | ||||
|                         apkInfo?.querySelector('div.info-top .code')?.text ?? | ||||
|                             '') | ||||
|                     ?.group(0) | ||||
|                     ?.trim(); | ||||
|                 var types = apkInfo | ||||
|                         ?.querySelectorAll('div.info-top span.tag') | ||||
|                         .map((e) => e.text.trim()) | ||||
|                         .map((t) => t == 'APKs' ? 'APK' : t) ?? | ||||
|                     []; | ||||
|                 String type = types.isEmpty ? 'APK' : types.first; | ||||
|                 String? dateString = apkInfo | ||||
|                     ?.querySelector('div.info-bottom span.time') | ||||
|                     ?.text | ||||
|                     .trim(); | ||||
|                 DateTime? releaseDate = parseDateTimeMMMddCommayyyy(dateString); | ||||
|           if (additionalSettings['autoApkFilterByArch'] == true && | ||||
|               architectures.isNotEmpty && | ||||
|                     architectures | ||||
|                         .where((a) => supportedArchs.contains(a)) | ||||
|                         .isEmpty) { | ||||
|                   return const MapEntry('', ''); | ||||
|               architectures.where((a) => supportedArchs.contains(a)).isEmpty) { | ||||
|             return null; | ||||
|           } | ||||
|                 topReleaseDate ??= | ||||
|                     releaseDate; // Just use the release date of the first APK in the list as the release date for this version | ||||
|  | ||||
|           String type = e['asset']['type']; | ||||
|           String downloadUri = e['asset']['url']; | ||||
|  | ||||
|           return MapEntry( | ||||
|             '$appId-$versionCode-$architectureString.${type.toLowerCase()}', | ||||
|                     'https://d.${hosts.contains(host) ? 'cdnpure.com' : host}/b/$type/$appId?versionCode=$versionCode'); | ||||
|             downloadUri, | ||||
|           ); | ||||
|         }) | ||||
|               .where((e) => e.key.isNotEmpty) | ||||
|               .toList() ?? | ||||
|           []; | ||||
|         .nonNulls | ||||
|         .toList() | ||||
|         .unique((e) => e.key); | ||||
|  | ||||
|     if (apkUrls.isEmpty) { | ||||
|         var link = | ||||
|             html.querySelector("a.download-start-btn")?.attributes['href']; | ||||
|         RegExp downloadLinkRegEx = RegExp( | ||||
|             r'^https:\/\/d\.[^/]+\/b\/([^/]+)\/[^/?]+\?versionCode=([0-9]+)$', | ||||
|             caseSensitive: false); | ||||
|         RegExpMatch? match = downloadLinkRegEx.firstMatch(link ?? ''); | ||||
|         if (match == null) { | ||||
|       throw NoAPKError(); | ||||
|     } | ||||
|         String type = match.group(1)!; | ||||
|         String versionCode = match.group(2)!; | ||||
|         apkUrls = [ | ||||
|           MapEntry('$appId-$versionCode-.${type.toLowerCase()}', | ||||
|               'https://d.${hosts.contains(host) ? 'cdnpure.com' : host}/b/$type/$appId?versionCode=$versionCode') | ||||
|         ]; | ||||
|  | ||||
|     // get version details from first variant | ||||
|     var v = versionVariants.first; | ||||
|     String version = v['version_name']; | ||||
|     String author = v['developer']; | ||||
|     String appName = v['title']; | ||||
|     DateTime releaseDate = DateTime.parse(v['update_date']); | ||||
|     String? changeLog = v['whatsnew']; | ||||
|     if (changeLog != null && changeLog.isEmpty) { | ||||
|       changeLog = null; | ||||
|     } | ||||
|       String version = Uri.parse(link).pathSegments.last; | ||||
|       String? author; | ||||
|       try { | ||||
|         author = html | ||||
|                 .querySelector('span.info-sdk') | ||||
|                 ?.text | ||||
|                 .trim() | ||||
|                 .substring(version.length + 4) ?? | ||||
|             Uri.parse(standardUrl).pathSegments.reversed.last; | ||||
|       } catch (e) { | ||||
|         author = html.querySelector('span.info-sdk')?.text.trim() ?? | ||||
|             Uri.parse(standardUrl).pathSegments.reversed.last; | ||||
|  | ||||
|     if (additionalSettings['useFirstApkOfVersion'] == true) { | ||||
|       apkUrls = [apkUrls.first]; | ||||
|     } | ||||
|       String appName = | ||||
|           html.querySelector('h1.info-title')?.text.trim() ?? appId; | ||||
|       String? changeLog = html | ||||
|           .querySelector('div.module.change-log') | ||||
|           ?.innerHtml | ||||
|           .trim() | ||||
|           .replaceAll("<br>", "  \n"); | ||||
|       return APKDetails(version, apkUrls, AppNames(author, appName), | ||||
|           releaseDate: topReleaseDate, changeLog: changeLog); | ||||
|  | ||||
|     return APKDetails( | ||||
|       version, | ||||
|       apkUrls, | ||||
|       AppNames(author, appName), | ||||
|       releaseDate: releaseDate, | ||||
|       changeLog: changeLog, | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<Map<String, String>?> getRequestHeaders( | ||||
|     Map<String, dynamic> additionalSettings, { | ||||
|     bool forAPKDownload = false, | ||||
|   }) async { | ||||
|     if (forAPKDownload) { | ||||
|       return null; | ||||
|     } else { | ||||
|       throw getObtainiumHttpError(res); | ||||
|       return { | ||||
|         "Ual-Access-Businessid": "projecta", | ||||
|         "Ual-Access-ProjectA": | ||||
|             '{"device_info":{"os_ver":"${((await DeviceInfoPlugin().androidInfo).version.sdkInt)}"}}', | ||||
|       }; | ||||
|     } | ||||
|   } | ||||
|  | ||||
| @@ -177,41 +160,56 @@ class APKPure extends AppSource { | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     String appId = (await tryInferringAppId(standardUrl))!; | ||||
|     String host = Uri.parse(standardUrl).host; | ||||
|  | ||||
|     var res0 = await sourceRequest('$standardUrl/versions', additionalSettings); | ||||
|     var decodedStandardUrl = standardUrl; | ||||
|     try { | ||||
|       decodedStandardUrl = Uri.decodeFull(decodedStandardUrl); | ||||
|     } catch (e) { | ||||
|       // | ||||
|     List<String> supportedArchs = | ||||
|         (await DeviceInfoPlugin().androidInfo).supportedAbis; | ||||
|  | ||||
|     // request versions from API | ||||
|     var res = await sourceRequest( | ||||
|       "https://tapi.pureapk.com/v3/get_app_his_version?package_name=$appId&hl=en", | ||||
|       additionalSettings, | ||||
|     ); | ||||
|     if (res.statusCode != 200) { | ||||
|       throw getObtainiumHttpError(res); | ||||
|     } | ||||
|     var versionLinks = await grabLinksCommon(res0, { | ||||
|       'skipSort': true, | ||||
|       'customLinkFilterRegex': '$decodedStandardUrl/download/[^/]+\$' | ||||
|     }); | ||||
|     List<Map<String, dynamic>> apks = jsonDecode( | ||||
|       res.body, | ||||
|     )['version_list'].cast<Map<String, dynamic>>(); | ||||
|  | ||||
|     var supportedArchs = (await DeviceInfoPlugin().androidInfo).supportedAbis; | ||||
|  | ||||
|     if (additionalSettings['autoApkFilterByArch'] != true) { | ||||
|       // No need to request multiple versions when we're not going to filter them (always pick the top one) | ||||
|       versionLinks = versionLinks.sublist(0, 1); | ||||
|     // group by version | ||||
|     List<List<Map<String, dynamic>>> versions = apks | ||||
|         .fold<Map<String, List<Map<String, dynamic>>>>({}, ( | ||||
|           Map<String, List<Map<String, dynamic>>> val, | ||||
|           Map<String, dynamic> element, | ||||
|         ) { | ||||
|           String v = element['version_name']; | ||||
|           if (!val.containsKey(v)) { | ||||
|             val[v] = []; | ||||
|           } | ||||
|     if (versionLinks.isEmpty) { | ||||
|           val[v]?.add(element); | ||||
|           return val; | ||||
|         }) | ||||
|         .values | ||||
|         .toList(); | ||||
|  | ||||
|     if (versions.isEmpty) { | ||||
|       throw NoReleasesError(); | ||||
|     } | ||||
|  | ||||
|     for (var i = 0; i < versionLinks.length; i++) { | ||||
|       var link = versionLinks[i]; | ||||
|     for (var i = 0; i < versions.length; i++) { | ||||
|       var v = versions[i]; | ||||
|       try { | ||||
|         if (i == 0 && additionalSettings['stayOneVersionBehind'] == true) { | ||||
|           throw NoReleasesError(); | ||||
|         } | ||||
|         return await getDetailsForVersionLink(standardUrl, appId, host, | ||||
|             supportedArchs, link.key, additionalSettings); | ||||
|         return await getDetailsForVersion( | ||||
|           v, | ||||
|           supportedArchs, | ||||
|           additionalSettings, | ||||
|         ); | ||||
|       } catch (e) { | ||||
|         if (additionalSettings['fallbackToOlderReleases'] != true || | ||||
|             i == versionLinks.length - 1) { | ||||
|             i == versions.length - 1) { | ||||
|           rethrow; | ||||
|         } | ||||
|       } | ||||
|   | ||||
| @@ -17,7 +17,8 @@ class Aptoide extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     RegExp standardUrlRegEx = RegExp( | ||||
|       '^https?://([^\\.]+\\.){2,}${getSourceRegex(hosts)}', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     RegExpMatch? match = standardUrlRegEx.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -26,14 +27,20 @@ class Aptoide extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<String?> tryInferringAppId(String standardUrl, | ||||
|       {Map<String, dynamic> additionalSettings = const {}}) async { | ||||
|   Future<String?> tryInferringAppId( | ||||
|     String standardUrl, { | ||||
|     Map<String, dynamic> additionalSettings = const {}, | ||||
|   }) async { | ||||
|     return (await getAppDetailsJSON( | ||||
|         standardUrl, additionalSettings))['package']; | ||||
|       standardUrl, | ||||
|       additionalSettings, | ||||
|     ))['package']; | ||||
|   } | ||||
|  | ||||
|   Future<Map<String, dynamic>> getAppDetailsJSON( | ||||
|       String standardUrl, Map<String, dynamic> additionalSettings) async { | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     var res = await sourceRequest(standardUrl, additionalSettings); | ||||
|     if (res.statusCode != 200) { | ||||
|       throw getObtainiumHttpError(res); | ||||
| @@ -46,7 +53,9 @@ class Aptoide extends AppSource { | ||||
|       throw NoReleasesError(); | ||||
|     } | ||||
|     var res2 = await sourceRequest( | ||||
|         'https://ws2.aptoide.com/api/7/getApp/app_id/$id', additionalSettings); | ||||
|       'https://ws2.aptoide.com/api/7/getApp/app_id/$id', | ||||
|       additionalSettings, | ||||
|     ); | ||||
|     if (res2.statusCode != 200) { | ||||
|       throw getObtainiumHttpError(res); | ||||
|     } | ||||
| @@ -76,7 +85,10 @@ class Aptoide extends AppSource { | ||||
|     } | ||||
|  | ||||
|     return APKDetails( | ||||
|         version, getApkUrlsFromUrls([apkUrl]), AppNames(author, appName), | ||||
|         releaseDate: relDate); | ||||
|       version, | ||||
|       getApkUrlsFromUrls([apkUrl]), | ||||
|       AppNames(author, appName), | ||||
|       releaseDate: relDate, | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -19,7 +19,8 @@ class Codeberg extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     RegExp standardUrlRegEx = RegExp( | ||||
|       '^https?://(www\\.)?${getSourceRegex(hosts)}/[^/]+/[^/]+', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     RegExpMatch? match = standardUrlRegEx.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -36,8 +37,9 @@ class Codeberg extends AppSource { | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     return await gh.getLatestAPKDetailsCommon2(standardUrl, additionalSettings, | ||||
|         (bool useTagUrl) async { | ||||
|     return await gh.getLatestAPKDetailsCommon2(standardUrl, additionalSettings, ( | ||||
|       bool useTagUrl, | ||||
|     ) async { | ||||
|       return 'https://${hosts[0]}/api/v1/repos${standardUrl.substring('https://${hosts[0]}'.length)}/${useTagUrl ? 'tags' : 'releases'}?per_page=100'; | ||||
|     }, null); | ||||
|   } | ||||
| @@ -49,12 +51,15 @@ class Codeberg extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<Map<String, List<String>>> search(String query, | ||||
|       {Map<String, dynamic> querySettings = const {}}) async { | ||||
|   Future<Map<String, List<String>>> search( | ||||
|     String query, { | ||||
|     Map<String, dynamic> querySettings = const {}, | ||||
|   }) async { | ||||
|     return gh.searchCommon( | ||||
|       query, | ||||
|       'https://${hosts[0]}/api/v1/repos/search?q=${Uri.encodeQueryComponent(query)}&limit=100', | ||||
|       'data', | ||||
|         querySettings: querySettings); | ||||
|       querySettings: querySettings, | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -20,7 +20,8 @@ class CoolApk extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     RegExp standardUrlRegEx = RegExp( | ||||
|       r'^https?://(www\.)?coolapk\.com/apk/[^/]+', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     var match = standardUrlRegEx.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -30,8 +31,10 @@ class CoolApk extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<String?> tryInferringAppId(String standardUrl, | ||||
|       {Map<String, dynamic> additionalSettings = const {}}) async { | ||||
|   Future<String?> tryInferringAppId( | ||||
|     String standardUrl, { | ||||
|     Map<String, dynamic> additionalSettings = const {}, | ||||
|   }) async { | ||||
|     String appId = Uri.parse(standardUrl).pathSegments.last; | ||||
|     return appId; | ||||
|   } | ||||
| @@ -71,7 +74,13 @@ class CoolApk extends AppSource { | ||||
|     String aid = detail['id'].toString(); | ||||
|  | ||||
|     // get apk url | ||||
|     String apkUrl = await _getLatestApkUrl(apiUrl, appId, aid, version, headers); | ||||
|     String apkUrl = await _getLatestApkUrl( | ||||
|       apiUrl, | ||||
|       appId, | ||||
|       aid, | ||||
|       version, | ||||
|       headers, | ||||
|     ); | ||||
|     if (apkUrl.isEmpty) { | ||||
|       throw NoAPKError(); | ||||
|     } | ||||
| @@ -89,8 +98,13 @@ class CoolApk extends AppSource { | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   Future<String> _getLatestApkUrl(String apiUrl, String appId, String aid, | ||||
|       String version, Map<String, String>? headers) async { | ||||
|   Future<String> _getLatestApkUrl( | ||||
|     String apiUrl, | ||||
|     String appId, | ||||
|     String aid, | ||||
|     String version, | ||||
|     Map<String, String>? headers, | ||||
|   ) async { | ||||
|     String url = '$apiUrl/v6/apk/download?pn=$appId&aid=$aid'; | ||||
|     var res = await sourceRequest(url, {}, followRedirects: false); | ||||
|     if (res.statusCode >= 300 && res.statusCode < 400) { | ||||
| @@ -102,8 +116,9 @@ class CoolApk extends AppSource { | ||||
|  | ||||
|   @override | ||||
|   Future<Map<String, String>?> getRequestHeaders( | ||||
|       Map<String, dynamic> additionalSettings, | ||||
|       {bool forAPKDownload = false}) async { | ||||
|     Map<String, dynamic> additionalSettings, { | ||||
|     bool forAPKDownload = false, | ||||
|   }) async { | ||||
|     var tokenPair = _getToken(); | ||||
|     // CoolAPK header | ||||
|     return { | ||||
| @@ -128,14 +143,15 @@ class CoolApk extends AppSource { | ||||
|   Map<String, String> _getToken() { | ||||
|     final rand = Random(); | ||||
|  | ||||
|     String randHexString(int n) => | ||||
|         List.generate(n, (_) => rand.nextInt(256).toRadixString(16).padLeft(2, '0')) | ||||
|             .join() | ||||
|             .toUpperCase(); | ||||
|     String randHexString(int n) => List.generate( | ||||
|       n, | ||||
|       (_) => rand.nextInt(256).toRadixString(16).padLeft(2, '0'), | ||||
|     ).join().toUpperCase(); | ||||
|  | ||||
|     String randMacAddress() => | ||||
|         List.generate(6, (_) => rand.nextInt(256).toRadixString(16).padLeft(2, '0')) | ||||
|             .join(':'); | ||||
|     String randMacAddress() => List.generate( | ||||
|       6, | ||||
|       (_) => rand.nextInt(256).toRadixString(16).padLeft(2, '0'), | ||||
|     ).join(':'); | ||||
|  | ||||
|     // 加密算法来自 https://github.com/XiaoMengXinX/FuckCoolapkTokenV2、https://github.com/Coolapk-UWP/Coolapk-UWP | ||||
|     // device | ||||
| @@ -147,11 +163,13 @@ class CoolApk extends AppSource { | ||||
|     const buildNumber = 'SQ1D.220105.007'; | ||||
|  | ||||
|     // generate deviceCode | ||||
|     String deviceCode = | ||||
|     base64.encode('$aid; ; ; $mac; $manufactor; $brand; $model; $buildNumber'.codeUnits); | ||||
|     String deviceCode = base64.encode( | ||||
|       '$aid; ; ; $mac; $manufactor; $brand; $model; $buildNumber'.codeUnits, | ||||
|     ); | ||||
|  | ||||
|     // generate timestamp | ||||
|     String timeStamp = (DateTime.now().millisecondsSinceEpoch ~/ 1000).toString(); | ||||
|     String timeStamp = (DateTime.now().millisecondsSinceEpoch ~/ 1000) | ||||
|         .toString(); | ||||
|     String base64TimeStamp = base64.encode(timeStamp.codeUnits); | ||||
|     String md5TimeStamp = md5.convert(timeStamp.codeUnits).toString(); | ||||
|     String md5DeviceCode = md5.convert(deviceCode.codeUnits).toString(); | ||||
| @@ -164,7 +182,8 @@ class CoolApk extends AppSource { | ||||
|     String md5Token = md5.convert(token.codeUnits).toString(); | ||||
|  | ||||
|     // generate salt and hash | ||||
|     String bcryptSalt = '\$2a\$10\$${base64TimeStamp.substring(0, 14)}/${md5Token.substring(0, 6)}u'; | ||||
|     String bcryptSalt = | ||||
|         '\$2a\$10\$${base64TimeStamp.substring(0, 14)}/${md5Token.substring(0, 6)}u'; | ||||
|     String bcryptResult = BCrypt.hashpw(md5Base64Token, bcryptSalt); | ||||
|     String reBcryptResult = bcryptResult.replaceRange(0, 3, '\$2y'); | ||||
|     String finalToken = 'v2${base64.encode(reBcryptResult.codeUnits)}'; | ||||
|   | ||||
| @@ -11,20 +11,23 @@ class DirectAPKLink extends AppSource { | ||||
|     name = tr('directAPKLink'); | ||||
|     additionalSourceAppSpecificSettingFormItems = [ | ||||
|       ...html.additionalSourceAppSpecificSettingFormItems | ||||
|           .where((element) => element | ||||
|           .where( | ||||
|             (element) => element | ||||
|                 .where((element) => element.key == 'requestHeader') | ||||
|               .isNotEmpty) | ||||
|           .toList(), | ||||
|                 .isNotEmpty, | ||||
|           ) | ||||
|           , | ||||
|       [ | ||||
|         GeneratedFormDropdown( | ||||
|           'defaultPseudoVersioningMethod', | ||||
|           [ | ||||
|             MapEntry('partialAPKHash', tr('partialAPKHash')), | ||||
|               MapEntry('ETag', 'ETag') | ||||
|             MapEntry('ETag', 'ETag'), | ||||
|           ], | ||||
|           label: tr('defaultPseudoVersioningMethod'), | ||||
|             defaultValue: 'partialAPKHash') | ||||
|       ] | ||||
|           defaultValue: 'partialAPKHash', | ||||
|         ), | ||||
|       ], | ||||
|     ]; | ||||
|     excludeCommonSettingKeys = [ | ||||
|       'versionExtractionRegEx', | ||||
| @@ -32,7 +35,7 @@ class DirectAPKLink extends AppSource { | ||||
|       'versionDetection', | ||||
|       'useVersionCodeAsOSVersion', | ||||
|       'apkFilterRegEx', | ||||
|       'autoApkFilterByArch' | ||||
|       'autoApkFilterByArch', | ||||
|     ]; | ||||
|   } | ||||
|  | ||||
| @@ -51,10 +54,13 @@ class DirectAPKLink extends AppSource { | ||||
|  | ||||
|   @override | ||||
|   Future<Map<String, String>?> getRequestHeaders( | ||||
|       Map<String, dynamic> additionalSettings, | ||||
|       {bool forAPKDownload = false}) { | ||||
|     return html.getRequestHeaders(additionalSettings, | ||||
|         forAPKDownload: forAPKDownload); | ||||
|     Map<String, dynamic> additionalSettings, { | ||||
|     bool forAPKDownload = false, | ||||
|   }) { | ||||
|     return html.getRequestHeaders( | ||||
|       additionalSettings, | ||||
|       forAPKDownload: forAPKDownload, | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   @override | ||||
| @@ -62,8 +68,9 @@ class DirectAPKLink extends AppSource { | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     var additionalSettingsNew = | ||||
|         getDefaultValuesFromFormItems(html.combinedAppSpecificSettingFormItems); | ||||
|     var additionalSettingsNew = getDefaultValuesFromFormItems( | ||||
|       html.combinedAppSpecificSettingFormItems, | ||||
|     ); | ||||
|     for (var s in additionalSettings.keys) { | ||||
|       if (additionalSettingsNew.containsKey(s)) { | ||||
|         additionalSettingsNew[s] = additionalSettings[s]; | ||||
|   | ||||
| @@ -17,22 +17,28 @@ class FDroid extends AppSource { | ||||
|     canSearch = true; | ||||
|     additionalSourceAppSpecificSettingFormItems = [ | ||||
|       [ | ||||
|         GeneratedFormTextField('filterVersionsByRegEx', | ||||
|         GeneratedFormTextField( | ||||
|           'filterVersionsByRegEx', | ||||
|           label: tr('filterVersionsByRegEx'), | ||||
|           required: false, | ||||
|           additionalValidators: [ | ||||
|             (value) { | ||||
|               return regExValidator(value); | ||||
|               } | ||||
|             ]) | ||||
|             }, | ||||
|           ], | ||||
|         ), | ||||
|       ], | ||||
|       [ | ||||
|         GeneratedFormSwitch('trySelectingSuggestedVersionCode', | ||||
|             label: tr('trySelectingSuggestedVersionCode')) | ||||
|         GeneratedFormSwitch( | ||||
|           'trySelectingSuggestedVersionCode', | ||||
|           label: tr('trySelectingSuggestedVersionCode'), | ||||
|         ), | ||||
|       ], | ||||
|       [ | ||||
|         GeneratedFormSwitch('autoSelectHighestVersionCode', | ||||
|             label: tr('autoSelectHighestVersionCode')) | ||||
|         GeneratedFormSwitch( | ||||
|           'autoSelectHighestVersionCode', | ||||
|           label: tr('autoSelectHighestVersionCode'), | ||||
|         ), | ||||
|       ], | ||||
|     ]; | ||||
|   } | ||||
| @@ -41,7 +47,8 @@ class FDroid extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     RegExp standardUrlRegExB = RegExp( | ||||
|       '^https?://(www\\.)?${getSourceRegex(hosts)}/+[^/]+/+packages/+[^/]+', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     RegExpMatch? match = standardUrlRegExB.firstMatch(url); | ||||
|     if (match != null) { | ||||
|       url = | ||||
| @@ -49,7 +56,8 @@ class FDroid extends AppSource { | ||||
|     } | ||||
|     RegExp standardUrlRegExA = RegExp( | ||||
|       '^https?://(www\\.)?${getSourceRegex(hosts)}/+packages/+[^/]+', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     match = standardUrlRegExA.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -58,8 +66,10 @@ class FDroid extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<String?> tryInferringAppId(String standardUrl, | ||||
|       {Map<String, dynamic> additionalSettings = const {}}) async { | ||||
|   Future<String?> tryInferringAppId( | ||||
|     String standardUrl, { | ||||
|     Map<String, dynamic> additionalSettings = const {}, | ||||
|   }) async { | ||||
|     return Uri.parse(standardUrl).pathSegments.last; | ||||
|   } | ||||
|  | ||||
| @@ -72,21 +82,27 @@ class FDroid extends AppSource { | ||||
|     String host = Uri.parse(standardUrl).host; | ||||
|     var details = getAPKUrlsFromFDroidPackagesAPIResponse( | ||||
|       await sourceRequest( | ||||
|             'https://$host/api/v1/packages/$appId', additionalSettings), | ||||
|         'https://$host/api/v1/packages/$appId', | ||||
|         additionalSettings, | ||||
|       ), | ||||
|       'https://$host/repo/$appId', | ||||
|       standardUrl, | ||||
|       name, | ||||
|         additionalSettings: additionalSettings); | ||||
|       additionalSettings: additionalSettings, | ||||
|     ); | ||||
|     if (!hostChanged) { | ||||
|       try { | ||||
|         var res = await sourceRequest( | ||||
|           'https://gitlab.com/fdroid/fdroiddata/-/raw/master/metadata/$appId.yml', | ||||
|             additionalSettings); | ||||
|           additionalSettings, | ||||
|         ); | ||||
|         var lines = res.body.split('\n'); | ||||
|         var authorLines = lines.where((l) => l.startsWith('AuthorName: ')); | ||||
|         if (authorLines.isNotEmpty) { | ||||
|           details.names.author = | ||||
|               authorLines.first.split(': ').sublist(1).join(': '); | ||||
|           details.names.author = authorLines.first | ||||
|               .split(': ') | ||||
|               .sublist(1) | ||||
|               .join(': '); | ||||
|         } | ||||
|         var changelogUrls = lines | ||||
|             .where((l) => l.startsWith('Changelog: ')) | ||||
| @@ -111,8 +127,8 @@ class FDroid extends AppSource { | ||||
|               (details.changeLog?.indexOf('/blob/') ?? -1) >= 0) { | ||||
|             details.changeLog = (await sourceRequest( | ||||
|               details.changeLog!.replaceFirst('/blob/', '/raw/'), | ||||
|                     additionalSettings)) | ||||
|                 .body; | ||||
|               additionalSettings, | ||||
|             )).body; | ||||
|           } | ||||
|         } | ||||
|       } catch (e) { | ||||
| @@ -126,10 +142,14 @@ class FDroid extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<Map<String, List<String>>> search(String query, | ||||
|       {Map<String, dynamic> querySettings = const {}}) async { | ||||
|   Future<Map<String, List<String>>> search( | ||||
|     String query, { | ||||
|     Map<String, dynamic> querySettings = const {}, | ||||
|   }) async { | ||||
|     Response res = await sourceRequest( | ||||
|         'https://search.${hosts[0]}/?q=${Uri.encodeQueryComponent(query)}', {}); | ||||
|       'https://search.${hosts[0]}/?q=${Uri.encodeQueryComponent(query)}', | ||||
|       {}, | ||||
|     ); | ||||
|     if (res.statusCode == 200) { | ||||
|       Map<String, List<String>> urlsWithDescriptions = {}; | ||||
|       parse(res.body).querySelectorAll('.package-header').forEach((e) { | ||||
| @@ -145,7 +165,7 @@ class FDroid extends AppSource { | ||||
|           urlsWithDescriptions[url] = [ | ||||
|             e.querySelector('.package-name')?.text.trim() ?? '', | ||||
|             e.querySelector('.package-summary')?.text.trim() ?? | ||||
|                 tr('noDescription') | ||||
|                 tr('noDescription'), | ||||
|           ]; | ||||
|         } | ||||
|       }); | ||||
| @@ -156,8 +176,12 @@ class FDroid extends AppSource { | ||||
|   } | ||||
|  | ||||
|   APKDetails getAPKUrlsFromFDroidPackagesAPIResponse( | ||||
|       Response res, String apkUrlPrefix, String standardUrl, String sourceName, | ||||
|       {Map<String, dynamic> additionalSettings = const {}}) { | ||||
|     Response res, | ||||
|     String apkUrlPrefix, | ||||
|     String standardUrl, | ||||
|     String sourceName, { | ||||
|     Map<String, dynamic> additionalSettings = const {}, | ||||
|   }) { | ||||
|     var autoSelectHighestVersionCode = | ||||
|         additionalSettings['autoSelectHighestVersionCode'] == true; | ||||
|     var trySelectingSuggestedVersionCode = | ||||
| @@ -177,8 +201,11 @@ class FDroid extends AppSource { | ||||
|       if (apkFilterRegEx != null) { | ||||
|         releases = releases.where((rel) { | ||||
|           String apk = '${apkUrlPrefix}_${rel['versionCode']}.apk'; | ||||
|           return filterApks([MapEntry(apk, apk)], apkFilterRegEx, false) | ||||
|               .isNotEmpty; | ||||
|           return filterApks( | ||||
|             [MapEntry(apk, apk)], | ||||
|             apkFilterRegEx, | ||||
|             false, | ||||
|           ).isNotEmpty; | ||||
|         }).toList(); | ||||
|       } | ||||
|       if (releases.isEmpty) { | ||||
| @@ -191,8 +218,10 @@ class FDroid extends AppSource { | ||||
|       if (trySelectingSuggestedVersionCode && | ||||
|           response['suggestedVersionCode'] != null && | ||||
|           filterVersionsByRegEx == null) { | ||||
|         var suggestedReleases = releases.where((element) => | ||||
|             element['versionCode'] == response['suggestedVersionCode']); | ||||
|         var suggestedReleases = releases.where( | ||||
|           (element) => | ||||
|               element['versionCode'] == response['suggestedVersionCode'], | ||||
|         ); | ||||
|         if (suggestedReleases.isNotEmpty) { | ||||
|           releaseChoices = suggestedReleases; | ||||
|           version = suggestedReleases.first['versionName']; | ||||
| @@ -203,8 +232,9 @@ class FDroid extends AppSource { | ||||
|         version = null; | ||||
|         releaseChoices = []; | ||||
|         for (var i = 0; i < releases.length; i++) { | ||||
|           if (RegExp(filterVersionsByRegEx!) | ||||
|               .hasMatch(releases[i]['versionName'])) { | ||||
|           if (RegExp( | ||||
|             filterVersionsByRegEx!, | ||||
|           ).hasMatch(releases[i]['versionName'])) { | ||||
|             version = releases[i]['versionName']; | ||||
|           } | ||||
|         } | ||||
| @@ -219,8 +249,9 @@ class FDroid extends AppSource { | ||||
|       } | ||||
|       // If a suggested release was not already picked, pick all those with the selected version | ||||
|       if (releaseChoices.isEmpty) { | ||||
|         releaseChoices = | ||||
|             releases.where((element) => element['versionName'] == version); | ||||
|         releaseChoices = releases.where( | ||||
|           (element) => element['versionName'] == version, | ||||
|         ); | ||||
|       } | ||||
|       // For the remaining releases, use the toggles to auto-select one if possible | ||||
|       if (releaseChoices.length > 1) { | ||||
| @@ -228,8 +259,10 @@ class FDroid extends AppSource { | ||||
|           releaseChoices = [releaseChoices.first]; | ||||
|         } else if (trySelectingSuggestedVersionCode && | ||||
|             response['suggestedVersionCode'] != null) { | ||||
|           var suggestedReleases = releaseChoices.where((element) => | ||||
|               element['versionCode'] == response['suggestedVersionCode']); | ||||
|           var suggestedReleases = releaseChoices.where( | ||||
|             (element) => | ||||
|                 element['versionCode'] == response['suggestedVersionCode'], | ||||
|           ); | ||||
|           if (suggestedReleases.isNotEmpty) { | ||||
|             releaseChoices = suggestedReleases; | ||||
|           } | ||||
| @@ -241,8 +274,11 @@ class FDroid extends AppSource { | ||||
|       List<String> apkUrls = releaseChoices | ||||
|           .map((e) => '${apkUrlPrefix}_${e['versionCode']}.apk') | ||||
|           .toList(); | ||||
|       return APKDetails(version, getApkUrlsFromUrls(apkUrls.toSet().toList()), | ||||
|           AppNames(sourceName, Uri.parse(standardUrl).pathSegments.last)); | ||||
|       return APKDetails( | ||||
|         version, | ||||
|         getApkUrlsFromUrls(apkUrls.toSet().toList()), | ||||
|         AppNames(sourceName, Uri.parse(standardUrl).pathSegments.last), | ||||
|       ); | ||||
|     } else { | ||||
|       throw getObtainiumHttpError(res); | ||||
|     } | ||||
|   | ||||
| @@ -15,15 +15,20 @@ class FDroidRepo extends AppSource { | ||||
|  | ||||
|     additionalSourceAppSpecificSettingFormItems = [ | ||||
|       [ | ||||
|         GeneratedFormTextField('appIdOrName', | ||||
|         GeneratedFormTextField( | ||||
|           'appIdOrName', | ||||
|           label: tr('appIdOrName'), | ||||
|           hint: tr('reposHaveMultipleApps'), | ||||
|             required: true) | ||||
|           required: true, | ||||
|         ), | ||||
|       ], | ||||
|       [ | ||||
|         GeneratedFormSwitch('pickHighestVersionCode', | ||||
|             label: tr('pickHighestVersionCode'), defaultValue: false) | ||||
|       ] | ||||
|         GeneratedFormSwitch( | ||||
|           'pickHighestVersionCode', | ||||
|           label: tr('pickHighestVersionCode'), | ||||
|           defaultValue: false, | ||||
|         ), | ||||
|       ], | ||||
|     ]; | ||||
|   } | ||||
|  | ||||
| @@ -54,8 +59,10 @@ class FDroidRepo extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<Map<String, List<String>>> search(String query, | ||||
|       {Map<String, dynamic> querySettings = const {}}) async { | ||||
|   Future<Map<String, List<String>>> search( | ||||
|     String query, { | ||||
|     Map<String, dynamic> querySettings = const {}, | ||||
|   }) async { | ||||
|     String? url = querySettings['url']; | ||||
|     if (url == null) { | ||||
|       throw NoReleasesError(); | ||||
| @@ -73,11 +80,8 @@ class FDroidRepo extends AppSource { | ||||
|             appId.contains(query) || | ||||
|             appName.contains(query) || | ||||
|             appDesc.contains(query)) { | ||||
|           results[ | ||||
|               '${res.request!.url.toString().split('/').reversed.toList().sublist(1).reversed.join('/')}?appId=$appId'] = [ | ||||
|             appName, | ||||
|             appDesc | ||||
|           ]; | ||||
|           results['${res.request!.url.toString().split('/').reversed.toList().sublist(1).reversed.join('/')}?appId=$appId'] = | ||||
|               [appName, appDesc]; | ||||
|         } | ||||
|       }); | ||||
|       return results; | ||||
| @@ -119,8 +123,11 @@ class FDroidRepo extends AppSource { | ||||
|     if (appId != null) { | ||||
|       app.url = uri | ||||
|           .replace( | ||||
|               queryParameters: Map.fromEntries( | ||||
|                   [...uri.queryParameters.entries, MapEntry('appId', appId)])) | ||||
|             queryParameters: Map.fromEntries([ | ||||
|               ...uri.queryParameters.entries, | ||||
|               MapEntry('appId', appId), | ||||
|             ]), | ||||
|           ) | ||||
|           .toString(); | ||||
|       app.additionalSettings['appIdOrName'] = appId; | ||||
|       app.id = appId; | ||||
| @@ -134,7 +141,8 @@ class FDroidRepo extends AppSource { | ||||
|   ) async { | ||||
|     var res = await sourceRequest( | ||||
|       '$url${url.endsWith('/index.xml') ? '' : '/index.xml'}', | ||||
|         additionalSettings); | ||||
|       additionalSettings, | ||||
|     ); | ||||
|     if (res.statusCode != 200) { | ||||
|       var base = url.endsWith('/index.xml') | ||||
|           ? url.split('/').reversed.toList().sublist(1).reversed.join('/') | ||||
| @@ -142,7 +150,9 @@ class FDroidRepo extends AppSource { | ||||
|       res = await sourceRequest('$base/repo/index.xml', additionalSettings); | ||||
|       if (res.statusCode != 200) { | ||||
|         res = await sourceRequest( | ||||
|             '$base/fdroid/repo/index.xml', additionalSettings); | ||||
|           '$base/fdroid/repo/index.xml', | ||||
|           additionalSettings, | ||||
|         ); | ||||
|       } | ||||
|     } | ||||
|     return res; | ||||
| @@ -164,8 +174,10 @@ class FDroidRepo extends AppSource { | ||||
|       throw NoReleasesError(); | ||||
|     } | ||||
|     additionalSettings['appIdOrName'] = appIdOrName; | ||||
|     var res = | ||||
|         await sourceRequestWithURLVariants(standardUrl, additionalSettings); | ||||
|     var res = await sourceRequestWithURLVariants( | ||||
|       standardUrl, | ||||
|       additionalSettings, | ||||
|     ); | ||||
|     if (res.statusCode == 200) { | ||||
|       var body = parse(res.body); | ||||
|       var foundApps = body.querySelectorAll('application').where((element) { | ||||
| @@ -202,24 +214,32 @@ class FDroidRepo extends AppSource { | ||||
|         throw NoVersionError(); | ||||
|       } | ||||
|       var latestVersionReleases = releases | ||||
|           .where((element) => | ||||
|           .where( | ||||
|             (element) => | ||||
|                 element.querySelector('version')?.innerHtml == latestVersion && | ||||
|               element.querySelector('apkname') != null) | ||||
|                 element.querySelector('apkname') != null, | ||||
|           ) | ||||
|           .toList(); | ||||
|       if (latestVersionReleases.length > 1 && pickHighestVersionCode) { | ||||
|         latestVersionReleases.sort((e1, e2) { | ||||
|           return int.parse(e2.querySelector('versioncode')!.innerHtml) | ||||
|               .compareTo(int.parse(e1.querySelector('versioncode')!.innerHtml)); | ||||
|           return int.parse( | ||||
|             e2.querySelector('versioncode')!.innerHtml, | ||||
|           ).compareTo(int.parse(e1.querySelector('versioncode')!.innerHtml)); | ||||
|         }); | ||||
|         latestVersionReleases = [latestVersionReleases[0]]; | ||||
|       } | ||||
|       List<String> apkUrls = latestVersionReleases | ||||
|           .map((e) => | ||||
|               '${res.request!.url.toString().split('/').reversed.toList().sublist(1).reversed.join('/')}/${e.querySelector('apkname')!.innerHtml}') | ||||
|           .map( | ||||
|             (e) => | ||||
|                 '${res.request!.url.toString().split('/').reversed.toList().sublist(1).reversed.join('/')}/${e.querySelector('apkname')!.innerHtml}', | ||||
|           ) | ||||
|           .toList(); | ||||
|       return APKDetails(latestVersion, getApkUrlsFromUrls(apkUrls), | ||||
|       return APKDetails( | ||||
|         latestVersion, | ||||
|         getApkUrlsFromUrls(apkUrls), | ||||
|         AppNames(authorName, appName), | ||||
|           releaseDate: releaseDate); | ||||
|         releaseDate: releaseDate, | ||||
|       ); | ||||
|     } else { | ||||
|       throw getObtainiumHttpError(res); | ||||
|     } | ||||
|   | ||||
| @@ -19,59 +19,71 @@ class GitHub extends AppSource { | ||||
|     showReleaseDateAsVersionToggle = true; | ||||
|  | ||||
|     sourceConfigSettingFormItems = [ | ||||
|       GeneratedFormTextField('github-creds', | ||||
|       GeneratedFormTextField( | ||||
|         'github-creds', | ||||
|         label: tr('githubPATLabel'), | ||||
|         password: true, | ||||
|         required: false, | ||||
|         belowWidgets: [ | ||||
|             const SizedBox( | ||||
|               height: 4, | ||||
|             ), | ||||
|           const SizedBox(height: 4), | ||||
|           GestureDetector( | ||||
|             onTap: () { | ||||
|               launchUrlString( | ||||
|                 'https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token', | ||||
|                       mode: LaunchMode.externalApplication); | ||||
|                 mode: LaunchMode.externalApplication, | ||||
|               ); | ||||
|             }, | ||||
|             child: Text( | ||||
|               tr('about'), | ||||
|               style: const TextStyle( | ||||
|                       decoration: TextDecoration.underline, fontSize: 12), | ||||
|                 )), | ||||
|             const SizedBox( | ||||
|               height: 4, | ||||
|                 decoration: TextDecoration.underline, | ||||
|                 fontSize: 12, | ||||
|               ), | ||||
|             ), | ||||
|           ), | ||||
|           const SizedBox(height: 4), | ||||
|         ], | ||||
|       ), | ||||
|           ]) | ||||
|     ]; | ||||
|  | ||||
|     additionalSourceAppSpecificSettingFormItems = [ | ||||
|       [ | ||||
|         GeneratedFormSwitch('includePrereleases', | ||||
|             label: tr('includePrereleases'), defaultValue: false) | ||||
|         GeneratedFormSwitch( | ||||
|           'includePrereleases', | ||||
|           label: tr('includePrereleases'), | ||||
|           defaultValue: false, | ||||
|         ), | ||||
|       ], | ||||
|       [ | ||||
|         GeneratedFormSwitch('fallbackToOlderReleases', | ||||
|             label: tr('fallbackToOlderReleases'), defaultValue: true) | ||||
|         GeneratedFormSwitch( | ||||
|           'fallbackToOlderReleases', | ||||
|           label: tr('fallbackToOlderReleases'), | ||||
|           defaultValue: true, | ||||
|         ), | ||||
|       ], | ||||
|       [ | ||||
|         GeneratedFormTextField('filterReleaseTitlesByRegEx', | ||||
|         GeneratedFormTextField( | ||||
|           'filterReleaseTitlesByRegEx', | ||||
|           label: tr('filterReleaseTitlesByRegEx'), | ||||
|           required: false, | ||||
|           additionalValidators: [ | ||||
|             (value) { | ||||
|               return regExValidator(value); | ||||
|               } | ||||
|             ]) | ||||
|             }, | ||||
|           ], | ||||
|         ), | ||||
|       ], | ||||
|       [ | ||||
|         GeneratedFormTextField('filterReleaseNotesByRegEx', | ||||
|         GeneratedFormTextField( | ||||
|           'filterReleaseNotesByRegEx', | ||||
|           label: tr('filterReleaseNotesByRegEx'), | ||||
|           required: false, | ||||
|           additionalValidators: [ | ||||
|             (value) { | ||||
|               return regExValidator(value); | ||||
|               } | ||||
|             ]) | ||||
|             }, | ||||
|           ], | ||||
|         ), | ||||
|       ], | ||||
|       [GeneratedFormSwitch('verifyLatestTag', label: tr('verifyLatestTag'))], | ||||
|       [ | ||||
| @@ -81,26 +93,36 @@ class GitHub extends AppSource { | ||||
|             MapEntry('date', tr('releaseDate')), | ||||
|             MapEntry('smartname', tr('smartname')), | ||||
|             MapEntry('none', tr('none')), | ||||
|               MapEntry('smartname-datefallback', | ||||
|                   '${tr('smartname')} x ${tr('releaseDate')}'), | ||||
|             MapEntry( | ||||
|               'smartname-datefallback', | ||||
|               '${tr('smartname')} x ${tr('releaseDate')}', | ||||
|             ), | ||||
|             MapEntry('name', tr('name')), | ||||
|           ], | ||||
|           label: tr('sortMethod'), | ||||
|             defaultValue: 'date') | ||||
|           defaultValue: 'date', | ||||
|         ), | ||||
|       ], | ||||
|       [ | ||||
|         GeneratedFormSwitch('useLatestAssetDateAsReleaseDate', | ||||
|             label: tr('useLatestAssetDateAsReleaseDate'), defaultValue: false) | ||||
|         GeneratedFormSwitch( | ||||
|           'useLatestAssetDateAsReleaseDate', | ||||
|           label: tr('useLatestAssetDateAsReleaseDate'), | ||||
|           defaultValue: false, | ||||
|         ), | ||||
|       ], | ||||
|       [ | ||||
|         GeneratedFormSwitch('releaseTitleAsVersion', | ||||
|             label: tr('releaseTitleAsVersion'), defaultValue: false) | ||||
|       ] | ||||
|         GeneratedFormSwitch( | ||||
|           'releaseTitleAsVersion', | ||||
|           label: tr('releaseTitleAsVersion'), | ||||
|           defaultValue: false, | ||||
|         ), | ||||
|       ], | ||||
|     ]; | ||||
|  | ||||
|     canSearch = true; | ||||
|     searchQuerySettingFormItems = [ | ||||
|       GeneratedFormTextField('minStarCount', | ||||
|       GeneratedFormTextField( | ||||
|         'minStarCount', | ||||
|         label: tr('minStarCount'), | ||||
|         defaultValue: '0', | ||||
|         additionalValidators: [ | ||||
| @@ -111,53 +133,71 @@ class GitHub extends AppSource { | ||||
|               return tr('invalidInput'); | ||||
|             } | ||||
|             return null; | ||||
|             } | ||||
|           ]) | ||||
|           }, | ||||
|         ], | ||||
|       ), | ||||
|     ]; | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<String?> tryInferringAppId(String standardUrl, | ||||
|       {Map<String, dynamic> additionalSettings = const {}}) async { | ||||
|   Future<String?> tryInferringAppId( | ||||
|     String standardUrl, { | ||||
|     Map<String, dynamic> additionalSettings = const {}, | ||||
|   }) async { | ||||
|     const possibleBuildGradleLocations = [ | ||||
|       '/app/build.gradle', | ||||
|       'android/app/build.gradle', | ||||
|       'src/app/build.gradle' | ||||
|       'src/app/build.gradle', | ||||
|     ]; | ||||
|     for (var path in possibleBuildGradleLocations) { | ||||
|       try { | ||||
|         var res = await sourceRequest( | ||||
|           '${await convertStandardUrlToAPIUrl(standardUrl, additionalSettings)}/contents/$path', | ||||
|             additionalSettings); | ||||
|           additionalSettings, | ||||
|         ); | ||||
|         if (res.statusCode == 200) { | ||||
|           try { | ||||
|             var body = jsonDecode(res.body); | ||||
|             var trimmedLines = utf8 | ||||
|                 .decode(base64 | ||||
|                     .decode(body['content'].toString().split('\n').join(''))) | ||||
|                 .decode( | ||||
|                   base64.decode( | ||||
|                     body['content'].toString().split('\n').join(''), | ||||
|                   ), | ||||
|                 ) | ||||
|                 .split('\n') | ||||
|                 .map((e) => e.trim()); | ||||
|             var appIds = trimmedLines.where((l) => | ||||
|             var appIds = trimmedLines.where( | ||||
|               (l) => | ||||
|                   l.startsWith('applicationId "') || | ||||
|                 l.startsWith('applicationId \'')); | ||||
|             appIds = appIds.map((appId) => appId | ||||
|                 .split(appId.startsWith('applicationId "') ? '"' : '\'')[1]); | ||||
|             appIds = appIds.map((appId) { | ||||
|                   l.startsWith('applicationId \''), | ||||
|             ); | ||||
|             appIds = appIds.map( | ||||
|               (appId) => appId.split( | ||||
|                 appId.startsWith('applicationId "') ? '"' : '\'', | ||||
|               )[1], | ||||
|             ); | ||||
|             appIds = appIds | ||||
|                 .map((appId) { | ||||
|                   if (appId.startsWith('\${') && appId.endsWith('}')) { | ||||
|                     appId = trimmedLines | ||||
|                     .where((l) => l.startsWith( | ||||
|                         'def ${appId.substring(2, appId.length - 1)}')) | ||||
|                         .where( | ||||
|                           (l) => l.startsWith( | ||||
|                             'def ${appId.substring(2, appId.length - 1)}', | ||||
|                           ), | ||||
|                         ) | ||||
|                         .first; | ||||
|                     appId = appId.split(appId.contains('"') ? '"' : '\'')[1]; | ||||
|                   } | ||||
|                   return appId; | ||||
|             }).where((appId) => appId.isNotEmpty); | ||||
|                 }) | ||||
|                 .where((appId) => appId.isNotEmpty); | ||||
|             if (appIds.length == 1) { | ||||
|               return appIds.first; | ||||
|             } | ||||
|           } catch (err) { | ||||
|             LogsProvider().add( | ||||
|                 'Error parsing build.gradle from ${res.request!.url.toString()}: ${err.toString()}'); | ||||
|               'Error parsing build.gradle from ${res.request!.url.toString()}: ${err.toString()}', | ||||
|             ); | ||||
|           } | ||||
|         } | ||||
|       } catch (err) { | ||||
| @@ -171,7 +211,8 @@ class GitHub extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     RegExp standardUrlRegEx = RegExp( | ||||
|       '^https?://(www\\.)?${getSourceRegex(hosts)}/[^/]+/[^/]+', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     RegExpMatch? match = standardUrlRegEx.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -181,8 +222,9 @@ class GitHub extends AppSource { | ||||
|  | ||||
|   @override | ||||
|   Future<Map<String, String>?> getRequestHeaders( | ||||
|       Map<String, dynamic> additionalSettings, | ||||
|       {bool forAPKDownload = false}) async { | ||||
|     Map<String, dynamic> additionalSettings, { | ||||
|     bool forAPKDownload = false, | ||||
|   }) async { | ||||
|     var token = await getTokenIfAny(additionalSettings); | ||||
|     var headers = <String, String>{}; | ||||
|     if (token != null && token.isNotEmpty) { | ||||
| @@ -201,14 +243,17 @@ class GitHub extends AppSource { | ||||
|   Future<String?> getTokenIfAny(Map<String, dynamic> additionalSettings) async { | ||||
|     SettingsProvider settingsProvider = SettingsProvider(); | ||||
|     await settingsProvider.initializeSettings(); | ||||
|     var sourceConfig = | ||||
|         await getSourceConfigValues(additionalSettings, settingsProvider); | ||||
|     var sourceConfig = await getSourceConfigValues( | ||||
|       additionalSettings, | ||||
|       settingsProvider, | ||||
|     ); | ||||
|     String? creds = sourceConfig['github-creds']; | ||||
|     if (creds != null) { | ||||
|       var userNameEndIndex = creds.indexOf(':'); | ||||
|       if (userNameEndIndex > 0) { | ||||
|         creds = creds.substring( | ||||
|             userNameEndIndex + 1); // For old username-included token inputs | ||||
|           userNameEndIndex + 1, | ||||
|         ); // For old username-included token inputs | ||||
|       } | ||||
|       return creds; | ||||
|     } else { | ||||
| @@ -228,16 +273,21 @@ class GitHub extends AppSource { | ||||
|       'https://api.${hosts[0]}'; | ||||
|  | ||||
|   Future<String> convertStandardUrlToAPIUrl( | ||||
|           String standardUrl, Map<String, dynamic> additionalSettings) async => | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async => | ||||
|       '${await getAPIHost(additionalSettings)}/repos${standardUrl.substring('https://${hosts[0]}'.length)}'; | ||||
|  | ||||
|   @override | ||||
|   String? changeLogPageFromStandardUrl(String standardUrl) => | ||||
|       '$standardUrl/releases'; | ||||
|  | ||||
|   Future<APKDetails> getLatestAPKDetailsCommon(String requestUrl, | ||||
|       String standardUrl, Map<String, dynamic> additionalSettings, | ||||
|       {Function(Response)? onHttpErrorCode}) async { | ||||
|   Future<APKDetails> getLatestAPKDetailsCommon( | ||||
|     String requestUrl, | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, { | ||||
|     Function(Response)? onHttpErrorCode, | ||||
|   }) async { | ||||
|     bool includePrereleases = additionalSettings['includePrereleases'] == true; | ||||
|     bool fallbackToOlderReleases = | ||||
|         additionalSettings['fallbackToOlderReleases'] == true; | ||||
| @@ -263,7 +313,8 @@ class GitHub extends AppSource { | ||||
|       var temp = requestUrl.split('?'); | ||||
|       Response res = await sourceRequest( | ||||
|         '${temp[0]}/latest${temp.length > 1 ? '?${temp.sublist(1).join('?')}' : ''}', | ||||
|           additionalSettings); | ||||
|         additionalSettings, | ||||
|       ); | ||||
|       if (res.statusCode != 200) { | ||||
|         if (onHttpErrorCode != null) { | ||||
|           onHttpErrorCode(res); | ||||
| @@ -278,8 +329,10 @@ class GitHub extends AppSource { | ||||
|       if (latestRelease != null) { | ||||
|         var latestTag = latestRelease['tag_name'] ?? latestRelease['name']; | ||||
|         if (releases | ||||
|             .where((element) => | ||||
|                 (element['tag_name'] ?? element['name']) == latestTag) | ||||
|             .where( | ||||
|               (element) => | ||||
|                   (element['tag_name'] ?? element['name']) == latestTag, | ||||
|             ) | ||||
|             .isEmpty) { | ||||
|           releases = [latestRelease, ...releases]; | ||||
|         } | ||||
| @@ -340,17 +393,25 @@ class GitHub extends AppSource { | ||||
|           } else { | ||||
|             var nameA = a['tag_name'] ?? a['name']; | ||||
|             var nameB = b['tag_name'] ?? b['name']; | ||||
|             var stdFormats = findStandardFormatsForVersion(nameA, false) | ||||
|                 .intersection(findStandardFormatsForVersion(nameB, false)); | ||||
|             var stdFormats = findStandardFormatsForVersion( | ||||
|               nameA, | ||||
|               false, | ||||
|             ).intersection(findStandardFormatsForVersion(nameB, false)); | ||||
|             if (sortMethod == 'date' || | ||||
|                 (sortMethod == 'smartname-datefallback' && | ||||
|                     stdFormats.isEmpty)) { | ||||
|               return (getReleaseDateFromRelease( | ||||
|                           a, useLatestAssetDateAsReleaseDate) ?? | ||||
|                         a, | ||||
|                         useLatestAssetDateAsReleaseDate, | ||||
|                       ) ?? | ||||
|                       DateTime(1)) | ||||
|                   .compareTo(getReleaseDateFromRelease( | ||||
|                           b, useLatestAssetDateAsReleaseDate) ?? | ||||
|                       DateTime(0)); | ||||
|                   .compareTo( | ||||
|                     getReleaseDateFromRelease( | ||||
|                           b, | ||||
|                           useLatestAssetDateAsReleaseDate, | ||||
|                         ) ?? | ||||
|                         DateTime(0), | ||||
|                   ); | ||||
|             } else { | ||||
|               if (sortMethod != 'name' && stdFormats.isNotEmpty) { | ||||
|                 var reg = RegExp(stdFormats.last); | ||||
| @@ -358,11 +419,14 @@ class GitHub extends AppSource { | ||||
|                 var matchB = reg.firstMatch(nameB); | ||||
|                 return compareAlphaNumeric( | ||||
|                   (nameA as String).substring(matchA!.start, matchA.end), | ||||
|                     (nameB as String).substring(matchB!.start, matchB.end)); | ||||
|                   (nameB as String).substring(matchB!.start, matchB.end), | ||||
|                 ); | ||||
|               } else { | ||||
|                 // 'name' | ||||
|                 return compareAlphaNumeric( | ||||
|                     (nameA as String), (nameB as String)); | ||||
|                   (nameA as String), | ||||
|                   (nameB as String), | ||||
|                 ); | ||||
|               } | ||||
|             } | ||||
|           } | ||||
| @@ -374,9 +438,11 @@ class GitHub extends AppSource { | ||||
|           latestRelease != | ||||
|               (releases[releases.length - 1]['tag_name'] ?? | ||||
|                   releases[0]['name'])) { | ||||
|         var ind = releases.indexWhere((element) => | ||||
|         var ind = releases.indexWhere( | ||||
|           (element) => | ||||
|               (latestRelease['tag_name'] ?? latestRelease['name']) == | ||||
|             (element['tag_name'] ?? element['name'])); | ||||
|               (element['tag_name'] ?? element['name']), | ||||
|         ); | ||||
|         if (ind >= 0) { | ||||
|           releases.add(releases.removeAt(ind)); | ||||
|         } | ||||
| @@ -404,8 +470,9 @@ class GitHub extends AppSource { | ||||
|           continue; | ||||
|         } | ||||
|         if (regexNotesFilter != null && | ||||
|             !RegExp(regexNotesFilter) | ||||
|                 .hasMatch(((releases[i]['body'] as String?) ?? '').trim())) { | ||||
|             !RegExp( | ||||
|               regexNotesFilter, | ||||
|             ).hasMatch(((releases[i]['body'] as String?) ?? '').trim())) { | ||||
|           continue; | ||||
|         } | ||||
|         var allAssetsWithUrls = findReleaseAssetUrls(releases[i]); | ||||
| @@ -413,11 +480,12 @@ class GitHub extends AppSource { | ||||
|             .map((e) => e['final_url'] as MapEntry<String, String>) | ||||
|             .toList(); | ||||
|         var apkAssetsWithUrls = allAssetsWithUrls | ||||
|             .where((element) => | ||||
|                 (element['final_url'] as MapEntry<String, String>) | ||||
|             .where( | ||||
|               (element) => (element['final_url'] as MapEntry<String, String>) | ||||
|                   .key | ||||
|                   .toLowerCase() | ||||
|                     .endsWith('.apk')) | ||||
|                   .endsWith('.apk'), | ||||
|             ) | ||||
|             .toList(); | ||||
|  | ||||
|         var filteredApkUrls = filterApks( | ||||
| @@ -425,12 +493,18 @@ class GitHub extends AppSource { | ||||
|               .map((e) => e['final_url'] as MapEntry<String, String>) | ||||
|               .toList(), | ||||
|           additionalSettings['apkFilterRegEx'], | ||||
|             additionalSettings['invertAPKFilter']); | ||||
|           additionalSettings['invertAPKFilter'], | ||||
|         ); | ||||
|         var filteredApks = apkAssetsWithUrls | ||||
|             .where((e) => filteredApkUrls | ||||
|                 .where((e2) => | ||||
|                     e2.key == (e['final_url'] as MapEntry<String, String>).key) | ||||
|                 .isNotEmpty) | ||||
|             .where( | ||||
|               (e) => filteredApkUrls | ||||
|                   .where( | ||||
|                     (e2) => | ||||
|                         e2.key == | ||||
|                         (e['final_url'] as MapEntry<String, String>).key, | ||||
|                   ) | ||||
|                   .isNotEmpty, | ||||
|             ) | ||||
|             .toList(); | ||||
|  | ||||
|         if (filteredApks.isEmpty && additionalSettings['trackOnly'] != true) { | ||||
| @@ -444,14 +518,20 @@ class GitHub extends AppSource { | ||||
|             ? nameToFilter | ||||
|             : targetRelease['tag_name'] ?? targetRelease['name']; | ||||
|         if (targetRelease['tarball_url'] != null) { | ||||
|           allAssetUrls.add(MapEntry( | ||||
|           allAssetUrls.add( | ||||
|             MapEntry( | ||||
|               (targetRelease['version'] ?? 'source') + '.tar.gz', | ||||
|               targetRelease['tarball_url'])); | ||||
|               targetRelease['tarball_url'], | ||||
|             ), | ||||
|           ); | ||||
|         } | ||||
|         if (targetRelease['zipball_url'] != null) { | ||||
|           allAssetUrls.add(MapEntry( | ||||
|           allAssetUrls.add( | ||||
|             MapEntry( | ||||
|               (targetRelease['version'] ?? 'source') + '.zip', | ||||
|               targetRelease['zipball_url'])); | ||||
|               targetRelease['zipball_url'], | ||||
|             ), | ||||
|           ); | ||||
|         } | ||||
|         targetRelease['allAssetUrls'] = allAssetUrls; | ||||
|         break; | ||||
| @@ -462,7 +542,9 @@ class GitHub extends AppSource { | ||||
|       String? version = targetRelease['version']; | ||||
|  | ||||
|       DateTime? releaseDate = getReleaseDateFromRelease( | ||||
|           targetRelease, useLatestAssetDateAsReleaseDate); | ||||
|         targetRelease, | ||||
|         useLatestAssetDateAsReleaseDate, | ||||
|       ); | ||||
|       if (version == null) { | ||||
|         throw NoVersionError(); | ||||
|       } | ||||
| @@ -474,7 +556,8 @@ class GitHub extends AppSource { | ||||
|         releaseDate: releaseDate, | ||||
|         changeLog: changeLog.isEmpty ? null : changeLog, | ||||
|         allAssetUrls: | ||||
|               targetRelease['allAssetUrls'] as List<MapEntry<String, String>>); | ||||
|             targetRelease['allAssetUrls'] as List<MapEntry<String, String>>, | ||||
|       ); | ||||
|     } else { | ||||
|       if (onHttpErrorCode != null) { | ||||
|         onHttpErrorCode(res); | ||||
| @@ -483,20 +566,27 @@ class GitHub extends AppSource { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   getLatestAPKDetailsCommon2( | ||||
|   Future<APKDetails> getLatestAPKDetailsCommon2( | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|     Future<String> Function(bool) reqUrlGenerator, | ||||
|       dynamic Function(Response)? onHttpErrorCode) async { | ||||
|     dynamic Function(Response)? onHttpErrorCode, | ||||
|   ) async { | ||||
|     try { | ||||
|       return await getLatestAPKDetailsCommon( | ||||
|           await reqUrlGenerator(false), standardUrl, additionalSettings, | ||||
|           onHttpErrorCode: onHttpErrorCode); | ||||
|         await reqUrlGenerator(false), | ||||
|         standardUrl, | ||||
|         additionalSettings, | ||||
|         onHttpErrorCode: onHttpErrorCode, | ||||
|       ); | ||||
|     } catch (err) { | ||||
|       if (err is NoReleasesError && additionalSettings['trackOnly'] == true) { | ||||
|         return await getLatestAPKDetailsCommon( | ||||
|             await reqUrlGenerator(true), standardUrl, additionalSettings, | ||||
|             onHttpErrorCode: onHttpErrorCode); | ||||
|           await reqUrlGenerator(true), | ||||
|           standardUrl, | ||||
|           additionalSettings, | ||||
|           onHttpErrorCode: onHttpErrorCode, | ||||
|         ); | ||||
|       } else { | ||||
|         rethrow; | ||||
|       } | ||||
| @@ -508,12 +598,16 @@ class GitHub extends AppSource { | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     return await getLatestAPKDetailsCommon2(standardUrl, additionalSettings, | ||||
|     return await getLatestAPKDetailsCommon2( | ||||
|       standardUrl, | ||||
|       additionalSettings, | ||||
|       (bool useTagUrl) async { | ||||
|         return '${await convertStandardUrlToAPIUrl(standardUrl, additionalSettings)}/${useTagUrl ? 'tags' : 'releases'}?per_page=100'; | ||||
|     }, (Response res) { | ||||
|       }, | ||||
|       (Response res) { | ||||
|         rateLimitErrorCheck(res); | ||||
|     }); | ||||
|       }, | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   AppNames getAppNames(String standardUrl) { | ||||
| @@ -523,9 +617,12 @@ class GitHub extends AppSource { | ||||
|   } | ||||
|  | ||||
|   Future<Map<String, List<String>>> searchCommon( | ||||
|       String query, String requestUrl, String rootProp, | ||||
|       {Function(Response)? onHttpErrorCode, | ||||
|       Map<String, dynamic> querySettings = const {}}) async { | ||||
|     String query, | ||||
|     String requestUrl, | ||||
|     String rootProp, { | ||||
|     Function(Response)? onHttpErrorCode, | ||||
|     Map<String, dynamic> querySettings = const {}, | ||||
|   }) async { | ||||
|     Response res = await sourceRequest(requestUrl, {}); | ||||
|     if (res.statusCode == 200) { | ||||
|       int minStarCount = querySettings['minStarCount'] != null | ||||
| @@ -540,8 +637,8 @@ class GitHub extends AppSource { | ||||
|               ((e['archived'] == true ? '[ARCHIVED] ' : '') + | ||||
|                   (e['description'] != null | ||||
|                       ? e['description'] as String | ||||
|                       : tr('noDescription'))) | ||||
|             ] | ||||
|                       : tr('noDescription'))), | ||||
|             ], | ||||
|           }); | ||||
|         } | ||||
|       } | ||||
| @@ -555,22 +652,27 @@ class GitHub extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<Map<String, List<String>>> search(String query, | ||||
|       {Map<String, dynamic> querySettings = const {}}) async { | ||||
|   Future<Map<String, List<String>>> search( | ||||
|     String query, { | ||||
|     Map<String, dynamic> querySettings = const {}, | ||||
|   }) async { | ||||
|     return searchCommon( | ||||
|       query, | ||||
|       '${await getAPIHost({})}/search/repositories?q=${Uri.encodeQueryComponent(query)}&per_page=100', | ||||
|         'items', onHttpErrorCode: (Response res) { | ||||
|       'items', | ||||
|       onHttpErrorCode: (Response res) { | ||||
|         rateLimitErrorCheck(res); | ||||
|     }, querySettings: querySettings); | ||||
|       }, | ||||
|       querySettings: querySettings, | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   rateLimitErrorCheck(Response res) { | ||||
|   void rateLimitErrorCheck(Response res) { | ||||
|     if (res.headers['x-ratelimit-remaining'] == '0') { | ||||
|       throw RateLimitError( | ||||
|           (int.parse(res.headers['x-ratelimit-reset'] ?? '1800000000') / | ||||
|                   60000000) | ||||
|               .round()); | ||||
|         (int.parse(res.headers['x-ratelimit-reset'] ?? '1800000000') / 60000000) | ||||
|             .round(), | ||||
|       ); | ||||
|     } | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -18,36 +18,41 @@ class GitLab extends AppSource { | ||||
|     showReleaseDateAsVersionToggle = true; | ||||
|  | ||||
|     sourceConfigSettingFormItems = [ | ||||
|       GeneratedFormTextField('gitlab-creds', | ||||
|       GeneratedFormTextField( | ||||
|         'gitlab-creds', | ||||
|         label: tr('gitlabPATLabel'), | ||||
|         password: true, | ||||
|         required: false, | ||||
|         belowWidgets: [ | ||||
|             const SizedBox( | ||||
|               height: 4, | ||||
|             ), | ||||
|           const SizedBox(height: 4), | ||||
|           GestureDetector( | ||||
|             onTap: () { | ||||
|               launchUrlString( | ||||
|                 'https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token', | ||||
|                       mode: LaunchMode.externalApplication); | ||||
|                 mode: LaunchMode.externalApplication, | ||||
|               ); | ||||
|             }, | ||||
|             child: Text( | ||||
|               tr('about'), | ||||
|               style: const TextStyle( | ||||
|                       decoration: TextDecoration.underline, fontSize: 12), | ||||
|                 )), | ||||
|             const SizedBox( | ||||
|               height: 4, | ||||
|             ) | ||||
|           ]) | ||||
|                 decoration: TextDecoration.underline, | ||||
|                 fontSize: 12, | ||||
|               ), | ||||
|             ), | ||||
|           ), | ||||
|           const SizedBox(height: 4), | ||||
|         ], | ||||
|       ), | ||||
|     ]; | ||||
|  | ||||
|     additionalSourceAppSpecificSettingFormItems = [ | ||||
|       [ | ||||
|         GeneratedFormSwitch('fallbackToOlderReleases', | ||||
|             label: tr('fallbackToOlderReleases'), defaultValue: true) | ||||
|       ] | ||||
|         GeneratedFormSwitch( | ||||
|           'fallbackToOlderReleases', | ||||
|           label: tr('fallbackToOlderReleases'), | ||||
|           defaultValue: true, | ||||
|         ), | ||||
|       ], | ||||
|     ]; | ||||
|   } | ||||
|  | ||||
| @@ -55,11 +60,13 @@ class GitLab extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     var urlSegments = url.split('/'); | ||||
|     var cutOffIndex = urlSegments.indexWhere((s) => s == '-'); | ||||
|     url = | ||||
|         urlSegments.sublist(0, cutOffIndex <= 0 ? null : cutOffIndex).join('/'); | ||||
|     url = urlSegments | ||||
|         .sublist(0, cutOffIndex <= 0 ? null : cutOffIndex) | ||||
|         .join('/'); | ||||
|     RegExp standardUrlRegEx = RegExp( | ||||
|       '^https?://(www\\.)?${getSourceRegex(hosts)}/[^/]+(/[^((\b/\b)|(\b/-/\b))]+){1,20}', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     RegExpMatch? match = standardUrlRegEx.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -70,15 +77,19 @@ class GitLab extends AppSource { | ||||
|   Future<String?> getPATIfAny(Map<String, dynamic> additionalSettings) async { | ||||
|     SettingsProvider settingsProvider = SettingsProvider(); | ||||
|     await settingsProvider.initializeSettings(); | ||||
|     var sourceConfig = | ||||
|         await getSourceConfigValues(additionalSettings, settingsProvider); | ||||
|     var sourceConfig = await getSourceConfigValues( | ||||
|       additionalSettings, | ||||
|       settingsProvider, | ||||
|     ); | ||||
|     String? creds = sourceConfig['gitlab-creds']; | ||||
|     return creds != null && creds.isNotEmpty ? creds : null; | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<Map<String, List<String>>> search(String query, | ||||
|       {Map<String, dynamic> querySettings = const {}}) async { | ||||
|   Future<Map<String, List<String>>> search( | ||||
|     String query, { | ||||
|     Map<String, dynamic> querySettings = const {}, | ||||
|   }) async { | ||||
|     var url = | ||||
|         'https://${hosts[0]}/api/v4/projects?search=${Uri.encodeQueryComponent(query)}'; | ||||
|     var res = await sourceRequest(url, {}); | ||||
| @@ -90,7 +101,7 @@ class GitLab extends AppSource { | ||||
|     for (var element in json) { | ||||
|       results['https://${hosts[0]}/${element['path_with_namespace']}'] = [ | ||||
|         element['name_with_namespace'], | ||||
|         element['description'] ?? tr('noDescription') | ||||
|         element['description'] ?? tr('noDescription'), | ||||
|       ]; | ||||
|     } | ||||
|     return results; | ||||
| @@ -102,8 +113,9 @@ class GitLab extends AppSource { | ||||
|  | ||||
|   @override | ||||
|   Future<Map<String, String>?> getRequestHeaders( | ||||
|       Map<String, dynamic> additionalSettings, | ||||
|       {bool forAPKDownload = false}) async { | ||||
|     Map<String, dynamic> additionalSettings, { | ||||
|     bool forAPKDownload = false, | ||||
|   }) async { | ||||
|     // Change headers to pacify, e.g. cloudflare protection | ||||
|     // Related to: (#1397, #1389, #1384, #1382, #1381, #1380, #1359, #854, #785, #697) | ||||
|     var headers = <String, String>{}; | ||||
| @@ -116,8 +128,11 @@ class GitLab extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<String> apkUrlPrefetchModifier(String apkUrl, String standardUrl, | ||||
|       Map<String, dynamic> additionalSettings) async { | ||||
|   Future<String> apkUrlPrefetchModifier( | ||||
|     String apkUrl, | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     String? PAT = await getPATIfAny(hostChanged ? additionalSettings : {}); | ||||
|     String optionalAuth = (PAT != null) ? 'private_token=$PAT' : ''; | ||||
|     return '$apkUrl${(Uri.parse(apkUrl).query.isEmpty ? '?' : '&')}$optionalAuth'; | ||||
| @@ -140,7 +155,8 @@ class GitLab extends AppSource { | ||||
|     // Get project ID | ||||
|     Response res0 = await sourceRequest( | ||||
|       'https://${hosts[0]}/api/v4/projects/$projectUriComponent?$optionalAuth', | ||||
|         additionalSettings); | ||||
|       additionalSettings, | ||||
|     ); | ||||
|     if (res0.statusCode != 200) { | ||||
|       throw getObtainiumHttpError(res0); | ||||
|     } | ||||
| @@ -152,7 +168,8 @@ class GitLab extends AppSource { | ||||
|     // Request data from REST API | ||||
|     Response res = await sourceRequest( | ||||
|       'https://${hosts[0]}/api/v4/projects/$projectUriComponent/${trackOnly ? 'repository/tags' : 'releases'}?$optionalAuth', | ||||
|         additionalSettings); | ||||
|       additionalSettings, | ||||
|     ); | ||||
|     if (res.statusCode != 200) { | ||||
|       throw getObtainiumHttpError(res); | ||||
|     } | ||||
| @@ -169,8 +186,10 @@ class GitLab extends AppSource { | ||||
|               (e['name'] ?? | ||||
|                       (parsedUrl != null && parsedUrl.pathSegments.isNotEmpty | ||||
|                           ? parsedUrl.pathSegments.last | ||||
|                         : 'unknown')) as String, | ||||
|                 (e['direct_asset_url'] ?? e['url'] ?? '') as String); | ||||
|                           : 'unknown')) | ||||
|                   as String, | ||||
|               (e['direct_asset_url'] ?? e['url'] ?? '') as String, | ||||
|             ); | ||||
|           }) | ||||
|           .where((s) => s.key.isNotEmpty) | ||||
|           .toList(); | ||||
| @@ -193,11 +212,15 @@ class GitLab extends AppSource { | ||||
|       } | ||||
|       var releaseDateString = | ||||
|           e['released_at'] ?? e['created_at'] ?? e['commit']?['created_at']; | ||||
|       DateTime? releaseDate = | ||||
|           releaseDateString != null ? DateTime.parse(releaseDateString) : null; | ||||
|       return APKDetails(e['tag_name'] ?? e['name'], apkUrls.entries.toList(), | ||||
|       DateTime? releaseDate = releaseDateString != null | ||||
|           ? DateTime.parse(releaseDateString) | ||||
|           : null; | ||||
|       return APKDetails( | ||||
|         e['tag_name'] ?? e['name'], | ||||
|         apkUrls.entries.toList(), | ||||
|         AppNames(names.author, names.name.split('/').last), | ||||
|           releaseDate: releaseDate); | ||||
|         releaseDate: releaseDate, | ||||
|       ); | ||||
|     }); | ||||
|     if (apkDetailsList.isEmpty) { | ||||
|       throw NoReleasesError(); | ||||
| @@ -208,8 +231,9 @@ class GitLab extends AppSource { | ||||
|     bool fallbackToOlderReleases = | ||||
|         additionalSettings['fallbackToOlderReleases'] == true; | ||||
|     if (finalResult.apkUrls.isEmpty && fallbackToOlderReleases && !trackOnly) { | ||||
|       apkDetailsList = | ||||
|           apkDetailsList.where((e) => e.apkUrls.isNotEmpty).toList(); | ||||
|       apkDetailsList = apkDetailsList | ||||
|           .where((e) => e.apkUrls.isNotEmpty) | ||||
|           .toList(); | ||||
|       finalResult = apkDetailsList.first; | ||||
|     } | ||||
|  | ||||
| @@ -218,10 +242,13 @@ class GitLab extends AppSource { | ||||
|     } | ||||
|  | ||||
|     finalResult.apkUrls = finalResult.apkUrls.map((apkUrl) { | ||||
|       if (RegExp('^$standardUrl/-/jobs/[0-9]+/artifacts/file/[^/]+') | ||||
|           .hasMatch(apkUrl.value)) { | ||||
|       if (RegExp( | ||||
|         '^$standardUrl/-/jobs/[0-9]+/artifacts/file/[^/]+', | ||||
|       ).hasMatch(apkUrl.value)) { | ||||
|         return MapEntry( | ||||
|             apkUrl.key, apkUrl.value.replaceFirst('/file/', '/raw/')); | ||||
|           apkUrl.key, | ||||
|           apkUrl.value.replaceFirst('/file/', '/raw/'), | ||||
|         ); | ||||
|       } else { | ||||
|         return apkUrl; | ||||
|       } | ||||
|   | ||||
| @@ -9,6 +9,13 @@ import 'package:obtainium/providers/apps_provider.dart'; | ||||
| import 'package:obtainium/providers/source_provider.dart'; | ||||
|  | ||||
| String ensureAbsoluteUrl(String ambiguousUrl, Uri referenceAbsoluteUrl) { | ||||
|   try { | ||||
|     if (Uri.parse(ambiguousUrl).isAbsolute) { | ||||
|       return ambiguousUrl; // #2315 | ||||
|     } | ||||
|   } catch (e) { | ||||
|     // | ||||
|   } | ||||
|   return referenceAbsoluteUrl.resolve(ambiguousUrl).toString(); | ||||
| } | ||||
|  | ||||
| @@ -93,28 +100,37 @@ bool _isNumeric(String s) { | ||||
|   return s.codeUnitAt(0) >= 48 && s.codeUnitAt(0) <= 57; | ||||
| } | ||||
|  | ||||
| List<MapEntry<String, String>> getLinksInLines(String lines) => RegExp( | ||||
|         r'(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?') | ||||
| List<MapEntry<String, String>> getLinksInLines(String lines) => | ||||
|     RegExp( | ||||
|           r'(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?', | ||||
|         ) | ||||
|         .allMatches(lines) | ||||
|     .map((match) => | ||||
|         MapEntry(match.group(0)!, match.group(0)?.split('/').last ?? '')) | ||||
|         .map( | ||||
|           (match) => | ||||
|               MapEntry(match.group(0)!, match.group(0)?.split('/').last ?? ''), | ||||
|         ) | ||||
|         .toList(); | ||||
|  | ||||
| // Given an HTTP response, grab some links according to the common additional settings | ||||
| // (those that apply to intermediate and final steps) | ||||
| Future<List<MapEntry<String, String>>> grabLinksCommon( | ||||
|     Response res, Map<String, dynamic> additionalSettings) async { | ||||
|   Response res, | ||||
|   Map<String, dynamic> additionalSettings, | ||||
| ) async { | ||||
|   if (res.statusCode != 200) { | ||||
|     throw getObtainiumHttpError(res); | ||||
|   } | ||||
|   var html = parse(res.body); | ||||
|   List<MapEntry<String, String>> allLinks = html | ||||
|       .querySelectorAll('a') | ||||
|       .map((element) => MapEntry( | ||||
|       .map( | ||||
|         (element) => MapEntry( | ||||
|           element.attributes['href'] ?? '', | ||||
|           element.text.isNotEmpty | ||||
|               ? element.text | ||||
|               : (element.attributes['href'] ?? '').split('/').last)) | ||||
|               : (element.attributes['href'] ?? '').split('/').last, | ||||
|         ), | ||||
|       ) | ||||
|       .where((element) => element.key.isNotEmpty) | ||||
|       .map((e) => MapEntry(ensureAbsoluteUrl(e.key, res.request!.url), e.value)) | ||||
|       .toList(); | ||||
| @@ -127,9 +143,13 @@ Future<List<MapEntry<String, String>>> grabLinksCommon( | ||||
|       var jsonStrings = collectAllStringsFromJSONObject(jsonDecode(res.body)); | ||||
|       allLinks = getLinksInLines(jsonStrings.join('\n')); | ||||
|       if (allLinks.isEmpty) { | ||||
|         allLinks = getLinksInLines(jsonStrings.map((l) { | ||||
|         allLinks = getLinksInLines( | ||||
|           jsonStrings | ||||
|               .map((l) { | ||||
|                 return ensureAbsoluteUrl(l, res.request!.url); | ||||
|         }).join('\n')); | ||||
|               }) | ||||
|               .join('\n'), | ||||
|         ); | ||||
|       } | ||||
|     } catch (e) { | ||||
|       // | ||||
| @@ -158,17 +178,20 @@ Future<List<MapEntry<String, String>>> grabLinksCommon( | ||||
|       } catch (e) { | ||||
|         // Some links may not have valid encoding | ||||
|       } | ||||
|       return Uri.parse(filterLinkByText ? element.value : link) | ||||
|           .path | ||||
|           .toLowerCase() | ||||
|           .endsWith('.apk'); | ||||
|       return Uri.parse( | ||||
|         filterLinkByText ? element.value : link, | ||||
|       ).path.toLowerCase().endsWith('.apk'); | ||||
|     }).toList(); | ||||
|   } | ||||
|   if (!skipSort) { | ||||
|     links.sort((a, b) => additionalSettings['sortByLastLinkSegment'] == true | ||||
|         ? compareAlphaNumeric(a.key.split('/').where((e) => e.isNotEmpty).last, | ||||
|             b.key.split('/').where((e) => e.isNotEmpty).last) | ||||
|         : compareAlphaNumeric(a.key, b.key)); | ||||
|     links.sort( | ||||
|       (a, b) => additionalSettings['sortByLastLinkSegment'] == true | ||||
|           ? compareAlphaNumeric( | ||||
|               a.key.split('/').where((e) => e.isNotEmpty).last, | ||||
|               b.key.split('/').where((e) => e.isNotEmpty).last, | ||||
|             ) | ||||
|           : compareAlphaNumeric(a.key, b.key), | ||||
|     ); | ||||
|   } | ||||
|   if (additionalSettings['reverseSort'] == true) { | ||||
|     links = links.reversed.toList(); | ||||
| @@ -194,49 +217,61 @@ class HTML extends AppSource { | ||||
|  | ||||
|   var finalStepFormitems = [ | ||||
|     [ | ||||
|       GeneratedFormTextField('customLinkFilterRegex', | ||||
|       GeneratedFormTextField( | ||||
|         'customLinkFilterRegex', | ||||
|         label: tr('customLinkFilterRegex'), | ||||
|         hint: 'download/(.*/)?(android|apk|mobile)', | ||||
|         required: false, | ||||
|         additionalValidators: [ | ||||
|           (value) { | ||||
|             return regExValidator(value); | ||||
|             } | ||||
|           ]) | ||||
|           }, | ||||
|         ], | ||||
|       ), | ||||
|     ], | ||||
|     [ | ||||
|       GeneratedFormSwitch('versionExtractWholePage', | ||||
|           label: tr('versionExtractWholePage')) | ||||
|     ] | ||||
|       GeneratedFormSwitch( | ||||
|         'versionExtractWholePage', | ||||
|         label: tr('versionExtractWholePage'), | ||||
|       ), | ||||
|     ], | ||||
|   ]; | ||||
|   var commonFormItems = [ | ||||
|     [GeneratedFormSwitch('filterByLinkText', label: tr('filterByLinkText'))], | ||||
|     [GeneratedFormSwitch('skipSort', label: tr('skipSort'))], | ||||
|     [GeneratedFormSwitch('reverseSort', label: tr('takeFirstLink'))], | ||||
|     [ | ||||
|       GeneratedFormSwitch('sortByLastLinkSegment', | ||||
|           label: tr('sortByLastLinkSegment')) | ||||
|       GeneratedFormSwitch( | ||||
|         'sortByLastLinkSegment', | ||||
|         label: tr('sortByLastLinkSegment'), | ||||
|       ), | ||||
|     ], | ||||
|   ]; | ||||
|   var intermediateFormItems = [ | ||||
|     [ | ||||
|       GeneratedFormTextField('customLinkFilterRegex', | ||||
|       GeneratedFormTextField( | ||||
|         'customLinkFilterRegex', | ||||
|         label: tr('intermediateLinkRegex'), | ||||
|         hint: '([0-9]+.)*[0-9]+/\$', | ||||
|         required: true, | ||||
|           additionalValidators: [(value) => regExValidator(value)]) | ||||
|         additionalValidators: [(value) => regExValidator(value)], | ||||
|       ), | ||||
|     ], | ||||
|     [ | ||||
|       GeneratedFormSwitch('autoLinkFilterByArch', | ||||
|           label: tr('autoLinkFilterByArch'), defaultValue: false) | ||||
|       GeneratedFormSwitch( | ||||
|         'autoLinkFilterByArch', | ||||
|         label: tr('autoLinkFilterByArch'), | ||||
|         defaultValue: false, | ||||
|       ), | ||||
|     ], | ||||
|   ]; | ||||
|   HTML() { | ||||
|     additionalSourceAppSpecificSettingFormItems = [ | ||||
|       [ | ||||
|         GeneratedFormSubForm( | ||||
|             'intermediateLink', [...intermediateFormItems, ...commonFormItems], | ||||
|             label: tr('intermediateLink')) | ||||
|         GeneratedFormSubForm('intermediateLink', [ | ||||
|           ...intermediateFormItems, | ||||
|           ...commonFormItems, | ||||
|         ], label: tr('intermediateLink')), | ||||
|       ], | ||||
|       finalStepFormitems[0], | ||||
|       ...commonFormItems, | ||||
| @@ -246,7 +281,8 @@ class HTML extends AppSource { | ||||
|           'requestHeader', | ||||
|           [ | ||||
|             [ | ||||
|                 GeneratedFormTextField('requestHeader', | ||||
|               GeneratedFormTextField( | ||||
|                 'requestHeader', | ||||
|                 label: tr('requestHeader'), | ||||
|                 required: false, | ||||
|                 additionalValidators: [ | ||||
| @@ -260,17 +296,19 @@ class HTML extends AppSource { | ||||
|                       return tr('invalidInput'); | ||||
|                     } | ||||
|                     return null; | ||||
|                       } | ||||
|                     ]) | ||||
|               ] | ||||
|                   }, | ||||
|                 ], | ||||
|               ), | ||||
|             ], | ||||
|           ], | ||||
|           label: tr('requestHeader'), | ||||
|           defaultValue: [ | ||||
|             { | ||||
|               'requestHeader': | ||||
|                     'User-Agent: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36' | ||||
|               } | ||||
|             ]) | ||||
|                   'User-Agent: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36', | ||||
|             }, | ||||
|           ], | ||||
|         ), | ||||
|       ], | ||||
|       [ | ||||
|         GeneratedFormDropdown( | ||||
| @@ -278,18 +316,20 @@ class HTML extends AppSource { | ||||
|           [ | ||||
|             MapEntry('partialAPKHash', tr('partialAPKHash')), | ||||
|             MapEntry('APKLinkHash', tr('APKLinkHash')), | ||||
|               MapEntry('ETag', 'ETag') | ||||
|             MapEntry('ETag', 'ETag'), | ||||
|           ], | ||||
|           label: tr('defaultPseudoVersioningMethod'), | ||||
|             defaultValue: 'partialAPKHash') | ||||
|       ] | ||||
|           defaultValue: 'partialAPKHash', | ||||
|         ), | ||||
|       ], | ||||
|     ]; | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<Map<String, String>?> getRequestHeaders( | ||||
|       Map<String, dynamic> additionalSettings, | ||||
|       {bool forAPKDownload = false}) async { | ||||
|     Map<String, dynamic> additionalSettings, { | ||||
|     bool forAPKDownload = false, | ||||
|   }) async { | ||||
|     if (additionalSettings.isNotEmpty) { | ||||
|       if (additionalSettings['requestHeader']?.isNotEmpty != true) { | ||||
|         additionalSettings['requestHeader'] = []; | ||||
| @@ -330,7 +370,8 @@ class HTML extends AppSource { | ||||
|     for (int i = 0; i < (additionalSettings['intermediateLink'].length); i++) { | ||||
|       var intLinks = await grabLinksCommon( | ||||
|         await sourceRequest(currentUrl, additionalSettings), | ||||
|           additionalSettings['intermediateLink'][i]); | ||||
|         additionalSettings['intermediateLink'][i], | ||||
|       ); | ||||
|       if (intLinks.isEmpty) { | ||||
|         throw NoReleasesError(note: currentUrl); | ||||
|       } else { | ||||
| @@ -346,11 +387,17 @@ class HTML extends AppSource { | ||||
|     String versionExtractionWholePageString = currentUrl; | ||||
|     if (additionalSettings['directAPKLink'] != true) { | ||||
|       Response res = await sourceRequest(currentUrl, additionalSettings); | ||||
|       versionExtractionWholePageString = | ||||
|           res.body.split('\r\n').join('\n').split('\n').join('\\n'); | ||||
|       versionExtractionWholePageString = res.body | ||||
|           .split('\r\n') | ||||
|           .join('\n') | ||||
|           .split('\n') | ||||
|           .join('\\n'); | ||||
|       links = await grabLinksCommon(res, additionalSettings); | ||||
|       links = filterApks(links, additionalSettings['apkFilterRegEx'], | ||||
|           additionalSettings['invertAPKFilter']); | ||||
|       links = filterApks( | ||||
|         links, | ||||
|         additionalSettings['apkFilterRegEx'], | ||||
|         additionalSettings['invertAPKFilter'], | ||||
|       ); | ||||
|       if (links.isEmpty) { | ||||
|         throw NoReleasesError(note: currentUrl); | ||||
|       } | ||||
| @@ -370,14 +417,19 @@ class HTML extends AppSource { | ||||
|       additionalSettings['matchGroupToUse'] as String?, | ||||
|       additionalSettings['versionExtractWholePage'] == true | ||||
|           ? versionExtractionWholePageString | ||||
|             : relDecoded); | ||||
|     var apkReqHeaders = | ||||
|         await getRequestHeaders(additionalSettings, forAPKDownload: true); | ||||
|           : relDecoded, | ||||
|     ); | ||||
|     var apkReqHeaders = await getRequestHeaders( | ||||
|       additionalSettings, | ||||
|       forAPKDownload: true, | ||||
|     ); | ||||
|     if (version == null && | ||||
|         additionalSettings['defaultPseudoVersioningMethod'] == 'ETag') { | ||||
|       version = await checkETagHeader(rel, | ||||
|       version = await checkETagHeader( | ||||
|         rel, | ||||
|         headers: apkReqHeaders, | ||||
|           allowInsecure: additionalSettings['allowInsecure'] == true); | ||||
|         allowInsecure: additionalSettings['allowInsecure'] == true, | ||||
|       ); | ||||
|       if (version == null) { | ||||
|         throw NoVersionError(); | ||||
|       } | ||||
| @@ -385,18 +437,21 @@ class HTML extends AppSource { | ||||
|     version ??= | ||||
|         additionalSettings['defaultPseudoVersioningMethod'] == 'APKLinkHash' | ||||
|         ? rel.hashCode.toString() | ||||
|             : (await checkPartialDownloadHashDynamic(rel, | ||||
|         : (await checkPartialDownloadHashDynamic( | ||||
|             rel, | ||||
|             headers: apkReqHeaders, | ||||
|                     allowInsecure: additionalSettings['allowInsecure'] == true)) | ||||
|                 .toString(); | ||||
|             allowInsecure: additionalSettings['allowInsecure'] == true, | ||||
|           )).toString(); | ||||
|     return APKDetails( | ||||
|       version, | ||||
|       [rel].map((e) { | ||||
|         var uri = Uri.parse(e); | ||||
|           var fileName = | ||||
|               uri.pathSegments.isNotEmpty ? uri.pathSegments.last : uri.origin; | ||||
|         var fileName = uri.pathSegments.isNotEmpty | ||||
|             ? uri.pathSegments.last | ||||
|             : uri.origin; | ||||
|         return MapEntry('${e.hashCode}-$fileName', e); | ||||
|       }).toList(), | ||||
|         AppNames(uri.host, tr('app'))); | ||||
|       AppNames(uri.host, tr('app')), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -15,7 +15,8 @@ class HuaweiAppGallery extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     RegExp standardUrlRegEx = RegExp( | ||||
|       '^https?://(www\\.)?${getSourceRegex(hosts)}(/#)?/(app|appdl)/[^/]+', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     RegExpMatch? match = standardUrlRegEx.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -23,13 +24,18 @@ class HuaweiAppGallery extends AppSource { | ||||
|     return match.group(0)!; | ||||
|   } | ||||
|  | ||||
|   getDlUrl(String standardUrl) => | ||||
|   String getDlUrl(String standardUrl) => | ||||
|       'https://${hosts[0].replaceAll('appgallery.huawei', 'appgallery.cloud.huawei')}/appdl/${standardUrl.split('/').last}'; | ||||
|  | ||||
|   requestAppdlRedirect( | ||||
|       String dlUrl, Map<String, dynamic> additionalSettings) async { | ||||
|     Response res = | ||||
|         await sourceRequest(dlUrl, additionalSettings, followRedirects: false); | ||||
|   Future<Response> requestAppdlRedirect( | ||||
|     String dlUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     Response res = await sourceRequest( | ||||
|       dlUrl, | ||||
|       additionalSettings, | ||||
|       followRedirects: false, | ||||
|     ); | ||||
|     if (res.statusCode == 200 || | ||||
|         res.statusCode == 302 || | ||||
|         res.statusCode == 304) { | ||||
| @@ -39,7 +45,7 @@ class HuaweiAppGallery extends AppSource { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   appIdFromRedirectDlUrl(String redirectDlUrl) { | ||||
|   String appIdFromRedirectDlUrl(String redirectDlUrl) { | ||||
|     var parts = redirectDlUrl | ||||
|         .split('?')[0] | ||||
|         .split('/') | ||||
| @@ -53,8 +59,10 @@ class HuaweiAppGallery extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<String?> tryInferringAppId(String standardUrl, | ||||
|       {Map<String, dynamic> additionalSettings = const {}}) async { | ||||
|   Future<String?> tryInferringAppId( | ||||
|     String standardUrl, { | ||||
|     Map<String, dynamic> additionalSettings = const {}, | ||||
|   }) async { | ||||
|     String dlUrl = getDlUrl(standardUrl); | ||||
|     Response res = await requestAppdlRedirect(dlUrl, additionalSettings); | ||||
|     return res.headers['location'] != null | ||||
| @@ -76,8 +84,11 @@ class HuaweiAppGallery extends AppSource { | ||||
|     if (appId.isEmpty) { | ||||
|       throw NoReleasesError(); | ||||
|     } | ||||
|     var relDateStr = | ||||
|         res.headers['location']?.split('?')[0].split('.').reversed.toList()[1]; | ||||
|     var relDateStr = res.headers['location'] | ||||
|         ?.split('?')[0] | ||||
|         .split('.') | ||||
|         .reversed | ||||
|         .toList()[1]; | ||||
|     if (relDateStr == null || relDateStr.length != 10) { | ||||
|       throw NoVersionError(); | ||||
|     } | ||||
| @@ -88,10 +99,15 @@ class HuaweiAppGallery extends AppSource { | ||||
|       relDateStrAdj.insert((i + i ~/ 2 - 1), '-'); | ||||
|       i += 2; | ||||
|     } | ||||
|     var relDate = | ||||
|         DateFormat('yy-MM-dd-HH-mm', 'en_US').parse(relDateStrAdj.join('')); | ||||
|     var relDate = DateFormat( | ||||
|       'yy-MM-dd-HH-mm', | ||||
|       'en_US', | ||||
|     ).parse(relDateStrAdj.join('')); | ||||
|     return APKDetails( | ||||
|         relDateStr, [MapEntry('$appId.apk', dlUrl)], AppNames(name, appId), | ||||
|         releaseDate: relDate); | ||||
|       relDateStr, | ||||
|       [MapEntry('$appId.apk', dlUrl)], | ||||
|       AppNames(name, appId), | ||||
|       releaseDate: relDate, | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -17,12 +17,14 @@ class IzzyOnDroid extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     RegExp standardUrlRegExA = RegExp( | ||||
|       '^https?://android.${getSourceRegex(hosts)}/repo/apk/[^/]+', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     RegExpMatch? match = standardUrlRegExA.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       RegExp standardUrlRegExB = RegExp( | ||||
|         '^https?://apt.${getSourceRegex(hosts)}/fdroid/index/apk/[^/]+', | ||||
|           caseSensitive: false); | ||||
|         caseSensitive: false, | ||||
|       ); | ||||
|       match = standardUrlRegExB.firstMatch(url); | ||||
|     } | ||||
|     if (match == null) { | ||||
| @@ -32,8 +34,10 @@ class IzzyOnDroid extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<String?> tryInferringAppId(String standardUrl, | ||||
|       {Map<String, dynamic> additionalSettings = const {}}) async { | ||||
|   Future<String?> tryInferringAppId( | ||||
|     String standardUrl, { | ||||
|     Map<String, dynamic> additionalSettings = const {}, | ||||
|   }) async { | ||||
|     return fd.tryInferringAppId(standardUrl); | ||||
|   } | ||||
|  | ||||
| @@ -46,10 +50,12 @@ class IzzyOnDroid extends AppSource { | ||||
|     return fd.getAPKUrlsFromFDroidPackagesAPIResponse( | ||||
|       await sourceRequest( | ||||
|         'https://apt.izzysoft.de/fdroid/api/v1/packages/$appId', | ||||
|             additionalSettings), | ||||
|         additionalSettings, | ||||
|       ), | ||||
|       'https://android.izzysoft.de/frepo/$appId', | ||||
|       standardUrl, | ||||
|       name, | ||||
|         additionalSettings: additionalSettings); | ||||
|       additionalSettings: additionalSettings, | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -31,14 +31,17 @@ class Jenkins extends AppSource { | ||||
|   ) async { | ||||
|     standardUrl = trimJobUrl(standardUrl); | ||||
|     Response res = await sourceRequest( | ||||
|         '$standardUrl/lastSuccessfulBuild/api/json', additionalSettings); | ||||
|       '$standardUrl/lastSuccessfulBuild/api/json', | ||||
|       additionalSettings, | ||||
|     ); | ||||
|     if (res.statusCode == 200) { | ||||
|       var json = jsonDecode(res.body); | ||||
|       var releaseDate = json['timestamp'] == null | ||||
|           ? null | ||||
|           : DateTime.fromMillisecondsSinceEpoch(json['timestamp'] as int); | ||||
|       var version = | ||||
|           json['number'] == null ? null : (json['number'] as int).toString(); | ||||
|       var version = json['number'] == null | ||||
|           ? null | ||||
|           : (json['number'] as int).toString(); | ||||
|       if (version == null) { | ||||
|         throw NoVersionError(); | ||||
|       } | ||||
| @@ -51,16 +54,21 @@ class Jenkins extends AppSource { | ||||
|             return path == null | ||||
|                 ? const MapEntry<String, String>('', '') | ||||
|                 : MapEntry<String, String>( | ||||
|                     (e['fileName'] ?? e['relativePath']) as String, path); | ||||
|                     (e['fileName'] ?? e['relativePath']) as String, | ||||
|                     path, | ||||
|                   ); | ||||
|           }) | ||||
|           .where((url) => | ||||
|               url.value.isNotEmpty && url.key.toLowerCase().endsWith('.apk')) | ||||
|           .where( | ||||
|             (url) => | ||||
|                 url.value.isNotEmpty && url.key.toLowerCase().endsWith('.apk'), | ||||
|           ) | ||||
|           .toList(); | ||||
|       return APKDetails( | ||||
|         version, | ||||
|         apkUrls, | ||||
|         releaseDate: releaseDate, | ||||
|           AppNames(Uri.parse(standardUrl).host, standardUrl.split('/').last)); | ||||
|         AppNames(Uri.parse(standardUrl).host, standardUrl.split('/').last), | ||||
|       ); | ||||
|     } else { | ||||
|       throw getObtainiumHttpError(res); | ||||
|     } | ||||
|   | ||||
| @@ -13,7 +13,8 @@ class Mullvad extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     RegExp standardUrlRegEx = RegExp( | ||||
|       '^https?://(www\\.)?${getSourceRegex(hosts)}', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     RegExpMatch? match = standardUrlRegEx.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -31,7 +32,9 @@ class Mullvad extends AppSource { | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     Response res = await sourceRequest( | ||||
|         '$standardUrl/en/download/android', additionalSettings); | ||||
|       '$standardUrl/en/download/android', | ||||
|       additionalSettings, | ||||
|     ); | ||||
|     if (res.statusCode == 200) { | ||||
|       var versions = parse(res.body) | ||||
|           .querySelectorAll('p') | ||||
| @@ -54,8 +57,8 @@ class Mullvad extends AppSource { | ||||
|       try { | ||||
|         changeLog = (await GitHub().getLatestAPKDetails( | ||||
|           'https://github.com/mullvad/mullvadvpn-app', | ||||
|                 {'fallbackToOlderReleases': true})) | ||||
|             .changeLog; | ||||
|           {'fallbackToOlderReleases': true}, | ||||
|         )).changeLog; | ||||
|       } catch (e) { | ||||
|         // Ignore | ||||
|       } | ||||
| @@ -63,7 +66,8 @@ class Mullvad extends AppSource { | ||||
|         versions[0], | ||||
|         getApkUrlsFromUrls(['https://mullvad.net/download/app/apk/latest']), | ||||
|         AppNames(name, 'Mullvad-VPN'), | ||||
|           changeLog: changeLog); | ||||
|         changeLog: changeLog, | ||||
|       ); | ||||
|     } else { | ||||
|       throw getObtainiumHttpError(res); | ||||
|     } | ||||
|   | ||||
| @@ -13,7 +13,8 @@ class NeutronCode extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     RegExp standardUrlRegEx = RegExp( | ||||
|       '^https?://(www\\.)?${getSourceRegex(hosts)}/downloads/file/[^/]+', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     RegExpMatch? match = standardUrlRegEx.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -55,7 +56,7 @@ class NeutronCode extends AppSource { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   customDateParse(String dateString) { | ||||
|   String? customDateParse(String dateString) { | ||||
|     List<String> parts = dateString.split(' '); | ||||
|     if (parts.length != 3) { | ||||
|       return null; | ||||
| @@ -89,24 +90,31 @@ class NeutronCode extends AppSource { | ||||
|       if (filename == null) { | ||||
|         throw NoReleasesError(); | ||||
|       } | ||||
|       var version = | ||||
|           http.querySelector('.pd-version-txt')?.nextElementSibling?.innerHtml; | ||||
|       var version = http | ||||
|           .querySelector('.pd-version-txt') | ||||
|           ?.nextElementSibling | ||||
|           ?.innerHtml; | ||||
|       if (version == null) { | ||||
|         throw NoVersionError(); | ||||
|       } | ||||
|       String? apkUrl = 'https://${hosts[0]}/download/$filename'; | ||||
|       var dateStringOriginal = | ||||
|           http.querySelector('.pd-date-txt')?.nextElementSibling?.innerHtml; | ||||
|       var dateStringOriginal = http | ||||
|           .querySelector('.pd-date-txt') | ||||
|           ?.nextElementSibling | ||||
|           ?.innerHtml; | ||||
|       var dateString = dateStringOriginal != null | ||||
|           ? (customDateParse(dateStringOriginal)) | ||||
|           : null; | ||||
|       var changeLogElements = http.querySelectorAll('.pd-fdesc p'); | ||||
|       return APKDetails(version, getApkUrlsFromUrls([apkUrl]), | ||||
|       return APKDetails( | ||||
|         version, | ||||
|         getApkUrlsFromUrls([apkUrl]), | ||||
|         AppNames(runtimeType.toString(), name ?? standardUrl.split('/').last), | ||||
|         releaseDate: dateString != null ? DateTime.parse(dateString) : null, | ||||
|         changeLog: changeLogElements.isNotEmpty | ||||
|             ? changeLogElements.last.innerHtml | ||||
|               : null); | ||||
|             : null, | ||||
|       ); | ||||
|     } else { | ||||
|       throw getObtainiumHttpError(res); | ||||
|     } | ||||
|   | ||||
| @@ -19,7 +19,8 @@ class RuStore extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     RegExp standardUrlRegEx = RegExp( | ||||
|       '^https?://(www\\.)?${getSourceRegex(hosts)}/catalog/app/+[^/]+', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     RegExpMatch? match = standardUrlRegEx.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -28,16 +29,18 @@ class RuStore extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<String?> tryInferringAppId(String standardUrl, | ||||
|       {Map<String, dynamic> additionalSettings = const {}}) async { | ||||
|   Future<String?> tryInferringAppId( | ||||
|     String standardUrl, { | ||||
|     Map<String, dynamic> additionalSettings = const {}, | ||||
|   }) async { | ||||
|     return Uri.parse(standardUrl).pathSegments.last; | ||||
|   } | ||||
|  | ||||
|   Future<String> decodeString(String str) async { | ||||
|     try { | ||||
|       return (await CharsetDetector.autoDecode( | ||||
|               Uint8List.fromList(str.codeUnits))) | ||||
|           .string; | ||||
|         Uint8List.fromList(str.codeUnits), | ||||
|       )).string; | ||||
|     } catch (e) { | ||||
|       return str; | ||||
|     } | ||||
| @@ -51,7 +54,8 @@ class RuStore extends AppSource { | ||||
|     String? appId = await tryInferringAppId(standardUrl); | ||||
|     Response res0 = await sourceRequest( | ||||
|       'https://backapi.rustore.ru/applicationData/overallInfo/$appId', | ||||
|         additionalSettings); | ||||
|       additionalSettings, | ||||
|     ); | ||||
|     if (res0.statusCode != 200) { | ||||
|       throw getObtainiumHttpError(res0); | ||||
|     } | ||||
| @@ -77,7 +81,8 @@ class RuStore extends AppSource { | ||||
|       'https://backapi.rustore.ru/applicationData/download-link', | ||||
|       additionalSettings, | ||||
|       followRedirects: false, | ||||
|         postBody: {"appId": appDetails['appId'], "firstInstall": true}); | ||||
|       postBody: {"appId": appDetails['appId'], "firstInstall": true}, | ||||
|     ); | ||||
|     var downloadDetails = jsonDecode(res1.body)['body']; | ||||
|     if (res1.statusCode != 200 || downloadDetails['apkUrl'] == null) { | ||||
|       throw NoAPKError(); | ||||
| @@ -90,11 +95,14 @@ class RuStore extends AppSource { | ||||
|     return APKDetails( | ||||
|       version, | ||||
|       getApkUrlsFromUrls([ | ||||
|           (downloadDetails['apkUrl'] as String) | ||||
|               .replaceAll(RegExp('\\.zip\$'), '.apk') | ||||
|         (downloadDetails['apkUrl'] as String).replaceAll( | ||||
|           RegExp('\\.zip\$'), | ||||
|           '.apk', | ||||
|         ), | ||||
|       ]), | ||||
|       AppNames(author, appName), | ||||
|       releaseDate: relDate, | ||||
|         changeLog: changeLog); | ||||
|       changeLog: changeLog, | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -11,8 +11,10 @@ class SourceForge extends AppSource { | ||||
|   @override | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     var sourceRegex = getSourceRegex(hosts); | ||||
|     RegExp standardUrlRegExC = | ||||
|         RegExp('^https?://(www\\.)?$sourceRegex/p/.+', caseSensitive: false); | ||||
|     RegExp standardUrlRegExC = RegExp( | ||||
|       '^https?://(www\\.)?$sourceRegex/p/.+', | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     RegExpMatch? match = standardUrlRegExC.firstMatch(url); | ||||
|     if (match != null) { | ||||
|       url = | ||||
| @@ -20,14 +22,16 @@ class SourceForge extends AppSource { | ||||
|     } | ||||
|     RegExp standardUrlRegExB = RegExp( | ||||
|       '^https?://(www\\.)?$sourceRegex/projects/[^/]+', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     match = standardUrlRegExB.firstMatch(url); | ||||
|     if (match != null && match.group(0) == url) { | ||||
|       url = '$url/files'; | ||||
|     } | ||||
|     RegExp standardUrlRegExA = RegExp( | ||||
|       '^https?://(www\\.)?$sourceRegex/projects/[^/]+/files(/.+)?', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     match = standardUrlRegExA.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -47,7 +51,8 @@ class SourceForge extends AppSource { | ||||
|     } | ||||
|     Response res = await sourceRequest( | ||||
|       '${standardUri.origin}/${standardUri.pathSegments.sublist(0, 2).join('/')}/rss?path=/', | ||||
|         additionalSettings); | ||||
|       additionalSettings, | ||||
|     ); | ||||
|     if (res.statusCode == 200) { | ||||
|       var parsedHtml = parse(res.body); | ||||
|       var allDownloadLinks = parsedHtml | ||||
| @@ -76,7 +81,8 @@ class SourceForge extends AppSource { | ||||
|               var extractedVersion = extractVersion( | ||||
|                 additionalSettings['versionExtractionRegEx'] as String?, | ||||
|                 additionalSettings['matchGroupToUse'] as String?, | ||||
|                   version); | ||||
|                 version, | ||||
|               ); | ||||
|               if (extractedVersion != null) { | ||||
|                 version = extractedVersion; | ||||
|               } | ||||
| @@ -111,8 +117,11 @@ class SourceForge extends AppSource { | ||||
|               .where((element) => getVersion(element) == version) | ||||
|               .toList(); | ||||
|       var segments = standardUrl.split('/'); | ||||
|       return APKDetails(version, getApkUrlsFromUrls(apkUrlList), | ||||
|           AppNames(name, segments[segments.indexOf('files') - 1])); | ||||
|       return APKDetails( | ||||
|         version, | ||||
|         getApkUrlsFromUrls(apkUrlList), | ||||
|         AppNames(name, segments[segments.indexOf('files') - 1]), | ||||
|       ); | ||||
|     } else { | ||||
|       throw getObtainiumHttpError(res); | ||||
|     } | ||||
|   | ||||
| @@ -13,9 +13,12 @@ class SourceHut extends AppSource { | ||||
|  | ||||
|     additionalSourceAppSpecificSettingFormItems = [ | ||||
|       [ | ||||
|         GeneratedFormSwitch('fallbackToOlderReleases', | ||||
|             label: tr('fallbackToOlderReleases'), defaultValue: true) | ||||
|       ] | ||||
|         GeneratedFormSwitch( | ||||
|           'fallbackToOlderReleases', | ||||
|           label: tr('fallbackToOlderReleases'), | ||||
|           defaultValue: true, | ||||
|         ), | ||||
|       ], | ||||
|     ]; | ||||
|   } | ||||
|  | ||||
| @@ -23,7 +26,8 @@ class SourceHut extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     RegExp standardUrlRegEx = RegExp( | ||||
|       '^https?://(www\\.)?${getSourceRegex(hosts)}/[^/]+/[^/]+', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     RegExpMatch? match = standardUrlRegEx.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -52,8 +56,10 @@ class SourceHut extends AppSource { | ||||
|     String appName = standardUri.pathSegments.last; | ||||
|     bool fallbackToOlderReleases = | ||||
|         additionalSettings['fallbackToOlderReleases'] == true; | ||||
|     Response res = | ||||
|         await sourceRequest('$standardUrl/refs/rss.xml', additionalSettings); | ||||
|     Response res = await sourceRequest( | ||||
|       '$standardUrl/refs/rss.xml', | ||||
|       additionalSettings, | ||||
|     ); | ||||
|     if (res.statusCode == 200) { | ||||
|       var parsedHtml = parse(res.body); | ||||
|       List<APKDetails> apkDetailsList = []; | ||||
| @@ -84,8 +90,9 @@ class SourceHut extends AppSource { | ||||
|               ? DateFormat('E, dd MMM yyyy HH:mm:ss Z').parse(releaseDateString) | ||||
|               : null; | ||||
|           releaseDate = releaseDateString != null | ||||
|               ? DateFormat('EEE, dd MMM yyyy HH:mm:ss Z') | ||||
|                   .parse(releaseDateString) | ||||
|               ? DateFormat( | ||||
|                   'EEE, dd MMM yyyy HH:mm:ss Z', | ||||
|                 ).parse(releaseDateString) | ||||
|               : null; | ||||
|         } catch (e) { | ||||
|           // ignore | ||||
| @@ -93,27 +100,35 @@ class SourceHut extends AppSource { | ||||
|         var res2 = await sourceRequest(releasePage, additionalSettings); | ||||
|         List<MapEntry<String, String>> apkUrls = []; | ||||
|         if (res2.statusCode == 200) { | ||||
|           apkUrls = getApkUrlsFromUrls(parse(res2.body) | ||||
|           apkUrls = getApkUrlsFromUrls( | ||||
|             parse(res2.body) | ||||
|                 .querySelectorAll('a') | ||||
|                 .map((e) => e.attributes['href'] ?? '') | ||||
|                 .where((e) => e.toLowerCase().endsWith('.apk')) | ||||
|                 .map((e) => ensureAbsoluteUrl(e, standardUri)) | ||||
|               .toList()); | ||||
|                 .toList(), | ||||
|           ); | ||||
|         } | ||||
|         apkDetailsList.add(APKDetails( | ||||
|         apkDetailsList.add( | ||||
|           APKDetails( | ||||
|             version, | ||||
|             apkUrls, | ||||
|             AppNames(entry.querySelector('author')?.innerHtml.trim() ?? appName, | ||||
|                 appName), | ||||
|             releaseDate: releaseDate)); | ||||
|             AppNames( | ||||
|               entry.querySelector('author')?.innerHtml.trim() ?? appName, | ||||
|               appName, | ||||
|             ), | ||||
|             releaseDate: releaseDate, | ||||
|           ), | ||||
|         ); | ||||
|       } | ||||
|       if (apkDetailsList.isEmpty) { | ||||
|         throw NoReleasesError(); | ||||
|       } | ||||
|       if (fallbackToOlderReleases) { | ||||
|         if (additionalSettings['trackOnly'] != true) { | ||||
|           apkDetailsList = | ||||
|               apkDetailsList.where((e) => e.apkUrls.isNotEmpty).toList(); | ||||
|           apkDetailsList = apkDetailsList | ||||
|               .where((e) => e.apkUrls.isNotEmpty) | ||||
|               .toList(); | ||||
|         } | ||||
|         if (apkDetailsList.isEmpty) { | ||||
|           throw NoReleasesError(); | ||||
|   | ||||
| @@ -20,12 +20,15 @@ class TelegramApp extends AppSource { | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     Response res = | ||||
|         await sourceRequest('https://t.me/s/TAndroidAPK', additionalSettings); | ||||
|     Response res = await sourceRequest( | ||||
|       'https://t.me/s/TAndroidAPK', | ||||
|       additionalSettings, | ||||
|     ); | ||||
|     if (res.statusCode == 200) { | ||||
|       var http = parse(res.body); | ||||
|       var messages = | ||||
|           http.querySelectorAll('.tgme_widget_message_text.js-message_text'); | ||||
|       var messages = http.querySelectorAll( | ||||
|         '.tgme_widget_message_text.js-message_text', | ||||
|       ); | ||||
|       var version = messages.isNotEmpty | ||||
|           ? messages.last.innerHtml.split('\n').first.trim().split(' ').first | ||||
|           : null; | ||||
| @@ -33,10 +36,9 @@ class TelegramApp extends AppSource { | ||||
|         throw NoVersionError(); | ||||
|       } | ||||
|       String? apkUrl = 'https://telegram.org/dl/android/apk'; | ||||
|       return APKDetails( | ||||
|           version, | ||||
|           [MapEntry<String, String>('telegram-$version.apk', apkUrl)], | ||||
|           AppNames('Telegram', 'Telegram')); | ||||
|       return APKDetails(version, [ | ||||
|         MapEntry<String, String>('telegram-$version.apk', apkUrl), | ||||
|       ], AppNames('Telegram', 'Telegram')); | ||||
|     } else { | ||||
|       throw getObtainiumHttpError(res); | ||||
|     } | ||||
|   | ||||
| @@ -16,7 +16,8 @@ class Tencent extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     RegExp standardUrlRegEx = RegExp( | ||||
|       '^https?://${getSourceRegex(hosts)}/appdetail/[^/]+', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     var match = standardUrlRegEx.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -25,8 +26,10 @@ class Tencent extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<String?> tryInferringAppId(String standardUrl, | ||||
|       {Map<String, dynamic> additionalSettings = const {}}) async { | ||||
|   Future<String?> tryInferringAppId( | ||||
|     String standardUrl, { | ||||
|     Map<String, dynamic> additionalSettings = const {}, | ||||
|   }) async { | ||||
|     return Uri.parse(standardUrl).pathSegments.last; | ||||
|   } | ||||
|  | ||||
| @@ -36,18 +39,16 @@ class Tencent extends AppSource { | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     String appId = (await tryInferringAppId(standardUrl))!; | ||||
|     String baseHost = Uri.parse(standardUrl) | ||||
|         .host | ||||
|         .split('.') | ||||
|         .reversed | ||||
|         .toList() | ||||
|         .sublist(0, 2) | ||||
|         .reversed | ||||
|         .join('.'); | ||||
|     String baseHost = Uri.parse( | ||||
|       standardUrl, | ||||
|     ).host.split('.').reversed.toList().sublist(0, 2).reversed.join('.'); | ||||
|  | ||||
|     var res = await sourceRequest( | ||||
|         'https://upage.html5.$baseHost/wechat-apkinfo', additionalSettings, | ||||
|         followRedirects: false, postBody: {"packagename": appId}); | ||||
|       'https://upage.html5.$baseHost/wechat-apkinfo', | ||||
|       additionalSettings, | ||||
|       followRedirects: false, | ||||
|       postBody: {"packagename": appId}, | ||||
|     ); | ||||
|  | ||||
|     if (res.statusCode == 200) { | ||||
|       var json = jsonDecode(res.body); | ||||
| @@ -64,14 +65,18 @@ class Tencent extends AppSource { | ||||
|       var author = json['app_detail_records'][appId]['app_info']['author']; | ||||
|       var releaseDate = | ||||
|           json['app_detail_records'][appId]['app_info']['update_time']; | ||||
|       var apkName = Uri.parse(apkUrl).queryParameters['fsname'] ?? | ||||
|       var apkName = | ||||
|           Uri.parse(apkUrl).queryParameters['fsname'] ?? | ||||
|           '${appId}_$version.apk'; | ||||
|  | ||||
|       return APKDetails( | ||||
|           version, [MapEntry(apkName, apkUrl)], AppNames(author, appName), | ||||
|         version, | ||||
|         [MapEntry(apkName, apkUrl)], | ||||
|         AppNames(author, appName), | ||||
|         releaseDate: releaseDate != null | ||||
|             ? DateTime.fromMillisecondsSinceEpoch(releaseDate * 1000) | ||||
|               : null); | ||||
|             : null, | ||||
|       ); | ||||
|     } else { | ||||
|       throw getObtainiumHttpError(res); | ||||
|     } | ||||
|   | ||||
| @@ -1,9 +1,23 @@ | ||||
| import 'package:easy_localization/easy_localization.dart'; | ||||
| import 'package:html/parser.dart'; | ||||
| import 'package:obtainium/app_sources/apkpure.dart'; | ||||
| import 'package:obtainium/custom_errors.dart'; | ||||
| import 'package:obtainium/providers/source_provider.dart'; | ||||
|  | ||||
| DateTime? parseDateTimeMMMddCommayyyy(String? dateString) { | ||||
|   DateTime? releaseDate; | ||||
|   try { | ||||
|     releaseDate = dateString != null | ||||
|         ? DateFormat('MMM dd, yyyy').parse(dateString) | ||||
|         : null; | ||||
|     releaseDate = dateString != null && releaseDate == null | ||||
|         ? DateFormat('MMMM dd, yyyy').parse(dateString) | ||||
|         : releaseDate; | ||||
|   } catch (err) { | ||||
|     // ignore | ||||
|   } | ||||
|   return releaseDate; | ||||
| } | ||||
|  | ||||
| class Uptodown extends AppSource { | ||||
|   Uptodown() { | ||||
|     hosts = ['uptodown.com']; | ||||
| @@ -17,7 +31,8 @@ class Uptodown extends AppSource { | ||||
|   String sourceSpecificStandardizeURL(String url, {bool forSelection = false}) { | ||||
|     RegExp standardUrlRegEx = RegExp( | ||||
|       '^https?://([^\\.]+\\.){2,}${getSourceRegex(hosts)}', | ||||
|         caseSensitive: false); | ||||
|       caseSensitive: false, | ||||
|     ); | ||||
|     RegExpMatch? match = standardUrlRegEx.firstMatch(url); | ||||
|     if (match == null) { | ||||
|       throw InvalidURLError(name); | ||||
| @@ -26,14 +41,20 @@ class Uptodown extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<String?> tryInferringAppId(String standardUrl, | ||||
|       {Map<String, dynamic> additionalSettings = const {}}) async { | ||||
|   Future<String?> tryInferringAppId( | ||||
|     String standardUrl, { | ||||
|     Map<String, dynamic> additionalSettings = const {}, | ||||
|   }) async { | ||||
|     return (await getAppDetailsFromPage( | ||||
|         standardUrl, additionalSettings))['appId']; | ||||
|       standardUrl, | ||||
|       additionalSettings, | ||||
|     ))['appId']; | ||||
|   } | ||||
|  | ||||
|   Future<Map<String, String?>> getAppDetailsFromPage( | ||||
|       String standardUrl, Map<String, dynamic> additionalSettings) async { | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     var res = await sourceRequest(standardUrl, additionalSettings); | ||||
|     if (res.statusCode != 200) { | ||||
|       throw getObtainiumHttpError(res); | ||||
| @@ -49,8 +70,9 @@ class Uptodown extends AppSource { | ||||
|         .toList(); | ||||
|     String? appId = detailElements.elementAtOrNull(0); | ||||
|     String? dateStr = detailElements.elementAtOrNull(6); | ||||
|     String? fileId = | ||||
|         html.querySelector('#detail-app-name')?.attributes['data-file-id']; | ||||
|     String? fileId = html | ||||
|         .querySelector('#detail-app-name') | ||||
|         ?.attributes['data-file-id']; | ||||
|     String? extension = detailElements.elementAtOrNull(7)?.toLowerCase(); | ||||
|     return Map.fromEntries([ | ||||
|       MapEntry('version', version), | ||||
| @@ -59,7 +81,7 @@ class Uptodown extends AppSource { | ||||
|       MapEntry('author', author), | ||||
|       MapEntry('dateStr', dateStr), | ||||
|       MapEntry('fileId', fileId), | ||||
|       MapEntry('extension', extension) | ||||
|       MapEntry('extension', extension), | ||||
|     ]); | ||||
|   } | ||||
|  | ||||
| @@ -68,8 +90,10 @@ class Uptodown extends AppSource { | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     var appDetails = | ||||
|         await getAppDetailsFromPage(standardUrl, additionalSettings); | ||||
|     var appDetails = await getAppDetailsFromPage( | ||||
|       standardUrl, | ||||
|       additionalSettings, | ||||
|     ); | ||||
|     var version = appDetails['version']; | ||||
|     var appId = appDetails['appId']; | ||||
|     var fileId = appDetails['fileId']; | ||||
| @@ -91,21 +115,28 @@ class Uptodown extends AppSource { | ||||
|     if (dateStr != null) { | ||||
|       relDate = parseDateTimeMMMddCommayyyy(dateStr); | ||||
|     } | ||||
|     return APKDetails(version, [MapEntry('$appId.$extension', apkUrl)], | ||||
|     return APKDetails( | ||||
|       version, | ||||
|       [MapEntry('$appId.$extension', apkUrl)], | ||||
|       AppNames(author, appName), | ||||
|         releaseDate: relDate); | ||||
|       releaseDate: relDate, | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<String> apkUrlPrefetchModifier(String apkUrl, String standardUrl, | ||||
|       Map<String, dynamic> additionalSettings) async { | ||||
|   Future<String> apkUrlPrefetchModifier( | ||||
|     String apkUrl, | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     var res = await sourceRequest(apkUrl, additionalSettings); | ||||
|     if (res.statusCode != 200) { | ||||
|       throw getObtainiumHttpError(res); | ||||
|     } | ||||
|     var html = parse(res.body); | ||||
|     var finalUrlKey = | ||||
|         html.querySelector('#detail-download-button')?.attributes['data-url']; | ||||
|     var finalUrlKey = html | ||||
|         .querySelector('#detail-download-button') | ||||
|         ?.attributes['data-url']; | ||||
|     if (finalUrlKey == null) { | ||||
|       throw NoAPKError(); | ||||
|     } | ||||
|   | ||||
| @@ -23,15 +23,19 @@ class VivoAppStore extends AppSource { | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<String?> tryInferringAppId(String standardUrl, | ||||
|       {Map<String, dynamic> additionalSettings = const {}}) async { | ||||
|   Future<String?> tryInferringAppId( | ||||
|     String standardUrl, { | ||||
|     Map<String, dynamic> additionalSettings = const {}, | ||||
|   }) async { | ||||
|     var json = await getDetailJson(standardUrl, additionalSettings); | ||||
|     return json['package_name']; | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<APKDetails> getLatestAPKDetails( | ||||
|       String standardUrl, Map<String, dynamic> additionalSettings) async { | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     var json = await getDetailJson(standardUrl, additionalSettings); | ||||
|     var appName = json['title_zh'].toString(); | ||||
|     var packageName = json['package_name'].toString(); | ||||
| @@ -42,13 +46,18 @@ class VivoAppStore extends AppSource { | ||||
|     var apkUrl = json['download_url'].toString(); | ||||
|     var apkName = '${packageName}_$versionCode.apk'; | ||||
|     return APKDetails( | ||||
|         versionName, [MapEntry(apkName, apkUrl)], AppNames(developer, appName), | ||||
|         releaseDate: DateTime.parse(uploadTime)); | ||||
|       versionName, | ||||
|       [MapEntry(apkName, apkUrl)], | ||||
|       AppNames(developer, appName), | ||||
|       releaseDate: DateTime.parse(uploadTime), | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Future<Map<String, List<String>>> search(String query, | ||||
|       {Map<String, dynamic> querySettings = const {}}) async { | ||||
|   Future<Map<String, List<String>>> search( | ||||
|     String query, { | ||||
|     Map<String, dynamic> querySettings = const {}, | ||||
|   }) async { | ||||
|     var apiBaseUrl = | ||||
|         'https://h5-api.appstore.vivo.com.cn/h5appstore/search/result-list?app_version=2100&page_index=1&apps_per_page=20&target=local&cfrom=2&key='; | ||||
|     var searchUrl = '$apiBaseUrl${Uri.encodeQueryComponent(query)}'; | ||||
| @@ -65,14 +74,16 @@ class VivoAppStore extends AppSource { | ||||
|     for (var item in (resultsJson as List<dynamic>)) { | ||||
|       results['$appDetailUrl${item['id']}'] = [ | ||||
|         item['title_zh'].toString(), | ||||
|         item['developer'].toString() | ||||
|         item['developer'].toString(), | ||||
|       ]; | ||||
|     } | ||||
|     return results; | ||||
|   } | ||||
|  | ||||
|   Future<Map<String, dynamic>> getDetailJson( | ||||
|       String standardUrl, Map<String, dynamic> additionalSettings) async { | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     var vivoAppId = parseVivoAppId(standardUrl); | ||||
|     var apiBaseUrl = 'https://h5-api.appstore.vivo.com.cn/detail/'; | ||||
|     var params = '?frompage=messageh5&app_version=2100'; | ||||
|   | ||||
| @@ -20,8 +20,9 @@ class _CustomAppBarState extends State<CustomAppBar> { | ||||
|         titlePadding: const EdgeInsets.symmetric(horizontal: 20, vertical: 16), | ||||
|         title: Text( | ||||
|           widget.title, | ||||
|           style: | ||||
|               TextStyle(color: Theme.of(context).textTheme.bodyMedium!.color), | ||||
|           style: TextStyle( | ||||
|             color: Theme.of(context).textTheme.bodyMedium!.color, | ||||
|           ), | ||||
|         ), | ||||
|       ), | ||||
|     ); | ||||
|   | ||||
| @@ -16,11 +16,13 @@ abstract class GeneratedFormItem { | ||||
|   dynamic ensureType(dynamic val); | ||||
|   GeneratedFormItem clone(); | ||||
|  | ||||
|   GeneratedFormItem(this.key, | ||||
|       {this.label = 'Input', | ||||
|   GeneratedFormItem( | ||||
|     this.key, { | ||||
|     this.label = 'Input', | ||||
|     this.belowWidgets = const [], | ||||
|     this.defaultValue, | ||||
|       this.additionalValidators = const []}); | ||||
|     this.additionalValidators = const [], | ||||
|   }); | ||||
| } | ||||
|  | ||||
| class GeneratedFormTextField extends GeneratedFormItem { | ||||
| @@ -31,18 +33,19 @@ class GeneratedFormTextField extends GeneratedFormItem { | ||||
|   late TextInputType? textInputType; | ||||
|   late List<String>? autoCompleteOptions; | ||||
|  | ||||
|   GeneratedFormTextField(super.key, | ||||
|       {super.label, | ||||
|   GeneratedFormTextField( | ||||
|     super.key, { | ||||
|     super.label, | ||||
|     super.belowWidgets, | ||||
|     String super.defaultValue = '', | ||||
|       List<String? Function(String? value)> super.additionalValidators = | ||||
|           const [], | ||||
|     List<String? Function(String? value)> super.additionalValidators = const [], | ||||
|     this.required = true, | ||||
|     this.max = 1, | ||||
|     this.hint, | ||||
|     this.password = false, | ||||
|     this.textInputType, | ||||
|       this.autoCompleteOptions}); | ||||
|     this.autoCompleteOptions, | ||||
|   }); | ||||
|  | ||||
|   @override | ||||
|   String ensureType(val) { | ||||
| @@ -51,7 +54,8 @@ class GeneratedFormTextField extends GeneratedFormItem { | ||||
|  | ||||
|   @override | ||||
|   GeneratedFormTextField clone() { | ||||
|     return GeneratedFormTextField(key, | ||||
|     return GeneratedFormTextField( | ||||
|       key, | ||||
|       label: label, | ||||
|       belowWidgets: belowWidgets, | ||||
|       defaultValue: defaultValue, | ||||
| @@ -60,7 +64,8 @@ class GeneratedFormTextField extends GeneratedFormItem { | ||||
|       max: max, | ||||
|       hint: hint, | ||||
|       password: password, | ||||
|         textInputType: textInputType); | ||||
|       textInputType: textInputType, | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|  | ||||
| @@ -91,8 +96,9 @@ class GeneratedFormDropdown extends GeneratedFormItem { | ||||
|       label: label, | ||||
|       belowWidgets: belowWidgets, | ||||
|       defaultValue: defaultValue, | ||||
|       disabledOptKeys: | ||||
|           disabledOptKeys != null ? List.from(disabledOptKeys!) : null, | ||||
|       disabledOptKeys: disabledOptKeys != null | ||||
|           ? List.from(disabledOptKeys!) | ||||
|           : null, | ||||
|       additionalValidators: List.from(additionalValidators), | ||||
|     ); | ||||
|   } | ||||
| @@ -117,12 +123,14 @@ class GeneratedFormSwitch extends GeneratedFormItem { | ||||
|  | ||||
|   @override | ||||
|   GeneratedFormSwitch clone() { | ||||
|     return GeneratedFormSwitch(key, | ||||
|     return GeneratedFormSwitch( | ||||
|       key, | ||||
|       label: label, | ||||
|       belowWidgets: belowWidgets, | ||||
|       defaultValue: defaultValue, | ||||
|       disabled: false, | ||||
|         additionalValidators: List.from(additionalValidators)); | ||||
|       additionalValidators: List.from(additionalValidators), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|  | ||||
| @@ -132,17 +140,20 @@ class GeneratedFormTagInput extends GeneratedFormItem { | ||||
|   late WrapAlignment alignment; | ||||
|   late String emptyMessage; | ||||
|   late bool showLabelWhenNotEmpty; | ||||
|   GeneratedFormTagInput(super.key, | ||||
|       {super.label, | ||||
|   GeneratedFormTagInput( | ||||
|     super.key, { | ||||
|     super.label, | ||||
|     super.belowWidgets, | ||||
|     Map<String, MapEntry<int, bool>> super.defaultValue = const {}, | ||||
|     List<String? Function(Map<String, MapEntry<int, bool>> value)> | ||||
|           super.additionalValidators = const [], | ||||
|         super.additionalValidators = | ||||
|         const [], | ||||
|     this.deleteConfirmationMessage, | ||||
|     this.singleSelect = false, | ||||
|     this.alignment = WrapAlignment.start, | ||||
|     this.emptyMessage = 'Input', | ||||
|       this.showLabelWhenNotEmpty = true}); | ||||
|     this.showLabelWhenNotEmpty = true, | ||||
|   }); | ||||
|  | ||||
|   @override | ||||
|   Map<String, MapEntry<int, bool>> ensureType(val) { | ||||
| @@ -151,7 +162,8 @@ class GeneratedFormTagInput extends GeneratedFormItem { | ||||
|  | ||||
|   @override | ||||
|   GeneratedFormTagInput clone() { | ||||
|     return GeneratedFormTagInput(key, | ||||
|     return GeneratedFormTagInput( | ||||
|       key, | ||||
|       label: label, | ||||
|       belowWidgets: belowWidgets, | ||||
|       defaultValue: defaultValue, | ||||
| @@ -160,16 +172,20 @@ class GeneratedFormTagInput extends GeneratedFormItem { | ||||
|       singleSelect: singleSelect, | ||||
|       alignment: alignment, | ||||
|       emptyMessage: emptyMessage, | ||||
|         showLabelWhenNotEmpty: showLabelWhenNotEmpty); | ||||
|       showLabelWhenNotEmpty: showLabelWhenNotEmpty, | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|  | ||||
| typedef OnValueChanges = void Function( | ||||
|     Map<String, dynamic> values, bool valid, bool isBuilding); | ||||
| typedef OnValueChanges = | ||||
|     void Function(Map<String, dynamic> values, bool valid, bool isBuilding); | ||||
|  | ||||
| class GeneratedForm extends StatefulWidget { | ||||
|   const GeneratedForm( | ||||
|       {super.key, required this.items, required this.onValueChanges}); | ||||
|   const GeneratedForm({ | ||||
|     super.key, | ||||
|     required this.items, | ||||
|     required this.onValueChanges, | ||||
|   }); | ||||
|  | ||||
|   final List<List<GeneratedFormItem>> items; | ||||
|   final OnValueChanges onValueChanges; | ||||
| @@ -179,7 +195,8 @@ class GeneratedForm extends StatefulWidget { | ||||
| } | ||||
|  | ||||
| List<List<GeneratedFormItem>> cloneFormItems( | ||||
|     List<List<GeneratedFormItem>> items) { | ||||
|   List<List<GeneratedFormItem>> items, | ||||
| ) { | ||||
|   List<List<GeneratedFormItem>> clonedItems = []; | ||||
|   for (var row in items) { | ||||
|     List<GeneratedFormItem> clonedRow = []; | ||||
| @@ -194,8 +211,13 @@ List<List<GeneratedFormItem>> cloneFormItems( | ||||
| class GeneratedFormSubForm extends GeneratedFormItem { | ||||
|   final List<List<GeneratedFormItem>> items; | ||||
|  | ||||
|   GeneratedFormSubForm(super.key, this.items, | ||||
|       {super.label, super.belowWidgets, super.defaultValue = const []}); | ||||
|   GeneratedFormSubForm( | ||||
|     super.key, | ||||
|     this.items, { | ||||
|     super.label, | ||||
|     super.belowWidgets, | ||||
|     super.defaultValue = const [], | ||||
|   }); | ||||
|  | ||||
|   @override | ||||
|   ensureType(val) { | ||||
| @@ -204,8 +226,13 @@ class GeneratedFormSubForm extends GeneratedFormItem { | ||||
|  | ||||
|   @override | ||||
|   GeneratedFormSubForm clone() { | ||||
|     return GeneratedFormSubForm(key, cloneFormItems(items), | ||||
|         label: label, belowWidgets: belowWidgets, defaultValue: defaultValue); | ||||
|     return GeneratedFormSubForm( | ||||
|       key, | ||||
|       cloneFormItems(items), | ||||
|       label: label, | ||||
|       belowWidgets: belowWidgets, | ||||
|       defaultValue: defaultValue, | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|  | ||||
| @@ -220,13 +247,18 @@ Color generateRandomLightColor() { | ||||
|   // Map from HPLuv color space to RGB, use constant saturation=100, lightness=70 | ||||
|   final List<double> rgbValuesDbl = Hsluv.hpluvToRgb([hue, 100, 70]); | ||||
|   // Map RBG values from 0-1 to 0-255: | ||||
|   final List<int> rgbValues = | ||||
|       rgbValuesDbl.map((rgb) => (rgb * 255).toInt()).toList(); | ||||
|   final List<int> rgbValues = rgbValuesDbl | ||||
|       .map((rgb) => (rgb * 255).toInt()) | ||||
|       .toList(); | ||||
|   return Color.fromARGB(255, rgbValues[0], rgbValues[1], rgbValues[2]); | ||||
| } | ||||
|  | ||||
| int generateRandomNumber(int seed1, | ||||
|     {int seed2 = 0, int seed3 = 0, max = 10000}) { | ||||
| int generateRandomNumber( | ||||
|   int seed1, { | ||||
|   int seed2 = 0, | ||||
|   int seed3 = 0, | ||||
|   max = 10000, | ||||
| }) { | ||||
|   int combinedSeed = seed1.hashCode ^ seed2.hashCode ^ seed3.hashCode; | ||||
|   Random random = Random(combinedSeed); | ||||
|   int randomNumber = random.nextInt(max); | ||||
| @@ -261,7 +293,7 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|     widget.onValueChanges(returnValues, valid, isBuilding); | ||||
|   } | ||||
|  | ||||
|   initForm() { | ||||
|   void initForm() { | ||||
|     initKey = widget.key.toString(); | ||||
|     // Initialize form values as all empty | ||||
|     values.clear(); | ||||
| @@ -297,9 +329,9 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|                   }); | ||||
|                 }, | ||||
|                 decoration: InputDecoration( | ||||
|                     helperText: | ||||
|                         formItem.label + (formItem.required ? ' *' : ''), | ||||
|                     hintText: formItem.hint), | ||||
|                   helperText: formItem.label + (formItem.required ? ' *' : ''), | ||||
|                   hintText: formItem.hint, | ||||
|                 ), | ||||
|                 minLines: formItem.max <= 1 ? null : formItem.max, | ||||
|                 maxLines: formItem.max <= 1 ? 1 : formItem.max, | ||||
|                 validator: (value) { | ||||
| @@ -342,20 +374,23 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|             decoration: InputDecoration(labelText: formItem.label), | ||||
|             value: values[formItem.key], | ||||
|             items: formItem.opts!.map((e2) { | ||||
|                 var enabled = | ||||
|                     formItem.disabledOptKeys?.contains(e2.key) != true; | ||||
|               var enabled = formItem.disabledOptKeys?.contains(e2.key) != true; | ||||
|               return DropdownMenuItem( | ||||
|                 value: e2.key, | ||||
|                 enabled: enabled, | ||||
|                 child: Opacity( | ||||
|                         opacity: enabled ? 1 : 0.5, child: Text(e2.value))); | ||||
|                   opacity: enabled ? 1 : 0.5, | ||||
|                   child: Text(e2.value), | ||||
|                 ), | ||||
|               ); | ||||
|             }).toList(), | ||||
|             onChanged: (value) { | ||||
|               setState(() { | ||||
|                 values[formItem.key] = value ?? formItem.opts!.first.key; | ||||
|                 someValueChanged(); | ||||
|               }); | ||||
|               }); | ||||
|             }, | ||||
|           ); | ||||
|         } else if (formItem is GeneratedFormSubForm) { | ||||
|           values[formItem.key] = []; | ||||
|           for (Map<String, dynamic> v | ||||
| @@ -394,20 +429,18 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|             mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||||
|             children: [ | ||||
|               Flexible(child: Text(widget.items[r][e].label)), | ||||
|               const SizedBox( | ||||
|                 width: 8, | ||||
|               ), | ||||
|               const SizedBox(width: 8), | ||||
|               Switch( | ||||
|                 value: values[fieldKey], | ||||
|                   onChanged: | ||||
|                       (widget.items[r][e] as GeneratedFormSwitch).disabled | ||||
|                 onChanged: (widget.items[r][e] as GeneratedFormSwitch).disabled | ||||
|                     ? null | ||||
|                     : (value) { | ||||
|                         setState(() { | ||||
|                           values[fieldKey] = value; | ||||
|                           someValueChanged(); | ||||
|                         }); | ||||
|                             }) | ||||
|                       }, | ||||
|               ), | ||||
|             ], | ||||
|           ); | ||||
|         } else if (widget.items[r][e] is GeneratedFormTagInput) { | ||||
| @@ -418,9 +451,11 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|                 return GeneratedFormModal( | ||||
|                   title: widget.items[r][e].label, | ||||
|                   items: [ | ||||
|                         [GeneratedFormTextField('label', label: tr('label'))] | ||||
|                       ]); | ||||
|                 }).then((value) { | ||||
|                     [GeneratedFormTextField('label', label: tr('label'))], | ||||
|                   ], | ||||
|                 ); | ||||
|               }, | ||||
|             ).then((value) { | ||||
|               String? label = value?['label']; | ||||
|               if (label != null) { | ||||
|                 setState(() { | ||||
| @@ -434,8 +469,10 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|                     var someSelected = temp.entries | ||||
|                         .where((element) => element.value.value) | ||||
|                         .isNotEmpty; | ||||
|                     temp[label] = MapEntry(generateRandomLightColor().value, | ||||
|                         !(someSelected && singleSelect)); | ||||
|                     temp[label] = MapEntry( | ||||
|                       generateRandomLightColor().value, | ||||
|                       !(someSelected && singleSelect), | ||||
|                     ); | ||||
|                     values[fieldKey] = temp; | ||||
|                     someValueChanged(); | ||||
|                   } | ||||
| @@ -444,8 +481,9 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|             }); | ||||
|           } | ||||
|  | ||||
|           formInputs[r][e] = | ||||
|               Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [ | ||||
|           formInputs[r][e] = Column( | ||||
|             crossAxisAlignment: CrossAxisAlignment.stretch, | ||||
|             children: [ | ||||
|               if ((values[fieldKey] as Map<String, MapEntry<int, bool>>?) | ||||
|                           ?.isNotEmpty == | ||||
|                       true && | ||||
| @@ -459,9 +497,7 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|                       : CrossAxisAlignment.stretch, | ||||
|                   children: [ | ||||
|                     Text(widget.items[r][e].label), | ||||
|                   const SizedBox( | ||||
|                     height: 8, | ||||
|                   ), | ||||
|                     const SizedBox(height: 8), | ||||
|                   ], | ||||
|                 ), | ||||
|               Wrap( | ||||
| @@ -481,45 +517,63 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|                           ?.entries | ||||
|                           .map((e2) { | ||||
|                             return Padding( | ||||
|                           padding: const EdgeInsets.symmetric(horizontal: 4), | ||||
|                               padding: const EdgeInsets.symmetric( | ||||
|                                 horizontal: 4, | ||||
|                               ), | ||||
|                               child: ChoiceChip( | ||||
|                                 label: Text(e2.key), | ||||
|                             backgroundColor: Color(e2.value.key).withAlpha(50), | ||||
|                                 backgroundColor: Color( | ||||
|                                   e2.value.key, | ||||
|                                 ).withAlpha(50), | ||||
|                                 selectedColor: Color(e2.value.key), | ||||
|                                 visualDensity: VisualDensity.compact, | ||||
|                                 selected: e2.value.value, | ||||
|                                 onSelected: (value) { | ||||
|                                   setState(() { | ||||
|                                 (values[fieldKey] as Map<String, | ||||
|                                         MapEntry<int, bool>>)[e2.key] = | ||||
|                                     MapEntry( | ||||
|                                         (values[fieldKey] as Map<String, | ||||
|                                                 MapEntry<int, bool>>)[e2.key]! | ||||
|                                     (values[fieldKey] | ||||
|                                         as Map<String, MapEntry<int, bool>>)[e2 | ||||
|                                         .key] = MapEntry( | ||||
|                                       (values[fieldKey] | ||||
|                                               as Map< | ||||
|                                                 String, | ||||
|                                                 MapEntry<int, bool> | ||||
|                                               >)[e2.key]! | ||||
|                                           .key, | ||||
|                                         value); | ||||
|                                       value, | ||||
|                                     ); | ||||
|                                     if ((widget.items[r][e] | ||||
|                                                 as GeneratedFormTagInput) | ||||
|                                             .singleSelect && | ||||
|                                         value == true) { | ||||
|                                   for (var key in (values[fieldKey] | ||||
|                                           as Map<String, MapEntry<int, bool>>) | ||||
|                                       for (var key | ||||
|                                           in (values[fieldKey] | ||||
|                                                   as Map< | ||||
|                                                     String, | ||||
|                                                     MapEntry<int, bool> | ||||
|                                                   >) | ||||
|                                               .keys) { | ||||
|                                         if (key != e2.key) { | ||||
|                                       (values[fieldKey] as Map< | ||||
|                                           (values[fieldKey] | ||||
|                                               as Map< | ||||
|                                                 String, | ||||
|                                           MapEntry<int, | ||||
|                                               bool>>)[key] = MapEntry( | ||||
|                                           (values[fieldKey] as Map<String, | ||||
|                                                   MapEntry<int, bool>>)[key]! | ||||
|                                                 MapEntry<int, bool> | ||||
|                                               >)[key] = MapEntry( | ||||
|                                             (values[fieldKey] | ||||
|                                                     as Map< | ||||
|                                                       String, | ||||
|                                                       MapEntry<int, bool> | ||||
|                                                     >)[key]! | ||||
|                                                 .key, | ||||
|                                           false); | ||||
|                                             false, | ||||
|                                           ); | ||||
|                                         } | ||||
|                                       } | ||||
|                                     } | ||||
|                                     someValueChanged(); | ||||
|                                   }); | ||||
|                                 }, | ||||
|                           )); | ||||
|                               ), | ||||
|                             ); | ||||
|                           }) ?? | ||||
|                       [const SizedBox.shrink()], | ||||
|                   (values[fieldKey] as Map<String, MapEntry<int, bool>>?) | ||||
| @@ -532,19 +586,23 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|                           child: IconButton( | ||||
|                             onPressed: () { | ||||
|                               setState(() { | ||||
|                               var temp = values[fieldKey] | ||||
|                                 var temp = | ||||
|                                     values[fieldKey] | ||||
|                                         as Map<String, MapEntry<int, bool>>; | ||||
|                                 // get selected category str where bool is true | ||||
|                               final oldEntry = temp.entries | ||||
|                                   .firstWhere((entry) => entry.value.value); | ||||
|                                 final oldEntry = temp.entries.firstWhere( | ||||
|                                   (entry) => entry.value.value, | ||||
|                                 ); | ||||
|                                 // generate new color, ensure it is not the same | ||||
|                                 int newColor = oldEntry.value.key; | ||||
|                                 while (oldEntry.value.key == newColor) { | ||||
|                                   newColor = generateRandomLightColor().value; | ||||
|                                 } | ||||
|                                 // Update entry with new color, remain selected | ||||
|                               temp.update(oldEntry.key, | ||||
|                                   (old) => MapEntry(newColor, old.value)); | ||||
|                                 temp.update( | ||||
|                                   oldEntry.key, | ||||
|                                   (old) => MapEntry(newColor, old.value), | ||||
|                                 ); | ||||
|                                 values[fieldKey] = temp; | ||||
|                                 someValueChanged(); | ||||
|                               }); | ||||
| @@ -552,7 +610,8 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|                             icon: const Icon(Icons.format_color_fill_rounded), | ||||
|                             visualDensity: VisualDensity.compact, | ||||
|                             tooltip: tr('colour'), | ||||
|                         )) | ||||
|                           ), | ||||
|                         ) | ||||
|                       : const SizedBox.shrink(), | ||||
|                   (values[fieldKey] as Map<String, MapEntry<int, bool>>?) | ||||
|                               ?.values | ||||
| @@ -565,7 +624,8 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|                             onPressed: () { | ||||
|                               fn() { | ||||
|                                 setState(() { | ||||
|                                 var temp = values[fieldKey] | ||||
|                                   var temp = | ||||
|                                       values[fieldKey] | ||||
|                                           as Map<String, MapEntry<int, bool>>; | ||||
|                                   temp.removeWhere((key, value) => value.value); | ||||
|                                   values[fieldKey] = temp; | ||||
| @@ -577,7 +637,8 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|                                       .deleteConfirmationMessage != | ||||
|                                   null) { | ||||
|                                 var message = | ||||
|                                   (widget.items[r][e] as GeneratedFormTagInput) | ||||
|                                     (widget.items[r][e] | ||||
|                                             as GeneratedFormTagInput) | ||||
|                                         .deleteConfirmationMessage!; | ||||
|                                 showDialog<Map<String, dynamic>?>( | ||||
|                                   context: context, | ||||
| @@ -585,8 +646,10 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|                                     return GeneratedFormModal( | ||||
|                                       title: message.key, | ||||
|                                       message: message.value, | ||||
|                                         items: const []); | ||||
|                                   }).then((value) { | ||||
|                                       items: const [], | ||||
|                                     ); | ||||
|                                   }, | ||||
|                                 ).then((value) { | ||||
|                                   if (value != null) { | ||||
|                                     fn(); | ||||
|                                   } | ||||
| @@ -598,7 +661,8 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|                             icon: const Icon(Icons.remove), | ||||
|                             visualDensity: VisualDensity.compact, | ||||
|                             tooltip: tr('remove'), | ||||
|                         )) | ||||
|                           ), | ||||
|                         ) | ||||
|                       : const SizedBox.shrink(), | ||||
|                   (values[fieldKey] as Map<String, MapEntry<int, bool>>?) | ||||
|                               ?.isEmpty == | ||||
| @@ -610,8 +674,10 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|                             icon: const Icon(Icons.add), | ||||
|                             label: Text( | ||||
|                               (widget.items[r][e] as GeneratedFormTagInput) | ||||
|                                   .label), | ||||
|                         )) | ||||
|                                   .label, | ||||
|                             ), | ||||
|                           ), | ||||
|                         ) | ||||
|                       : Padding( | ||||
|                           padding: const EdgeInsets.symmetric(horizontal: 4), | ||||
|                           child: IconButton( | ||||
| @@ -619,29 +685,30 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|                             icon: const Icon(Icons.add), | ||||
|                             visualDensity: VisualDensity.compact, | ||||
|                             tooltip: tr('add'), | ||||
|                         )), | ||||
|                           ), | ||||
|                         ), | ||||
|                 ], | ||||
|             ) | ||||
|           ]); | ||||
|               ), | ||||
|             ], | ||||
|           ); | ||||
|         } else if (widget.items[r][e] is GeneratedFormSubForm) { | ||||
|           List<Widget> subformColumn = []; | ||||
|           var compact = (widget.items[r][e] as GeneratedFormSubForm) | ||||
|                       .items | ||||
|                       .length == | ||||
|                   1 && | ||||
|           var compact = | ||||
|               (widget.items[r][e] as GeneratedFormSubForm).items.length == 1 && | ||||
|               (widget.items[r][e] as GeneratedFormSubForm).items[0].length == 1; | ||||
|           for (int i = 0; i < values[fieldKey].length; i++) { | ||||
|             var internalFormKey = ValueKey(generateRandomNumber( | ||||
|             var internalFormKey = ValueKey( | ||||
|               generateRandomNumber( | ||||
|                 values[fieldKey].length, | ||||
|                 seed2: i, | ||||
|                 seed3: forceUpdateKeyCount)); | ||||
|             subformColumn.add(Column( | ||||
|                 seed3: forceUpdateKeyCount, | ||||
|               ), | ||||
|             ); | ||||
|             subformColumn.add( | ||||
|               Column( | ||||
|                 crossAxisAlignment: CrossAxisAlignment.start, | ||||
|                 children: [ | ||||
|                 if (!compact) | ||||
|                   const SizedBox( | ||||
|                     height: 16, | ||||
|                   ), | ||||
|                   if (!compact) const SizedBox(height: 16), | ||||
|                   if (!compact) | ||||
|                     Text( | ||||
|                       '${(widget.items[r][e] as GeneratedFormSubForm).label} (${i + 1})', | ||||
| @@ -649,22 +716,30 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|                     ), | ||||
|                   GeneratedForm( | ||||
|                     key: internalFormKey, | ||||
|                   items: cloneFormItems( | ||||
|                           (widget.items[r][e] as GeneratedFormSubForm).items) | ||||
|                       .map((x) => x.map((y) { | ||||
|                     items: | ||||
|                         cloneFormItems( | ||||
|                               (widget.items[r][e] as GeneratedFormSubForm) | ||||
|                                   .items, | ||||
|                             ) | ||||
|                             .map( | ||||
|                               (x) => x.map((y) { | ||||
|                                 y.defaultValue = values[fieldKey]?[i]?[y.key]; | ||||
|                                 y.key = '${y.key.toString()},$internalFormKey'; | ||||
|                                 return y; | ||||
|                           }).toList()) | ||||
|                               }).toList(), | ||||
|                             ) | ||||
|                             .toList(), | ||||
|                     onValueChanges: (values, valid, isBuilding) { | ||||
|                       values = values.map( | ||||
|                         (key, value) => MapEntry(key.split(',')[0], value)); | ||||
|                         (key, value) => MapEntry(key.split(',')[0], value), | ||||
|                       ); | ||||
|                       if (valid) { | ||||
|                         this.values[fieldKey]?[i] = values; | ||||
|                       } | ||||
|                       someValueChanged( | ||||
|                         isBuilding: isBuilding, forceInvalid: !valid); | ||||
|                         isBuilding: isBuilding, | ||||
|                         forceInvalid: !valid, | ||||
|                       ); | ||||
|                     }, | ||||
|                   ), | ||||
|                   Row( | ||||
| @@ -672,8 +747,8 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|                     children: [ | ||||
|                       TextButton.icon( | ||||
|                         style: TextButton.styleFrom( | ||||
|                             foregroundColor: | ||||
|                                 Theme.of(context).colorScheme.error), | ||||
|                           foregroundColor: Theme.of(context).colorScheme.error, | ||||
|                         ), | ||||
|                         onPressed: (values[fieldKey].length > 0) | ||||
|                             ? () { | ||||
|                                 var temp = List.from(values[fieldKey]); | ||||
| @@ -686,33 +761,40 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|                         label: Text( | ||||
|                           '${(widget.items[r][e] as GeneratedFormSubForm).label} (${i + 1})', | ||||
|                         ), | ||||
|                         icon: const Icon( | ||||
|                           Icons.delete_outline_rounded, | ||||
|                         )) | ||||
|                         icon: const Icon(Icons.delete_outline_rounded), | ||||
|                       ), | ||||
|                     ], | ||||
|                 ) | ||||
|                   ), | ||||
|                 ], | ||||
|             )); | ||||
|               ), | ||||
|             ); | ||||
|           } | ||||
|           subformColumn.add(Padding( | ||||
|           subformColumn.add( | ||||
|             Padding( | ||||
|               padding: const EdgeInsets.only(bottom: 0, top: 8), | ||||
|               child: Row( | ||||
|                 children: [ | ||||
|                   Expanded( | ||||
|                     child: ElevatedButton.icon( | ||||
|                       onPressed: () { | ||||
|                           values[fieldKey].add(getDefaultValuesFromFormItems( | ||||
|                               (widget.items[r][e] as GeneratedFormSubForm) | ||||
|                                   .items)); | ||||
|                         values[fieldKey].add( | ||||
|                           getDefaultValuesFromFormItems( | ||||
|                             (widget.items[r][e] as GeneratedFormSubForm).items, | ||||
|                           ), | ||||
|                         ); | ||||
|                         forceUpdateKeyCount++; | ||||
|                         someValueChanged(); | ||||
|                       }, | ||||
|                       icon: const Icon(Icons.add), | ||||
|                         label: Text((widget.items[r][e] as GeneratedFormSubForm) | ||||
|                             .label))), | ||||
|                       label: Text( | ||||
|                         (widget.items[r][e] as GeneratedFormSubForm).label, | ||||
|                       ), | ||||
|                     ), | ||||
|                   ), | ||||
|                 ], | ||||
|               ), | ||||
|           )); | ||||
|             ), | ||||
|           ); | ||||
|           formInputs[r][e] = Column(children: subformColumn); | ||||
|         } | ||||
|       } | ||||
| @@ -726,24 +808,26 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|             height: widget.items[rowInputs.key - 1][0] is GeneratedFormSwitch | ||||
|                 ? 8 | ||||
|                 : 25, | ||||
|           ) | ||||
|           ), | ||||
|         ]); | ||||
|       } | ||||
|       List<Widget> rowItems = []; | ||||
|       rowInputs.value.asMap().entries.forEach((rowInput) { | ||||
|         if (rowInput.key > 0) { | ||||
|           rowItems.add(const SizedBox( | ||||
|             width: 20, | ||||
|           )); | ||||
|           rowItems.add(const SizedBox(width: 20)); | ||||
|         } | ||||
|         rowItems.add(Expanded( | ||||
|         rowItems.add( | ||||
|           Expanded( | ||||
|             child: Column( | ||||
|               crossAxisAlignment: CrossAxisAlignment.stretch, | ||||
|               mainAxisSize: MainAxisSize.min, | ||||
|               children: [ | ||||
|                 rowInput.value, | ||||
|               ...widget.items[rowInputs.key][rowInput.key].belowWidgets | ||||
|             ]))); | ||||
|                 ...widget.items[rowInputs.key][rowInput.key].belowWidgets, | ||||
|               ], | ||||
|             ), | ||||
|           ), | ||||
|         ); | ||||
|       }); | ||||
|       rows.add(rowItems); | ||||
|     }); | ||||
| @@ -752,12 +836,15 @@ class _GeneratedFormState extends State<GeneratedForm> { | ||||
|       key: _formKey, | ||||
|       child: Column( | ||||
|         children: [ | ||||
|             ...rows.map((row) => Row( | ||||
|           ...rows.map( | ||||
|             (row) => Row( | ||||
|               mainAxisAlignment: MainAxisAlignment.start, | ||||
|               crossAxisAlignment: CrossAxisAlignment.start, | ||||
|               children: [...row.map((e) => e)], | ||||
|                 )) | ||||
|             ), | ||||
|           ), | ||||
|         ], | ||||
|         )); | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -4,15 +4,16 @@ import 'package:flutter/services.dart'; | ||||
| import 'package:obtainium/components/generated_form.dart'; | ||||
|  | ||||
| class GeneratedFormModal extends StatefulWidget { | ||||
|   const GeneratedFormModal( | ||||
|       {super.key, | ||||
|   const GeneratedFormModal({ | ||||
|     super.key, | ||||
|     required this.title, | ||||
|     required this.items, | ||||
|     this.initValid = false, | ||||
|     this.message = '', | ||||
|     this.additionalWidgets = const [], | ||||
|     this.singleNullReturnButton, | ||||
|       this.primaryActionColour}); | ||||
|     this.primaryActionColour, | ||||
|   }); | ||||
|  | ||||
|   final String title; | ||||
|   final String message; | ||||
| @@ -41,13 +42,11 @@ class _GeneratedFormModalState extends State<GeneratedFormModal> { | ||||
|     return AlertDialog( | ||||
|       scrollable: true, | ||||
|       title: Text(widget.title), | ||||
|       content: | ||||
|           Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [ | ||||
|       content: Column( | ||||
|         crossAxisAlignment: CrossAxisAlignment.stretch, | ||||
|         children: [ | ||||
|           if (widget.message.isNotEmpty) Text(widget.message), | ||||
|         if (widget.message.isNotEmpty) | ||||
|           const SizedBox( | ||||
|             height: 16, | ||||
|           ), | ||||
|           if (widget.message.isNotEmpty) const SizedBox(height: 16), | ||||
|           GeneratedForm( | ||||
|             items: widget.items, | ||||
|             onValueChanges: (values, valid, isBuilding) { | ||||
| @@ -60,23 +59,29 @@ class _GeneratedFormModalState extends State<GeneratedFormModal> { | ||||
|                   this.valid = valid; | ||||
|                 }); | ||||
|               } | ||||
|             }), | ||||
|         if (widget.additionalWidgets.isNotEmpty) ...widget.additionalWidgets | ||||
|       ]), | ||||
|             }, | ||||
|           ), | ||||
|           if (widget.additionalWidgets.isNotEmpty) ...widget.additionalWidgets, | ||||
|         ], | ||||
|       ), | ||||
|       actions: [ | ||||
|         TextButton( | ||||
|           onPressed: () { | ||||
|             Navigator.of(context).pop(null); | ||||
|           }, | ||||
|             child: Text(widget.singleNullReturnButton == null | ||||
|           child: Text( | ||||
|             widget.singleNullReturnButton == null | ||||
|                 ? tr('cancel') | ||||
|                 : widget.singleNullReturnButton!)), | ||||
|                 : widget.singleNullReturnButton!, | ||||
|           ), | ||||
|         ), | ||||
|         widget.singleNullReturnButton == null | ||||
|             ? TextButton( | ||||
|                 style: widget.primaryActionColour == null | ||||
|                     ? null | ||||
|                     : TextButton.styleFrom( | ||||
|                         foregroundColor: widget.primaryActionColour), | ||||
|                         foregroundColor: widget.primaryActionColour, | ||||
|                       ), | ||||
|                 onPressed: !valid | ||||
|                     ? null | ||||
|                     : () { | ||||
| @@ -85,8 +90,9 @@ class _GeneratedFormModalState extends State<GeneratedFormModal> { | ||||
|                           Navigator.of(context).pop(values); | ||||
|                         } | ||||
|                       }, | ||||
|                 child: Text(tr('continue'))) | ||||
|             : const SizedBox.shrink() | ||||
|                 child: Text(tr('continue')), | ||||
|               ) | ||||
|             : const SizedBox.shrink(), | ||||
|       ], | ||||
|     ); | ||||
|   } | ||||
|   | ||||
| @@ -36,7 +36,8 @@ class CredsNeededError extends ObtainiumError { | ||||
| class NoReleasesError extends ObtainiumError { | ||||
|   NoReleasesError({String? note}) | ||||
|     : super( | ||||
|             '${tr('noReleaseFound')}${note?.isNotEmpty == true ? '\n\n$note' : ''}'); | ||||
|         '${tr('noReleaseFound')}${note?.isNotEmpty == true ? '\n\n$note' : ''}', | ||||
|       ); | ||||
| } | ||||
|  | ||||
| class NoAPKError extends ObtainiumError { | ||||
| @@ -75,7 +76,7 @@ class MultiAppMultiError extends ObtainiumError { | ||||
|  | ||||
|   MultiAppMultiError() : super(tr('placeholder'), unexpected: true); | ||||
|  | ||||
|   add(String appId, dynamic error, {String? appName}) { | ||||
|   void add(String appId, dynamic error, {String? appName}) { | ||||
|     if (error is SocketException) { | ||||
|       error = error.message; | ||||
|     } | ||||
| @@ -93,8 +94,11 @@ class MultiAppMultiError extends ObtainiumError { | ||||
|   String errorString(String appId, {bool includeIdsWithNames = false}) => | ||||
|       '${appIdNames.containsKey(appId) ? '${appIdNames[appId]}${includeIdsWithNames ? ' ($appId)' : ''}' : appId}: ${rawErrors[appId].toString()}'; | ||||
|  | ||||
|   String errorsAppsString(String errString, List<String> appIds, | ||||
|           {bool includeIdsWithNames = false}) => | ||||
|   String errorsAppsString( | ||||
|     String errString, | ||||
|     List<String> appIds, { | ||||
|     bool includeIdsWithNames = false, | ||||
|   }) => | ||||
|       '$errString [${list2FriendlyString(appIds.map((id) => appIdNames.containsKey(id) == true ? '${appIdNames[id]}${includeIdsWithNames ? ' ($id)' : ''}' : id).toList())}]'; | ||||
|  | ||||
|   @override | ||||
| @@ -103,43 +107,50 @@ class MultiAppMultiError extends ObtainiumError { | ||||
|       .join('\n\n'); | ||||
| } | ||||
|  | ||||
| showMessage(dynamic e, BuildContext context, {bool isError = false}) { | ||||
|   Provider.of<LogsProvider>(context, listen: false) | ||||
|       .add(e.toString(), level: isError ? LogLevels.error : LogLevels.info); | ||||
| void showMessage(dynamic e, BuildContext context, {bool isError = false}) { | ||||
|   Provider.of<LogsProvider>( | ||||
|     context, | ||||
|     listen: false, | ||||
|   ).add(e.toString(), level: isError ? LogLevels.error : LogLevels.info); | ||||
|   if (e is String || (e is ObtainiumError && !e.unexpected)) { | ||||
|     ScaffoldMessenger.of(context).showSnackBar( | ||||
|       SnackBar(content: Text(e.toString())), | ||||
|     ); | ||||
|     ScaffoldMessenger.of( | ||||
|       context, | ||||
|     ).showSnackBar(SnackBar(content: Text(e.toString()))); | ||||
|   } else { | ||||
|     showDialog( | ||||
|       context: context, | ||||
|       builder: (BuildContext ctx) { | ||||
|         return AlertDialog( | ||||
|           scrollable: true, | ||||
|             title: Text(e is MultiAppMultiError | ||||
|           title: Text( | ||||
|             e is MultiAppMultiError | ||||
|                 ? tr(isError ? 'someErrors' : 'updates') | ||||
|                 : tr(isError ? 'unexpectedError' : 'unknown')), | ||||
|                 : tr(isError ? 'unexpectedError' : 'unknown'), | ||||
|           ), | ||||
|           content: GestureDetector( | ||||
|             onLongPress: () { | ||||
|               Clipboard.setData(ClipboardData(text: e.toString())); | ||||
|                   ScaffoldMessenger.of(context).showSnackBar(SnackBar( | ||||
|                     content: Text(tr('copiedToClipboard')), | ||||
|                   )); | ||||
|               ScaffoldMessenger.of( | ||||
|                 context, | ||||
|               ).showSnackBar(SnackBar(content: Text(tr('copiedToClipboard')))); | ||||
|             }, | ||||
|                 child: Text(e.toString())), | ||||
|             child: Text(e.toString()), | ||||
|           ), | ||||
|           actions: [ | ||||
|             TextButton( | ||||
|               onPressed: () { | ||||
|                 Navigator.of(context).pop(null); | ||||
|               }, | ||||
|                   child: Text(tr('ok'))), | ||||
|               child: Text(tr('ok')), | ||||
|             ), | ||||
|           ], | ||||
|         ); | ||||
|         }); | ||||
|       }, | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|  | ||||
| showError(dynamic e, BuildContext context) { | ||||
| void showError(dynamic e, BuildContext context) { | ||||
|   showMessage(e, context, isError: true); | ||||
| } | ||||
|  | ||||
| @@ -149,12 +160,14 @@ String list2FriendlyString(List<String> list) { | ||||
|       : list | ||||
|             .asMap() | ||||
|             .entries | ||||
|           .map((e) => | ||||
|             .map( | ||||
|               (e) => | ||||
|                   e.value + | ||||
|                   (e.key == list.length - 1 | ||||
|                       ? '' | ||||
|                       : e.key == list.length - 2 | ||||
|                       ? ' and ' | ||||
|                       : ', ')) | ||||
|                       : ', '), | ||||
|             ) | ||||
|             .join(''); | ||||
| } | ||||
|   | ||||
| @@ -43,11 +43,14 @@ List<MapEntry<Locale, String>> supportedLocales = const [ | ||||
|   MapEntry(Locale('tr'), 'Türkçe'), | ||||
|   MapEntry(Locale('uk'), 'Українська'), | ||||
|   MapEntry(Locale('da'), 'Dansk'), | ||||
|   MapEntry(Locale('en', 'EO'), | ||||
|       'Esperanto'), // https://github.com/aissat/easy_localization/issues/220#issuecomment-846035493 | ||||
|   MapEntry( | ||||
|     Locale('en', 'EO'), | ||||
|     'Esperanto', | ||||
|   ), // https://github.com/aissat/easy_localization/issues/220#issuecomment-846035493 | ||||
|   MapEntry(Locale('in'), 'Bahasa Indonesia'), | ||||
|   MapEntry(Locale('ko'), '한국어'), | ||||
|   MapEntry(Locale('ca'), 'Català'), | ||||
|   MapEntry(Locale('ar'), 'العربية'), | ||||
| ]; | ||||
| const fallbackLocale = Locale('en'); | ||||
| const localeDir = 'assets/translations'; | ||||
| @@ -75,9 +78,11 @@ Future<void> loadTranslations() async { | ||||
|     }, | ||||
|   ); | ||||
|   await controller.loadTranslations(); | ||||
|   Localization.load(controller.locale, | ||||
|   Localization.load( | ||||
|     controller.locale, | ||||
|     translations: controller.translations, | ||||
|       fallbackTranslations: controller.fallbackTranslations); | ||||
|     fallbackTranslations: controller.fallbackTranslations, | ||||
|   ); | ||||
| } | ||||
|  | ||||
| @pragma('vm:entry-point') | ||||
| @@ -96,10 +101,12 @@ void backgroundFetchHeadlessTask(HeadlessTask task) async { | ||||
| void main() async { | ||||
|   WidgetsFlutterBinding.ensureInitialized(); | ||||
|   try { | ||||
|     ByteData data = | ||||
|         await PlatformAssetBundle().load('assets/ca/lets-encrypt-r3.pem'); | ||||
|     SecurityContext.defaultContext | ||||
|         .setTrustedCertificatesBytes(data.buffer.asUint8List()); | ||||
|     ByteData data = await PlatformAssetBundle().load( | ||||
|       'assets/ca/lets-encrypt-r3.pem', | ||||
|     ); | ||||
|     SecurityContext.defaultContext.setTrustedCertificatesBytes( | ||||
|       data.buffer.asUint8List(), | ||||
|     ); | ||||
|   } catch (e) { | ||||
|     // Already added, do nothing (see #375) | ||||
|   } | ||||
| @@ -112,20 +119,23 @@ void main() async { | ||||
|   } | ||||
|   final np = NotificationsProvider(); | ||||
|   await np.initialize(); | ||||
|   runApp(MultiProvider( | ||||
|   runApp( | ||||
|     MultiProvider( | ||||
|       providers: [ | ||||
|         ChangeNotifierProvider(create: (context) => AppsProvider()), | ||||
|         ChangeNotifierProvider(create: (context) => SettingsProvider()), | ||||
|         Provider(create: (context) => np), | ||||
|       Provider(create: (context) => LogsProvider()) | ||||
|         Provider(create: (context) => LogsProvider()), | ||||
|       ], | ||||
|       child: EasyLocalization( | ||||
|         supportedLocales: supportedLocales.map((e) => e.key).toList(), | ||||
|         path: localeDir, | ||||
|         fallbackLocale: fallbackLocale, | ||||
|         useOnlyLangCode: false, | ||||
|         child: const Obtainium()), | ||||
|   )); | ||||
|         child: const Obtainium(), | ||||
|       ), | ||||
|     ), | ||||
|   ); | ||||
|   BackgroundFetch.registerHeadlessTask(backgroundFetchHeadlessTask); | ||||
| } | ||||
|  | ||||
| @@ -156,13 +166,17 @@ class _ObtainiumState extends State<Obtainium> { | ||||
|         requiresCharging: false, | ||||
|         requiresStorageNotLow: false, | ||||
|         requiresDeviceIdle: false, | ||||
|             requiredNetworkType: NetworkType.ANY), (String taskId) async { | ||||
|         requiredNetworkType: NetworkType.ANY, | ||||
|       ), | ||||
|       (String taskId) async { | ||||
|         await bgUpdateCheck(taskId, null); | ||||
|         BackgroundFetch.finish(taskId); | ||||
|     }, (String taskId) async { | ||||
|       }, | ||||
|       (String taskId) async { | ||||
|         context.read<LogsProvider>().add('BG update task timed out.'); | ||||
|         BackgroundFetch.finish(taskId); | ||||
|     }); | ||||
|       }, | ||||
|     ); | ||||
|     if (!mounted) return; | ||||
|   } | ||||
|  | ||||
| @@ -182,7 +196,8 @@ class _ObtainiumState extends State<Obtainium> { | ||||
|         // If this is the first run, ask for notification permissions and add Obtainium to the Apps list | ||||
|         Permission.notification.request(); | ||||
|         if (!fdroid) { | ||||
|           getInstalledInfo(obtainiumId).then((value) { | ||||
|           getInstalledInfo(obtainiumId) | ||||
|               .then((value) { | ||||
|                 if (value?.versionName != null) { | ||||
|                   appsProvider.saveApps([ | ||||
|                     App( | ||||
| @@ -197,13 +212,15 @@ class _ObtainiumState extends State<Obtainium> { | ||||
|                       { | ||||
|                         'versionDetection': true, | ||||
|                         'apkFilterRegEx': 'fdroid', | ||||
|                       'invertAPKFilter': true | ||||
|                         'invertAPKFilter': true, | ||||
|                       }, | ||||
|                       null, | ||||
|                     false) | ||||
|                       false, | ||||
|                     ), | ||||
|                   ], onlyIfExists: false); | ||||
|                 } | ||||
|           }).catchError((err) { | ||||
|               }) | ||||
|               .catchError((err) { | ||||
|                 print(err); | ||||
|               }); | ||||
|         } | ||||
| @@ -230,17 +247,20 @@ class _ObtainiumState extends State<Obtainium> { | ||||
|           lightColorScheme = lightDynamic.harmonized(); | ||||
|           darkColorScheme = darkDynamic.harmonized(); | ||||
|         } else { | ||||
|         lightColorScheme = | ||||
|             ColorScheme.fromSeed(seedColor: settingsProvider.themeColor); | ||||
|           lightColorScheme = ColorScheme.fromSeed( | ||||
|             seedColor: settingsProvider.themeColor, | ||||
|           ); | ||||
|           darkColorScheme = ColorScheme.fromSeed( | ||||
|             seedColor: settingsProvider.themeColor, | ||||
|             brightness: Brightness.dark); | ||||
|             brightness: Brightness.dark, | ||||
|           ); | ||||
|         } | ||||
|  | ||||
|         // set the background and surface colors to pure black in the amoled theme | ||||
|         if (settingsProvider.useBlackTheme) { | ||||
|         darkColorScheme = | ||||
|             darkColorScheme.copyWith(surface: Colors.black).harmonized(); | ||||
|           darkColorScheme = darkColorScheme | ||||
|               .copyWith(surface: Colors.black) | ||||
|               .harmonized(); | ||||
|         } | ||||
|  | ||||
|         if (settingsProvider.useSystemFont) NativeFeatures.loadSystemFont(); | ||||
| @@ -257,18 +277,27 @@ class _ObtainiumState extends State<Obtainium> { | ||||
|             colorScheme: settingsProvider.theme == ThemeSettings.dark | ||||
|                 ? darkColorScheme | ||||
|                 : lightColorScheme, | ||||
|               fontFamily: | ||||
|                   settingsProvider.useSystemFont ? 'SystemFont' : 'Montserrat'), | ||||
|             fontFamily: settingsProvider.useSystemFont | ||||
|                 ? 'SystemFont' | ||||
|                 : 'Montserrat', | ||||
|           ), | ||||
|           darkTheme: ThemeData( | ||||
|             useMaterial3: true, | ||||
|             colorScheme: settingsProvider.theme == ThemeSettings.light | ||||
|                 ? lightColorScheme | ||||
|                 : darkColorScheme, | ||||
|               fontFamily: | ||||
|                   settingsProvider.useSystemFont ? 'SystemFont' : 'Montserrat'), | ||||
|           home: Shortcuts(shortcuts: <LogicalKeySet, Intent>{ | ||||
|             fontFamily: settingsProvider.useSystemFont | ||||
|                 ? 'SystemFont' | ||||
|                 : 'Montserrat', | ||||
|           ), | ||||
|           home: Shortcuts( | ||||
|             shortcuts: <LogicalKeySet, Intent>{ | ||||
|               LogicalKeySet(LogicalKeyboardKey.select): const ActivateIntent(), | ||||
|           }, child: const HomePage())); | ||||
|     }); | ||||
|             }, | ||||
|             child: const HomePage(), | ||||
|           ), | ||||
|         ); | ||||
|       }, | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -14,11 +14,15 @@ class GitHubStars implements MassAppUrlSource { | ||||
|   late List<String> requiredArgs = [tr('uname')]; | ||||
|  | ||||
|   Future<Map<String, List<String>>> getOnePageOfUserStarredUrlsWithDescriptions( | ||||
|       String username, int page) async { | ||||
|     String username, | ||||
|     int page, | ||||
|   ) async { | ||||
|     Response res = await get( | ||||
|       Uri.parse( | ||||
|             'https://api.github.com/users/$username/starred?per_page=100&page=$page'), | ||||
|         headers: await GitHub().getRequestHeaders({})); | ||||
|         'https://api.github.com/users/$username/starred?per_page=100&page=$page', | ||||
|       ), | ||||
|       headers: await GitHub().getRequestHeaders({}), | ||||
|     ); | ||||
|     if (res.statusCode == 200) { | ||||
|       Map<String, List<String>> urlsWithDescriptions = {}; | ||||
|       for (var e in (jsonDecode(res.body) as List<dynamic>)) { | ||||
| @@ -27,8 +31,8 @@ class GitHubStars implements MassAppUrlSource { | ||||
|             e['full_name'] as String, | ||||
|             e['description'] != null | ||||
|                 ? e['description'] as String | ||||
|                 : tr('noDescription') | ||||
|           ] | ||||
|                 : tr('noDescription'), | ||||
|           ], | ||||
|         }); | ||||
|       } | ||||
|       return urlsWithDescriptions; | ||||
| @@ -41,15 +45,18 @@ class GitHubStars implements MassAppUrlSource { | ||||
|  | ||||
|   @override | ||||
|   Future<Map<String, List<String>>> getUrlsWithDescriptions( | ||||
|       List<String> args) async { | ||||
|     List<String> args, | ||||
|   ) async { | ||||
|     if (args.length != requiredArgs.length) { | ||||
|       throw ObtainiumError(tr('wrongArgNum')); | ||||
|     } | ||||
|     Map<String, List<String>> urlsWithDescriptions = {}; | ||||
|     var page = 1; | ||||
|     while (true) { | ||||
|       var pageUrls = | ||||
|           await getOnePageOfUserStarredUrlsWithDescriptions(args[0], page++); | ||||
|       var pageUrls = await getOnePageOfUserStarredUrlsWithDescriptions( | ||||
|         args[0], | ||||
|         page++, | ||||
|       ); | ||||
|       urlsWithDescriptions.addAll(pageUrls); | ||||
|       if (pageUrls.length < 100) { | ||||
|         break; | ||||
|   | ||||
| @@ -39,7 +39,7 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|   int urlInputKey = 0; | ||||
|   SourceProvider sourceProvider = SourceProvider(); | ||||
|  | ||||
|   linkFn(String input) { | ||||
|   void linkFn(String input) { | ||||
|     try { | ||||
|       if (input.isEmpty) { | ||||
|         throw UnsupportedURLError(); | ||||
| @@ -51,8 +51,13 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   changeUserInput(String input, bool valid, bool isBuilding, | ||||
|       {bool updateUrlInput = false, String? overrideSource}) { | ||||
|   void changeUserInput( | ||||
|     String input, | ||||
|     bool valid, | ||||
|     bool isBuilding, { | ||||
|     bool updateUrlInput = false, | ||||
|     String? overrideSource, | ||||
|   }) { | ||||
|     userInput = input; | ||||
|     if (!isBuilding) { | ||||
|       setState(() { | ||||
| @@ -69,8 +74,10 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|             ? pickedSource?.hosts[0] | ||||
|             : null; | ||||
|         var source = valid | ||||
|             ? sourceProvider.getSource(userInput, | ||||
|                 overrideSource: pickedSourceOverride) | ||||
|             ? sourceProvider.getSource( | ||||
|                 userInput, | ||||
|                 overrideSource: pickedSourceOverride, | ||||
|               ) | ||||
|             : null; | ||||
|         if (pickedSource.runtimeType != source.runtimeType || | ||||
|             overrideChanged || | ||||
| @@ -79,7 +86,8 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|           pickedSource?.runOnAddAppInputChange(userInput); | ||||
|           additionalSettings = source != null | ||||
|               ? getDefaultValuesFromFormItems( | ||||
|                   source.combinedAppSpecificSettingFormItems) | ||||
|                   source.combinedAppSpecificSettingFormItems, | ||||
|                 ) | ||||
|               : {}; | ||||
|           additionalSettingsValid = source != null | ||||
|               ? !sourceProvider.ifRequiredAppSpecificSettingsExist(source) | ||||
| @@ -94,13 +102,15 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|   Widget build(BuildContext context) { | ||||
|     AppsProvider appsProvider = context.read<AppsProvider>(); | ||||
|     SettingsProvider settingsProvider = context.watch<SettingsProvider>(); | ||||
|     NotificationsProvider notificationsProvider = | ||||
|         context.read<NotificationsProvider>(); | ||||
|     NotificationsProvider notificationsProvider = context | ||||
|         .read<NotificationsProvider>(); | ||||
|  | ||||
|     bool doingSomething = gettingAppInfo || searching; | ||||
|  | ||||
|     Future<bool> getTrackOnlyConfirmationIfNeeded(bool userPickedTrackOnly, | ||||
|         {bool ignoreHideSetting = false}) async { | ||||
|     Future<bool> getTrackOnlyConfirmationIfNeeded( | ||||
|       bool userPickedTrackOnly, { | ||||
|       bool ignoreHideSetting = false, | ||||
|     }) async { | ||||
|       var useTrackOnly = userPickedTrackOnly || pickedSource!.enforceTrackOnly; | ||||
|       if (useTrackOnly && | ||||
|           (!settingsProvider.hideTrackOnlyWarning || ignoreHideSetting)) { | ||||
| @@ -110,16 +120,20 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|           builder: (BuildContext ctx) { | ||||
|             return GeneratedFormModal( | ||||
|               initValid: true, | ||||
|                 title: tr('xIsTrackOnly', args: [ | ||||
|                   pickedSource!.enforceTrackOnly ? tr('source') : tr('app') | ||||
|                 ]), | ||||
|               title: tr( | ||||
|                 'xIsTrackOnly', | ||||
|                 args: [ | ||||
|                   pickedSource!.enforceTrackOnly ? tr('source') : tr('app'), | ||||
|                 ], | ||||
|               ), | ||||
|               items: [ | ||||
|                   [GeneratedFormSwitch('hide', label: tr('dontShowAgain'))] | ||||
|                 [GeneratedFormSwitch('hide', label: tr('dontShowAgain'))], | ||||
|               ], | ||||
|               message: | ||||
|                   '${pickedSource!.enforceTrackOnly ? tr('appsFromSourceAreTrackOnly') : tr('youPickedTrackOnly')}\n\n${tr('trackOnlyAppDescription')}', | ||||
|             ); | ||||
|             }); | ||||
|           }, | ||||
|         ); | ||||
|         if (values != null) { | ||||
|           settingsProvider.hideTrackOnlyWarning = values['hide'] == true; | ||||
|         } | ||||
| @@ -130,7 +144,8 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|     } | ||||
|  | ||||
|     getReleaseDateAsVersionConfirmationIfNeeded( | ||||
|         bool userPickedTrackOnly) async { | ||||
|       bool userPickedTrackOnly, | ||||
|     ) async { | ||||
|       return (!(additionalSettings['releaseDateAsVersion'] == true && | ||||
|           // ignore: use_build_context_synchronously | ||||
|           await showDialog( | ||||
| @@ -141,7 +156,8 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                     items: const [], | ||||
|                     message: tr('releaseDateAsVersionExplanation'), | ||||
|                   ); | ||||
|                   }) == | ||||
|                 }, | ||||
|               ) == | ||||
|               null)); | ||||
|     } | ||||
|  | ||||
| @@ -154,27 +170,38 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|         App? app; | ||||
|         if ((await getTrackOnlyConfirmationIfNeeded(userPickedTrackOnly)) && | ||||
|             (await getReleaseDateAsVersionConfirmationIfNeeded( | ||||
|                 userPickedTrackOnly))) { | ||||
|               userPickedTrackOnly, | ||||
|             ))) { | ||||
|           var trackOnly = pickedSource!.enforceTrackOnly || userPickedTrackOnly; | ||||
|           app = await sourceProvider.getApp( | ||||
|               pickedSource!, userInput.trim(), additionalSettings, | ||||
|             pickedSource!, | ||||
|             userInput.trim(), | ||||
|             additionalSettings, | ||||
|             trackOnlyOverride: trackOnly, | ||||
|             sourceIsOverriden: pickedSourceOverride != null, | ||||
|               inferAppIdIfOptional: inferAppIdIfOptional); | ||||
|             inferAppIdIfOptional: inferAppIdIfOptional, | ||||
|           ); | ||||
|           // Only download the APK here if you need to for the package ID | ||||
|           if (isTempId(app) && app.additionalSettings['trackOnly'] != true) { | ||||
|             // ignore: use_build_context_synchronously | ||||
|             var apkUrl = | ||||
|                 await appsProvider.confirmAppFileUrl(app, context, false); | ||||
|             var apkUrl = await appsProvider.confirmAppFileUrl( | ||||
|               app, | ||||
|               context, | ||||
|               false, | ||||
|             ); | ||||
|             if (apkUrl == null) { | ||||
|               throw ObtainiumError(tr('cancelled')); | ||||
|             } | ||||
|             app.preferredApkIndex = | ||||
|                 app.apkUrls.map((e) => e.value).toList().indexOf(apkUrl.value); | ||||
|             app.preferredApkIndex = app.apkUrls | ||||
|                 .map((e) => e.value) | ||||
|                 .toList() | ||||
|                 .indexOf(apkUrl.value); | ||||
|             // ignore: use_build_context_synchronously | ||||
|             var downloadedArtifact = await appsProvider.downloadApp( | ||||
|                 app, globalNavigatorKey.currentContext, | ||||
|                 notificationsProvider: notificationsProvider); | ||||
|               app, | ||||
|               globalNavigatorKey.currentContext, | ||||
|               notificationsProvider: notificationsProvider, | ||||
|             ); | ||||
|             DownloadedApk? downloadedFile; | ||||
|             DownloadedXApkDir? downloadedDir; | ||||
|             if (downloadedArtifact is DownloadedApk) { | ||||
| @@ -195,8 +222,10 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|           await appsProvider.saveApps([app], onlyIfExists: false); | ||||
|         } | ||||
|         if (app != null) { | ||||
|           Navigator.push(globalNavigatorKey.currentContext ?? context, | ||||
|               MaterialPageRoute(builder: (context) => AppPage(appId: app!.id))); | ||||
|           Navigator.push( | ||||
|             globalNavigatorKey.currentContext ?? context, | ||||
|             MaterialPageRoute(builder: (context) => AppPage(appId: app!.id)), | ||||
|           ); | ||||
|         } | ||||
|       } catch (e) { | ||||
|         showError(e, context); | ||||
| @@ -217,15 +246,18 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|             key: Key(urlInputKey.toString()), | ||||
|             items: [ | ||||
|               [ | ||||
|                         GeneratedFormTextField('appSourceURL', | ||||
|                 GeneratedFormTextField( | ||||
|                   'appSourceURL', | ||||
|                   label: tr('appSourceURL'), | ||||
|                   defaultValue: userInput, | ||||
|                   additionalValidators: [ | ||||
|                     (value) { | ||||
|                       try { | ||||
|                         sourceProvider | ||||
|                                       .getSource(value ?? '', | ||||
|                                           overrideSource: pickedSourceOverride) | ||||
|                             .getSource( | ||||
|                               value ?? '', | ||||
|                               overrideSource: pickedSourceOverride, | ||||
|                             ) | ||||
|                             .standardizeUrl(value ?? ''); | ||||
|                       } catch (e) { | ||||
|                         return e is String | ||||
| @@ -235,23 +267,25 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                             : tr('error'); | ||||
|                       } | ||||
|                       return null; | ||||
|                               } | ||||
|                             ]) | ||||
|                       ] | ||||
|                     }, | ||||
|                   ], | ||||
|                 ), | ||||
|               ], | ||||
|             ], | ||||
|             onValueChanges: (values, valid, isBuilding) { | ||||
|                       changeUserInput( | ||||
|                           values['appSourceURL']!, valid, isBuilding); | ||||
|                     })), | ||||
|             const SizedBox( | ||||
|               width: 16, | ||||
|               changeUserInput(values['appSourceURL']!, valid, isBuilding); | ||||
|             }, | ||||
|           ), | ||||
|         ), | ||||
|         const SizedBox(width: 16), | ||||
|         gettingAppInfo | ||||
|             ? const CircularProgressIndicator() | ||||
|             : ElevatedButton( | ||||
|                     onPressed: doingSomething || | ||||
|                 onPressed: | ||||
|                     doingSomething || | ||||
|                         pickedSource == null || | ||||
|                             (pickedSource!.combinedAppSpecificSettingFormItems | ||||
|                         (pickedSource! | ||||
|                                 .combinedAppSpecificSettingFormItems | ||||
|                                 .isNotEmpty && | ||||
|                             !additionalSettingsValid) | ||||
|                     ? null | ||||
| @@ -259,7 +293,8 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                         HapticFeedback.selectionClick(); | ||||
|                         addApp(); | ||||
|                       }, | ||||
|                     child: Text(tr('add'))) | ||||
|                 child: Text(tr('add')), | ||||
|               ), | ||||
|       ], | ||||
|     ); | ||||
|  | ||||
| @@ -272,7 +307,8 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|         sourceStrings[s.name] = [s.name]; | ||||
|       }); | ||||
|       try { | ||||
|         var searchSources = await showDialog<List<String>?>( | ||||
|         var searchSources = | ||||
|             await showDialog<List<String>?>( | ||||
|               context: context, | ||||
|               builder: (BuildContext ctx) { | ||||
|                 return SelectionModal( | ||||
| @@ -283,14 +319,16 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                   titlesAreLinks: false, | ||||
|                   deselectThese: settingsProvider.searchDeselected, | ||||
|                 ); | ||||
|                 }) ?? | ||||
|               }, | ||||
|             ) ?? | ||||
|             []; | ||||
|         if (searchSources.isNotEmpty) { | ||||
|           settingsProvider.searchDeselected = sourceStrings.keys | ||||
|               .where((s) => !searchSources.contains(s)) | ||||
|               .toList(); | ||||
|           List<MapEntry<String, Map<String, List<String>>>?> results = | ||||
|               (await Future.wait(sourceProvider.sources | ||||
|           List<MapEntry<String, Map<String, List<String>>>?> | ||||
|           results = (await Future.wait( | ||||
|             sourceProvider.sources | ||||
|                 .where((e) => searchSources.contains(e.name)) | ||||
|                 .map((e) async { | ||||
|                   try { | ||||
| @@ -304,38 +342,48 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                             items: [ | ||||
|                               ...e.searchQuerySettingFormItems.map((e) => [e]), | ||||
|                               [ | ||||
|                             GeneratedFormTextField('url', | ||||
|                                 GeneratedFormTextField( | ||||
|                                   'url', | ||||
|                                   label: e.hosts.isNotEmpty | ||||
|                                       ? tr('overrideSource') | ||||
|                                       : plural('url', 1).substring(2), | ||||
|                                   autoCompleteOptions: [ | ||||
|                                     ...(e.hosts.isNotEmpty ? [e.hosts[0]] : []), | ||||
|                                     ...appsProvider.apps.values | ||||
|                                       .where((a) => | ||||
|                                         .where( | ||||
|                                           (a) => | ||||
|                                               sourceProvider | ||||
|                                               .getSource(a.app.url, | ||||
|                                                   .getSource( | ||||
|                                                     a.app.url, | ||||
|                                                     overrideSource: | ||||
|                                                       a.app.overrideSource) | ||||
|                                                         a.app.overrideSource, | ||||
|                                                   ) | ||||
|                                                   .runtimeType == | ||||
|                                           e.runtimeType) | ||||
|                                               e.runtimeType, | ||||
|                                         ) | ||||
|                                         .map((a) { | ||||
|                                           var uri = Uri.parse(a.app.url); | ||||
|                                           return '${uri.origin}${uri.path}'; | ||||
|                                   }) | ||||
|                                         }), | ||||
|                                   ], | ||||
|                                 defaultValue: | ||||
|                                     e.hosts.isNotEmpty ? e.hosts[0] : '', | ||||
|                                 required: true) | ||||
|                                   defaultValue: e.hosts.isNotEmpty | ||||
|                                       ? e.hosts[0] | ||||
|                                       : '', | ||||
|                                   required: true, | ||||
|                                 ), | ||||
|                               ], | ||||
|                             ], | ||||
|                           ); | ||||
|                     }); | ||||
|                         }, | ||||
|                       ); | ||||
|                       if (querySettings == null) { | ||||
|                         return null; | ||||
|                       } | ||||
|                     } | ||||
|               return MapEntry(e.runtimeType.toString(), | ||||
|                   await e.search(searchQuery, querySettings: querySettings)); | ||||
|                     return MapEntry( | ||||
|                       e.runtimeType.toString(), | ||||
|                       await e.search(searchQuery, querySettings: querySettings), | ||||
|                     ); | ||||
|                   } catch (err) { | ||||
|                     if (err is! CredsNeededError) { | ||||
|                       rethrow; | ||||
| @@ -345,9 +393,8 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                       return null; | ||||
|                     } | ||||
|                   } | ||||
|           }))) | ||||
|                   .where((a) => a != null) | ||||
|                   .toList(); | ||||
|                 }), | ||||
|           )).where((a) => a != null).toList(); | ||||
|  | ||||
|           // Interleave results instead of simple reduce | ||||
|           Map<String, MapEntry<String, List<String>>> res = {}; | ||||
| @@ -379,11 +426,17 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                       selectedByDefault: false, | ||||
|                       onlyOneSelectionAllowed: true, | ||||
|                     ); | ||||
|                   }); | ||||
|                   }, | ||||
|                 ); | ||||
|           if (selectedUrls != null && selectedUrls.isNotEmpty) { | ||||
|             var sourceName = res[selectedUrls[0]]?.key; | ||||
|             changeUserInput(selectedUrls[0], true, false, | ||||
|                 updateUrlInput: true, overrideSource: sourceName); | ||||
|             changeUserInput( | ||||
|               selectedUrls[0], | ||||
|               true, | ||||
|               false, | ||||
|               updateUrlInput: true, | ||||
|               overrideSource: sourceName, | ||||
|             ); | ||||
|           } | ||||
|         } | ||||
|       } catch (e) { | ||||
| @@ -395,7 +448,8 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     Widget getHTMLSourceOverrideDropdown() => Column(children: [ | ||||
|     Widget getHTMLSourceOverrideDropdown() => Column( | ||||
|       children: [ | ||||
|         Row( | ||||
|           children: [ | ||||
|             Expanded( | ||||
| @@ -408,20 +462,25 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                       [ | ||||
|                         MapEntry('', tr('none')), | ||||
|                         ...sourceProvider.sources | ||||
|                               .where((s) => | ||||
|                             .where( | ||||
|                               (s) => | ||||
|                                   s.allowOverride || | ||||
|                                   (pickedSource != null && | ||||
|                                       pickedSource.runtimeType == | ||||
|                                           s.runtimeType)) | ||||
|                               .map((s) => | ||||
|                                   MapEntry(s.runtimeType.toString(), s.name)) | ||||
|                                           s.runtimeType), | ||||
|                             ) | ||||
|                             .map( | ||||
|                               (s) => MapEntry(s.runtimeType.toString(), s.name), | ||||
|                             ), | ||||
|                       ], | ||||
|                       label: tr('overrideSource'), | ||||
|                     ), | ||||
|                   ], | ||||
|                         label: tr('overrideSource')) | ||||
|                   ] | ||||
|                 ], | ||||
|                 onValueChanges: (values, valid, isBuilding) { | ||||
|                   fn() { | ||||
|                     pickedSourceOverride = (values['overrideSource'] == null || | ||||
|                     pickedSourceOverride = | ||||
|                         (values['overrideSource'] == null || | ||||
|                             values['overrideSource'] == '') | ||||
|                         ? null | ||||
|                         : values['overrideSource']; | ||||
| @@ -436,13 +495,13 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                   } | ||||
|                   changeUserInput(userInput, valid, isBuilding); | ||||
|                 }, | ||||
|               )) | ||||
|               ), | ||||
|             ), | ||||
|           ], | ||||
|         ), | ||||
|           const SizedBox( | ||||
|             height: 16, | ||||
|           ) | ||||
|         ]); | ||||
|         const SizedBox(height: 16), | ||||
|       ], | ||||
|     ); | ||||
|  | ||||
|     bool shouldShowSearchBar() => | ||||
|         sourceProvider.sources.where((e) => e.canSearch).isNotEmpty && | ||||
| @@ -455,9 +514,12 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|           child: GeneratedForm( | ||||
|             items: [ | ||||
|               [ | ||||
|                       GeneratedFormTextField('searchSomeSources', | ||||
|                           label: tr('searchSomeSourcesLabel'), required: false), | ||||
|                     ] | ||||
|                 GeneratedFormTextField( | ||||
|                   'searchSomeSources', | ||||
|                   label: tr('searchSomeSourcesLabel'), | ||||
|                   required: false, | ||||
|                 ), | ||||
|               ], | ||||
|             ], | ||||
|             onValueChanges: (values, valid, isBuilding) { | ||||
|               if (values.isNotEmpty && valid && !isBuilding) { | ||||
| @@ -465,11 +527,10 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                   searchQuery = values['searchSomeSources']!.trim(); | ||||
|                 }); | ||||
|               } | ||||
|                   }), | ||||
|             }, | ||||
|           ), | ||||
|             const SizedBox( | ||||
|               width: 16, | ||||
|         ), | ||||
|         const SizedBox(width: 16), | ||||
|         searching | ||||
|             ? const CircularProgressIndicator() | ||||
|             : ElevatedButton( | ||||
| @@ -478,34 +539,32 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                     : () { | ||||
|                         runSearch(); | ||||
|                       }, | ||||
|                     child: Text(tr('search'))) | ||||
|                 child: Text(tr('search')), | ||||
|               ), | ||||
|       ], | ||||
|     ); | ||||
|  | ||||
|     Widget getAdditionalOptsCol() => Column( | ||||
|       crossAxisAlignment: CrossAxisAlignment.stretch, | ||||
|       children: [ | ||||
|             const SizedBox( | ||||
|               height: 16, | ||||
|             ), | ||||
|         const SizedBox(height: 16), | ||||
|         Text( | ||||
|                 tr('additionalOptsFor', | ||||
|                     args: [pickedSource?.name ?? tr('source')]), | ||||
|           tr('additionalOptsFor', args: [pickedSource?.name ?? tr('source')]), | ||||
|           style: TextStyle( | ||||
|             color: Theme.of(context).colorScheme.primary, | ||||
|                     fontWeight: FontWeight.bold)), | ||||
|             const SizedBox( | ||||
|               height: 16, | ||||
|             fontWeight: FontWeight.bold, | ||||
|           ), | ||||
|         ), | ||||
|         const SizedBox(height: 16), | ||||
|         GeneratedForm( | ||||
|           key: Key( | ||||
|                     '${pickedSource.runtimeType.toString()}-${pickedSource?.hostChanged.toString()}-${pickedSource?.hostIdenticalDespiteAnyChange.toString()}'), | ||||
|             '${pickedSource.runtimeType.toString()}-${pickedSource?.hostChanged.toString()}-${pickedSource?.hostIdenticalDespiteAnyChange.toString()}', | ||||
|           ), | ||||
|           items: [ | ||||
|             ...pickedSource!.combinedAppSpecificSettingFormItems, | ||||
|             ...(pickedSourceOverride != null | ||||
|                       ? pickedSource!.sourceConfigSettingFormItems | ||||
|                           .map((e) => [e]) | ||||
|                       : []) | ||||
|                 ? pickedSource!.sourceConfigSettingFormItems.map((e) => [e]) | ||||
|                 : []), | ||||
|           ], | ||||
|           onValueChanges: (values, valid, isBuilding) { | ||||
|             if (!isBuilding) { | ||||
| @@ -514,17 +573,17 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                 additionalSettingsValid = valid; | ||||
|               }); | ||||
|             } | ||||
|                 }), | ||||
|           }, | ||||
|         ), | ||||
|         Column( | ||||
|           children: [ | ||||
|                 const SizedBox( | ||||
|                   height: 16, | ||||
|                 ), | ||||
|             const SizedBox(height: 16), | ||||
|             CategoryEditorSelector( | ||||
|               alignment: WrapAlignment.start, | ||||
|               onSelected: (categories) { | ||||
|                 pickedCategories = categories; | ||||
|                     }), | ||||
|               }, | ||||
|             ), | ||||
|           ], | ||||
|         ), | ||||
|         if (pickedSource != null && pickedSource!.appIdInferIsOptional) | ||||
| @@ -532,10 +591,12 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|             key: const Key('inferAppIdIfOptional'), | ||||
|             items: [ | ||||
|               [ | ||||
|                       GeneratedFormSwitch('inferAppIdIfOptional', | ||||
|                 GeneratedFormSwitch( | ||||
|                   'inferAppIdIfOptional', | ||||
|                   label: tr('tryInferAppIdFromCode'), | ||||
|                           defaultValue: inferAppIdIfOptional) | ||||
|                     ] | ||||
|                   defaultValue: inferAppIdIfOptional, | ||||
|                 ), | ||||
|               ], | ||||
|             ], | ||||
|             onValueChanges: (values, valid, isBuilding) { | ||||
|               if (!isBuilding) { | ||||
| @@ -543,14 +604,17 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                   inferAppIdIfOptional = values['inferAppIdIfOptional']; | ||||
|                 }); | ||||
|               } | ||||
|                   }), | ||||
|             }, | ||||
|           ), | ||||
|         if (pickedSource != null && pickedSource!.enforceTrackOnly) | ||||
|           GeneratedForm( | ||||
|             key: Key( | ||||
|                       '${pickedSource.runtimeType.toString()}-${pickedSource?.hostChanged.toString()}-${pickedSource?.hostIdenticalDespiteAnyChange.toString()}-appId'), | ||||
|               '${pickedSource.runtimeType.toString()}-${pickedSource?.hostChanged.toString()}-${pickedSource?.hostIdenticalDespiteAnyChange.toString()}-appId', | ||||
|             ), | ||||
|             items: [ | ||||
|               [ | ||||
|                       GeneratedFormTextField('appId', | ||||
|                 GeneratedFormTextField( | ||||
|                   'appId', | ||||
|                   label: '${tr('appId')} - ${tr('custom')}', | ||||
|                   required: false, | ||||
|                   additionalValidators: [ | ||||
| @@ -559,15 +623,16 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                         return null; | ||||
|                       } | ||||
|                       final isValid = RegExp( | ||||
|                                       r'^([A-Za-z]{1}[A-Za-z\d_]*\.)+[A-Za-z][A-Za-z\d_]*$') | ||||
|                                   .hasMatch(value); | ||||
|                         r'^([A-Za-z]{1}[A-Za-z\d_]*\.)+[A-Za-z][A-Za-z\d_]*$', | ||||
|                       ).hasMatch(value); | ||||
|                       if (!isValid) { | ||||
|                         return tr('invalidInput'); | ||||
|                       } | ||||
|                       return null; | ||||
|                             } | ||||
|                           ]), | ||||
|                     ] | ||||
|                     }, | ||||
|                   ], | ||||
|                 ), | ||||
|               ], | ||||
|             ], | ||||
|             onValueChanges: (values, valid, isBuilding) { | ||||
|               if (!isBuilding) { | ||||
| @@ -575,7 +640,8 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                   additionalSettings['appId'] = values['appId']; | ||||
|                 }); | ||||
|               } | ||||
|                   }), | ||||
|             }, | ||||
|           ), | ||||
|       ], | ||||
|     ); | ||||
|  | ||||
| @@ -598,15 +664,14 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                     additionalWidgets: [ | ||||
|                       ...sourceProvider.sources.map( | ||||
|                         (e) => Padding( | ||||
|                                   padding: | ||||
|                                       const EdgeInsets.symmetric(vertical: 4), | ||||
|                           padding: const EdgeInsets.symmetric(vertical: 4), | ||||
|                           child: GestureDetector( | ||||
|                             onTap: e.hosts.isNotEmpty | ||||
|                                 ? () { | ||||
|                                     launchUrlString( | ||||
|                                       'https://${e.hosts[0]}', | ||||
|                                                   mode: LaunchMode | ||||
|                                                       .externalApplication); | ||||
|                                       mode: LaunchMode.externalApplication, | ||||
|                                     ); | ||||
|                                   } | ||||
|                                 : null, | ||||
|                             child: Text( | ||||
| @@ -614,22 +679,19 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                               style: TextStyle( | ||||
|                                 decoration: e.hosts.isNotEmpty | ||||
|                                     ? TextDecoration.underline | ||||
|                                                 : TextDecoration.none), | ||||
|                                       ))), | ||||
|                                     : TextDecoration.none, | ||||
|                               ), | ||||
|                             const SizedBox( | ||||
|                               height: 16, | ||||
|                             ), | ||||
|                           ), | ||||
|                         ), | ||||
|                       ), | ||||
|                       const SizedBox(height: 16), | ||||
|                       Text( | ||||
|                         '${tr('note')}:', | ||||
|                               style: | ||||
|                                   const TextStyle(fontWeight: FontWeight.bold), | ||||
|                         style: const TextStyle(fontWeight: FontWeight.bold), | ||||
|                       ), | ||||
|                             const SizedBox( | ||||
|                               height: 4, | ||||
|                             ), | ||||
|                             Text(tr('selfHostedNote', | ||||
|                                 args: [tr('overrideSource')])), | ||||
|                       const SizedBox(height: 4), | ||||
|                       Text(tr('selfHostedNote', args: [tr('overrideSource')])), | ||||
|                     ], | ||||
|                   ); | ||||
|                 }, | ||||
| @@ -640,19 +702,24 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|               style: const TextStyle( | ||||
|                 fontWeight: FontWeight.bold, | ||||
|                 decoration: TextDecoration.underline, | ||||
|                         fontStyle: FontStyle.italic), | ||||
|                   )), | ||||
|                 fontStyle: FontStyle.italic, | ||||
|               ), | ||||
|             ), | ||||
|           ), | ||||
|           GestureDetector( | ||||
|             onTap: () { | ||||
|                   launchUrlString('https://apps.obtainium.imranr.dev/', | ||||
|                       mode: LaunchMode.externalApplication); | ||||
|               launchUrlString( | ||||
|                 'https://apps.obtainium.imranr.dev/', | ||||
|                 mode: LaunchMode.externalApplication, | ||||
|               ); | ||||
|             }, | ||||
|             child: Text( | ||||
|               tr('crowdsourcedConfigsShort'), | ||||
|               style: const TextStyle( | ||||
|                 fontWeight: FontWeight.bold, | ||||
|                 decoration: TextDecoration.underline, | ||||
|                       fontStyle: FontStyle.italic), | ||||
|                 fontStyle: FontStyle.italic, | ||||
|               ), | ||||
|             ), | ||||
|           ), | ||||
|         ], | ||||
| @@ -661,9 +728,10 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|  | ||||
|     return Scaffold( | ||||
|       backgroundColor: Theme.of(context).colorScheme.surface, | ||||
|         bottomNavigationBar: | ||||
|             pickedSource == null ? getSourcesListWidget() : null, | ||||
|         body: CustomScrollView(shrinkWrap: true, slivers: <Widget>[ | ||||
|       bottomNavigationBar: pickedSource == null ? getSourcesListWidget() : null, | ||||
|       body: CustomScrollView( | ||||
|         shrinkWrap: true, | ||||
|         slivers: <Widget>[ | ||||
|           CustomAppBar(title: tr('addApp')), | ||||
|           SliverToBoxAdapter( | ||||
|             child: Padding( | ||||
| @@ -673,9 +741,7 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                 crossAxisAlignment: CrossAxisAlignment.stretch, | ||||
|                 children: [ | ||||
|                   getUrlInputRow(), | ||||
|                       const SizedBox( | ||||
|                         height: 16, | ||||
|                       ), | ||||
|                   const SizedBox(height: 16), | ||||
|                   if (pickedSource != null) getHTMLSourceOverrideDropdown(), | ||||
|                   if (shouldShowSearchBar()) getSearchBarRow(), | ||||
|                   if (pickedSource != null) | ||||
| @@ -684,15 +750,19 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                         return val.data != null && val.data!.isNotEmpty | ||||
|                             ? Text( | ||||
|                                 val.data!, | ||||
|                                       style: | ||||
|                                           Theme.of(context).textTheme.bodySmall, | ||||
|                                 style: Theme.of(context).textTheme.bodySmall, | ||||
|                               ) | ||||
|                             : const SizedBox(); | ||||
|                       }, | ||||
|                             future: pickedSource?.getSourceNote()), | ||||
|                       future: pickedSource?.getSourceNote(), | ||||
|                     ), | ||||
|                   if (pickedSource != null) getAdditionalOptsCol(), | ||||
|                     ])), | ||||
|           ) | ||||
|         ])); | ||||
|                 ], | ||||
|               ), | ||||
|             ), | ||||
|           ), | ||||
|         ], | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -40,7 +40,9 @@ class _AppPageState extends State<AppPage> { | ||||
|           onWebResourceError: (WebResourceError error) { | ||||
|             if (error.isForMainFrame == true) { | ||||
|               showError( | ||||
|                   ObtainiumError(error.description, unexpected: true), context); | ||||
|                 ObtainiumError(error.description, unexpected: true), | ||||
|                 context, | ||||
|               ); | ||||
|             } | ||||
|           }, | ||||
|           onNavigationRequest: (NavigationRequest request) => | ||||
| @@ -85,8 +87,10 @@ class _AppPageState extends State<AppPage> { | ||||
|     var sourceProvider = SourceProvider(); | ||||
|     AppInMemory? app = appsProvider.apps[widget.appId]?.deepCopy(); | ||||
|     var source = app != null | ||||
|         ? sourceProvider.getSource(app.app.url, | ||||
|             overrideSource: app.app.overrideSource) | ||||
|         ? sourceProvider.getSource( | ||||
|             app.app.url, | ||||
|             overrideSource: app.app.overrideSource, | ||||
|           ) | ||||
|         : null; | ||||
|     if (!areDownloadsRunning && | ||||
|         prevApp == null && | ||||
| @@ -100,9 +104,9 @@ class _AppPageState extends State<AppPage> { | ||||
|     bool isVersionDetectionStandard = | ||||
|         app?.app.additionalSettings['versionDetection'] == true; | ||||
|  | ||||
|     bool installedVersionIsEstimate = trackOnly || | ||||
|         (app?.app.installedVersion != null && | ||||
|             app?.app.additionalSettings['versionDetection'] != true); | ||||
|     bool installedVersionIsEstimate = app?.app != null | ||||
|         ? isVersionPseudo(app!.app) | ||||
|         : false; | ||||
|  | ||||
|     if (app != null && !_wasWebViewOpened) { | ||||
|       _wasWebViewOpened = true; | ||||
| @@ -124,11 +128,14 @@ class _AppPageState extends State<AppPage> { | ||||
|       if (!upToDate) { | ||||
|         versionLines += '\n${app?.app.latestVersion} ${tr('latest')}'; | ||||
|       } | ||||
|       String infoLines = tr('lastUpdateCheckX', args: [ | ||||
|       String infoLines = tr( | ||||
|         'lastUpdateCheckX', | ||||
|         args: [ | ||||
|           app?.app.lastUpdateCheck == null | ||||
|               ? tr('never') | ||||
|             : '${app?.app.lastUpdateCheck?.toLocal()}' | ||||
|       ]); | ||||
|               : '${app?.app.lastUpdateCheck?.toLocal()}', | ||||
|         ], | ||||
|       ); | ||||
|       if (trackOnly) { | ||||
|         infoLines = '${tr('xIsTrackOnly', args: [tr('app')])}\n$infoLines'; | ||||
|       } | ||||
| @@ -148,15 +155,14 @@ class _AppPageState extends State<AppPage> { | ||||
|             padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 24), | ||||
|             child: Column( | ||||
|               children: [ | ||||
|                 const SizedBox( | ||||
|                   height: 8, | ||||
|                 ), | ||||
|                 Text(versionLines, | ||||
|                 const SizedBox(height: 8), | ||||
|                 Text( | ||||
|                   versionLines, | ||||
|                   textAlign: TextAlign.start, | ||||
|                     style: Theme.of(context) | ||||
|                         .textTheme | ||||
|                         .bodyLarge! | ||||
|                         .copyWith(fontWeight: FontWeight.bold)), | ||||
|                   style: Theme.of( | ||||
|                     context, | ||||
|                   ).textTheme.bodyLarge!.copyWith(fontWeight: FontWeight.bold), | ||||
|                 ), | ||||
|                 changeLogFn != null || app?.app.releaseDate != null | ||||
|                     ? GestureDetector( | ||||
|                         onTap: changeLogFn, | ||||
| @@ -165,8 +171,8 @@ class _AppPageState extends State<AppPage> { | ||||
|                               ? tr('changes') | ||||
|                               : app!.app.releaseDate!.toLocal().toString(), | ||||
|                           textAlign: TextAlign.center, | ||||
|                           style: | ||||
|                               Theme.of(context).textTheme.labelSmall!.copyWith( | ||||
|                           style: Theme.of(context).textTheme.labelSmall! | ||||
|                               .copyWith( | ||||
|                                 decoration: changeLogFn != null | ||||
|                                     ? TextDecoration.underline | ||||
|                                     : null, | ||||
| @@ -177,9 +183,7 @@ class _AppPageState extends State<AppPage> { | ||||
|                         ), | ||||
|                       ) | ||||
|                     : const SizedBox.shrink(), | ||||
|                 const SizedBox( | ||||
|                   height: 8, | ||||
|                 ), | ||||
|                 const SizedBox(height: 8), | ||||
|               ], | ||||
|             ), | ||||
|           ), | ||||
| @@ -195,8 +199,9 @@ class _AppPageState extends State<AppPage> { | ||||
|                   ? null | ||||
|                   : () async { | ||||
|                       try { | ||||
|                           await appsProvider | ||||
|                               .downloadAppAssets([app!.app.id], context); | ||||
|                         await appsProvider.downloadAppAssets([ | ||||
|                           app!.app.id, | ||||
|                         ], context); | ||||
|                       } catch (e) { | ||||
|                         showError(e, context); | ||||
|                       } | ||||
| @@ -208,35 +213,34 @@ class _AppPageState extends State<AppPage> { | ||||
|                     decoration: BoxDecoration( | ||||
|                       borderRadius: BorderRadius.circular(12), | ||||
|                       color: settingsProvider.highlightTouchTargets | ||||
|                                 ? (Theme.of(context).brightness == | ||||
|                                             Brightness.light | ||||
|                           ? (Theme.of(context).brightness == Brightness.light | ||||
|                                     ? Theme.of(context).primaryColor | ||||
|                                     : Theme.of(context).primaryColorLight) | ||||
|                                     .withAlpha(Theme.of(context).brightness == | ||||
|                                 .withAlpha( | ||||
|                                   Theme.of(context).brightness == | ||||
|                                           Brightness.light | ||||
|                                       ? 20 | ||||
|                                         : 40) | ||||
|                                 : null), | ||||
|                                       : 40, | ||||
|                                 ) | ||||
|                           : null, | ||||
|                     ), | ||||
|                     padding: settingsProvider.highlightTouchTargets | ||||
|                         ? const EdgeInsetsDirectional.fromSTEB(12, 6, 12, 6) | ||||
|                         : const EdgeInsetsDirectional.fromSTEB(0, 6, 0, 6), | ||||
|                         margin: | ||||
|                             const EdgeInsetsDirectional.fromSTEB(0, 6, 0, 0), | ||||
|                     margin: const EdgeInsetsDirectional.fromSTEB(0, 6, 0, 0), | ||||
|                     child: Text( | ||||
|                           tr('downloadX', | ||||
|                               args: [tr('releaseAsset').toLowerCase()]), | ||||
|                       tr('downloadX', args: [tr('releaseAsset').toLowerCase()]), | ||||
|                       textAlign: TextAlign.center, | ||||
|                           style: | ||||
|                               Theme.of(context).textTheme.labelSmall!.copyWith( | ||||
|                       style: Theme.of(context).textTheme.labelSmall!.copyWith( | ||||
|                         decoration: TextDecoration.underline, | ||||
|                         fontStyle: FontStyle.italic, | ||||
|                       ), | ||||
|                         )) | ||||
|                   ], | ||||
|                 )), | ||||
|           const SizedBox( | ||||
|             height: 48, | ||||
|                     ), | ||||
|                   ), | ||||
|                 ], | ||||
|               ), | ||||
|             ), | ||||
|           const SizedBox(height: 48), | ||||
|           CategoryEditorSelector( | ||||
|             alignment: WrapAlignment.center, | ||||
|             preselected: app?.app.categories != null | ||||
| @@ -247,45 +251,52 @@ class _AppPageState extends State<AppPage> { | ||||
|                 app.app.categories = categories; | ||||
|                 appsProvider.saveApps([app.app]); | ||||
|               } | ||||
|               }), | ||||
|             }, | ||||
|           ), | ||||
|           if (app?.app.additionalSettings['about'] is String && | ||||
|               app?.app.additionalSettings['about'].isNotEmpty) | ||||
|             Column( | ||||
|               mainAxisSize: MainAxisSize.min, | ||||
|               children: [ | ||||
|                 const SizedBox( | ||||
|                   height: 48, | ||||
|                 ), | ||||
|                 const SizedBox(height: 48), | ||||
|                 GestureDetector( | ||||
|                   onLongPress: () { | ||||
|                       Clipboard.setData(ClipboardData( | ||||
|                           text: app?.app.additionalSettings['about'] ?? '')); | ||||
|                       ScaffoldMessenger.of(context).showSnackBar(SnackBar( | ||||
|                         content: Text(tr('copiedToClipboard')), | ||||
|                       )); | ||||
|                     Clipboard.setData( | ||||
|                       ClipboardData( | ||||
|                         text: app?.app.additionalSettings['about'] ?? '', | ||||
|                       ), | ||||
|                     ); | ||||
|                     ScaffoldMessenger.of(context).showSnackBar( | ||||
|                       SnackBar(content: Text(tr('copiedToClipboard'))), | ||||
|                     ); | ||||
|                   }, | ||||
|                   child: Markdown( | ||||
|                     physics: NeverScrollableScrollPhysics(), | ||||
|                     shrinkWrap: true, | ||||
|                     styleSheet: MarkdownStyleSheet( | ||||
|                           blockquoteDecoration: | ||||
|                               BoxDecoration(color: Theme.of(context).cardColor), | ||||
|                           textAlign: WrapAlignment.center), | ||||
|                       blockquoteDecoration: BoxDecoration( | ||||
|                         color: Theme.of(context).cardColor, | ||||
|                       ), | ||||
|                       textAlign: WrapAlignment.center, | ||||
|                     ), | ||||
|                     data: app?.app.additionalSettings['about'], | ||||
|                     onTapLink: (text, href, title) { | ||||
|                       if (href != null) { | ||||
|                           launchUrlString(href, | ||||
|                               mode: LaunchMode.externalApplication); | ||||
|                         launchUrlString( | ||||
|                           href, | ||||
|                           mode: LaunchMode.externalApplication, | ||||
|                         ); | ||||
|                       } | ||||
|                     }, | ||||
|                     extensionSet: md.ExtensionSet( | ||||
|                       md.ExtensionSet.gitHubFlavored.blockSyntaxes, | ||||
|                       [ | ||||
|                         md.EmojiSyntax(), | ||||
|                           ...md.ExtensionSet.gitHubFlavored.inlineSyntaxes | ||||
|                         ...md.ExtensionSet.gitHubFlavored.inlineSyntaxes, | ||||
|                       ], | ||||
|                     ), | ||||
|                     )) | ||||
|                   ), | ||||
|                 ), | ||||
|               ], | ||||
|             ), | ||||
|         ], | ||||
| @@ -298,8 +309,7 @@ class _AppPageState extends State<AppPage> { | ||||
|       children: [ | ||||
|         SizedBox(height: small ? 5 : 20), | ||||
|         FutureBuilder( | ||||
|                 future: | ||||
|                     appsProvider.updateAppIcon(app?.app.id, ignoreCache: true), | ||||
|           future: appsProvider.updateAppIcon(app?.app.id, ignoreCache: true), | ||||
|           builder: (ctx, val) { | ||||
|             return app?.icon != null | ||||
|                 ? Row( | ||||
| @@ -314,13 +324,13 @@ class _AppPageState extends State<AppPage> { | ||||
|                           height: small ? 70 : 150, | ||||
|                           gaplessPlayback: true, | ||||
|                         ), | ||||
|                               ) | ||||
|                             ]) | ||||
|                       : Container(); | ||||
|                 }), | ||||
|             SizedBox( | ||||
|               height: small ? 10 : 25, | ||||
|                       ), | ||||
|                     ], | ||||
|                   ) | ||||
|                 : Container(); | ||||
|           }, | ||||
|         ), | ||||
|         SizedBox(height: small ? 10 : 25), | ||||
|         Text( | ||||
|           app?.name ?? tr('app'), | ||||
|           textAlign: TextAlign.center, | ||||
| @@ -328,41 +338,45 @@ class _AppPageState extends State<AppPage> { | ||||
|               ? Theme.of(context).textTheme.displaySmall | ||||
|               : Theme.of(context).textTheme.displayLarge, | ||||
|         ), | ||||
|             Text(tr('byX', args: [app?.author ?? tr('unknown')]), | ||||
|         Text( | ||||
|           tr('byX', args: [app?.author ?? tr('unknown')]), | ||||
|           textAlign: TextAlign.center, | ||||
|           style: small | ||||
|               ? Theme.of(context).textTheme.headlineSmall | ||||
|                     : Theme.of(context).textTheme.headlineMedium), | ||||
|             const SizedBox( | ||||
|               height: 24, | ||||
|               : Theme.of(context).textTheme.headlineMedium, | ||||
|         ), | ||||
|         const SizedBox(height: 24), | ||||
|         GestureDetector( | ||||
|           onTap: () { | ||||
|             if (app?.app.url != null) { | ||||
|                     launchUrlString(app?.app.url ?? '', | ||||
|                         mode: LaunchMode.externalApplication); | ||||
|               launchUrlString( | ||||
|                 app?.app.url ?? '', | ||||
|                 mode: LaunchMode.externalApplication, | ||||
|               ); | ||||
|             } | ||||
|           }, | ||||
|           onLongPress: () { | ||||
|             Clipboard.setData(ClipboardData(text: app?.app.url ?? '')); | ||||
|                   ScaffoldMessenger.of(context).showSnackBar(SnackBar( | ||||
|                     content: Text(tr('copiedToClipboard')), | ||||
|                   )); | ||||
|             ScaffoldMessenger.of( | ||||
|               context, | ||||
|             ).showSnackBar(SnackBar(content: Text(tr('copiedToClipboard')))); | ||||
|           }, | ||||
|           child: Text( | ||||
|             app?.app.url ?? '', | ||||
|             textAlign: TextAlign.center, | ||||
|             style: Theme.of(context).textTheme.labelSmall!.copyWith( | ||||
|               decoration: TextDecoration.underline, | ||||
|                       fontStyle: FontStyle.italic), | ||||
|                 )), | ||||
|               fontStyle: FontStyle.italic, | ||||
|             ), | ||||
|           ), | ||||
|         ), | ||||
|         Text( | ||||
|           app?.app.id ?? '', | ||||
|           textAlign: TextAlign.center, | ||||
|           style: Theme.of(context).textTheme.labelSmall, | ||||
|         ), | ||||
|         getInfoColumn(), | ||||
|             const SizedBox(height: 150) | ||||
|         const SizedBox(height: 150), | ||||
|       ], | ||||
|     ); | ||||
|  | ||||
| @@ -370,7 +384,8 @@ class _AppPageState extends State<AppPage> { | ||||
|         ? WebViewWidget( | ||||
|             key: ObjectKey(_webViewController), | ||||
|             controller: _webViewController | ||||
|               ..setBackgroundColor(Theme.of(context).colorScheme.surface)) | ||||
|               ..setBackgroundColor(Theme.of(context).colorScheme.surface), | ||||
|           ) | ||||
|         : Container(); | ||||
|  | ||||
|     showMarkUpdatedDialog() { | ||||
| @@ -384,7 +399,8 @@ class _AppPageState extends State<AppPage> { | ||||
|                 onPressed: () { | ||||
|                   Navigator.of(context).pop(); | ||||
|                 }, | ||||
|                     child: Text(tr('no'))), | ||||
|                 child: Text(tr('no')), | ||||
|               ), | ||||
|               TextButton( | ||||
|                 onPressed: () { | ||||
|                   HapticFeedback.selectionClick(); | ||||
| @@ -395,18 +411,21 @@ class _AppPageState extends State<AppPage> { | ||||
|                   } | ||||
|                   Navigator.of(context).pop(); | ||||
|                 }, | ||||
|                     child: Text(tr('yesMarkUpdated'))) | ||||
|                 child: Text(tr('yesMarkUpdated')), | ||||
|               ), | ||||
|             ], | ||||
|           ); | ||||
|           }); | ||||
|         }, | ||||
|       ); | ||||
|     } | ||||
|  | ||||
|     showAdditionalOptionsDialog() async { | ||||
|       return await showDialog<Map<String, dynamic>?>( | ||||
|         context: context, | ||||
|         builder: (BuildContext ctx) { | ||||
|             var items = | ||||
|                 (source?.combinedAppSpecificSettingFormItems ?? []).map((row) { | ||||
|           var items = (source?.combinedAppSpecificSettingFormItems ?? []).map(( | ||||
|             row, | ||||
|           ) { | ||||
|             row = row.map((e) { | ||||
|               if (app?.app.additionalSettings[e.key] != null) { | ||||
|                 e.defaultValue = app?.app.additionalSettings[e.key]; | ||||
| @@ -417,8 +436,11 @@ class _AppPageState extends State<AppPage> { | ||||
|           }).toList(); | ||||
|  | ||||
|           return GeneratedFormModal( | ||||
|                 title: tr('additionalOptions'), items: items); | ||||
|           }); | ||||
|             title: tr('additionalOptions'), | ||||
|             items: items, | ||||
|           ); | ||||
|         }, | ||||
|       ); | ||||
|     } | ||||
|  | ||||
|     handleAdditionalOptionChanges(Map<String, dynamic>? values) { | ||||
| @@ -442,8 +464,8 @@ class _AppPageState extends State<AppPage> { | ||||
|         if (releaseDateVersionEnabled) { | ||||
|           if (app.app.releaseDate != null) { | ||||
|             bool isUpdated = app.app.installedVersion == app.app.latestVersion; | ||||
|             app.app.latestVersion = | ||||
|                 app.app.releaseDate!.microsecondsSinceEpoch.toString(); | ||||
|             app.app.latestVersion = app.app.releaseDate!.microsecondsSinceEpoch | ||||
|                 .toString(); | ||||
|             if (isUpdated) { | ||||
|               app.app.installedVersion = app.app.latestVersion; | ||||
|             } | ||||
| @@ -463,7 +485,8 @@ class _AppPageState extends State<AppPage> { | ||||
|     } | ||||
|  | ||||
|     getInstallOrUpdateButton() => TextButton( | ||||
|         onPressed: !updating && | ||||
|       onPressed: | ||||
|           !updating && | ||||
|               (app?.app.installedVersion == null || | ||||
|                   app?.app.installedVersion != app?.app.latestVersion) && | ||||
|               !areDownloadsRunning | ||||
| @@ -490,17 +513,24 @@ class _AppPageState extends State<AppPage> { | ||||
|               } | ||||
|             } | ||||
|           : null, | ||||
|         child: Text(app?.app.installedVersion == null | ||||
|       child: Text( | ||||
|         app?.app.installedVersion == null | ||||
|             ? !trackOnly | ||||
|                   ? tr('install') | ||||
|                   : tr('markInstalled') | ||||
|             : !trackOnly | ||||
|             ? tr('update') | ||||
|                 : tr('markUpdated'))); | ||||
|             : tr('markUpdated'), | ||||
|       ), | ||||
|     ); | ||||
|  | ||||
|     getBottomSheetMenu() => Padding( | ||||
|         padding: | ||||
|             EdgeInsets.fromLTRB(0, 0, 0, MediaQuery.of(context).padding.bottom), | ||||
|       padding: EdgeInsets.fromLTRB( | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
|         MediaQuery.of(context).padding.bottom, | ||||
|       ), | ||||
|       child: Column( | ||||
|         mainAxisSize: MainAxisSize.min, | ||||
|         children: [ | ||||
| @@ -515,12 +545,12 @@ class _AppPageState extends State<AppPage> { | ||||
|                     onPressed: app?.downloadProgress != null || updating | ||||
|                         ? null | ||||
|                         : () async { | ||||
|                                     var values = | ||||
|                                         await showAdditionalOptionsDialog(); | ||||
|                             var values = await showAdditionalOptionsDialog(); | ||||
|                             handleAdditionalOptionChanges(values); | ||||
|                           }, | ||||
|                     tooltip: tr('additionalOptions'), | ||||
|                             icon: const Icon(Icons.edit)), | ||||
|                     icon: const Icon(Icons.edit), | ||||
|                   ), | ||||
|                 if (app != null && app.installedInfo != null) | ||||
|                   IconButton( | ||||
|                     onPressed: () { | ||||
| @@ -544,13 +574,16 @@ class _AppPageState extends State<AppPage> { | ||||
|                                 onPressed: () { | ||||
|                                   Navigator.of(context).pop(); | ||||
|                                 }, | ||||
|                                             child: Text(tr('continue'))) | ||||
|                                 child: Text(tr('continue')), | ||||
|                               ), | ||||
|                             ], | ||||
|                           ); | ||||
|                                   }); | ||||
|                         }, | ||||
|                       ); | ||||
|                     }, | ||||
|                     icon: const Icon(Icons.more_horiz), | ||||
|                             tooltip: tr('more')), | ||||
|                     tooltip: tr('more'), | ||||
|                   ), | ||||
|                 if (app?.app.installedVersion != null && | ||||
|                     app?.app.installedVersion != app?.app.latestVersion && | ||||
|                     !isVersionDetectionStandard && | ||||
| @@ -560,7 +593,8 @@ class _AppPageState extends State<AppPage> { | ||||
|                         ? null | ||||
|                         : showMarkUpdatedDialog, | ||||
|                     tooltip: tr('markUpdated'), | ||||
|                             icon: const Icon(Icons.done)), | ||||
|                     icon: const Icon(Icons.done), | ||||
|                   ), | ||||
|                 if ((!isVersionDetectionStandard || trackOnly) && | ||||
|                     app?.app.installedVersion != null && | ||||
|                     app?.app.installedVersion == app?.app.latestVersion) | ||||
| @@ -572,7 +606,8 @@ class _AppPageState extends State<AppPage> { | ||||
|                             appsProvider.saveApps([app.app]); | ||||
|                           }, | ||||
|                     icon: const Icon(Icons.restore_rounded), | ||||
|                             tooltip: tr('resetInstallStatus')), | ||||
|                     tooltip: tr('resetInstallStatus'), | ||||
|                   ), | ||||
|                 const SizedBox(width: 16.0), | ||||
|                 Expanded(child: getInstallOrUpdateButton()), | ||||
|                 const SizedBox(width: 16.0), | ||||
| @@ -582,7 +617,9 @@ class _AppPageState extends State<AppPage> { | ||||
|                       : () { | ||||
|                           appsProvider | ||||
|                               .removeAppsWithModal( | ||||
|                                         context, app != null ? [app.app] : []) | ||||
|                                 context, | ||||
|                                 app != null ? [app.app] : [], | ||||
|                               ) | ||||
|                               .then((value) { | ||||
|                                 if (value == true) { | ||||
|                                   Navigator.of(context).pop(); | ||||
| @@ -592,16 +629,21 @@ class _AppPageState extends State<AppPage> { | ||||
|                   tooltip: tr('remove'), | ||||
|                   icon: const Icon(Icons.delete_outline), | ||||
|                 ), | ||||
|                     ])), | ||||
|               ], | ||||
|             ), | ||||
|           ), | ||||
|           if (app?.downloadProgress != null) | ||||
|             Padding( | ||||
|               padding: const EdgeInsets.fromLTRB(0, 8, 0, 0), | ||||
|               child: LinearProgressIndicator( | ||||
|                 value: app!.downloadProgress! >= 0 | ||||
|                     ? app.downloadProgress! / 100 | ||||
|                           : null)) | ||||
|                     : null, | ||||
|               ), | ||||
|             ), | ||||
|         ], | ||||
|         )); | ||||
|       ), | ||||
|     ); | ||||
|  | ||||
|     appScreenAppBar() => AppBar( | ||||
|       leading: IconButton( | ||||
| @@ -621,14 +663,17 @@ class _AppPageState extends State<AppPage> { | ||||
|             : CustomScrollView( | ||||
|                 slivers: [ | ||||
|                   SliverToBoxAdapter( | ||||
|                           child: Column(children: [getFullInfoColumn()])), | ||||
|                     child: Column(children: [getFullInfoColumn()]), | ||||
|                   ), | ||||
|                 ], | ||||
|               ), | ||||
|         onRefresh: () async { | ||||
|           if (app != null) { | ||||
|             getUpdate(app.app.id); | ||||
|           } | ||||
|             }), | ||||
|         bottomSheet: getBottomSheetMenu()); | ||||
|         }, | ||||
|       ), | ||||
|       bottomSheet: getBottomSheetMenu(), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -43,13 +43,22 @@ class _HomePageState extends State<HomePage> { | ||||
|   bool isLinkActivity = false; | ||||
|  | ||||
|   List<NavigationPageItem> pages = [ | ||||
|     NavigationPageItem(tr('appsString'), Icons.apps, | ||||
|         AppsPage(key: GlobalKey<AppsPageState>())), | ||||
|     NavigationPageItem( | ||||
|         tr('addApp'), Icons.add, AddAppPage(key: GlobalKey<AddAppPageState>())), | ||||
|       tr('appsString'), | ||||
|       Icons.apps, | ||||
|       AppsPage(key: GlobalKey<AppsPageState>()), | ||||
|     ), | ||||
|     NavigationPageItem( | ||||
|         tr('importExport'), Icons.import_export, const ImportExportPage()), | ||||
|     NavigationPageItem(tr('settings'), Icons.settings, const SettingsPage()) | ||||
|       tr('addApp'), | ||||
|       Icons.add, | ||||
|       AddAppPage(key: GlobalKey<AddAppPageState>()), | ||||
|     ), | ||||
|     NavigationPageItem( | ||||
|       tr('importExport'), | ||||
|       Icons.import_export, | ||||
|       const ImportExportPage(), | ||||
|     ), | ||||
|     NavigationPageItem(tr('settings'), Icons.settings, const SettingsPage()), | ||||
|   ]; | ||||
|  | ||||
|   @override | ||||
| @@ -73,14 +82,17 @@ class _HomePageState extends State<HomePage> { | ||||
|                     onTap: () { | ||||
|                       launchUrlString( | ||||
|                         'https://github.com/ImranR98/Obtainium/blob/main/README.md', | ||||
|                               mode: LaunchMode.externalApplication); | ||||
|                         mode: LaunchMode.externalApplication, | ||||
|                       ); | ||||
|                     }, | ||||
|                     child: Text( | ||||
|                       'https://github.com/ImranR98/Obtainium/blob/main/README.md', | ||||
|                       style: const TextStyle( | ||||
|                         decoration: TextDecoration.underline, | ||||
|                               fontWeight: FontWeight.bold), | ||||
|                         )), | ||||
|                         fontWeight: FontWeight.bold, | ||||
|                       ), | ||||
|                     ), | ||||
|                   ), | ||||
|                   Column( | ||||
|                     crossAxisAlignment: CrossAxisAlignment.start, | ||||
|                     children: [ | ||||
| @@ -100,11 +112,12 @@ class _HomePageState extends State<HomePage> { | ||||
|                           tr('settings'), | ||||
|                           style: const TextStyle( | ||||
|                             decoration: TextDecoration.underline, | ||||
|                                 fontWeight: FontWeight.bold), | ||||
|                             fontWeight: FontWeight.bold, | ||||
|                           ), | ||||
|                         ), | ||||
|                       ), | ||||
|                         ) | ||||
|                     ], | ||||
|                     ) | ||||
|                   ), | ||||
|                 ], | ||||
|               ), | ||||
|               actions: [ | ||||
| @@ -113,10 +126,12 @@ class _HomePageState extends State<HomePage> { | ||||
|                     sp.welcomeShown = true; | ||||
|                     Navigator.of(context).pop(null); | ||||
|                   }, | ||||
|                       child: Text(tr('ok'))), | ||||
|                   child: Text(tr('ok')), | ||||
|                 ), | ||||
|               ], | ||||
|             ); | ||||
|             }); | ||||
|           }, | ||||
|         ); | ||||
|       } | ||||
|     }); | ||||
|   } | ||||
| @@ -126,13 +141,12 @@ class _HomePageState extends State<HomePage> { | ||||
|  | ||||
|     goToAddApp(String data) async { | ||||
|       switchToPage(1); | ||||
|       while ( | ||||
|           (pages[1].widget.key as GlobalKey<AddAppPageState>?)?.currentState == | ||||
|       while ((pages[1].widget.key as GlobalKey<AddAppPageState>?) | ||||
|               ?.currentState == | ||||
|           null) { | ||||
|         await Future.delayed(const Duration(microseconds: 1)); | ||||
|       } | ||||
|       (pages[1].widget.key as GlobalKey<AddAppPageState>?) | ||||
|           ?.currentState | ||||
|       (pages[1].widget.key as GlobalKey<AddAppPageState>?)?.currentState | ||||
|           ?.linkFn(data); | ||||
|     } | ||||
|  | ||||
| @@ -149,9 +163,13 @@ class _HomePageState extends State<HomePage> { | ||||
|                 context: context, | ||||
|                 builder: (BuildContext ctx) { | ||||
|                   return GeneratedFormModal( | ||||
|                       title: tr('importX', args: [ | ||||
|                         action == 'app' ? tr('app') : tr('appsString') | ||||
|                       ]), | ||||
|                     title: tr( | ||||
|                       'importX', | ||||
|                       args: [ | ||||
|                         (action == 'app' ? tr('app') : tr('appsString')) | ||||
|                             .toLowerCase(), | ||||
|                       ], | ||||
|                     ), | ||||
|                     items: const [], | ||||
|                     additionalWidgets: [ | ||||
|                       ExpansionTile( | ||||
| @@ -160,22 +178,29 @@ class _HomePageState extends State<HomePage> { | ||||
|                           Text( | ||||
|                             dataStr, | ||||
|                             style: const TextStyle(fontFamily: 'monospace'), | ||||
|                             ) | ||||
|                           ), | ||||
|                         ], | ||||
|                         ) | ||||
|                       ), | ||||
|                     ], | ||||
|                   ); | ||||
|                   }) != | ||||
|                 }, | ||||
|               ) != | ||||
|               null) { | ||||
|             // ignore: use_build_context_synchronously | ||||
|             var appsProvider = context.read<AppsProvider>(); | ||||
|             var result = await appsProvider.import(action == 'app' | ||||
|             var result = await appsProvider.import( | ||||
|               action == 'app' | ||||
|                   ? '{ "apps": [$dataStr] }' | ||||
|                 : '{ "apps": $dataStr }'); | ||||
|                   : '{ "apps": $dataStr }', | ||||
|             ); | ||||
|             // ignore: use_build_context_synchronously | ||||
|             showMessage( | ||||
|                 tr('importedX', args: [plural('apps', result.key.length)]), | ||||
|                 context); | ||||
|               tr( | ||||
|                 'importedX', | ||||
|                 args: [plural('apps', result.key.length).toLowerCase()], | ||||
|               ), | ||||
|               context, | ||||
|             ); | ||||
|             await appsProvider | ||||
|                 .checkUpdates(specificIds: result.key.map((e) => e.id).toList()) | ||||
|                 .catchError((e) { | ||||
| @@ -210,15 +235,16 @@ class _HomePageState extends State<HomePage> { | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   setIsReversing(int targetIndex) { | ||||
|     bool reversing = selectedIndexHistory.isNotEmpty && | ||||
|   void setIsReversing(int targetIndex) { | ||||
|     bool reversing = | ||||
|         selectedIndexHistory.isNotEmpty && | ||||
|         selectedIndexHistory.last > targetIndex; | ||||
|     setState(() { | ||||
|       isReversing = reversing; | ||||
|     }); | ||||
|   } | ||||
|  | ||||
|   switchToPage(int index) async { | ||||
|   Future<void> switchToPage(int index) async { | ||||
|     setIsReversing(index); | ||||
|     if (index == 0) { | ||||
|       while ((pages[0].widget.key as GlobalKey<AppsPageState>).currentState != | ||||
| @@ -263,12 +289,13 @@ class _HomePageState extends State<HomePage> { | ||||
|         backgroundColor: Theme.of(context).colorScheme.surface, | ||||
|         body: PageTransitionSwitcher( | ||||
|           duration: Duration( | ||||
|                 milliseconds: | ||||
|                     settingsProvider.disablePageTransitions ? 0 : 300), | ||||
|             milliseconds: settingsProvider.disablePageTransitions ? 0 : 300, | ||||
|           ), | ||||
|           reverse: settingsProvider.reversePageTransitions | ||||
|               ? !isReversing | ||||
|               : isReversing, | ||||
|             transitionBuilder: ( | ||||
|           transitionBuilder: | ||||
|               ( | ||||
|                 Widget child, | ||||
|                 Animation<double> animation, | ||||
|                 Animation<double> secondaryAnimation, | ||||
| @@ -281,22 +308,25 @@ class _HomePageState extends State<HomePage> { | ||||
|                 ); | ||||
|               }, | ||||
|           child: pages | ||||
|                 .elementAt(selectedIndexHistory.isEmpty | ||||
|                     ? 0 | ||||
|                     : selectedIndexHistory.last) | ||||
|               .elementAt( | ||||
|                 selectedIndexHistory.isEmpty ? 0 : selectedIndexHistory.last, | ||||
|               ) | ||||
|               .widget, | ||||
|         ), | ||||
|         bottomNavigationBar: NavigationBar( | ||||
|           destinations: pages | ||||
|                 .map((e) => | ||||
|                     NavigationDestination(icon: Icon(e.icon), label: e.title)) | ||||
|               .map( | ||||
|                 (e) => | ||||
|                     NavigationDestination(icon: Icon(e.icon), label: e.title), | ||||
|               ) | ||||
|               .toList(), | ||||
|           onDestinationSelected: (int index) async { | ||||
|             HapticFeedback.selectionClick(); | ||||
|             switchToPage(index); | ||||
|           }, | ||||
|             selectedIndex: | ||||
|                 selectedIndexHistory.isEmpty ? 0 : selectedIndexHistory.last, | ||||
|           selectedIndex: selectedIndexHistory.isEmpty | ||||
|               ? 0 | ||||
|               : selectedIndexHistory.last, | ||||
|         ), | ||||
|       ), | ||||
|       onWillPop: () async { | ||||
| @@ -305,19 +335,21 @@ class _HomePageState extends State<HomePage> { | ||||
|             selectedIndexHistory.last == 1) { | ||||
|           return true; | ||||
|         } | ||||
|           setIsReversing(selectedIndexHistory.length >= 2 | ||||
|         setIsReversing( | ||||
|           selectedIndexHistory.length >= 2 | ||||
|               ? selectedIndexHistory.reversed.toList()[1] | ||||
|               : 0); | ||||
|               : 0, | ||||
|         ); | ||||
|         if (selectedIndexHistory.isNotEmpty) { | ||||
|           setState(() { | ||||
|             selectedIndexHistory.removeLast(); | ||||
|           }); | ||||
|           return false; | ||||
|         } | ||||
|           return !(pages[0].widget.key as GlobalKey<AppsPageState>) | ||||
|               .currentState | ||||
|               ?.clearSelected(); | ||||
|         }); | ||||
|         return !(pages[0].widget.key as GlobalKey<AppsPageState>).currentState! | ||||
|             .clearSelected(); | ||||
|       }, | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   | ||||
| @@ -52,7 +52,8 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|             title: tr('importFromURLList'), | ||||
|             items: [ | ||||
|               [ | ||||
|                   GeneratedFormTextField('appURLList', | ||||
|                 GeneratedFormTextField( | ||||
|                   'appURLList', | ||||
|                   defaultValue: initValue ?? '', | ||||
|                   label: tr('appURLList'), | ||||
|                   max: 7, | ||||
| @@ -69,32 +70,46 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|                         } | ||||
|                       } | ||||
|                       return null; | ||||
|                         } | ||||
|                       ]) | ||||
|                 ] | ||||
|                     }, | ||||
|                   ], | ||||
|                 ), | ||||
|               ], | ||||
|             ], | ||||
|           ); | ||||
|           }).then((values) { | ||||
|         }, | ||||
|       ).then((values) { | ||||
|         if (values != null) { | ||||
|           var urls = (values['appURLList'] as String).split('\n'); | ||||
|           setState(() { | ||||
|             importInProgress = true; | ||||
|           }); | ||||
|           appsProvider.addAppsByURL(urls).then((errors) { | ||||
|           appsProvider | ||||
|               .addAppsByURL(urls) | ||||
|               .then((errors) { | ||||
|                 if (errors.isEmpty) { | ||||
|               showMessage(tr('importedX', args: [plural('apps', urls.length)]), | ||||
|                   context); | ||||
|                   showMessage( | ||||
|                     tr( | ||||
|                       'importedX', | ||||
|                       args: [plural('apps', urls.length).toLowerCase()], | ||||
|                     ), | ||||
|                     context, | ||||
|                   ); | ||||
|                 } else { | ||||
|                   showDialog( | ||||
|                     context: context, | ||||
|                     builder: (BuildContext ctx) { | ||||
|                       return ImportErrorDialog( | ||||
|                         urlsLength: urls.length, errors: errors); | ||||
|                   }); | ||||
|                         urlsLength: urls.length, | ||||
|                         errors: errors, | ||||
|                       ); | ||||
|                     }, | ||||
|                   ); | ||||
|                 } | ||||
|           }).catchError((e) { | ||||
|               }) | ||||
|               .catchError((e) { | ||||
|                 showError(e, context); | ||||
|           }).whenComplete(() { | ||||
|               }) | ||||
|               .whenComplete(() { | ||||
|                 setState(() { | ||||
|                   importInProgress = false; | ||||
|                 }); | ||||
| @@ -109,19 +124,23 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|           .export( | ||||
|             pickOnly: | ||||
|                 pickOnly || (await settingsProvider.getExportDir()) == null, | ||||
|               sp: settingsProvider) | ||||
|             sp: settingsProvider, | ||||
|           ) | ||||
|           .then((String? result) { | ||||
|             if (result != null) { | ||||
|               showMessage(tr('exportedTo', args: [result]), context); | ||||
|             } | ||||
|       }).catchError((e) { | ||||
|           }) | ||||
|           .catchError((e) { | ||||
|             showError(e, context); | ||||
|           }); | ||||
|     } | ||||
|  | ||||
|     runObtainiumImport() { | ||||
|       HapticFeedback.selectionClick(); | ||||
|       FilePicker.platform.pickFiles().then((result) { | ||||
|       FilePicker.platform | ||||
|           .pickFiles() | ||||
|           .then((result) { | ||||
|             setState(() { | ||||
|               importInProgress = true; | ||||
|             }); | ||||
| @@ -143,17 +162,18 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|                 }); | ||||
|                 appsProvider.addMissingCategories(settingsProvider); | ||||
|                 showMessage( | ||||
|                 '${tr('importedX', args: [ | ||||
|                       plural('apps', value.key.length) | ||||
|                     ])}${value.value ? ' + ${tr('settings')}' : ''}', | ||||
|                 context); | ||||
|                   '${tr('importedX', args: [plural('apps', value.key.length).toLowerCase()])}${value.value ? ' + ${tr('settings').toLowerCase()}' : ''}', | ||||
|                   context, | ||||
|                 ); | ||||
|               }); | ||||
|             } else { | ||||
|               // User canceled the picker | ||||
|             } | ||||
|       }).catchError((e) { | ||||
|           }) | ||||
|           .catchError((e) { | ||||
|             showError(e, context); | ||||
|       }).whenComplete(() { | ||||
|           }) | ||||
|           .whenComplete(() { | ||||
|             setState(() { | ||||
|               importInProgress = false; | ||||
|             }); | ||||
| @@ -166,8 +186,7 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|           urlListImport( | ||||
|             overrideInitValid: true, | ||||
|             initValue: RegExp('https?://[^"]+') | ||||
|                   .allMatches( | ||||
|                       File(result.files.single.path!).readAsStringSync()) | ||||
|                 .allMatches(File(result.files.single.path!).readAsStringSync()) | ||||
|                 .map((e) => e.input.substring(e.start, e.end)) | ||||
|                 .toSet() | ||||
|                 .toList() | ||||
| @@ -178,7 +197,9 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|                   } catch (e) { | ||||
|                     return false; | ||||
|                   } | ||||
|               }).join('\n')); | ||||
|                 }) | ||||
|                 .join('\n'), | ||||
|           ); | ||||
|         } | ||||
|       }); | ||||
|     } | ||||
| @@ -192,33 +213,43 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|                   title: tr('searchX', args: [source.name]), | ||||
|                   items: [ | ||||
|                     [ | ||||
|                     GeneratedFormTextField('searchQuery', | ||||
|                       GeneratedFormTextField( | ||||
|                         'searchQuery', | ||||
|                         label: tr('searchQuery'), | ||||
|                         required: source.name != FDroidRepo().name) | ||||
|                         required: source.name != FDroidRepo().name, | ||||
|                       ), | ||||
|                     ], | ||||
|                     ...source.searchQuerySettingFormItems.map((e) => [e]), | ||||
|                     [ | ||||
|                     GeneratedFormTextField('url', | ||||
|                       GeneratedFormTextField( | ||||
|                         'url', | ||||
|                         label: source.hosts.isNotEmpty | ||||
|                             ? tr('overrideSource') | ||||
|                             : plural('url', 1).substring(2), | ||||
|                         defaultValue: | ||||
|                             source.hosts.isNotEmpty ? source.hosts[0] : '', | ||||
|                         required: true) | ||||
|                         defaultValue: source.hosts.isNotEmpty | ||||
|                             ? source.hosts[0] | ||||
|                             : '', | ||||
|                         required: true, | ||||
|                       ), | ||||
|                     ], | ||||
|                   ], | ||||
|                 ); | ||||
|             }); | ||||
|               }, | ||||
|             ); | ||||
|             if (values != null) { | ||||
|               setState(() { | ||||
|                 importInProgress = true; | ||||
|               }); | ||||
|               if (source.hosts.isEmpty || values['url'] != source.hosts[0]) { | ||||
|             source = sourceProvider.getSource(values['url'], | ||||
|                 overrideSource: source.runtimeType.toString()); | ||||
|                 source = sourceProvider.getSource( | ||||
|                   values['url'], | ||||
|                   overrideSource: source.runtimeType.toString(), | ||||
|                 ); | ||||
|               } | ||||
|           var urlsWithDescriptions = await source | ||||
|               .search(values['searchQuery'] as String, querySettings: values); | ||||
|               var urlsWithDescriptions = await source.search( | ||||
|                 values['searchQuery'] as String, | ||||
|                 querySettings: values, | ||||
|               ); | ||||
|               if (urlsWithDescriptions.isNotEmpty) { | ||||
|                 var selectedUrls = | ||||
|                     // ignore: use_build_context_synchronously | ||||
| @@ -229,24 +260,33 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|                           entries: urlsWithDescriptions, | ||||
|                           selectedByDefault: false, | ||||
|                         ); | ||||
|                     }); | ||||
|                       }, | ||||
|                     ); | ||||
|                 if (selectedUrls != null && selectedUrls.isNotEmpty) { | ||||
|               var errors = await appsProvider.addAppsByURL(selectedUrls, | ||||
|                   sourceOverride: source); | ||||
|                   var errors = await appsProvider.addAppsByURL( | ||||
|                     selectedUrls, | ||||
|                     sourceOverride: source, | ||||
|                   ); | ||||
|                   if (errors.isEmpty) { | ||||
|                     // ignore: use_build_context_synchronously | ||||
|                     showMessage( | ||||
|                     tr('importedX', | ||||
|                         args: [plural('apps', selectedUrls.length)]), | ||||
|                     context); | ||||
|                       tr( | ||||
|                         'importedX', | ||||
|                         args: [plural('apps', selectedUrls.length)], | ||||
|                       ), | ||||
|                       context, | ||||
|                     ); | ||||
|                   } else { | ||||
|                     // ignore: use_build_context_synchronously | ||||
|                     showDialog( | ||||
|                       context: context, | ||||
|                       builder: (BuildContext ctx) { | ||||
|                         return ImportErrorDialog( | ||||
|                           urlsLength: selectedUrls.length, errors: errors); | ||||
|                     }); | ||||
|                           urlsLength: selectedUrls.length, | ||||
|                           errors: errors, | ||||
|                         ); | ||||
|                       }, | ||||
|                     ); | ||||
|                   } | ||||
|                 } | ||||
|               } else { | ||||
| @@ -256,7 +296,8 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|           }() | ||||
|           .catchError((e) { | ||||
|             showError(e, context); | ||||
|       }).whenComplete(() { | ||||
|           }) | ||||
|           .whenComplete(() { | ||||
|             setState(() { | ||||
|               importInProgress = false; | ||||
|             }); | ||||
| @@ -274,42 +315,53 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|                       .map((e) => [GeneratedFormTextField(e, label: e)]) | ||||
|                       .toList(), | ||||
|                 ); | ||||
|             }); | ||||
|               }, | ||||
|             ); | ||||
|             if (values != null) { | ||||
|               setState(() { | ||||
|                 importInProgress = true; | ||||
|               }); | ||||
|               var urlsWithDescriptions = await source.getUrlsWithDescriptions( | ||||
|               values.values.map((e) => e.toString()).toList()); | ||||
|                 values.values.map((e) => e.toString()).toList(), | ||||
|               ); | ||||
|               var selectedUrls = | ||||
|                   // ignore: use_build_context_synchronously | ||||
|                   await showDialog<List<String>?>( | ||||
|                     context: context, | ||||
|                     builder: (BuildContext ctx) { | ||||
|                       return SelectionModal(entries: urlsWithDescriptions); | ||||
|                   }); | ||||
|                     }, | ||||
|                   ); | ||||
|               if (selectedUrls != null) { | ||||
|                 var errors = await appsProvider.addAppsByURL(selectedUrls); | ||||
|                 if (errors.isEmpty) { | ||||
|                   // ignore: use_build_context_synchronously | ||||
|                   showMessage( | ||||
|                   tr('importedX', args: [plural('apps', selectedUrls.length)]), | ||||
|                   context); | ||||
|                     tr( | ||||
|                       'importedX', | ||||
|                       args: [plural('apps', selectedUrls.length)], | ||||
|                     ), | ||||
|                     context, | ||||
|                   ); | ||||
|                 } else { | ||||
|                   // ignore: use_build_context_synchronously | ||||
|                   showDialog( | ||||
|                     context: context, | ||||
|                     builder: (BuildContext ctx) { | ||||
|                       return ImportErrorDialog( | ||||
|                         urlsLength: selectedUrls.length, errors: errors); | ||||
|                   }); | ||||
|                         urlsLength: selectedUrls.length, | ||||
|                         errors: errors, | ||||
|                       ); | ||||
|                     }, | ||||
|                   ); | ||||
|                 } | ||||
|               } | ||||
|             } | ||||
|           }() | ||||
|           .catchError((e) { | ||||
|             showError(e, context); | ||||
|       }).whenComplete(() { | ||||
|           }) | ||||
|           .whenComplete(() { | ||||
|             setState(() { | ||||
|               importInProgress = false; | ||||
|             }); | ||||
| @@ -323,12 +375,12 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|  | ||||
|     return Scaffold( | ||||
|       backgroundColor: Theme.of(context).colorScheme.surface, | ||||
|         body: CustomScrollView(slivers: <Widget>[ | ||||
|       body: CustomScrollView( | ||||
|         slivers: <Widget>[ | ||||
|           CustomAppBar(title: tr('importExport')), | ||||
|           SliverFillRemaining( | ||||
|             child: Padding( | ||||
|                   padding: | ||||
|                       const EdgeInsets.symmetric(vertical: 8, horizontal: 16), | ||||
|               padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), | ||||
|               child: Column( | ||||
|                 crossAxisAlignment: CrossAxisAlignment.stretch, | ||||
|                 children: [ | ||||
| @@ -342,34 +394,38 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|                               Expanded( | ||||
|                                 child: TextButton( | ||||
|                                   style: outlineButtonStyle, | ||||
|                                     onPressed: appsProvider.apps.isEmpty || | ||||
|                                   onPressed: | ||||
|                                       appsProvider.apps.isEmpty || | ||||
|                                           importInProgress | ||||
|                                       ? null | ||||
|                                       : () { | ||||
|                                           runObtainiumExport(pickOnly: true); | ||||
|                                         }, | ||||
|                                     child: Text(tr('pickExportDir'), | ||||
|                                         textAlign: TextAlign.center), | ||||
|                                   )), | ||||
|                                   const SizedBox( | ||||
|                                     width: 16, | ||||
|                                   child: Text( | ||||
|                                     tr('pickExportDir'), | ||||
|                                     textAlign: TextAlign.center, | ||||
|                                   ), | ||||
|                                 ), | ||||
|                               ), | ||||
|                               const SizedBox(width: 16), | ||||
|                               Expanded( | ||||
|                                 child: TextButton( | ||||
|                                   style: outlineButtonStyle, | ||||
|                                     onPressed: appsProvider.apps.isEmpty || | ||||
|                                   onPressed: | ||||
|                                       appsProvider.apps.isEmpty || | ||||
|                                           importInProgress || | ||||
|                                           snapshot.data == null | ||||
|                                       ? null | ||||
|                                       : runObtainiumExport, | ||||
|                                     child: Text(tr('obtainiumExport'), | ||||
|                                         textAlign: TextAlign.center), | ||||
|                                   )), | ||||
|                                   child: Text( | ||||
|                                     tr('obtainiumExport'), | ||||
|                                     textAlign: TextAlign.center, | ||||
|                                   ), | ||||
|                                 ), | ||||
|                               ), | ||||
|                             ], | ||||
|                           ), | ||||
|                               const SizedBox( | ||||
|                                 height: 8, | ||||
|                               ), | ||||
|                           const SizedBox(height: 8), | ||||
|                           Row( | ||||
|                             children: [ | ||||
|                               Expanded( | ||||
| @@ -378,8 +434,12 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|                                   onPressed: importInProgress | ||||
|                                       ? null | ||||
|                                       : runObtainiumImport, | ||||
|                                           child: Text(tr('obtainiumImport'), | ||||
|                                               textAlign: TextAlign.center))), | ||||
|                                   child: Text( | ||||
|                                     tr('obtainiumImport'), | ||||
|                                     textAlign: TextAlign.center, | ||||
|                                   ), | ||||
|                                 ), | ||||
|                               ), | ||||
|                             ], | ||||
|                           ), | ||||
|                           if (snapshot.data != null) | ||||
| @@ -394,35 +454,32 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|                                         label: tr('autoExportOnChanges'), | ||||
|                                         defaultValue: settingsProvider | ||||
|                                             .autoExportOnChanges, | ||||
|                                             ) | ||||
|                                       ), | ||||
|                                     ], | ||||
|                                     [ | ||||
|                                       GeneratedFormSwitch( | ||||
|                                         'exportSettings', | ||||
|                                         label: tr('includeSettings'), | ||||
|                                               defaultValue: settingsProvider | ||||
|                                                   .exportSettings, | ||||
|                                             ) | ||||
|                                           ] | ||||
|                                         defaultValue: | ||||
|                                             settingsProvider.exportSettings, | ||||
|                                       ), | ||||
|                                     ], | ||||
|                                         onValueChanges: | ||||
|                                             (value, valid, isBuilding) { | ||||
|                                   ], | ||||
|                                   onValueChanges: (value, valid, isBuilding) { | ||||
|                                     if (valid && !isBuilding) { | ||||
|                                       if (value['autoExportOnChanges'] != | ||||
|                                           null) { | ||||
|                                               settingsProvider | ||||
|                                                   .autoExportOnChanges = value[ | ||||
|                                                       'autoExportOnChanges'] == | ||||
|                                         settingsProvider.autoExportOnChanges = | ||||
|                                             value['autoExportOnChanges'] == | ||||
|                                             true; | ||||
|                                       } | ||||
|                                             if (value['exportSettings'] != | ||||
|                                                 null) { | ||||
|                                       if (value['exportSettings'] != null) { | ||||
|                                         settingsProvider.exportSettings = | ||||
|                                                   value['exportSettings'] == | ||||
|                                                       true; | ||||
|                                             value['exportSettings'] == true; | ||||
|                                       } | ||||
|                                     } | ||||
|                                         }), | ||||
|                                   }, | ||||
|                                 ), | ||||
|                               ], | ||||
|                             ), | ||||
|                         ], | ||||
| @@ -432,21 +489,15 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|                   if (importInProgress) | ||||
|                     const Column( | ||||
|                       children: [ | ||||
|                             SizedBox( | ||||
|                               height: 14, | ||||
|                             ), | ||||
|                         SizedBox(height: 14), | ||||
|                         LinearProgressIndicator(), | ||||
|                             SizedBox( | ||||
|                               height: 14, | ||||
|                             ), | ||||
|                         SizedBox(height: 14), | ||||
|                       ], | ||||
|                     ) | ||||
|                   else | ||||
|                     Column( | ||||
|                       children: [ | ||||
|                             const Divider( | ||||
|                               height: 32, | ||||
|                             ), | ||||
|                         const Divider(height: 32), | ||||
|                         Row( | ||||
|                           children: [ | ||||
|                             Expanded( | ||||
| @@ -455,63 +506,58 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|                                     ? null | ||||
|                                     : () async { | ||||
|                                         var searchSourceName = | ||||
|                                                     await showDialog< | ||||
|                                                                 List<String>?>( | ||||
|                                             await showDialog<List<String>?>( | ||||
|                                               context: context, | ||||
|                                                             builder: | ||||
|                                                                 (BuildContext | ||||
|                                                                     ctx) { | ||||
|                                               builder: (BuildContext ctx) { | ||||
|                                                 return SelectionModal( | ||||
|                                                   title: tr( | ||||
|                                                     'selectX', | ||||
|                                                                     args: [ | ||||
|                                                                       tr('source') | ||||
|                                                                     ]), | ||||
|                                                                 entries: | ||||
|                                                                     sourceStrings, | ||||
|                                                                 selectedByDefault: | ||||
|                                                                     false, | ||||
|                                                                 onlyOneSelectionAllowed: | ||||
|                                                                     true, | ||||
|                                                                 titlesAreLinks: | ||||
|                                                                     false, | ||||
|                                                     args: [tr('source')], | ||||
|                                                   ), | ||||
|                                                   entries: sourceStrings, | ||||
|                                                   selectedByDefault: false, | ||||
|                                                   onlyOneSelectionAllowed: true, | ||||
|                                                   titlesAreLinks: false, | ||||
|                                                 ); | ||||
|                                                             }) ?? | ||||
|                                               }, | ||||
|                                             ) ?? | ||||
|                                             []; | ||||
|                                                 var searchSource = | ||||
|                                                     sourceProvider.sources | ||||
|                                                         .where((e) => | ||||
|                                                             searchSourceName | ||||
|                                                                 .contains( | ||||
|                                                                     e.name)) | ||||
|                                         var searchSource = sourceProvider | ||||
|                                             .sources | ||||
|                                             .where( | ||||
|                                               (e) => searchSourceName.contains( | ||||
|                                                 e.name, | ||||
|                                               ), | ||||
|                                             ) | ||||
|                                             .toList(); | ||||
|                                         if (searchSource.isNotEmpty) { | ||||
|                                                   runSourceSearch( | ||||
|                                                       searchSource[0]); | ||||
|                                           runSourceSearch(searchSource[0]); | ||||
|                                         } | ||||
|                                       }, | ||||
|                                         child: Text(tr('searchX', args: [ | ||||
|                                           tr('source').toLowerCase() | ||||
|                                         ])))), | ||||
|                                 child: Text( | ||||
|                                   tr( | ||||
|                                     'searchX', | ||||
|                                     args: [tr('source').toLowerCase()], | ||||
|                                   ), | ||||
|                                 ), | ||||
|                               ), | ||||
|                             ), | ||||
|                           ], | ||||
|                         ), | ||||
|                         const SizedBox(height: 8), | ||||
|                         TextButton( | ||||
|                                 onPressed: | ||||
|                                     importInProgress ? null : urlListImport, | ||||
|                                 child: Text( | ||||
|                                   tr('importFromURLList'), | ||||
|                                 )), | ||||
|                           onPressed: importInProgress ? null : urlListImport, | ||||
|                           child: Text(tr('importFromURLList')), | ||||
|                         ), | ||||
|                         const SizedBox(height: 8), | ||||
|                         TextButton( | ||||
|                                 onPressed: | ||||
|                                     importInProgress ? null : runUrlImport, | ||||
|                                 child: Text( | ||||
|                                   tr('importFromURLsInFile'), | ||||
|                                 )), | ||||
|                           onPressed: importInProgress ? null : runUrlImport, | ||||
|                           child: Text(tr('importFromURLsInFile')), | ||||
|                         ), | ||||
|                       ], | ||||
|                     ), | ||||
|                       ...sourceProvider.massUrlSources.map((source) => Column( | ||||
|                   ...sourceProvider.massUrlSources.map( | ||||
|                     (source) => Column( | ||||
|                       crossAxisAlignment: CrossAxisAlignment.stretch, | ||||
|                       children: [ | ||||
|                         const SizedBox(height: 8), | ||||
| @@ -521,29 +567,38 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|                               : () { | ||||
|                                   runMassSourceImport(source); | ||||
|                                 }, | ||||
|                                     child: Text( | ||||
|                                         tr('importX', args: [source.name]))) | ||||
|                               ])), | ||||
|                       const Spacer(), | ||||
|                       const Divider( | ||||
|                         height: 32, | ||||
|                       ), | ||||
|                       Text(tr('importedAppsIdDisclaimer'), | ||||
|                           textAlign: TextAlign.center, | ||||
|                           style: const TextStyle( | ||||
|                               fontStyle: FontStyle.italic, fontSize: 12)), | ||||
|                       const SizedBox( | ||||
|                         height: 8, | ||||
|                           child: Text(tr('importX', args: [source.name])), | ||||
|                         ), | ||||
|                       ], | ||||
|                   ))) | ||||
|         ])); | ||||
|                     ), | ||||
|                   ), | ||||
|                   const Spacer(), | ||||
|                   const Divider(height: 32), | ||||
|                   Text( | ||||
|                     tr('importedAppsIdDisclaimer'), | ||||
|                     textAlign: TextAlign.center, | ||||
|                     style: const TextStyle( | ||||
|                       fontStyle: FontStyle.italic, | ||||
|                       fontSize: 12, | ||||
|                     ), | ||||
|                   ), | ||||
|                   const SizedBox(height: 8), | ||||
|                 ], | ||||
|               ), | ||||
|             ), | ||||
|           ), | ||||
|         ], | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|  | ||||
| class ImportErrorDialog extends StatefulWidget { | ||||
|   const ImportErrorDialog( | ||||
|       {super.key, required this.urlsLength, required this.errors}); | ||||
|   const ImportErrorDialog({ | ||||
|     super.key, | ||||
|     required this.urlsLength, | ||||
|     required this.errors, | ||||
|   }); | ||||
|  | ||||
|   final int urlsLength; | ||||
|   final List<List<String>> errors; | ||||
| @@ -558,13 +613,17 @@ class _ImportErrorDialogState extends State<ImportErrorDialog> { | ||||
|     return AlertDialog( | ||||
|       scrollable: true, | ||||
|       title: Text(tr('importErrors')), | ||||
|       content: | ||||
|           Column(crossAxisAlignment: CrossAxisAlignment.stretch, children: [ | ||||
|       content: Column( | ||||
|         crossAxisAlignment: CrossAxisAlignment.stretch, | ||||
|         children: [ | ||||
|           Text( | ||||
|           tr('importedXOfYApps', args: [ | ||||
|             tr( | ||||
|               'importedXOfYApps', | ||||
|               args: [ | ||||
|                 (widget.urlsLength - widget.errors.length).toString(), | ||||
|             widget.urlsLength.toString() | ||||
|           ]), | ||||
|                 widget.urlsLength.toString(), | ||||
|               ], | ||||
|             ), | ||||
|             style: Theme.of(context).textTheme.bodyLarge, | ||||
|           ), | ||||
|           const SizedBox(height: 16), | ||||
| @@ -576,23 +635,21 @@ class _ImportErrorDialogState extends State<ImportErrorDialog> { | ||||
|             return Column( | ||||
|               crossAxisAlignment: CrossAxisAlignment.stretch, | ||||
|               children: [ | ||||
|                 const SizedBox( | ||||
|                   height: 16, | ||||
|                 ), | ||||
|                 const SizedBox(height: 16), | ||||
|                 Text(e[0]), | ||||
|                 Text( | ||||
|                   e[1], | ||||
|                   style: const TextStyle(fontStyle: FontStyle.italic), | ||||
|                 ) | ||||
|               ]); | ||||
|         }) | ||||
|       ]), | ||||
|                 Text(e[1], style: const TextStyle(fontStyle: FontStyle.italic)), | ||||
|               ], | ||||
|             ); | ||||
|           }), | ||||
|         ], | ||||
|       ), | ||||
|       actions: [ | ||||
|         TextButton( | ||||
|           onPressed: () { | ||||
|             Navigator.of(context).pop(null); | ||||
|           }, | ||||
|             child: Text(tr('ok'))) | ||||
|           child: Text(tr('ok')), | ||||
|         ), | ||||
|       ], | ||||
|     ); | ||||
|   } | ||||
| @@ -600,14 +657,15 @@ class _ImportErrorDialogState extends State<ImportErrorDialog> { | ||||
|  | ||||
| // ignore: must_be_immutable | ||||
| class SelectionModal extends StatefulWidget { | ||||
|   SelectionModal( | ||||
|       {super.key, | ||||
|   SelectionModal({ | ||||
|     super.key, | ||||
|     required this.entries, | ||||
|     this.selectedByDefault = true, | ||||
|     this.onlyOneSelectionAllowed = false, | ||||
|     this.titlesAreLinks = true, | ||||
|     this.title, | ||||
|       this.deselectThese = const []}); | ||||
|     this.deselectThese = const [], | ||||
|   }); | ||||
|  | ||||
|   String? title; | ||||
|   Map<String, List<String>> entries; | ||||
| @@ -632,14 +690,15 @@ class _SelectionModalState extends State<SelectionModal> { | ||||
|         () => | ||||
|             widget.selectedByDefault && | ||||
|             !widget.onlyOneSelectionAllowed && | ||||
|               !widget.deselectThese.contains(entry.key)); | ||||
|             !widget.deselectThese.contains(entry.key), | ||||
|       ); | ||||
|     } | ||||
|     if (widget.selectedByDefault && widget.onlyOneSelectionAllowed) { | ||||
|       selectOnlyOne(widget.entries.entries.first.key); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   selectOnlyOne(String url) { | ||||
|   void selectOnlyOne(String url) { | ||||
|     for (var e in entrySelections.keys) { | ||||
|       entrySelections[e] = e.key == url; | ||||
|     } | ||||
| @@ -658,8 +717,10 @@ class _SelectionModalState extends State<SelectionModal> { | ||||
|       entrySelections.forEach((key, value) { | ||||
|         var searchableText = key.value.isEmpty ? key.key : key.value[0]; | ||||
|         if (filterRegex.isEmpty || | ||||
|             RegExp(filterRegex, caseSensitive: false) | ||||
|                 .hasMatch(searchableText)) { | ||||
|             RegExp( | ||||
|               filterRegex, | ||||
|               caseSensitive: false, | ||||
|             ).hasMatch(searchableText)) { | ||||
|           filteredEntrySelections.putIfAbsent(key, () => value); | ||||
|         } | ||||
|       }); | ||||
| @@ -667,19 +728,22 @@ class _SelectionModalState extends State<SelectionModal> { | ||||
|     return AlertDialog( | ||||
|       scrollable: true, | ||||
|       title: Text(widget.title ?? tr('pick')), | ||||
|       content: Column(children: [ | ||||
|       content: Column( | ||||
|         children: [ | ||||
|           GeneratedForm( | ||||
|             items: [ | ||||
|               [ | ||||
|                 GeneratedFormTextField('filter', | ||||
|                 GeneratedFormTextField( | ||||
|                   'filter', | ||||
|                   label: tr('filter'), | ||||
|                   required: false, | ||||
|                   additionalValidators: [ | ||||
|                     (value) { | ||||
|                       return regExValidator(value); | ||||
|                       } | ||||
|                     ]) | ||||
|               ] | ||||
|                     }, | ||||
|                   ], | ||||
|                 ), | ||||
|               ], | ||||
|             ], | ||||
|             onValueChanges: (value, valid, isBuilding) { | ||||
|               if (valid && !isBuilding) { | ||||
| @@ -689,7 +753,8 @@ class _SelectionModalState extends State<SelectionModal> { | ||||
|                   }); | ||||
|                 } | ||||
|               } | ||||
|             }), | ||||
|             }, | ||||
|           ), | ||||
|           ...filteredEntrySelections.keys.map((entry) { | ||||
|             selectThis(bool? value) { | ||||
|               setState(() { | ||||
| @@ -706,8 +771,10 @@ class _SelectionModalState extends State<SelectionModal> { | ||||
|               onTap: !widget.titlesAreLinks | ||||
|                   ? null | ||||
|                   : () { | ||||
|                       launchUrlString(entry.key, | ||||
|                           mode: LaunchMode.externalApplication); | ||||
|                       launchUrlString( | ||||
|                         entry.key, | ||||
|                         mode: LaunchMode.externalApplication, | ||||
|                       ); | ||||
|                     }, | ||||
|               child: Column( | ||||
|                 crossAxisAlignment: CrossAxisAlignment.start, | ||||
| @@ -718,17 +785,21 @@ class _SelectionModalState extends State<SelectionModal> { | ||||
|                       decoration: widget.titlesAreLinks | ||||
|                           ? TextDecoration.underline | ||||
|                           : null, | ||||
|                         fontWeight: FontWeight.bold), | ||||
|                       fontWeight: FontWeight.bold, | ||||
|                     ), | ||||
|                     textAlign: TextAlign.start, | ||||
|                   ), | ||||
|                   if (widget.titlesAreLinks) | ||||
|                     Text( | ||||
|                       Uri.parse(entry.key).host, | ||||
|                       style: const TextStyle( | ||||
|                           decoration: TextDecoration.underline, fontSize: 12), | ||||
|                     ) | ||||
|                         decoration: TextDecoration.underline, | ||||
|                         fontSize: 12, | ||||
|                       ), | ||||
|                     ), | ||||
|                 ], | ||||
|               )); | ||||
|               ), | ||||
|             ); | ||||
|  | ||||
|             var descriptionText = entry.value.length <= 1 | ||||
|                 ? const SizedBox.shrink() | ||||
| @@ -737,11 +808,14 @@ class _SelectionModalState extends State<SelectionModal> { | ||||
|                         ? '${entry.value[1].substring(0, 128)}...' | ||||
|                         : entry.value[1], | ||||
|                     style: const TextStyle( | ||||
|                       fontStyle: FontStyle.italic, fontSize: 12), | ||||
|                       fontStyle: FontStyle.italic, | ||||
|                       fontSize: 12, | ||||
|                     ), | ||||
|                   ); | ||||
|  | ||||
|           var selectedEntries = | ||||
|               entrySelections.entries.where((e) => e.value).toList(); | ||||
|             var selectedEntries = entrySelections.entries | ||||
|                 .where((e) => e.value) | ||||
|                 .toList(); | ||||
|  | ||||
|             var singleSelectTile = ListTile( | ||||
|               title: GestureDetector( | ||||
| @@ -775,23 +849,21 @@ class _SelectionModalState extends State<SelectionModal> { | ||||
|               ), | ||||
|             ); | ||||
|  | ||||
|           var multiSelectTile = Row(children: [ | ||||
|             var multiSelectTile = Row( | ||||
|               children: [ | ||||
|                 Checkbox( | ||||
|                   value: entrySelections[entry], | ||||
|                   onChanged: (value) { | ||||
|                     selectThis(value); | ||||
|                 }), | ||||
|             const SizedBox( | ||||
|               width: 8, | ||||
|                   }, | ||||
|                 ), | ||||
|                 const SizedBox(width: 8), | ||||
|                 Expanded( | ||||
|                   child: Column( | ||||
|                     crossAxisAlignment: CrossAxisAlignment.start, | ||||
|                     mainAxisAlignment: MainAxisAlignment.center, | ||||
|                     children: [ | ||||
|                 const SizedBox( | ||||
|                   height: 8, | ||||
|                 ), | ||||
|                       const SizedBox(height: 8), | ||||
|                       GestureDetector( | ||||
|                         onTap: widget.titlesAreLinks | ||||
|                             ? null | ||||
| @@ -808,38 +880,48 @@ class _SelectionModalState extends State<SelectionModal> { | ||||
|                               }, | ||||
|                               child: descriptionText, | ||||
|                             ), | ||||
|                 const SizedBox( | ||||
|                   height: 8, | ||||
|                 ) | ||||
|                       const SizedBox(height: 8), | ||||
|                     ], | ||||
|             )) | ||||
|           ]); | ||||
|                   ), | ||||
|                 ), | ||||
|               ], | ||||
|             ); | ||||
|  | ||||
|             return widget.onlyOneSelectionAllowed | ||||
|                 ? singleSelectTile | ||||
|                 : multiSelectTile; | ||||
|         }) | ||||
|       ]), | ||||
|           }), | ||||
|         ], | ||||
|       ), | ||||
|       actions: [ | ||||
|         TextButton( | ||||
|           onPressed: () { | ||||
|             Navigator.of(context).pop(); | ||||
|           }, | ||||
|             child: Text(tr('cancel'))), | ||||
|           child: Text(tr('cancel')), | ||||
|         ), | ||||
|         TextButton( | ||||
|           onPressed: entrySelections.values.where((b) => b).isEmpty | ||||
|               ? null | ||||
|               : () { | ||||
|                     Navigator.of(context).pop(entrySelections.entries | ||||
|                   Navigator.of(context).pop( | ||||
|                     entrySelections.entries | ||||
|                         .where((entry) => entry.value) | ||||
|                         .map((e) => e.key.key) | ||||
|                         .toList()); | ||||
|                         .toList(), | ||||
|                   ); | ||||
|                 }, | ||||
|             child: Text(widget.onlyOneSelectionAllowed | ||||
|           child: Text( | ||||
|             widget.onlyOneSelectionAllowed | ||||
|                 ? tr('pick') | ||||
|                 : tr('selectX', args: [ | ||||
|                     entrySelections.values.where((b) => b).length.toString() | ||||
|                   ]))) | ||||
|                 : tr( | ||||
|                     'selectX', | ||||
|                     args: [ | ||||
|                       entrySelections.values.where((b) => b).length.toString(), | ||||
|                     ], | ||||
|                   ), | ||||
|           ), | ||||
|         ), | ||||
|       ], | ||||
|     ); | ||||
|   } | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -22,7 +22,7 @@ class Log { | ||||
|       idColumn: id, | ||||
|       levelColumn: level.index, | ||||
|       messageColumn: message, | ||||
|       timestampColumn: timestamp.millisecondsSinceEpoch | ||||
|       timestampColumn: timestamp.millisecondsSinceEpoch, | ||||
|     }; | ||||
|     return map; | ||||
|   } | ||||
| @@ -33,8 +33,9 @@ class Log { | ||||
|     id = map[idColumn] as int; | ||||
|     level = LogLevels.values.elementAt(map[levelColumn] as int); | ||||
|     message = map[messageColumn] as String; | ||||
|     timestamp = | ||||
|         DateTime.fromMillisecondsSinceEpoch(map[timestampColumn] as int); | ||||
|     timestamp = DateTime.fromMillisecondsSinceEpoch( | ||||
|       map[timestampColumn] as int, | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   @override | ||||
| @@ -51,7 +52,9 @@ class LogsProvider { | ||||
|   Database? db; | ||||
|  | ||||
|   Future<Database> getDB() async { | ||||
|     db ??= await openDatabase(dbPath, version: 1, | ||||
|     db ??= await openDatabase( | ||||
|       dbPath, | ||||
|       version: 1, | ||||
|       onCreate: (Database db, int version) async { | ||||
|         await db.execute(''' | ||||
| create table if not exists $logTable (  | ||||
| @@ -60,7 +63,8 @@ create table if not exists $logTable ( | ||||
|   $messageColumn text not null, | ||||
|   $timestampColumn integer not null) | ||||
| '''); | ||||
|     }); | ||||
|       }, | ||||
|     ); | ||||
|     return db!; | ||||
|   } | ||||
|  | ||||
| @@ -75,27 +79,38 @@ create table if not exists $logTable ( | ||||
|  | ||||
|   Future<List<Log>> get({DateTime? before, DateTime? after}) async { | ||||
|     var where = getWhereDates(before: before, after: after); | ||||
|     return (await (await getDB()) | ||||
|             .query(logTable, where: where.key, whereArgs: where.value)) | ||||
|         .map((e) => Log.fromMap(e)) | ||||
|         .toList(); | ||||
|     return (await (await getDB()).query( | ||||
|       logTable, | ||||
|       where: where.key, | ||||
|       whereArgs: where.value, | ||||
|     )).map((e) => Log.fromMap(e)).toList(); | ||||
|   } | ||||
|  | ||||
|   Future<int> clear({DateTime? before, DateTime? after}) async { | ||||
|     var where = getWhereDates(before: before, after: after); | ||||
|     var res = await (await getDB()) | ||||
|         .delete(logTable, where: where.key, whereArgs: where.value); | ||||
|     var res = await (await getDB()).delete( | ||||
|       logTable, | ||||
|       where: where.key, | ||||
|       whereArgs: where.value, | ||||
|     ); | ||||
|     if (res > 0) { | ||||
|       add(plural('clearedNLogsBeforeXAfterY', res, | ||||
|       add( | ||||
|         plural( | ||||
|           'clearedNLogsBeforeXAfterY', | ||||
|           res, | ||||
|           namedArgs: {'before': before.toString(), 'after': after.toString()}, | ||||
|           name: 'n')); | ||||
|           name: 'n', | ||||
|         ), | ||||
|       ); | ||||
|     } | ||||
|     return res; | ||||
|   } | ||||
| } | ||||
|  | ||||
| MapEntry<String?, List<int>?> getWhereDates( | ||||
|     {DateTime? before, DateTime? after}) { | ||||
| MapEntry<String?, List<int>?> getWhereDates({ | ||||
|   DateTime? before, | ||||
|   DateTime? after, | ||||
| }) { | ||||
|   List<String> where = []; | ||||
|   List<int> whereArgs = []; | ||||
|   if (before != null) { | ||||
|   | ||||
| @@ -20,9 +20,18 @@ class ObtainiumNotification { | ||||
|   bool onlyAlertOnce; | ||||
|   String? payload; | ||||
|  | ||||
|   ObtainiumNotification(this.id, this.title, this.message, this.channelCode, | ||||
|       this.channelName, this.channelDescription, this.importance, | ||||
|       {this.onlyAlertOnce = false, this.progPercent, this.payload}); | ||||
|   ObtainiumNotification( | ||||
|     this.id, | ||||
|     this.title, | ||||
|     this.message, | ||||
|     this.channelCode, | ||||
|     this.channelName, | ||||
|     this.channelDescription, | ||||
|     this.importance, { | ||||
|     this.onlyAlertOnce = false, | ||||
|     this.progPercent, | ||||
|     this.payload, | ||||
|   }); | ||||
| } | ||||
|  | ||||
| class UpdateNotification extends ObtainiumNotification { | ||||
| @@ -34,13 +43,17 @@ class UpdateNotification extends ObtainiumNotification { | ||||
|         'UPDATES_AVAILABLE', | ||||
|         tr('updatesAvailableNotifChannel'), | ||||
|         tr('updatesAvailableNotifDescription'), | ||||
|             Importance.max) { | ||||
|         Importance.max, | ||||
|       ) { | ||||
|     message = updates.isEmpty | ||||
|         ? tr('noNewUpdates') | ||||
|         : updates.length == 1 | ||||
|         ? tr('xHasAnUpdate', args: [updates[0].finalName]) | ||||
|             : plural('xAndNMoreUpdatesAvailable', updates.length - 1, | ||||
|                 args: [updates[0].finalName, (updates.length - 1).toString()]); | ||||
|         : plural( | ||||
|             'xAndNMoreUpdatesAvailable', | ||||
|             updates.length - 1, | ||||
|             args: [updates[0].finalName, (updates.length - 1).toString()], | ||||
|           ); | ||||
|   } | ||||
| } | ||||
|  | ||||
| @@ -53,14 +66,18 @@ class SilentUpdateNotification extends ObtainiumNotification { | ||||
|         'APPS_UPDATED', | ||||
|         tr('appsUpdatedNotifChannel'), | ||||
|         tr('appsUpdatedNotifDescription'), | ||||
|             Importance.defaultImportance) { | ||||
|         Importance.defaultImportance, | ||||
|       ) { | ||||
|     message = updates.length == 1 | ||||
|         ? tr(succeeded ? 'xWasUpdatedToY' : 'xWasNotUpdatedToY', | ||||
|             args: [updates[0].finalName, updates[0].latestVersion]) | ||||
|         ? tr( | ||||
|             succeeded ? 'xWasUpdatedToY' : 'xWasNotUpdatedToY', | ||||
|             args: [updates[0].finalName, updates[0].latestVersion], | ||||
|           ) | ||||
|         : plural( | ||||
|             succeeded ? 'xAndNMoreUpdatesInstalled' : "xAndNMoreUpdatesFailed", | ||||
|             updates.length - 1, | ||||
|             args: [updates[0].finalName, (updates.length - 1).toString()]); | ||||
|             args: [updates[0].finalName, (updates.length - 1).toString()], | ||||
|           ); | ||||
|   } | ||||
| } | ||||
|  | ||||
| @@ -73,12 +90,18 @@ class SilentUpdateAttemptNotification extends ObtainiumNotification { | ||||
|         'APPS_POSSIBLY_UPDATED', | ||||
|         tr('appsPossiblyUpdatedNotifChannel'), | ||||
|         tr('appsPossiblyUpdatedNotifDescription'), | ||||
|             Importance.defaultImportance) { | ||||
|         Importance.defaultImportance, | ||||
|       ) { | ||||
|     message = updates.length == 1 | ||||
|         ? tr('xWasPossiblyUpdatedToY', | ||||
|             args: [updates[0].finalName, updates[0].latestVersion]) | ||||
|         : plural('xAndNMoreUpdatesPossiblyInstalled', updates.length - 1, | ||||
|             args: [updates[0].finalName, (updates.length - 1).toString()]); | ||||
|         ? tr( | ||||
|             'xWasPossiblyUpdatedToY', | ||||
|             args: [updates[0].finalName, updates[0].latestVersion], | ||||
|           ) | ||||
|         : plural( | ||||
|             'xAndNMoreUpdatesPossiblyInstalled', | ||||
|             updates.length - 1, | ||||
|             args: [updates[0].finalName, (updates.length - 1).toString()], | ||||
|           ); | ||||
|   } | ||||
| } | ||||
|  | ||||
| @@ -92,7 +115,8 @@ class ErrorCheckingUpdatesNotification extends ObtainiumNotification { | ||||
|         tr('errorCheckingUpdatesNotifChannel'), | ||||
|         tr('errorCheckingUpdatesNotifDescription'), | ||||
|         Importance.high, | ||||
|             payload: "${tr('errorCheckingUpdates')}\n$error"); | ||||
|         payload: "${tr('errorCheckingUpdates')}\n$error", | ||||
|       ); | ||||
| } | ||||
|  | ||||
| class AppsRemovedNotification extends ObtainiumNotification { | ||||
| @@ -104,7 +128,8 @@ class AppsRemovedNotification extends ObtainiumNotification { | ||||
|         'APPS_REMOVED', | ||||
|         tr('appsRemovedNotifChannel'), | ||||
|         tr('appsRemovedNotifDescription'), | ||||
|             Importance.max) { | ||||
|         Importance.max, | ||||
|       ) { | ||||
|     message = ''; | ||||
|     for (var r in namedReasons) { | ||||
|       message += '${tr('xWasRemovedDueToErrorY', args: [r[0], r[1]])} \n'; | ||||
| @@ -124,7 +149,8 @@ class DownloadNotification extends ObtainiumNotification { | ||||
|         tr('downloadNotifDescription'), | ||||
|         Importance.low, | ||||
|         onlyAlertOnce: true, | ||||
|             progPercent: progPercent); | ||||
|         progPercent: progPercent, | ||||
|       ); | ||||
| } | ||||
|  | ||||
| class DownloadedNotification extends ObtainiumNotification { | ||||
| @@ -136,7 +162,8 @@ class DownloadedNotification extends ObtainiumNotification { | ||||
|         'FILE_DOWNLOADED', | ||||
|         tr('downloadedXNotifChannel', args: [tr('app')]), | ||||
|         tr('downloadedX', args: [tr('app')]), | ||||
|             Importance.defaultImportance); | ||||
|         Importance.defaultImportance, | ||||
|       ); | ||||
| } | ||||
|  | ||||
| final completeInstallationNotification = ObtainiumNotification( | ||||
| @@ -146,7 +173,8 @@ final completeInstallationNotification = ObtainiumNotification( | ||||
|   'COMPLETE_INSTALL', | ||||
|   tr('completeAppInstallationNotifChannel'), | ||||
|   tr('completeAppInstallationNotifDescription'), | ||||
|     Importance.max); | ||||
|   Importance.max, | ||||
| ); | ||||
|  | ||||
| class CheckingUpdatesNotification extends ObtainiumNotification { | ||||
|   CheckingUpdatesNotification(String appName) | ||||
| @@ -157,7 +185,8 @@ class CheckingUpdatesNotification extends ObtainiumNotification { | ||||
|         'BG_UPDATE_CHECK', | ||||
|         tr('checkingForUpdatesNotifChannel'), | ||||
|         tr('checkingForUpdatesNotifDescription'), | ||||
|             Importance.min); | ||||
|         Importance.min, | ||||
|       ); | ||||
| } | ||||
|  | ||||
| class NotificationsProvider { | ||||
| @@ -173,13 +202,15 @@ class NotificationsProvider { | ||||
|     Importance.max: Priority.max, | ||||
|     Importance.min: Priority.min, | ||||
|     Importance.none: Priority.min, | ||||
|     Importance.unspecified: Priority.defaultPriority | ||||
|     Importance.unspecified: Priority.defaultPriority, | ||||
|   }; | ||||
|  | ||||
|   Future<void> initialize() async { | ||||
|     isInitialized = await notifications.initialize( | ||||
|     isInitialized = | ||||
|         await notifications.initialize( | ||||
|           const InitializationSettings( | ||||
|               android: AndroidInitializationSettings('ic_notification')), | ||||
|             android: AndroidInitializationSettings('ic_notification'), | ||||
|           ), | ||||
|           onDidReceiveNotificationResponse: (NotificationResponse response) { | ||||
|             _showNotificationPayload(response.payload); | ||||
|           }, | ||||
| @@ -187,16 +218,18 @@ class NotificationsProvider { | ||||
|         false; | ||||
|   } | ||||
|  | ||||
|   checkLaunchByNotif() async { | ||||
|     final NotificationAppLaunchDetails? launchDetails = | ||||
|         await notifications.getNotificationAppLaunchDetails(); | ||||
|   Future<void> checkLaunchByNotif() async { | ||||
|     final NotificationAppLaunchDetails? launchDetails = await notifications | ||||
|         .getNotificationAppLaunchDetails(); | ||||
|     if (launchDetails?.didNotificationLaunchApp ?? false) { | ||||
|       _showNotificationPayload(launchDetails!.notificationResponse?.payload, | ||||
|           doublePop: true); | ||||
|       _showNotificationPayload( | ||||
|         launchDetails!.notificationResponse?.payload, | ||||
|         doublePop: true, | ||||
|       ); | ||||
|     } | ||||
|   } | ||||
|  | ||||
|   _showNotificationPayload(String? payload, {bool doublePop = false}) { | ||||
|   void _showNotificationPayload(String? payload, {bool doublePop = false}) { | ||||
|     if (payload?.isNotEmpty == true) { | ||||
|       var title = (payload ?? '\n\n').split('\n').first; | ||||
|       var content = (payload ?? '\n\n').split('\n').sublist(1).join('\n'); | ||||
| @@ -213,7 +246,8 @@ class NotificationsProvider { | ||||
|                     Navigator.of(context).pop(null); | ||||
|                   } | ||||
|                 }, | ||||
|                   child: Text(tr('ok'))), | ||||
|                 child: Text(tr('ok')), | ||||
|               ), | ||||
|             ], | ||||
|           ), | ||||
|         ), | ||||
| @@ -235,11 +269,12 @@ class NotificationsProvider { | ||||
|     String channelCode, | ||||
|     String channelName, | ||||
|     String channelDescription, | ||||
|       Importance importance, | ||||
|       {bool cancelExisting = false, | ||||
|     Importance importance, { | ||||
|     bool cancelExisting = false, | ||||
|     int? progPercent, | ||||
|     bool onlyAlertOnce = false, | ||||
|       String? payload}) async { | ||||
|     String? payload, | ||||
|   }) async { | ||||
|     if (cancelExisting) { | ||||
|       await cancel(id); | ||||
|     } | ||||
| @@ -251,7 +286,9 @@ class NotificationsProvider { | ||||
|       title, | ||||
|       message, | ||||
|       NotificationDetails( | ||||
|             android: AndroidNotificationDetails(channelCode, channelName, | ||||
|         android: AndroidNotificationDetails( | ||||
|           channelCode, | ||||
|           channelName, | ||||
|           channelDescription: channelDescription, | ||||
|           importance: importance, | ||||
|           priority: importanceToPriority[importance]!, | ||||
| @@ -260,16 +297,27 @@ class NotificationsProvider { | ||||
|           maxProgress: 100, | ||||
|           showProgress: progPercent != null, | ||||
|           onlyAlertOnce: onlyAlertOnce, | ||||
|                 indeterminate: progPercent != null && progPercent < 0)), | ||||
|         payload: payload); | ||||
|           indeterminate: progPercent != null && progPercent < 0, | ||||
|         ), | ||||
|       ), | ||||
|       payload: payload, | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   Future<void> notify(ObtainiumNotification notif, | ||||
|           {bool cancelExisting = false}) => | ||||
|       notifyRaw(notif.id, notif.title, notif.message, notif.channelCode, | ||||
|           notif.channelName, notif.channelDescription, notif.importance, | ||||
|   Future<void> notify( | ||||
|     ObtainiumNotification notif, { | ||||
|     bool cancelExisting = false, | ||||
|   }) => notifyRaw( | ||||
|     notif.id, | ||||
|     notif.title, | ||||
|     notif.message, | ||||
|     notif.channelCode, | ||||
|     notif.channelName, | ||||
|     notif.channelDescription, | ||||
|     notif.importance, | ||||
|     cancelExisting: cancelExisting, | ||||
|     onlyAlertOnce: notif.onlyAlertOnce, | ||||
|     progPercent: notif.progPercent, | ||||
|           payload: notif.payload); | ||||
|     payload: notif.payload, | ||||
|   ); | ||||
| } | ||||
|   | ||||
| @@ -58,8 +58,8 @@ class SettingsProvider with ChangeNotifier { | ||||
|   } | ||||
|  | ||||
|   ThemeSettings get theme { | ||||
|     return ThemeSettings | ||||
|         .values[prefs?.getInt('theme') ?? ThemeSettings.system.index]; | ||||
|     return ThemeSettings.values[prefs?.getInt('theme') ?? | ||||
|         ThemeSettings.system.index]; | ||||
|   } | ||||
|  | ||||
|   set theme(ThemeSettings t) { | ||||
| @@ -123,8 +123,8 @@ class SettingsProvider with ChangeNotifier { | ||||
|   } | ||||
|  | ||||
|   SortColumnSettings get sortColumn { | ||||
|     return SortColumnSettings.values[ | ||||
|         prefs?.getInt('sortColumn') ?? SortColumnSettings.nameAuthor.index]; | ||||
|     return SortColumnSettings.values[prefs?.getInt('sortColumn') ?? | ||||
|         SortColumnSettings.nameAuthor.index]; | ||||
|   } | ||||
|  | ||||
|   set sortColumn(SortColumnSettings s) { | ||||
| @@ -133,8 +133,8 @@ class SettingsProvider with ChangeNotifier { | ||||
|   } | ||||
|  | ||||
|   SortOrderSettings get sortOrder { | ||||
|     return SortOrderSettings.values[ | ||||
|         prefs?.getInt('sortOrder') ?? SortOrderSettings.ascending.index]; | ||||
|     return SortOrderSettings.values[prefs?.getInt('sortOrder') ?? | ||||
|         SortOrderSettings.ascending.index]; | ||||
|   } | ||||
|  | ||||
|   set sortOrder(SortOrderSettings s) { | ||||
| @@ -171,7 +171,9 @@ class SettingsProvider with ChangeNotifier { | ||||
|     while (!(await Permission.requestInstallPackages.isGranted)) { | ||||
|       // Explicit request as InstallPlugin request sometimes bugged | ||||
|       Fluttertoast.showToast( | ||||
|           msg: tr('pleaseAllowInstallPerm'), toastLength: Toast.LENGTH_LONG); | ||||
|         msg: tr('pleaseAllowInstallPerm'), | ||||
|         toastLength: Toast.LENGTH_LONG, | ||||
|       ); | ||||
|       if ((await Permission.requestInstallPackages.request()) == | ||||
|           PermissionStatus.granted) { | ||||
|         return true; | ||||
| @@ -470,7 +472,8 @@ class SettingsProvider with ChangeNotifier { | ||||
|   } | ||||
|  | ||||
|   List<String> get searchDeselected { | ||||
|     return prefs?.getStringList('searchDeselected') ?? []; | ||||
|     return prefs?.getStringList('searchDeselected') ?? | ||||
|         SourceProvider().sources.map((s) => s.name).toList(); | ||||
|   } | ||||
|  | ||||
|   set searchDeselected(List<String> list) { | ||||
|   | ||||
| @@ -53,29 +53,40 @@ class APKDetails { | ||||
|   late String? changeLog; | ||||
|   late List<MapEntry<String, String>> allAssetUrls; | ||||
|  | ||||
|   APKDetails(this.version, this.apkUrls, this.names, | ||||
|       {this.releaseDate, this.changeLog, this.allAssetUrls = const []}); | ||||
|   APKDetails( | ||||
|     this.version, | ||||
|     this.apkUrls, | ||||
|     this.names, { | ||||
|     this.releaseDate, | ||||
|     this.changeLog, | ||||
|     this.allAssetUrls = const [], | ||||
|   }); | ||||
| } | ||||
|  | ||||
| stringMapListTo2DList(List<MapEntry<String, String>> mapList) => | ||||
| List<List<String>> stringMapListTo2DList(List<MapEntry<String, String>> mapList) => | ||||
|     mapList.map((e) => [e.key, e.value]).toList(); | ||||
|  | ||||
| assumed2DlistToStringMapList(List<dynamic> arr) => | ||||
| List<MapEntry<String, String>> assumed2DlistToStringMapList(List<dynamic> arr) => | ||||
|     arr.map((e) => MapEntry(e[0] as String, e[1] as String)).toList(); | ||||
|  | ||||
| // App JSON schema has changed multiple times over the many versions of Obtainium | ||||
| // This function takes an App JSON and modifies it if needed to conform to the latest (current) version | ||||
| appJSONCompatibilityModifiers(Map<String, dynamic> json) { | ||||
|   var source = SourceProvider() | ||||
|       .getSource(json['url'], overrideSource: json['overrideSource']); | ||||
|   var formItems = source.combinedAppSpecificSettingFormItems | ||||
|       .reduce((value, element) => [...value, ...element]); | ||||
|   Map<String, dynamic> additionalSettings = | ||||
|       getDefaultValuesFromFormItems([formItems]); | ||||
| Map<String, dynamic> appJSONCompatibilityModifiers(Map<String, dynamic> json) { | ||||
|   var source = SourceProvider().getSource( | ||||
|     json['url'], | ||||
|     overrideSource: json['overrideSource'], | ||||
|   ); | ||||
|   var formItems = source.combinedAppSpecificSettingFormItems.reduce( | ||||
|     (value, element) => [...value, ...element], | ||||
|   ); | ||||
|   Map<String, dynamic> additionalSettings = getDefaultValuesFromFormItems([ | ||||
|     formItems, | ||||
|   ]); | ||||
|   Map<String, dynamic> originalAdditionalSettings = {}; | ||||
|   if (json['additionalSettings'] != null) { | ||||
|     originalAdditionalSettings = | ||||
|         Map<String, dynamic>.from(jsonDecode(json['additionalSettings'])); | ||||
|     originalAdditionalSettings = Map<String, dynamic>.from( | ||||
|       jsonDecode(json['additionalSettings']), | ||||
|     ); | ||||
|     additionalSettings.addEntries(originalAdditionalSettings.entries); | ||||
|   } | ||||
|   // If needed, migrate old-style additionalData to newer-style additionalSettings (V1) | ||||
| @@ -127,12 +138,14 @@ appJSONCompatibilityModifiers(Map<String, dynamic> json) { | ||||
|   // Ensure additionalSettings are correctly typed | ||||
|   for (var item in formItems) { | ||||
|     if (additionalSettings[item.key] != null) { | ||||
|       additionalSettings[item.key] = | ||||
|           item.ensureType(additionalSettings[item.key]); | ||||
|       additionalSettings[item.key] = item.ensureType( | ||||
|         additionalSettings[item.key], | ||||
|       ); | ||||
|     } | ||||
|   } | ||||
|   int preferredApkIndex = | ||||
|       json['preferredApkIndex'] == null ? 0 : json['preferredApkIndex'] as int; | ||||
|   int preferredApkIndex = json['preferredApkIndex'] == null | ||||
|       ? 0 | ||||
|       : json['preferredApkIndex'] as int; | ||||
|   if (preferredApkIndex < 0) { | ||||
|     preferredApkIndex = 0; | ||||
|   } | ||||
| @@ -145,9 +158,9 @@ appJSONCompatibilityModifiers(Map<String, dynamic> json) { | ||||
|       apkUrls = getApkUrlsFromUrls(List<String>.from(apkUrlJson)); | ||||
|     } catch (e) { | ||||
|       apkUrls = assumed2DlistToStringMapList(List<dynamic>.from(apkUrlJson)); | ||||
|       apkUrls = List<dynamic>.from(apkUrlJson) | ||||
|           .map((e) => MapEntry(e[0] as String, e[1] as String)) | ||||
|           .toList(); | ||||
|       apkUrls = List<dynamic>.from( | ||||
|         apkUrlJson, | ||||
|       ).map((e) => MapEntry(e[0] as String, e[1] as String)).toList(); | ||||
|     } | ||||
|     json['apkUrls'] = jsonEncode(stringMapListTo2DList(apkUrls)); | ||||
|   } | ||||
| @@ -173,8 +186,8 @@ appJSONCompatibilityModifiers(Map<String, dynamic> json) { | ||||
|           'customLinkFilterRegex': | ||||
|               originalAdditionalSettings['intermediateLinkRegex'], | ||||
|           'filterByLinkText': | ||||
|               originalAdditionalSettings['intermediateLinkByText'] | ||||
|         } | ||||
|               originalAdditionalSettings['intermediateLinkByText'], | ||||
|         }, | ||||
|       ]; | ||||
|     } | ||||
|     if ((additionalSettings['intermediateLink']?.length ?? 0) > 0) { | ||||
| @@ -188,7 +201,8 @@ appJSONCompatibilityModifiers(Map<String, dynamic> json) { | ||||
|     if (legacySteamSourceApps.contains(additionalSettings['app'] ?? '')) { | ||||
|       json['url'] = '${json['url']}/mobile'; | ||||
|       var replacementAdditionalSettings = getDefaultValuesFromFormItems( | ||||
|           HTML().combinedAppSpecificSettingFormItems); | ||||
|         HTML().combinedAppSpecificSettingFormItems, | ||||
|       ); | ||||
|       for (var s in replacementAdditionalSettings.keys) { | ||||
|         if (additionalSettings.containsKey(s)) { | ||||
|           replacementAdditionalSettings[s] = additionalSettings[s]; | ||||
| @@ -212,7 +226,8 @@ appJSONCompatibilityModifiers(Map<String, dynamic> json) { | ||||
|         json['lastUpdateCheck'] != null) { | ||||
|       json['url'] = 'https://updates.signal.org/android/latest.json'; | ||||
|       var replacementAdditionalSettings = getDefaultValuesFromFormItems( | ||||
|           HTML().combinedAppSpecificSettingFormItems); | ||||
|         HTML().combinedAppSpecificSettingFormItems, | ||||
|       ); | ||||
|       replacementAdditionalSettings['versionExtractionRegEx'] = | ||||
|           '\\d+.\\d+.\\d+'; | ||||
|       additionalSettings = replacementAdditionalSettings; | ||||
| @@ -228,7 +243,8 @@ appJSONCompatibilityModifiers(Map<String, dynamic> json) { | ||||
|         json['lastUpdateCheck'] != null) { | ||||
|       json['url'] = 'https://whatsapp.com/android'; | ||||
|       var replacementAdditionalSettings = getDefaultValuesFromFormItems( | ||||
|           HTML().combinedAppSpecificSettingFormItems); | ||||
|         HTML().combinedAppSpecificSettingFormItems, | ||||
|       ); | ||||
|       replacementAdditionalSettings['refreshBeforeDownload'] = true; | ||||
|       additionalSettings = replacementAdditionalSettings; | ||||
|     } | ||||
| @@ -243,7 +259,8 @@ appJSONCompatibilityModifiers(Map<String, dynamic> json) { | ||||
|         json['lastUpdateCheck'] != null) { | ||||
|       json['url'] = 'https://www.videolan.org/vlc/download-android.html'; | ||||
|       var replacementAdditionalSettings = getDefaultValuesFromFormItems( | ||||
|           HTML().combinedAppSpecificSettingFormItems); | ||||
|         HTML().combinedAppSpecificSettingFormItems, | ||||
|       ); | ||||
|       replacementAdditionalSettings['refreshBeforeDownload'] = true; | ||||
|       replacementAdditionalSettings['intermediateLink'] = | ||||
|           <Map<String, dynamic>>[ | ||||
| @@ -252,15 +269,15 @@ appJSONCompatibilityModifiers(Map<String, dynamic> json) { | ||||
|               'filterByLinkText': true, | ||||
|               'skipSort': false, | ||||
|               'reverseSort': false, | ||||
|           'sortByLastLinkSegment': false | ||||
|               'sortByLastLinkSegment': false, | ||||
|             }, | ||||
|             { | ||||
|               'customLinkFilterRegex': 'arm64-v8a\\.apk\$', | ||||
|               'filterByLinkText': false, | ||||
|               'skipSort': false, | ||||
|               'reverseSort': false, | ||||
|           'sortByLastLinkSegment': false | ||||
|         } | ||||
|               'sortByLastLinkSegment': false, | ||||
|             }, | ||||
|           ]; | ||||
|       replacementAdditionalSettings['versionExtractionRegEx'] = | ||||
|           '/vlc-android/([^/]+)/'; | ||||
| @@ -277,8 +294,9 @@ appJSONCompatibilityModifiers(Map<String, dynamic> json) { | ||||
|     json['overrideSource'] = FDroid().runtimeType.toString(); | ||||
|   } else if (overrideSourceWasUndefined) { | ||||
|     // Similar to above, but for third-party F-Droid repos | ||||
|     RegExpMatch? match = RegExp('^https?://.+/fdroid/([^/]+(/|\\?)|[^/]+\$)') | ||||
|         .firstMatch(json['url'] as String); | ||||
|     RegExpMatch? match = RegExp( | ||||
|       '^https?://.+/fdroid/([^/]+(/|\\?)|[^/]+\$)', | ||||
|     ).firstMatch(json['url'] as String); | ||||
|     if (match != null) { | ||||
|       json['overrideSource'] = FDroidRepo().runtimeType.toString(); | ||||
|     } | ||||
| @@ -315,13 +333,14 @@ class App { | ||||
|     this.preferredApkIndex, | ||||
|     this.additionalSettings, | ||||
|     this.lastUpdateCheck, | ||||
|       this.pinned, | ||||
|       {this.categories = const [], | ||||
|     this.pinned, { | ||||
|     this.categories = const [], | ||||
|     this.releaseDate, | ||||
|     this.changeLog, | ||||
|     this.overrideSource, | ||||
|     this.allowIdChange = false, | ||||
|       this.otherAssetUrls = const []}); | ||||
|     this.otherAssetUrls = const [], | ||||
|   }); | ||||
|  | ||||
|   @override | ||||
|   String toString() { | ||||
| @@ -363,7 +382,8 @@ class App { | ||||
|     releaseDate: releaseDate, | ||||
|     overrideSource: overrideSource, | ||||
|     allowIdChange: allowIdChange, | ||||
|       otherAssetUrls: otherAssetUrls); | ||||
|     otherAssetUrls: otherAssetUrls, | ||||
|   ); | ||||
|  | ||||
|   factory App.fromJson(Map<String, dynamic> json) { | ||||
|     Map<String, dynamic> originalJSON = Map.from(json); | ||||
| @@ -372,7 +392,8 @@ class App { | ||||
|     } catch (e) { | ||||
|       json = originalJSON; | ||||
|       LogsProvider().add( | ||||
|           'Error running JSON compat modifiers: ${e.toString()}: ${originalJSON.toString()}'); | ||||
|         'Error running JSON compat modifiers: ${e.toString()}: ${originalJSON.toString()}', | ||||
|       ); | ||||
|     } | ||||
|     return App( | ||||
|       json['id'] as String, | ||||
| @@ -384,7 +405,8 @@ class App { | ||||
|           : json['installedVersion'] as String, | ||||
|       (json['latestVersion'] ?? tr('unknown')) as String, | ||||
|       assumed2DlistToStringMapList( | ||||
|           jsonDecode((json['apkUrls'] ?? '[["placeholder", "placeholder"]]'))), | ||||
|         jsonDecode((json['apkUrls'] ?? '[["placeholder", "placeholder"]]')), | ||||
|       ), | ||||
|       (json['preferredApkIndex'] ?? -1) as int, | ||||
|       jsonDecode(json['additionalSettings']) as Map<String, dynamic>, | ||||
|       json['lastUpdateCheck'] == null | ||||
| @@ -405,7 +427,8 @@ class App { | ||||
|       overrideSource: json['overrideSource'], | ||||
|       allowIdChange: json['allowIdChange'] ?? false, | ||||
|       otherAssetUrls: assumed2DlistToStringMapList( | ||||
|           jsonDecode((json['otherAssetUrls'] ?? '[]'))), | ||||
|         jsonDecode((json['otherAssetUrls'] ?? '[]')), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
|  | ||||
| @@ -426,12 +449,12 @@ class App { | ||||
|     'releaseDate': releaseDate?.microsecondsSinceEpoch, | ||||
|     'changeLog': changeLog, | ||||
|     'overrideSource': overrideSource, | ||||
|         'allowIdChange': allowIdChange | ||||
|     'allowIdChange': allowIdChange, | ||||
|   }; | ||||
| } | ||||
|  | ||||
| // Ensure the input is starts with HTTPS and has no WWW | ||||
| preStandardizeUrl(String url) { | ||||
| String preStandardizeUrl(String url) { | ||||
|   var firstDotIndex = url.indexOf('.'); | ||||
|   if (!(firstDotIndex >= 0 && firstDotIndex != url.length - 1)) { | ||||
|     throw UnsupportedURLError(); | ||||
| @@ -441,11 +464,13 @@ preStandardizeUrl(String url) { | ||||
|     url = 'https://$url'; | ||||
|   } | ||||
|   var uri = Uri.tryParse(url); | ||||
|   var trailingSlash = ((uri?.path.endsWith('/') ?? false) || | ||||
|   var trailingSlash = | ||||
|       ((uri?.path.endsWith('/') ?? false) || | ||||
|           ((uri?.path.isEmpty ?? false) && url.endsWith('/'))) && | ||||
|       (uri?.queryParameters.isEmpty ?? false); | ||||
|  | ||||
|   url = url | ||||
|   url = | ||||
|       url | ||||
|           .split('/') | ||||
|           .where((e) => e.isNotEmpty) | ||||
|           .join('/') | ||||
| @@ -457,8 +482,10 @@ preStandardizeUrl(String url) { | ||||
| String noAPKFound = tr('noAPKFound'); | ||||
|  | ||||
| List<String> getLinksFromParsedHTML( | ||||
|         Document dom, RegExp hrefPattern, String prependToLinks) => | ||||
|     dom | ||||
|   Document dom, | ||||
|   RegExp hrefPattern, | ||||
|   String prependToLinks, | ||||
| ) => dom | ||||
|     .querySelectorAll('a') | ||||
|     .where((element) { | ||||
|       if (element.attributes['href'] == null) return false; | ||||
| @@ -468,10 +495,13 @@ List<String> getLinksFromParsedHTML( | ||||
|     .toList(); | ||||
|  | ||||
| Map<String, dynamic> getDefaultValuesFromFormItems( | ||||
|     List<List<GeneratedFormItem>> items) { | ||||
|   return Map.fromEntries(items | ||||
|   List<List<GeneratedFormItem>> items, | ||||
| ) { | ||||
|   return Map.fromEntries( | ||||
|     items | ||||
|         .map((row) => row.map((el) => MapEntry(el.key, el.defaultValue ?? ''))) | ||||
|       .reduce((value, element) => [...value, ...element])); | ||||
|         .reduce((value, element) => [...value, ...element]), | ||||
|   ); | ||||
| } | ||||
|  | ||||
| List<MapEntry<String, String>> getApkUrlsFromUrls(List<String> urls) => | ||||
| @@ -482,7 +512,8 @@ List<MapEntry<String, String>> getApkUrlsFromUrls(List<String> urls) => | ||||
|     }).toList(); | ||||
|  | ||||
| Future<List<MapEntry<String, String>>> filterApksByArch( | ||||
|     List<MapEntry<String, String>> apkUrls) async { | ||||
|   List<MapEntry<String, String>> apkUrls, | ||||
| ) async { | ||||
|   if (apkUrls.length > 1) { | ||||
|     var abis = (await DeviceInfoPlugin().androidInfo).supportedAbis; | ||||
|     for (var abi in abis) { | ||||
| @@ -498,7 +529,7 @@ Future<List<MapEntry<String, String>>> filterApksByArch( | ||||
|   return apkUrls; | ||||
| } | ||||
|  | ||||
| getSourceRegex(List<String> hosts) { | ||||
| String getSourceRegex(List<String> hosts) { | ||||
|   return '(${hosts.join('|').replaceAll('.', '\\.')})'; | ||||
| } | ||||
|  | ||||
| @@ -511,20 +542,23 @@ HttpClient createHttpClient(bool insecure) { | ||||
|   return client; | ||||
| } | ||||
|  | ||||
| Future<MapEntry<HttpClient, HttpClientResponse>> sourceRequestStreamResponse( | ||||
| Future<MapEntry<Uri, MapEntry<HttpClient, HttpClientResponse>>> | ||||
| sourceRequestStreamResponse( | ||||
|   String method, | ||||
|   String url, | ||||
|   Map<String, String>? requestHeaders, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|     {bool followRedirects = true, | ||||
|     Object? postBody}) async { | ||||
|   Map<String, dynamic> additionalSettings, { | ||||
|   bool followRedirects = true, | ||||
|   Object? postBody, | ||||
| }) async { | ||||
|   var currentUrl = Uri.parse(url); | ||||
|   var redirectCount = 0; | ||||
|   const maxRedirects = 10; | ||||
|   List<Cookie> cookies = []; | ||||
|   while (redirectCount < maxRedirects) { | ||||
|     var httpClient = | ||||
|         createHttpClient(additionalSettings['allowInsecure'] == true); | ||||
|     var httpClient = createHttpClient( | ||||
|       additionalSettings['allowInsecure'] == true, | ||||
|     ); | ||||
|     var request = await httpClient.openUrl(method, currentUrl); | ||||
|     if (requestHeaders != null) { | ||||
|       requestHeaders.forEach((key, value) { | ||||
| @@ -551,16 +585,21 @@ Future<MapEntry<HttpClient, HttpClientResponse>> sourceRequestStreamResponse( | ||||
|       } | ||||
|     } | ||||
|  | ||||
|     return MapEntry(httpClient, response); | ||||
|     return MapEntry(currentUrl, MapEntry(httpClient, response)); | ||||
|   } | ||||
|   throw ObtainiumError('Too many redirects ($maxRedirects)'); | ||||
| } | ||||
|  | ||||
| Future<Response> httpClientResponseStreamToFinalResponse(HttpClient httpClient, | ||||
|     String method, String url, HttpClientResponse response) async { | ||||
|   final bytes = | ||||
|       (await response.fold<BytesBuilder>(BytesBuilder(), (b, d) => b..add(d))) | ||||
|           .toBytes(); | ||||
| Future<Response> httpClientResponseStreamToFinalResponse( | ||||
|   HttpClient httpClient, | ||||
|   String method, | ||||
|   String url, | ||||
|   HttpClientResponse response, | ||||
| ) async { | ||||
|   final bytes = (await response.fold<BytesBuilder>( | ||||
|     BytesBuilder(), | ||||
|     (b, d) => b..add(d), | ||||
|   )).toBytes(); | ||||
|  | ||||
|   final headers = <String, String>{}; | ||||
|   response.headers.forEach((name, values) { | ||||
| @@ -598,11 +637,14 @@ abstract class AppSource { | ||||
|     name = runtimeType.toString(); | ||||
|   } | ||||
|  | ||||
|   overrideAdditionalAppSpecificSourceAgnosticSettingSwitch(String key, | ||||
|       {bool disabled = true, bool defaultValue = true}) { | ||||
|   void overrideAdditionalAppSpecificSourceAgnosticSettingSwitch( | ||||
|     String key, { | ||||
|     bool disabled = true, | ||||
|     bool defaultValue = true, | ||||
|   }) { | ||||
|     additionalAppSpecificSourceAgnosticSettingFormItemsNeverUseDirectly = | ||||
|         additionalAppSpecificSourceAgnosticSettingFormItemsNeverUseDirectly | ||||
|             .map((e) { | ||||
|         additionalAppSpecificSourceAgnosticSettingFormItemsNeverUseDirectly.map( | ||||
|           (e) { | ||||
|             return e.map((e2) { | ||||
|               if (e2.key == key) { | ||||
|                 var item = e2 as GeneratedFormSwitch; | ||||
| @@ -611,7 +653,8 @@ abstract class AppSource { | ||||
|               } | ||||
|               return e2; | ||||
|             }).toList(); | ||||
|     }).toList(); | ||||
|           }, | ||||
|         ).toList(); | ||||
|   } | ||||
|  | ||||
|   String standardizeUrl(String url) { | ||||
| @@ -623,8 +666,9 @@ abstract class AppSource { | ||||
|   } | ||||
|  | ||||
|   Future<Map<String, String>?> getRequestHeaders( | ||||
|       Map<String, dynamic> additionalSettings, | ||||
|       {bool forAPKDownload = false}) async { | ||||
|     Map<String, dynamic> additionalSettings, { | ||||
|     bool forAPKDownload = false, | ||||
|   }) async { | ||||
|     return null; | ||||
|   } | ||||
|  | ||||
| @@ -633,18 +677,28 @@ abstract class AppSource { | ||||
|   } | ||||
|  | ||||
|   Future<Response> sourceRequest( | ||||
|       String url, Map<String, dynamic> additionalSettings, | ||||
|       {bool followRedirects = true, Object? postBody}) async { | ||||
|     String url, | ||||
|     Map<String, dynamic> additionalSettings, { | ||||
|     bool followRedirects = true, | ||||
|     Object? postBody, | ||||
|   }) async { | ||||
|     var method = postBody == null ? 'GET' : 'POST'; | ||||
|     var requestHeaders = await getRequestHeaders(additionalSettings); | ||||
|     var streamedResponseAndClient = await sourceRequestStreamResponse( | ||||
|         method, url, requestHeaders, additionalSettings, | ||||
|         followRedirects: followRedirects, postBody: postBody); | ||||
|     return await httpClientResponseStreamToFinalResponse( | ||||
|         streamedResponseAndClient.key, | ||||
|     var streamedResponseUrlWithResponseAndClient = | ||||
|         await sourceRequestStreamResponse( | ||||
|           method, | ||||
|           url, | ||||
|         streamedResponseAndClient.value); | ||||
|           requestHeaders, | ||||
|           additionalSettings, | ||||
|           followRedirects: followRedirects, | ||||
|           postBody: postBody, | ||||
|         ); | ||||
|     return await httpClientResponseStreamToFinalResponse( | ||||
|       streamedResponseUrlWithResponseAndClient.value.key, | ||||
|       method, | ||||
|       streamedResponseUrlWithResponseAndClient.key.toString(), | ||||
|       streamedResponseUrlWithResponseAndClient.value.value, | ||||
|     ); | ||||
|   } | ||||
|  | ||||
|   void runOnAddAppInputChange(String inputUrl) { | ||||
| @@ -656,7 +710,9 @@ abstract class AppSource { | ||||
|   } | ||||
|  | ||||
|   Future<APKDetails> getLatestAPKDetails( | ||||
|       String standardUrl, Map<String, dynamic> additionalSettings) { | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) { | ||||
|     throw NotImplementedError(); | ||||
|   } | ||||
|  | ||||
| @@ -667,120 +723,159 @@ abstract class AppSource { | ||||
|   // Some additional data may be needed for Apps regardless of Source | ||||
|   List<List<GeneratedFormItem>> | ||||
|   additionalAppSpecificSourceAgnosticSettingFormItemsNeverUseDirectly = [ | ||||
|     [GeneratedFormSwitch('trackOnly', label: tr('trackOnly'))], | ||||
|     [ | ||||
|       GeneratedFormSwitch( | ||||
|         'trackOnly', | ||||
|         label: tr('trackOnly'), | ||||
|       ) | ||||
|     ], | ||||
|     [ | ||||
|       GeneratedFormTextField('versionExtractionRegEx', | ||||
|       GeneratedFormTextField( | ||||
|         'versionExtractionRegEx', | ||||
|         label: tr('trimVersionString'), | ||||
|         required: false, | ||||
|           additionalValidators: [(value) => regExValidator(value)]), | ||||
|         additionalValidators: [(value) => regExValidator(value)], | ||||
|       ), | ||||
|     ], | ||||
|     [ | ||||
|       GeneratedFormTextField('matchGroupToUse', | ||||
|       GeneratedFormTextField( | ||||
|         'matchGroupToUse', | ||||
|         label: tr('matchGroupToUseForX', args: [tr('trimVersionString')]), | ||||
|         required: false, | ||||
|           hint: '\$0') | ||||
|         hint: '\$0', | ||||
|       ), | ||||
|     ], | ||||
|     [ | ||||
|       GeneratedFormSwitch('versionDetection', | ||||
|           label: tr('versionDetectionExplanation'), defaultValue: true) | ||||
|       GeneratedFormSwitch( | ||||
|         'versionDetection', | ||||
|         label: tr('versionDetectionExplanation'), | ||||
|         defaultValue: true, | ||||
|       ), | ||||
|     ], | ||||
|     [ | ||||
|       GeneratedFormSwitch('useVersionCodeAsOSVersion', | ||||
|           label: tr('useVersionCodeAsOSVersion'), defaultValue: false) | ||||
|       GeneratedFormSwitch( | ||||
|         'useVersionCodeAsOSVersion', | ||||
|         label: tr('useVersionCodeAsOSVersion'), | ||||
|         defaultValue: false, | ||||
|       ), | ||||
|     ], | ||||
|     [ | ||||
|       GeneratedFormTextField('apkFilterRegEx', | ||||
|       GeneratedFormTextField( | ||||
|         'apkFilterRegEx', | ||||
|         label: tr('filterAPKsByRegEx'), | ||||
|         required: false, | ||||
|         additionalValidators: [ | ||||
|           (value) { | ||||
|             return regExValidator(value); | ||||
|             } | ||||
|           ]) | ||||
|           }, | ||||
|         ], | ||||
|       ), | ||||
|     ], | ||||
|     [ | ||||
|       GeneratedFormSwitch('invertAPKFilter', | ||||
|       GeneratedFormSwitch( | ||||
|         'invertAPKFilter', | ||||
|         label: '${tr('invertRegEx')} (${tr('filterAPKsByRegEx')})', | ||||
|           defaultValue: false) | ||||
|         defaultValue: false, | ||||
|       ), | ||||
|     ], | ||||
|     [ | ||||
|       GeneratedFormSwitch('autoApkFilterByArch', | ||||
|           label: tr('autoApkFilterByArch'), defaultValue: true) | ||||
|       GeneratedFormSwitch( | ||||
|         'autoApkFilterByArch', | ||||
|         label: tr('autoApkFilterByArch'), | ||||
|         defaultValue: true, | ||||
|       ), | ||||
|     ], | ||||
|     [GeneratedFormTextField('appName', label: tr('appName'), required: false)], | ||||
|     [GeneratedFormTextField('appAuthor', label: tr('author'), required: false)], | ||||
|     [ | ||||
|       GeneratedFormSwitch('shizukuPretendToBeGooglePlay', | ||||
|           label: tr('shizukuPretendToBeGooglePlay'), defaultValue: false) | ||||
|       GeneratedFormSwitch( | ||||
|         'shizukuPretendToBeGooglePlay', | ||||
|         label: tr('shizukuPretendToBeGooglePlay'), | ||||
|         defaultValue: false, | ||||
|       ), | ||||
|     ], | ||||
|     [ | ||||
|       GeneratedFormSwitch('allowInsecure', | ||||
|           label: tr('allowInsecure'), defaultValue: false) | ||||
|       GeneratedFormSwitch( | ||||
|         'allowInsecure', | ||||
|         label: tr('allowInsecure'), | ||||
|         defaultValue: false, | ||||
|       ), | ||||
|     ], | ||||
|     [ | ||||
|       GeneratedFormSwitch('exemptFromBackgroundUpdates', | ||||
|           label: tr('exemptFromBackgroundUpdates')) | ||||
|       GeneratedFormSwitch( | ||||
|         'exemptFromBackgroundUpdates', | ||||
|         label: tr('exemptFromBackgroundUpdates'), | ||||
|       ), | ||||
|     ], | ||||
|     [ | ||||
|       GeneratedFormSwitch('skipUpdateNotifications', | ||||
|           label: tr('skipUpdateNotifications')) | ||||
|       GeneratedFormSwitch( | ||||
|         'skipUpdateNotifications', | ||||
|         label: tr('skipUpdateNotifications'), | ||||
|       ), | ||||
|     ], | ||||
|     [GeneratedFormTextField('about', label: tr('about'), required: false)], | ||||
|     [ | ||||
|       GeneratedFormSwitch('refreshBeforeDownload', | ||||
|           label: tr('refreshBeforeDownload')) | ||||
|     ] | ||||
|       GeneratedFormSwitch( | ||||
|         'refreshBeforeDownload', | ||||
|         label: tr('refreshBeforeDownload'), | ||||
|       ), | ||||
|     ], | ||||
|   ]; | ||||
|  | ||||
|   // Previous 2 variables combined into one at runtime for convenient usage | ||||
|   List<List<GeneratedFormItem>> get combinedAppSpecificSettingFormItems { | ||||
|     if (showReleaseDateAsVersionToggle == true) { | ||||
|       if (additionalAppSpecificSourceAgnosticSettingFormItemsNeverUseDirectly | ||||
|               .indexWhere((List<GeneratedFormItem> e) => | ||||
|                   e.indexWhere((GeneratedFormItem i) => | ||||
|                       i.key == 'releaseDateAsVersion') >= | ||||
|                   0) < | ||||
|               .indexWhere( | ||||
|                 (List<GeneratedFormItem> e) => | ||||
|                     e.indexWhere( | ||||
|                       (GeneratedFormItem i) => i.key == 'releaseDateAsVersion', | ||||
|                     ) >= | ||||
|                     0, | ||||
|               ) < | ||||
|           0) { | ||||
|         additionalAppSpecificSourceAgnosticSettingFormItemsNeverUseDirectly.insert( | ||||
|         additionalAppSpecificSourceAgnosticSettingFormItemsNeverUseDirectly | ||||
|                     .indexWhere((List<GeneratedFormItem> e) => | ||||
|                         e.indexWhere((GeneratedFormItem i) => | ||||
|                             i.key == 'versionDetection') >= | ||||
|                         0) + | ||||
|             .insert( | ||||
|               additionalAppSpecificSourceAgnosticSettingFormItemsNeverUseDirectly | ||||
|                       .indexWhere( | ||||
|                         (List<GeneratedFormItem> e) => | ||||
|                             e.indexWhere( | ||||
|                               (GeneratedFormItem i) => | ||||
|                                   i.key == 'versionDetection', | ||||
|                             ) >= | ||||
|                             0, | ||||
|                       ) + | ||||
|                   1, | ||||
|               [ | ||||
|               GeneratedFormSwitch('releaseDateAsVersion', | ||||
|                 GeneratedFormSwitch( | ||||
|                   'releaseDateAsVersion', | ||||
|                   label: | ||||
|                       '${tr('releaseDateAsVersion')} (${tr('pseudoVersion')})', | ||||
|                   defaultValue: false) | ||||
|             ]); | ||||
|                   defaultValue: false, | ||||
|                 ), | ||||
|               ], | ||||
|             ); | ||||
|       } | ||||
|     } | ||||
|     additionalAppSpecificSourceAgnosticSettingFormItemsNeverUseDirectly = | ||||
|         additionalAppSpecificSourceAgnosticSettingFormItemsNeverUseDirectly | ||||
|             .map((e) => e | ||||
|             .map( | ||||
|               (e) => e | ||||
|                   .where((ee) => !excludeCommonSettingKeys.contains(ee.key)) | ||||
|                 .toList()) | ||||
|                   .toList(), | ||||
|             ) | ||||
|             .where((e) => e.isNotEmpty) | ||||
|             .toList(); | ||||
|     if (versionDetectionDisallowed) { | ||||
|       overrideAdditionalAppSpecificSourceAgnosticSettingSwitch( | ||||
|         'versionDetection', | ||||
|         disabled: true, | ||||
|           defaultValue: false); | ||||
|         defaultValue: false, | ||||
|       ); | ||||
|       overrideAdditionalAppSpecificSourceAgnosticSettingSwitch( | ||||
|         'useVersionCodeAsOSVersion', | ||||
|         disabled: true, | ||||
|           defaultValue: false); | ||||
|         defaultValue: false, | ||||
|       ); | ||||
|     } | ||||
|     return [ | ||||
|       ...additionalSourceAppSpecificSettingFormItems, | ||||
|       ...additionalAppSpecificSourceAgnosticSettingFormItemsNeverUseDirectly | ||||
|       ...additionalAppSpecificSourceAgnosticSettingFormItemsNeverUseDirectly, | ||||
|     ]; | ||||
|   } | ||||
|  | ||||
| @@ -789,7 +884,8 @@ abstract class AppSource { | ||||
|   List<GeneratedFormItem> sourceConfigSettingFormItems = []; | ||||
|   Future<Map<String, String>> getSourceConfigValues( | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|       SettingsProvider settingsProvider) async { | ||||
|     SettingsProvider settingsProvider, | ||||
|   ) async { | ||||
|     Map<String, String> results = {}; | ||||
|     for (var e in sourceConfigSettingFormItems) { | ||||
|       var val = hostChanged && !hostIdenticalDespiteAnyChange | ||||
| @@ -811,31 +907,40 @@ abstract class AppSource { | ||||
|     return null; | ||||
|   } | ||||
|  | ||||
|   Future<String> apkUrlPrefetchModifier(String apkUrl, String standardUrl, | ||||
|       Map<String, dynamic> additionalSettings) async { | ||||
|   Future<String> apkUrlPrefetchModifier( | ||||
|     String apkUrl, | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     return apkUrl; | ||||
|   } | ||||
|  | ||||
|   bool canSearch = false; | ||||
|   bool includeAdditionalOptsInMainSearch = false; | ||||
|   List<GeneratedFormItem> searchQuerySettingFormItems = []; | ||||
|   Future<Map<String, List<String>>> search(String query, | ||||
|       {Map<String, dynamic> querySettings = const {}}) { | ||||
|   Future<Map<String, List<String>>> search( | ||||
|     String query, { | ||||
|     Map<String, dynamic> querySettings = const {}, | ||||
|   }) { | ||||
|     throw NotImplementedError(); | ||||
|   } | ||||
|  | ||||
|   Future<String?> tryInferringAppId(String standardUrl, | ||||
|       {Map<String, dynamic> additionalSettings = const {}}) async { | ||||
|   Future<String?> tryInferringAppId( | ||||
|     String standardUrl, { | ||||
|     Map<String, dynamic> additionalSettings = const {}, | ||||
|   }) async { | ||||
|     return null; | ||||
|   } | ||||
| } | ||||
|  | ||||
| ObtainiumError getObtainiumHttpError(Response res) { | ||||
|   return ObtainiumError((res.reasonPhrase != null && | ||||
|   return ObtainiumError( | ||||
|     (res.reasonPhrase != null && | ||||
|             res.reasonPhrase != null && | ||||
|             res.reasonPhrase!.isNotEmpty) | ||||
|         ? res.reasonPhrase! | ||||
|       : tr('errorWithHttpStatusCode', args: [res.statusCode.toString()])); | ||||
|         : tr('errorWithHttpStatusCode', args: [res.statusCode.toString()]), | ||||
|   ); | ||||
| } | ||||
|  | ||||
| abstract class MassAppUrlSource { | ||||
| @@ -844,7 +949,7 @@ abstract class MassAppUrlSource { | ||||
|   Future<Map<String, List<String>>> getUrlsWithDescriptions(List<String> args); | ||||
| } | ||||
|  | ||||
| regExValidator(String? value) { | ||||
| String? regExValidator(String? value) { | ||||
|   if (value == null || value.isEmpty) { | ||||
|     return null; | ||||
|   } | ||||
| @@ -856,7 +961,7 @@ regExValidator(String? value) { | ||||
|   return null; | ||||
| } | ||||
|  | ||||
| intValidator(String? value, {bool positive = false}) { | ||||
| String? intValidator(String? value, {bool positive = false}) { | ||||
|   if (value == null) { | ||||
|     return tr('invalidInput'); | ||||
|   } | ||||
| @@ -875,7 +980,7 @@ bool isTempId(App app) { | ||||
|   return RegExp('^[0-9]+\$').hasMatch(app.id); | ||||
| } | ||||
|  | ||||
| replaceMatchGroupsInString(RegExpMatch match, String matchGroupString) { | ||||
| String? replaceMatchGroupsInString(RegExpMatch match, String matchGroupString) { | ||||
|   if (RegExp('^\\d+\$').hasMatch(matchGroupString)) { | ||||
|     matchGroupString = '\$$matchGroupString'; | ||||
|   } | ||||
| @@ -904,8 +1009,11 @@ replaceMatchGroupsInString(RegExpMatch match, String matchGroupString) { | ||||
|   return outputString; | ||||
| } | ||||
|  | ||||
| String? extractVersion(String? versionExtractionRegEx, String? matchGroupString, | ||||
|     String stringToCheck) { | ||||
| String? extractVersion( | ||||
|   String? versionExtractionRegEx, | ||||
|   String? matchGroupString, | ||||
|   String stringToCheck, | ||||
| ) { | ||||
|   if (versionExtractionRegEx?.isNotEmpty == true) { | ||||
|     String? version = stringToCheck; | ||||
|     var match = RegExp(versionExtractionRegEx!).allMatches(version); | ||||
| @@ -929,7 +1037,8 @@ String? extractVersion(String? versionExtractionRegEx, String? matchGroupString, | ||||
| List<MapEntry<String, String>> filterApks( | ||||
|   List<MapEntry<String, String>> apkUrls, | ||||
|   String? apkFilterRegEx, | ||||
|     bool? invert) { | ||||
|   bool? invert, | ||||
| ) { | ||||
|   if (apkFilterRegEx?.isNotEmpty == true) { | ||||
|     var reg = RegExp(apkFilterRegEx!); | ||||
|     apkUrls = apkUrls.where((element) { | ||||
| @@ -940,6 +1049,11 @@ List<MapEntry<String, String>> filterApks( | ||||
|   return apkUrls; | ||||
| } | ||||
|  | ||||
| bool isVersionPseudo(App app) => | ||||
|     app.additionalSettings['trackOnly'] == true || | ||||
|     (app.installedVersion != null && | ||||
|         app.additionalSettings['versionDetection'] != true); | ||||
|  | ||||
| class SourceProvider { | ||||
|   // Add more source classes here so they are available via the service | ||||
|   List<AppSource> get sources => [ | ||||
| @@ -963,7 +1077,7 @@ class SourceProvider { | ||||
|     TelegramApp(), | ||||
|     NeutronCode(), | ||||
|     DirectAPKLink(), | ||||
|         HTML() // This should ALWAYS be the last option as they are tried in order | ||||
|     HTML(), // This should ALWAYS be the last option as they are tried in order | ||||
|   ]; | ||||
|  | ||||
|   // Add more mass url source classes here so they are available via the service | ||||
| @@ -972,8 +1086,9 @@ class SourceProvider { | ||||
|   AppSource getSource(String url, {String? overrideSource}) { | ||||
|     url = preStandardizeUrl(url); | ||||
|     if (overrideSource != null) { | ||||
|       var srcs = | ||||
|           sources.where((e) => e.runtimeType.toString() == overrideSource); | ||||
|       var srcs = sources.where( | ||||
|         (e) => e.runtimeType.toString() == overrideSource, | ||||
|       ); | ||||
|       if (srcs.isEmpty) { | ||||
|         throw UnsupportedURLError(); | ||||
|       } | ||||
| @@ -991,8 +1106,8 @@ class SourceProvider { | ||||
|     for (var s in sources.where((element) => element.hosts.isNotEmpty)) { | ||||
|       try { | ||||
|         if (RegExp( | ||||
|                 '^${s.allowSubDomains ? '([^\\.]+\\.)*' : '(www\\.)?'}(${getSourceRegex(s.hosts)})\$') | ||||
|             .hasMatch(Uri.parse(url).host)) { | ||||
|           '^${s.allowSubDomains ? '([^\\.]+\\.)*' : '(www\\.)?'}(${getSourceRegex(s.hosts)})\$', | ||||
|         ).hasMatch(Uri.parse(url).host)) { | ||||
|           source = s; | ||||
|           break; | ||||
|         } | ||||
| @@ -1002,7 +1117,8 @@ class SourceProvider { | ||||
|     } | ||||
|     if (source == null) { | ||||
|       for (var s in sources.where( | ||||
|           (element) => element.hosts.isEmpty && !element.neverAutoSelect)) { | ||||
|         (element) => element.hosts.isEmpty && !element.neverAutoSelect, | ||||
|       )) { | ||||
|         try { | ||||
|           s.sourceSpecificStandardizeURL(url, forSelection: true); | ||||
|           source = s; | ||||
| @@ -1030,22 +1146,28 @@ class SourceProvider { | ||||
|   } | ||||
|  | ||||
|   String generateTempID( | ||||
|           String standardUrl, Map<String, dynamic> additionalSettings) => | ||||
|       (standardUrl + additionalSettings.toString()).hashCode.toString(); | ||||
|     String standardUrl, | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) => (standardUrl + additionalSettings.toString()).hashCode.toString(); | ||||
|  | ||||
|   Future<App> getApp( | ||||
|       AppSource source, String url, Map<String, dynamic> additionalSettings, | ||||
|       {App? currentApp, | ||||
|     AppSource source, | ||||
|     String url, | ||||
|     Map<String, dynamic> additionalSettings, { | ||||
|     App? currentApp, | ||||
|     bool trackOnlyOverride = false, | ||||
|     bool sourceIsOverriden = false, | ||||
|       bool inferAppIdIfOptional = false}) async { | ||||
|     bool inferAppIdIfOptional = false, | ||||
|   }) async { | ||||
|     if (trackOnlyOverride || source.enforceTrackOnly) { | ||||
|       additionalSettings['trackOnly'] = true; | ||||
|     } | ||||
|     var trackOnly = additionalSettings['trackOnly'] == true; | ||||
|     String standardUrl = source.standardizeUrl(url); | ||||
|     APKDetails apk = | ||||
|         await source.getLatestAPKDetails(standardUrl, additionalSettings); | ||||
|     APKDetails apk = await source.getLatestAPKDetails( | ||||
|       standardUrl, | ||||
|       additionalSettings, | ||||
|     ); | ||||
|  | ||||
|     if (source.runtimeType != | ||||
|             HTML().runtimeType && // Some sources do it separately | ||||
| @@ -1053,7 +1175,8 @@ class SourceProvider { | ||||
|       String? extractedVersion = extractVersion( | ||||
|         additionalSettings['versionExtractionRegEx'] as String?, | ||||
|         additionalSettings['matchGroupToUse'] as String?, | ||||
|           apk.version); | ||||
|         apk.version, | ||||
|       ); | ||||
|       if (extractedVersion != null) { | ||||
|         apk.version = extractedVersion; | ||||
|       } | ||||
| @@ -1063,8 +1186,11 @@ class SourceProvider { | ||||
|         apk.releaseDate != null) { | ||||
|       apk.version = apk.releaseDate!.microsecondsSinceEpoch.toString(); | ||||
|     } | ||||
|     apk.apkUrls = filterApks(apk.apkUrls, additionalSettings['apkFilterRegEx'], | ||||
|         additionalSettings['invertAPKFilter']); | ||||
|     apk.apkUrls = filterApks( | ||||
|       apk.apkUrls, | ||||
|       additionalSettings['apkFilterRegEx'], | ||||
|       additionalSettings['invertAPKFilter'], | ||||
|     ); | ||||
|     if (apk.apkUrls.isEmpty && !trackOnly) { | ||||
|       throw NoAPKError(); | ||||
|     } | ||||
| @@ -1081,8 +1207,10 @@ class SourceProvider { | ||||
|           (!trackOnly && | ||||
|                   (!source.appIdInferIsOptional || | ||||
|                       (source.appIdInferIsOptional && inferAppIdIfOptional)) | ||||
|                 ? await source.tryInferringAppId(standardUrl, | ||||
|                     additionalSettings: additionalSettings) | ||||
|               ? await source.tryInferringAppId( | ||||
|                   standardUrl, | ||||
|                   additionalSettings: additionalSettings, | ||||
|                 ) | ||||
|               : null) ?? | ||||
|           generateTempID(standardUrl, additionalSettings), | ||||
|       standardUrl, | ||||
| @@ -1101,20 +1229,24 @@ class SourceProvider { | ||||
|       overrideSource: sourceIsOverriden | ||||
|           ? source.runtimeType.toString() | ||||
|           : currentApp?.overrideSource, | ||||
|         allowIdChange: currentApp?.allowIdChange ?? | ||||
|       allowIdChange: | ||||
|           currentApp?.allowIdChange ?? | ||||
|           trackOnly || | ||||
|               (source.appIdInferIsOptional && | ||||
|                   inferAppIdIfOptional), // Optional ID inferring may be incorrect - allow correction on first install | ||||
|       otherAssetUrls: apk.allAssetUrls | ||||
|           .where((a) => apk.apkUrls.indexWhere((p) => a.key == p.key) < 0) | ||||
|             .toList()); | ||||
|           .toList(), | ||||
|     ); | ||||
|     return source.endOfGetAppChanges(finalApp); | ||||
|   } | ||||
|  | ||||
|   // Returns errors in [results, errors] instead of throwing them | ||||
|   Future<List<dynamic>> getAppsByURLNaive(List<String> urls, | ||||
|       {List<String> alreadyAddedUrls = const [], | ||||
|       AppSource? sourceOverride}) async { | ||||
|   Future<List<dynamic>> getAppsByURLNaive( | ||||
|     List<String> urls, { | ||||
|     List<String> alreadyAddedUrls = const [], | ||||
|     AppSource? sourceOverride, | ||||
|   }) async { | ||||
|     List<App> apps = []; | ||||
|     Map<String, dynamic> errors = {}; | ||||
|     for (var url in urls) { | ||||
| @@ -1123,12 +1255,16 @@ class SourceProvider { | ||||
|           throw ObtainiumError(tr('appAlreadyAdded')); | ||||
|         } | ||||
|         var source = sourceOverride ?? getSource(url); | ||||
|         apps.add(await getApp( | ||||
|         apps.add( | ||||
|           await getApp( | ||||
|             source, | ||||
|             url, | ||||
|             sourceIsOverriden: sourceOverride != null, | ||||
|             getDefaultValuesFromFormItems( | ||||
|                 source.combinedAppSpecificSettingFormItems))); | ||||
|               source.combinedAppSpecificSettingFormItems, | ||||
|             ), | ||||
|           ), | ||||
|         ); | ||||
|       } catch (e) { | ||||
|         errors.addAll(<String, dynamic>{url: e}); | ||||
|       } | ||||
|   | ||||
							
								
								
									
										128
									
								
								pubspec.lock
									
									
									
									
									
								
							
							
						
						
									
										128
									
								
								pubspec.lock
									
									
									
									
									
								
							| @@ -76,14 +76,6 @@ packages: | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "1.0.4" | ||||
|   archive: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: archive | ||||
|       sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "4.0.7" | ||||
|   args: | ||||
|     dependency: transitive | ||||
|     description: | ||||
| @@ -96,10 +88,10 @@ packages: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: async | ||||
|       sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 | ||||
|       sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "2.12.0" | ||||
|     version: "2.13.0" | ||||
|   background_fetch: | ||||
|     dependency: "direct main" | ||||
|     description: | ||||
| @@ -148,22 +140,6 @@ packages: | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "1.4.0" | ||||
|   checked_yaml: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: checked_yaml | ||||
|       sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "2.0.3" | ||||
|   cli_util: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: cli_util | ||||
|       sha256: ff6785f7e9e3c38ac98b2fb035701789de90154024a75b6cb926445e83197d1c | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "0.4.2" | ||||
|   clock: | ||||
|     dependency: transitive | ||||
|     description: | ||||
| @@ -288,10 +264,10 @@ packages: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: fake_async | ||||
|       sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" | ||||
|       sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "1.3.2" | ||||
|     version: "1.3.3" | ||||
|   ffi: | ||||
|     dependency: transitive | ||||
|     description: | ||||
| @@ -312,10 +288,10 @@ packages: | ||||
|     dependency: "direct main" | ||||
|     description: | ||||
|       name: file_picker | ||||
|       sha256: "77f8e81d22d2a07d0dee2c62e1dda71dc1da73bf43bb2d45af09727406167964" | ||||
|       sha256: ef9908739bdd9c476353d6adff72e88fd00c625f5b959ae23f7567bd5137db0a | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "10.1.9" | ||||
|     version: "10.2.0" | ||||
|   fixnum: | ||||
|     dependency: transitive | ||||
|     description: | ||||
| @@ -449,22 +425,14 @@ packages: | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "1.0.0" | ||||
|   flutter_launcher_icons: | ||||
|     dependency: "direct dev" | ||||
|     description: | ||||
|       name: flutter_launcher_icons | ||||
|       sha256: bfa04787c85d80ecb3f8777bde5fc10c3de809240c48fa061a2c2bf15ea5211c | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "0.14.3" | ||||
|   flutter_lints: | ||||
|     dependency: "direct dev" | ||||
|     dependency: "direct main" | ||||
|     description: | ||||
|       name: flutter_lints | ||||
|       sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1" | ||||
|       sha256: "3105dc8492f6183fb076ccf1f351ac3d60564bff92e20bfc4af9cc1651f4e7e1" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "5.0.0" | ||||
|     version: "6.0.0" | ||||
|   flutter_local_notifications: | ||||
|     dependency: "direct main" | ||||
|     description: | ||||
| @@ -511,7 +479,7 @@ packages: | ||||
|     source: hosted | ||||
|     version: "2.0.28" | ||||
|   flutter_test: | ||||
|     dependency: "direct dev" | ||||
|     dependency: transitive | ||||
|     description: flutter | ||||
|     source: sdk | ||||
|     version: "0.0.0" | ||||
| @@ -584,38 +552,22 @@ packages: | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "4.1.2" | ||||
|   image: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: image | ||||
|       sha256: "4e973fcf4caae1a4be2fa0a13157aa38a8f9cb049db6529aa00b4d71abc4d928" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "4.5.4" | ||||
|   intl: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: intl | ||||
|       sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf | ||||
|       sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "0.19.0" | ||||
|   json_annotation: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: json_annotation | ||||
|       sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "4.9.0" | ||||
|     version: "0.20.2" | ||||
|   leak_tracker: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: leak_tracker | ||||
|       sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec | ||||
|       sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "10.0.8" | ||||
|     version: "10.0.9" | ||||
|   leak_tracker_flutter_testing: | ||||
|     dependency: transitive | ||||
|     description: | ||||
| @@ -636,10 +588,10 @@ packages: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: lints | ||||
|       sha256: c35bb79562d980e9a453fc715854e1ed39e24e7d0297a880ef54e17f9874a9d7 | ||||
|       sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0 | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "5.1.1" | ||||
|     version: "6.0.0" | ||||
|   markdown: | ||||
|     dependency: "direct main" | ||||
|     description: | ||||
| @@ -852,18 +804,10 @@ packages: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: pointer_interceptor_web | ||||
|       sha256: "7a7087782110f8c1827170660b09f8aa893e0e9a61431dbbe2ac3fc482e8c044" | ||||
|       sha256: "460b600e71de6fcea2b3d5f662c92293c049c4319e27f0829310e5a953b3ee2a" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "0.10.2+1" | ||||
|   posix: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: posix | ||||
|       sha256: f0d7856b6ca1887cfa6d1d394056a296ae33489db914e365e2044fdada449e62 | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "6.0.2" | ||||
|     version: "0.10.3" | ||||
|   provider: | ||||
|     dependency: "direct main" | ||||
|     description: | ||||
| @@ -949,7 +893,7 @@ packages: | ||||
|     description: | ||||
|       path: "." | ||||
|       ref: master | ||||
|       resolved-ref: "8784c39b909324df8913dd30fa416b8a50d55f49" | ||||
|       resolved-ref: "012e22791138958e089f6c1a8d6c4c6943a9f253" | ||||
|       url: "https://github.com/AlexBacich/shared-storage" | ||||
|     source: git | ||||
|     version: "0.7.0" | ||||
| @@ -1179,10 +1123,10 @@ packages: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: vm_service | ||||
|       sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" | ||||
|       sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "14.3.1" | ||||
|     version: "15.0.0" | ||||
|   web: | ||||
|     dependency: transitive | ||||
|     description: | ||||
| @@ -1195,42 +1139,42 @@ packages: | ||||
|     dependency: "direct main" | ||||
|     description: | ||||
|       name: webview_flutter | ||||
|       sha256: "62d763c27ce7f6cef04b3bec01c85a28d60149bffd155884aa4b8fd4941ea2e4" | ||||
|       sha256: c3e4fe614b1c814950ad07186007eff2f2e5dd2935eba7b9a9a1af8e5885f1ba | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "4.12.0" | ||||
|     version: "4.13.0" | ||||
|   webview_flutter_android: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: webview_flutter_android | ||||
|       sha256: "5ece28a317a9f76ad5ee17c78dbacc8a491687cec85ee19c1643761bf8d678ef" | ||||
|       sha256: f6e6afef6e234801da77170f7a1847ded8450778caf2fe13979d140484be3678 | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "4.6.0" | ||||
|     version: "4.7.0" | ||||
|   webview_flutter_platform_interface: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: webview_flutter_platform_interface | ||||
|       sha256: "7cb32b21825bd65569665c32bb00a34ded5779786d6201f5350979d2d529940d" | ||||
|       sha256: f0dc2dc3a2b1e3a6abdd6801b9355ebfeb3b8f6cde6b9dc7c9235909c4a1f147 | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "2.13.0" | ||||
|     version: "2.13.1" | ||||
|   webview_flutter_wkwebview: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: webview_flutter_wkwebview | ||||
|       sha256: "6af7d1908c9c89311c2dffcc2c9b51b88a6f055ba16fa0aa8a04cbb1c3afc9ce" | ||||
|       sha256: a3d461fe3467014e05f3ac4962e5fdde2a4bf44c561cb53e9ae5c586600fdbc3 | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "3.21.0" | ||||
|     version: "3.22.0" | ||||
|   win32: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: win32 | ||||
|       sha256: "329edf97fdd893e0f1e3b9e88d6a0e627128cc17cc316a8d67fda8f1451178ba" | ||||
|       sha256: "66814138c3562338d05613a6e368ed8cfb237ad6d64a9e9334be3f309acfca03" | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "5.13.0" | ||||
|     version: "5.14.0" | ||||
|   win32_registry: | ||||
|     dependency: transitive | ||||
|     description: | ||||
| @@ -1255,14 +1199,6 @@ packages: | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "6.3.0" | ||||
|   yaml: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: yaml | ||||
|       sha256: b9da305ac7c39faa3f030eccd175340f968459dae4af175130b3fc47e40d76ce | ||||
|       url: "https://pub.dev" | ||||
|     source: hosted | ||||
|     version: "3.1.3" | ||||
| sdks: | ||||
|   dart: ">=3.7.2 <4.0.0" | ||||
|   dart: ">=3.8.1 <4.0.0" | ||||
|   flutter: ">=3.27.0" | ||||
|   | ||||
							
								
								
									
										63
									
								
								pubspec.yaml
									
									
									
									
									
								
							
							
						
						
									
										63
									
								
								pubspec.yaml
									
									
									
									
									
								
							| @@ -16,10 +16,10 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev | ||||
| # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html | ||||
| # In Windows, build-name is used as the major, minor, and patch parts | ||||
| # of the product and file versions while build-number is used as the build suffix. | ||||
| version: 1.1.54+2311 | ||||
| version: 1.1.58+2315 | ||||
|  | ||||
| environment: | ||||
|   sdk: ^3.6.0 | ||||
|   sdk: ^3.8.1 | ||||
|  | ||||
| # Dependencies specify other packages that your package needs in order to work. | ||||
| # To automatically upgrade your package dependencies to the latest versions | ||||
| @@ -33,22 +33,22 @@ dependencies: | ||||
|  | ||||
|   # The following adds the Cupertino Icons font to your application. | ||||
|   # Use with the CupertinoIcons class for iOS style icons. | ||||
|   cupertino_icons: ^1.0.5 | ||||
|   path_provider: ^2.0.11 | ||||
|   cupertino_icons: ^1.0.8 | ||||
|   path_provider: ^2.1.5 | ||||
|   flutter_fgbg: ^0.7.1 | ||||
|   flutter_local_notifications: ^18.0.0 | ||||
|   provider: ^6.0.3 | ||||
|   http: ^1.0.0 | ||||
|   webview_flutter: ^4.0.0 | ||||
|   dynamic_color: ^1.5.4 | ||||
|   html: ^0.15.0 | ||||
|   shared_preferences: ^2.0.15 | ||||
|   url_launcher: ^6.1.5 | ||||
|   flutter_local_notifications: ^18.0.1 | ||||
|   provider: ^6.1.5 | ||||
|   http: ^1.4.0 | ||||
|   webview_flutter: ^4.13.0 | ||||
|   dynamic_color: ^1.7.0 | ||||
|   html: ^0.15.6 | ||||
|   shared_preferences: ^2.5.3 | ||||
|   url_launcher: ^6.3.1 | ||||
|   permission_handler: ^12.0.0+1 | ||||
|   fluttertoast: ^8.0.9 | ||||
|   device_info_plus: ^11.0.0 | ||||
|   file_picker: ^10.0.0 | ||||
|   animations: ^2.0.4 | ||||
|   fluttertoast: ^8.2.12 | ||||
|   device_info_plus: ^11.4.0 | ||||
|   file_picker: ^10.1.9 | ||||
|   animations: ^2.0.11 | ||||
|   android_package_installer: # TODO: See if PR will be accepted (dev may not be active), else remove this comment | ||||
|     git: | ||||
|       url: https://github.com/ImranR98/android_package_installer | ||||
| @@ -58,23 +58,23 @@ dependencies: | ||||
|       url: https://github.com/ImranR98/android_package_manager | ||||
|       ref: master | ||||
|   share_plus: ^11.0.0 | ||||
|   sqflite: ^2.2.0+3 | ||||
|   easy_localization: ^3.0.1 | ||||
|   android_intent_plus: ^5.0.1 | ||||
|   flutter_markdown: ^0.7.1 | ||||
|   flutter_archive: ^6.0.0 | ||||
|   sqflite: ^2.4.2 | ||||
|   easy_localization: ^3.0.7+1 | ||||
|   android_intent_plus: ^5.3.0 | ||||
|   flutter_markdown: ^0.7.7+1 | ||||
|   flutter_archive: ^6.0.3 | ||||
|   hsluv: ^1.1.3 | ||||
|   connectivity_plus: ^6.0.1 | ||||
|   connectivity_plus: ^6.1.4 | ||||
|   shared_storage: # TODO: Is this maintained? | ||||
|     git: | ||||
|       url: https://github.com/AlexBacich/shared-storage | ||||
|       ref: master | ||||
|   crypto: ^3.0.3 | ||||
|   crypto: ^3.0.6 | ||||
|   bcrypt: ^1.1.3 | ||||
|   app_links: ^6.0.1 | ||||
|   background_fetch: ^1.2.1 | ||||
|   app_links: ^6.4.0 | ||||
|   background_fetch: ^1.3.8 | ||||
|   equations: ^5.0.2 | ||||
|   flex_color_picker: ^3.4.1 | ||||
|   flex_color_picker: ^3.7.1 | ||||
|   android_system_font: | ||||
|     git: | ||||
|       url: https://github.com/re7gog/android_system_font | ||||
| @@ -83,22 +83,17 @@ dependencies: | ||||
|     git: | ||||
|       url: https://github.com/wilver06w/shizuku_apk_installer | ||||
|       ref: master | ||||
|  | ||||
|   markdown: any | ||||
|   markdown: ^7.3.0 | ||||
|   flutter_typeahead: ^5.2.0 | ||||
|   battery_plus: ^6.1.0 | ||||
|   battery_plus: ^6.2.1 | ||||
|   flutter_charset_detector: ^5.0.0 | ||||
| dev_dependencies: | ||||
|   flutter_test: | ||||
|     sdk: flutter | ||||
|   flutter_launcher_icons: ^0.14.1 | ||||
|  | ||||
|   # The "flutter_lints" package below contains a set of recommended lints to | ||||
|   # encourage good coding practices. The lint set provided by the package is | ||||
|   # activated in the `analysis_options.yaml` file located at the root of your | ||||
|   # package. See that file for information about deactivating specific lint | ||||
|   # rules and activating additional ones. | ||||
|   flutter_lints: ^5.0.0 | ||||
|   flutter_lints: ^6.0.0 | ||||
|  | ||||
| flutter_launcher_icons: | ||||
|   android: "ic_launcher" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user