mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-30 21:13:28 +01:00 
			
		
		
		
	Compare commits
	
		
			6 Commits
		
	
	
		
			v0.14.37-b
			...
			v0.14.38-b
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | cbaaec961c | ||
|  | 5477b3f936 | ||
|  | fd59a93ede | ||
|  | cd316b7138 | ||
|  | d1955192ed | ||
|  | 9beb839bf4 | 
| @@ -65,7 +65,7 @@ class FDroid extends AppSource { | |||||||
|   ) async { |   ) async { | ||||||
|     String? appId = await tryInferringAppId(standardUrl); |     String? appId = await tryInferringAppId(standardUrl); | ||||||
|     String host = Uri.parse(standardUrl).host; |     String host = Uri.parse(standardUrl).host; | ||||||
|     return getAPKUrlsFromFDroidPackagesAPIResponse( |     var details = getAPKUrlsFromFDroidPackagesAPIResponse( | ||||||
|         await sourceRequest('https://$host/api/v1/packages/$appId'), |         await sourceRequest('https://$host/api/v1/packages/$appId'), | ||||||
|         'https://$host/repo/$appId', |         'https://$host/repo/$appId', | ||||||
|         standardUrl, |         standardUrl, | ||||||
| @@ -80,6 +80,23 @@ class FDroid extends AppSource { | |||||||
|                     true |                     true | ||||||
|                 ? additionalSettings['filterVersionsByRegEx'] |                 ? additionalSettings['filterVersionsByRegEx'] | ||||||
|                 : null); |                 : null); | ||||||
|  |     if (!hostChanged) { | ||||||
|  |       try { | ||||||
|  |         var res = await sourceRequest( | ||||||
|  |             'https://gitlab.com/fdroid/fdroiddata/-/raw/master/metadata/$appId.yml'); | ||||||
|  |         String author = res.body | ||||||
|  |             .split('\n') | ||||||
|  |             .where((l) => l.startsWith('AuthorName: ')) | ||||||
|  |             .first | ||||||
|  |             .split(': ') | ||||||
|  |             .sublist(1) | ||||||
|  |             .join(': '); | ||||||
|  |         details.names.author = author; | ||||||
|  |       } catch (e) { | ||||||
|  |         // Fail silently | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |     return details; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @override |   @override | ||||||
| @@ -111,79 +128,79 @@ class FDroid extends AppSource { | |||||||
|       throw getObtainiumHttpError(res); |       throw getObtainiumHttpError(res); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } |  | ||||||
|  |  | ||||||
| APKDetails getAPKUrlsFromFDroidPackagesAPIResponse( |   APKDetails getAPKUrlsFromFDroidPackagesAPIResponse( | ||||||
|     Response res, String apkUrlPrefix, String standardUrl, String sourceName, |       Response res, String apkUrlPrefix, String standardUrl, String sourceName, | ||||||
|     {bool autoSelectHighestVersionCode = false, |       {bool autoSelectHighestVersionCode = false, | ||||||
|     bool trySelectingSuggestedVersionCode = false, |       bool trySelectingSuggestedVersionCode = false, | ||||||
|     String? filterVersionsByRegEx}) { |       String? filterVersionsByRegEx}) { | ||||||
|   if (res.statusCode == 200) { |     if (res.statusCode == 200) { | ||||||
|     var response = jsonDecode(res.body); |       var response = jsonDecode(res.body); | ||||||
|     List<dynamic> releases = response['packages'] ?? []; |       List<dynamic> releases = response['packages'] ?? []; | ||||||
|     if (releases.isEmpty) { |       if (releases.isEmpty) { | ||||||
|       throw NoReleasesError(); |         throw NoReleasesError(); | ||||||
|     } |  | ||||||
|     String? version; |  | ||||||
|     Iterable<dynamic> releaseChoices = []; |  | ||||||
|     // Grab the versionCode suggested if the user chose to do that |  | ||||||
|     // Only do so at this stage if the user has no release filter |  | ||||||
|     if (trySelectingSuggestedVersionCode && |  | ||||||
|         response['suggestedVersionCode'] != null && |  | ||||||
|         filterVersionsByRegEx == null) { |  | ||||||
|       var suggestedReleases = releases.where((element) => |  | ||||||
|           element['versionCode'] == response['suggestedVersionCode']); |  | ||||||
|       if (suggestedReleases.isNotEmpty) { |  | ||||||
|         releaseChoices = suggestedReleases; |  | ||||||
|         version = suggestedReleases.first['versionName']; |  | ||||||
|       } |       } | ||||||
|     } |       String? version; | ||||||
|     // Apply the release filter if any |       Iterable<dynamic> releaseChoices = []; | ||||||
|     if (filterVersionsByRegEx?.isNotEmpty == true) { |       // Grab the versionCode suggested if the user chose to do that | ||||||
|       version = null; |       // Only do so at this stage if the user has no release filter | ||||||
|       releaseChoices = []; |       if (trySelectingSuggestedVersionCode && | ||||||
|       for (var i = 0; i < releases.length; i++) { |           response['suggestedVersionCode'] != null && | ||||||
|         if (RegExp(filterVersionsByRegEx!) |           filterVersionsByRegEx == null) { | ||||||
|             .hasMatch(releases[i]['versionName'])) { |         var suggestedReleases = releases.where((element) => | ||||||
|           version = releases[i]['versionName']; |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|       if (version == null) { |  | ||||||
|         throw NoVersionError(); |  | ||||||
|       } |  | ||||||
|     } |  | ||||||
|     // Default to the highest version |  | ||||||
|     version ??= releases[0]['versionName']; |  | ||||||
|     if (version == null) { |  | ||||||
|       throw NoVersionError(); |  | ||||||
|     } |  | ||||||
|     // 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); |  | ||||||
|     } |  | ||||||
|     // For the remaining releases, use the toggles to auto-select one if possible |  | ||||||
|     if (releaseChoices.length > 1) { |  | ||||||
|       if (autoSelectHighestVersionCode) { |  | ||||||
|         releaseChoices = [releaseChoices.first]; |  | ||||||
|       } else if (trySelectingSuggestedVersionCode && |  | ||||||
|           response['suggestedVersionCode'] != null) { |  | ||||||
|         var suggestedReleases = releaseChoices.where((element) => |  | ||||||
|             element['versionCode'] == response['suggestedVersionCode']); |             element['versionCode'] == response['suggestedVersionCode']); | ||||||
|         if (suggestedReleases.isNotEmpty) { |         if (suggestedReleases.isNotEmpty) { | ||||||
|           releaseChoices = suggestedReleases; |           releaseChoices = suggestedReleases; | ||||||
|  |           version = suggestedReleases.first['versionName']; | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|  |       // Apply the release filter if any | ||||||
|  |       if (filterVersionsByRegEx?.isNotEmpty == true) { | ||||||
|  |         version = null; | ||||||
|  |         releaseChoices = []; | ||||||
|  |         for (var i = 0; i < releases.length; i++) { | ||||||
|  |           if (RegExp(filterVersionsByRegEx!) | ||||||
|  |               .hasMatch(releases[i]['versionName'])) { | ||||||
|  |             version = releases[i]['versionName']; | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |         if (version == null) { | ||||||
|  |           throw NoVersionError(); | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |       // Default to the highest version | ||||||
|  |       version ??= releases[0]['versionName']; | ||||||
|  |       if (version == null) { | ||||||
|  |         throw NoVersionError(); | ||||||
|  |       } | ||||||
|  |       // 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); | ||||||
|  |       } | ||||||
|  |       // For the remaining releases, use the toggles to auto-select one if possible | ||||||
|  |       if (releaseChoices.length > 1) { | ||||||
|  |         if (autoSelectHighestVersionCode) { | ||||||
|  |           releaseChoices = [releaseChoices.first]; | ||||||
|  |         } else if (trySelectingSuggestedVersionCode && | ||||||
|  |             response['suggestedVersionCode'] != null) { | ||||||
|  |           var suggestedReleases = releaseChoices.where((element) => | ||||||
|  |               element['versionCode'] == response['suggestedVersionCode']); | ||||||
|  |           if (suggestedReleases.isNotEmpty) { | ||||||
|  |             releaseChoices = suggestedReleases; | ||||||
|  |           } | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |       if (releaseChoices.isEmpty) { | ||||||
|  |         throw NoReleasesError(); | ||||||
|  |       } | ||||||
|  |       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)); | ||||||
|  |     } else { | ||||||
|  |       throw getObtainiumHttpError(res); | ||||||
|     } |     } | ||||||
|     if (releaseChoices.isEmpty) { |  | ||||||
|       throw NoReleasesError(); |  | ||||||
|     } |  | ||||||
|     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)); |  | ||||||
|   } else { |  | ||||||
|     throw getObtainiumHttpError(res); |  | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -234,7 +234,7 @@ class GitHub extends AppSource { | |||||||
|     bool verifyLatestTag = additionalSettings['verifyLatestTag'] == true; |     bool verifyLatestTag = additionalSettings['verifyLatestTag'] == true; | ||||||
|     bool dontSortReleasesList = |     bool dontSortReleasesList = | ||||||
|         additionalSettings['dontSortReleasesList'] == true; |         additionalSettings['dontSortReleasesList'] == true; | ||||||
|     String? latestTag; |     dynamic latestRelease; | ||||||
|     if (verifyLatestTag) { |     if (verifyLatestTag) { | ||||||
|       var temp = requestUrl.split('?'); |       var temp = requestUrl.split('?'); | ||||||
|       Response res = await sourceRequest( |       Response res = await sourceRequest( | ||||||
| @@ -245,12 +245,20 @@ class GitHub extends AppSource { | |||||||
|         } |         } | ||||||
|         throw getObtainiumHttpError(res); |         throw getObtainiumHttpError(res); | ||||||
|       } |       } | ||||||
|       var jsres = jsonDecode(res.body); |       latestRelease = jsonDecode(res.body); | ||||||
|       latestTag = jsres['tag_name'] ?? jsres['name']; |  | ||||||
|     } |     } | ||||||
|     Response res = await sourceRequest(requestUrl); |     Response res = await sourceRequest(requestUrl); | ||||||
|     if (res.statusCode == 200) { |     if (res.statusCode == 200) { | ||||||
|       var releases = jsonDecode(res.body) as List<dynamic>; |       var releases = jsonDecode(res.body) as List<dynamic>; | ||||||
|  |       if (latestRelease != null) { | ||||||
|  |         var latestTag = latestRelease['tag_name'] ?? latestRelease['name']; | ||||||
|  |         if (releases | ||||||
|  |             .where((element) => | ||||||
|  |                 (element['tag_name'] ?? element['name']) == latestTag) | ||||||
|  |             .isEmpty) { | ||||||
|  |           releases = [latestRelease, ...releases]; | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |  | ||||||
|       List<MapEntry<String, String>> getReleaseAPKUrls(dynamic release) => |       List<MapEntry<String, String>> getReleaseAPKUrls(dynamic release) => | ||||||
|           (release['assets'] as List<dynamic>?) |           (release['assets'] as List<dynamic>?) | ||||||
| @@ -299,13 +307,13 @@ class GitHub extends AppSource { | |||||||
|           } |           } | ||||||
|         }); |         }); | ||||||
|       } |       } | ||||||
|       if (latestTag != null && |       if (latestRelease != null && | ||||||
|           releases.isNotEmpty && |           releases.isNotEmpty && | ||||||
|           latestTag != |           latestRelease != | ||||||
|               (releases[releases.length - 1]['tag_name'] ?? |               (releases[releases.length - 1]['tag_name'] ?? | ||||||
|                   releases[0]['name'])) { |                   releases[0]['name'])) { | ||||||
|         var ind = releases.indexWhere( |         var ind = releases.indexWhere((element) => | ||||||
|             (element) => latestTag == (element['tag_name'] ?? element['name'])); |             latestRelease == (element['tag_name'] ?? element['name'])); | ||||||
|         if (ind >= 0) { |         if (ind >= 0) { | ||||||
|           releases.add(releases.removeAt(ind)); |           releases.add(releases.removeAt(ind)); | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -40,7 +40,7 @@ class IzzyOnDroid extends AppSource { | |||||||
|     Map<String, dynamic> additionalSettings, |     Map<String, dynamic> additionalSettings, | ||||||
|   ) async { |   ) async { | ||||||
|     String? appId = await tryInferringAppId(standardUrl); |     String? appId = await tryInferringAppId(standardUrl); | ||||||
|     return getAPKUrlsFromFDroidPackagesAPIResponse( |     return fd.getAPKUrlsFromFDroidPackagesAPIResponse( | ||||||
|         await sourceRequest( |         await sourceRequest( | ||||||
|             'https://apt.izzysoft.de/fdroid/api/v1/packages/$appId'), |             'https://apt.izzysoft.de/fdroid/api/v1/packages/$appId'), | ||||||
|         'https://android.izzysoft.de/frepo/$appId', |         'https://android.izzysoft.de/frepo/$appId', | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ import 'package:easy_localization/src/easy_localization_controller.dart'; | |||||||
| // ignore: implementation_imports | // ignore: implementation_imports | ||||||
| import 'package:easy_localization/src/localization.dart'; | import 'package:easy_localization/src/localization.dart'; | ||||||
|  |  | ||||||
| const String currentVersion = '0.14.37'; | const String currentVersion = '0.14.38'; | ||||||
| const String currentReleaseTag = | const String currentReleaseTag = | ||||||
|     'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES |     'v$currentVersion-beta'; // KEEP THIS IN SYNC WITH GITHUB RELEASES | ||||||
|  |  | ||||||
|   | |||||||
| @@ -347,7 +347,8 @@ class _ImportExportPageState extends State<ImportExportPage> { | |||||||
|                                         : () { |                                         : () { | ||||||
|                                             runObtainiumExport(pickOnly: true); |                                             runObtainiumExport(pickOnly: true); | ||||||
|                                           }, |                                           }, | ||||||
|                                     child: Text(tr('pickExportDir')), |                                     child: Text(tr('pickExportDir'), | ||||||
|  |                                         textAlign: TextAlign.center), | ||||||
|                                   )), |                                   )), | ||||||
|                                   const SizedBox( |                                   const SizedBox( | ||||||
|                                     width: 16, |                                     width: 16, | ||||||
| @@ -360,7 +361,8 @@ class _ImportExportPageState extends State<ImportExportPage> { | |||||||
|                                             snapshot.data == null |                                             snapshot.data == null | ||||||
|                                         ? null |                                         ? null | ||||||
|                                         : runObtainiumExport, |                                         : runObtainiumExport, | ||||||
|                                     child: Text(tr('obtainiumExport')), |                                     child: Text(tr('obtainiumExport'), | ||||||
|  |                                         textAlign: TextAlign.center), | ||||||
|                                   )), |                                   )), | ||||||
|                                 ], |                                 ], | ||||||
|                               ), |                               ), | ||||||
| @@ -375,7 +377,8 @@ class _ImportExportPageState extends State<ImportExportPage> { | |||||||
|                                           onPressed: importInProgress |                                           onPressed: importInProgress | ||||||
|                                               ? null |                                               ? null | ||||||
|                                               : runObtainiumImport, |                                               : runObtainiumImport, | ||||||
|                                           child: Text(tr('obtainiumImport')))), |                                           child: Text(tr('obtainiumImport'), | ||||||
|  |                                               textAlign: TextAlign.center))), | ||||||
|                                 ], |                                 ], | ||||||
|                               ), |                               ), | ||||||
|                               if (snapshot.data != null) |                               if (snapshot.data != null) | ||||||
|   | |||||||
| @@ -1230,7 +1230,7 @@ class AppsProvider with ChangeNotifier { | |||||||
|  |  | ||||||
|   Future<MapEntry<int, bool>> import(String appsJSON) async { |   Future<MapEntry<int, bool>> import(String appsJSON) async { | ||||||
|     var decodedJSON = jsonDecode(appsJSON); |     var decodedJSON = jsonDecode(appsJSON); | ||||||
|     var newFormat = !(decodedJSON is List); |     var newFormat = decodedJSON is! List; | ||||||
|     List<App> importedApps = |     List<App> importedApps = | ||||||
|         ((newFormat ? decodedJSON['apps'] : decodedJSON) as List<dynamic>) |         ((newFormat ? decodedJSON['apps'] : decodedJSON) as List<dynamic>) | ||||||
|             .map((e) => App.fromJson(e)) |             .map((e) => App.fromJson(e)) | ||||||
|   | |||||||
| @@ -684,8 +684,9 @@ class SourceProvider { | |||||||
|     name = name.isNotEmpty ? name : apk.names.name; |     name = name.isNotEmpty ? name : apk.names.name; | ||||||
|     App finalApp = App( |     App finalApp = App( | ||||||
|         currentApp?.id ?? |         currentApp?.id ?? | ||||||
|             ((!source.appIdInferIsOptional || |             (!trackOnly && | ||||||
|                     (source.appIdInferIsOptional && inferAppIdIfOptional)) |                     (!source.appIdInferIsOptional || | ||||||
|  |                         (source.appIdInferIsOptional && inferAppIdIfOptional)) | ||||||
|                 ? await source.tryInferringAppId(standardUrl, |                 ? await source.tryInferringAppId(standardUrl, | ||||||
|                     additionalSettings: additionalSettings) |                     additionalSettings: additionalSettings) | ||||||
|                 : null) ?? |                 : null) ?? | ||||||
| @@ -705,8 +706,9 @@ class SourceProvider { | |||||||
|         changeLog: apk.changeLog, |         changeLog: apk.changeLog, | ||||||
|         overrideSource: overrideSource ?? currentApp?.overrideSource, |         overrideSource: overrideSource ?? currentApp?.overrideSource, | ||||||
|         allowIdChange: currentApp?.allowIdChange ?? |         allowIdChange: currentApp?.allowIdChange ?? | ||||||
|             source.appIdInferIsOptional && |             trackOnly || | ||||||
|                 inferAppIdIfOptional // Optional ID inferring may be incorrect - allow correction on first install |                 (source.appIdInferIsOptional && | ||||||
|  |                     inferAppIdIfOptional) // Optional ID inferring may be incorrect - allow correction on first install | ||||||
|         ); |         ); | ||||||
|     return source.endOfGetAppChanges(finalApp); |     return source.endOfGetAppChanges(finalApp); | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -783,10 +783,10 @@ packages: | |||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|       name: synchronized |       name: synchronized | ||||||
|       sha256: "5fcbd27688af6082f5abd611af56ee575342c30e87541d0245f7ff99faa02c60" |       sha256: "539ef412b170d65ecdafd780f924e5be3f60032a1128df156adad6c5b373d558" | ||||||
|       url: "https://pub.dev" |       url: "https://pub.dev" | ||||||
|     source: hosted |     source: hosted | ||||||
|     version: "3.1.0" |     version: "3.1.0+1" | ||||||
|   term_glyph: |   term_glyph: | ||||||
|     dependency: transitive |     dependency: transitive | ||||||
|     description: |     description: | ||||||
|   | |||||||
| @@ -17,7 +17,7 @@ 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 | # 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 | # 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. | # of the product and file versions while build-number is used as the build suffix. | ||||||
| version: 0.14.37+231 # When changing this, update the tag in main() accordingly | version: 0.14.38+232 # When changing this, update the tag in main() accordingly | ||||||
|  |  | ||||||
| environment: | environment: | ||||||
|   sdk: '>=3.0.0 <4.0.0' |   sdk: '>=3.0.0 <4.0.0' | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user