mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-31 05:23:28 +01:00 
			
		
		
		
	Initial release date support
This commit is contained in:
		| @@ -213,6 +213,9 @@ | |||||||
|     "removeFromObtainium": "Remove from Obtainium", |     "removeFromObtainium": "Remove from Obtainium", | ||||||
|     "uninstallFromDevice": "Uninstall from Device", |     "uninstallFromDevice": "Uninstall from Device", | ||||||
|     "onlyWorksWithNonVersionDetectApps": "Only works for Apps with version detection disabled.", |     "onlyWorksWithNonVersionDetectApps": "Only works for Apps with version detection disabled.", | ||||||
|  |     "useReleaseDateAsVersion": "Use Release Date as Version", | ||||||
|  |     "releaseDateAsVersionExplanation": "This option should only be used for Apps where version detection does not work correctly, but a release date is available.", | ||||||
|  |     "changes": "Changes", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "App entfernen?", |         "one": "App entfernen?", | ||||||
|         "other": "App entfernen?" |         "other": "App entfernen?" | ||||||
|   | |||||||
| @@ -213,6 +213,9 @@ | |||||||
|     "removeFromObtainium": "Remove from Obtainium", |     "removeFromObtainium": "Remove from Obtainium", | ||||||
|     "uninstallFromDevice": "Uninstall from Device", |     "uninstallFromDevice": "Uninstall from Device", | ||||||
|     "onlyWorksWithNonVersionDetectApps": "Only works for Apps with version detection disabled.", |     "onlyWorksWithNonVersionDetectApps": "Only works for Apps with version detection disabled.", | ||||||
|  |     "useReleaseDateAsVersion": "Use Release Date as Version", | ||||||
|  |     "releaseDateAsVersionExplanation": "This option should only be used for Apps where version detection does not work correctly, but a release date is available.", | ||||||
|  |     "changes": "Changes", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Remove App?", |         "one": "Remove App?", | ||||||
|         "other": "Remove Apps?" |         "other": "Remove Apps?" | ||||||
|   | |||||||
| @@ -213,6 +213,9 @@ | |||||||
|     "removeFromObtainium": "از Obtainium حذف کنید", |     "removeFromObtainium": "از Obtainium حذف کنید", | ||||||
|     "uninstallFromDevice": "حذف نصب از دستگاه", |     "uninstallFromDevice": "حذف نصب از دستگاه", | ||||||
|     "onlyWorksWithNonVersionDetectApps": "فقط برای برنامههایی کار میکند که تشخیص نسخه غیرفعال است.", |     "onlyWorksWithNonVersionDetectApps": "فقط برای برنامههایی کار میکند که تشخیص نسخه غیرفعال است.", | ||||||
|  |     "useReleaseDateAsVersion": "Use Release Date as Version", | ||||||
|  |     "releaseDateAsVersionExplanation": "This option should only be used for Apps where version detection does not work correctly, but a release date is available.", | ||||||
|  |     "changes": "Changes", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "برنامه حذف شود؟", |         "one": "برنامه حذف شود؟", | ||||||
|         "other": "برنامه ها حذف شوند؟" |         "other": "برنامه ها حذف شوند؟" | ||||||
|   | |||||||
| @@ -212,6 +212,9 @@ | |||||||
|     "removeFromObtainium": "Eltávolítás az Obtainiumból", |     "removeFromObtainium": "Eltávolítás az Obtainiumból", | ||||||
|     "uninstallFromDevice": "Eltávolítás a készülékről", |     "uninstallFromDevice": "Eltávolítás a készülékről", | ||||||
|     "onlyWorksWithNonVersionDetectApps": "Csak azoknál az alkalmazásoknál működik, amelyeknél a verzióérzékelés le van tiltva.", |     "onlyWorksWithNonVersionDetectApps": "Csak azoknál az alkalmazásoknál működik, amelyeknél a verzióérzékelés le van tiltva.", | ||||||
|  |     "useReleaseDateAsVersion": "Use Release Date as Version", | ||||||
|  |     "releaseDateAsVersionExplanation": "This option should only be used for Apps where version detection does not work correctly, but a release date is available.", | ||||||
|  |     "changes": "Changes", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Eltávolítja az alkalmazást?", |         "one": "Eltávolítja az alkalmazást?", | ||||||
|         "other": "Eltávolítja az alkalmazást?" |         "other": "Eltávolítja az alkalmazást?" | ||||||
|   | |||||||
| @@ -213,6 +213,9 @@ | |||||||
|     "removeFromObtainium": "Rimuovi da Obtainium", |     "removeFromObtainium": "Rimuovi da Obtainium", | ||||||
|     "uninstallFromDevice": "Disinstalla dal dispositivo", |     "uninstallFromDevice": "Disinstalla dal dispositivo", | ||||||
|     "onlyWorksWithNonVersionDetectApps": "Funziona solo per le App con il rilevamento della versione disattivato.", |     "onlyWorksWithNonVersionDetectApps": "Funziona solo per le App con il rilevamento della versione disattivato.", | ||||||
|  |     "useReleaseDateAsVersion": "Use Release Date as Version", | ||||||
|  |     "releaseDateAsVersionExplanation": "This option should only be used for Apps where version detection does not work correctly, but a release date is available.", | ||||||
|  |     "changes": "Changes", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "Rimuovere l'App?", |         "one": "Rimuovere l'App?", | ||||||
|         "other": "Rimuovere le App?" |         "other": "Rimuovere le App?" | ||||||
|   | |||||||
| @@ -213,6 +213,9 @@ | |||||||
|     "removeFromObtainium": "Obtainiumから削除する", |     "removeFromObtainium": "Obtainiumから削除する", | ||||||
|     "uninstallFromDevice": "デバイスからアンインストールする", |     "uninstallFromDevice": "デバイスからアンインストールする", | ||||||
|     "onlyWorksWithNonVersionDetectApps": "バージョン検出を無効にしているアプリにのみ動作します。", |     "onlyWorksWithNonVersionDetectApps": "バージョン検出を無効にしているアプリにのみ動作します。", | ||||||
|  |     "useReleaseDateAsVersion": "Use Release Date as Version", | ||||||
|  |     "releaseDateAsVersionExplanation": "This option should only be used for Apps where version detection does not work correctly, but a release date is available.", | ||||||
|  |     "changes": "Changes", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "アプリを削除しますか?", |         "one": "アプリを削除しますか?", | ||||||
|         "other": "アプリを削除しますか?" |         "other": "アプリを削除しますか?" | ||||||
|   | |||||||
| @@ -213,6 +213,9 @@ | |||||||
|     "filterAPKsByRegEx": "Filter APKs by Regular Expression", |     "filterAPKsByRegEx": "Filter APKs by Regular Expression", | ||||||
|     "removeFromObtainium": "Remove from Obtainium", |     "removeFromObtainium": "Remove from Obtainium", | ||||||
|     "uninstallFromDevice": "Uninstall from Device", |     "uninstallFromDevice": "Uninstall from Device", | ||||||
|  |     "useReleaseDateAsVersion": "Use Release Date as Version", | ||||||
|  |     "releaseDateAsVersionExplanation": "This option should only be used for Apps where version detection does not work correctly, but a release date is available.", | ||||||
|  |     "changes": "Changes", | ||||||
|     "removeAppQuestion": { |     "removeAppQuestion": { | ||||||
|         "one": "删除应用?", |         "one": "删除应用?", | ||||||
|         "other": "删除应用?" |         "other": "删除应用?" | ||||||
|   | |||||||
| @@ -154,11 +154,15 @@ class GitHub extends AppSource { | |||||||
|         throw NoReleasesError(); |         throw NoReleasesError(); | ||||||
|       } |       } | ||||||
|       String? version = targetRelease['tag_name']; |       String? version = targetRelease['tag_name']; | ||||||
|  |       DateTime? releaseDate = targetRelease['published_at'] != null | ||||||
|  |           ? DateTime.parse(targetRelease['published_at']) | ||||||
|  |           : null; | ||||||
|       if (version == null) { |       if (version == null) { | ||||||
|         throw NoVersionError(); |         throw NoVersionError(); | ||||||
|       } |       } | ||||||
|       return APKDetails(version, targetRelease['apkUrls'] as List<String>, |       return APKDetails(version, targetRelease['apkUrls'] as List<String>, | ||||||
|           getAppNames(standardUrl)); |           getAppNames(standardUrl), | ||||||
|  |           releaseDate: releaseDate); | ||||||
|     } else { |     } else { | ||||||
|       rateLimitErrorCheck(res); |       rateLimitErrorCheck(res); | ||||||
|       throw getObtainiumHttpError(res); |       throw getObtainiumHttpError(res); | ||||||
|   | |||||||
| @@ -73,6 +73,8 @@ class _AddAppPageState extends State<AddAppPage> { | |||||||
|         var userPickedTrackOnly = additionalSettings['trackOnly'] == true; |         var userPickedTrackOnly = additionalSettings['trackOnly'] == true; | ||||||
|         var userPickedNoVersionDetection = |         var userPickedNoVersionDetection = | ||||||
|             additionalSettings['noVersionDetection'] == true; |             additionalSettings['noVersionDetection'] == true; | ||||||
|  |         var userPickedReleaseDateAsVersion = | ||||||
|  |             additionalSettings['releaseDateAsVersion'] == true; | ||||||
|         var cont = true; |         var cont = true; | ||||||
|         if ((userPickedTrackOnly || pickedSource!.enforceTrackOnly) && |         if ((userPickedTrackOnly || pickedSource!.enforceTrackOnly) && | ||||||
|             // ignore: use_build_context_synchronously |             // ignore: use_build_context_synchronously | ||||||
| @@ -93,7 +95,22 @@ class _AddAppPageState extends State<AddAppPage> { | |||||||
|                 null) { |                 null) { | ||||||
|           cont = false; |           cont = false; | ||||||
|         } |         } | ||||||
|         if (userPickedNoVersionDetection && |         if (userPickedReleaseDateAsVersion && // ignore: use_build_context_synchronously | ||||||
|  |             // ignore: use_build_context_synchronously | ||||||
|  |             await showDialog( | ||||||
|  |                     context: context, | ||||||
|  |                     builder: (BuildContext ctx) { | ||||||
|  |                       return GeneratedFormModal( | ||||||
|  |                         title: tr('useReleaseDateAsVersion'), | ||||||
|  |                         items: const [], | ||||||
|  |                         message: tr('releaseDateAsVersionExplanation'), | ||||||
|  |                       ); | ||||||
|  |                     }) == | ||||||
|  |                 null) { | ||||||
|  |           cont = false; | ||||||
|  |         } | ||||||
|  |         if (!userPickedReleaseDateAsVersion && | ||||||
|  |             userPickedNoVersionDetection && | ||||||
|             // ignore: use_build_context_synchronously |             // ignore: use_build_context_synchronously | ||||||
|             await showDialog( |             await showDialog( | ||||||
|                     context: context, |                     context: context, | ||||||
| @@ -113,7 +130,8 @@ class _AddAppPageState extends State<AddAppPage> { | |||||||
|           App app = await sourceProvider.getApp( |           App app = await sourceProvider.getApp( | ||||||
|               pickedSource!, userInput, additionalSettings, |               pickedSource!, userInput, additionalSettings, | ||||||
|               trackOnlyOverride: trackOnly, |               trackOnlyOverride: trackOnly, | ||||||
|               noVersionDetectionOverride: userPickedNoVersionDetection); |               noVersionDetectionOverride: userPickedNoVersionDetection, | ||||||
|  |               releaseDateAsVersionOverride: userPickedReleaseDateAsVersion); | ||||||
|           if (!trackOnly) { |           if (!trackOnly) { | ||||||
|             await settingsProvider.getInstallPermission(); |             await settingsProvider.getInstallPermission(); | ||||||
|           } |           } | ||||||
|   | |||||||
| @@ -144,6 +144,13 @@ class _AppPageState extends State<AppPage> { | |||||||
|           textAlign: TextAlign.center, |           textAlign: TextAlign.center, | ||||||
|           style: Theme.of(context).textTheme.labelSmall, |           style: Theme.of(context).textTheme.labelSmall, | ||||||
|         ), |         ), | ||||||
|  |         app?.app.releaseDate == null | ||||||
|  |             ? const SizedBox.shrink() | ||||||
|  |             : Text( | ||||||
|  |                 app!.app.releaseDate.toString(), | ||||||
|  |                 textAlign: TextAlign.center, | ||||||
|  |                 style: Theme.of(context).textTheme.labelSmall, | ||||||
|  |               ), | ||||||
|         const SizedBox( |         const SizedBox( | ||||||
|           height: 32, |           height: 32, | ||||||
|         ), |         ), | ||||||
| @@ -286,6 +293,37 @@ class _AppPageState extends State<AppPage> { | |||||||
|                                                 tr('appsFromSourceAreTrackOnly'), |                                                 tr('appsFromSourceAreTrackOnly'), | ||||||
|                                                 context); |                                                 context); | ||||||
|                                           } |                                           } | ||||||
|  |                                           if (changedApp.additionalSettings[ | ||||||
|  |                                                   'releaseDateAsVersion'] == | ||||||
|  |                                               true) { | ||||||
|  |                                             changedApp.additionalSettings[ | ||||||
|  |                                                 'noVersionDetection'] = true; | ||||||
|  |                                             if (app.app.additionalSettings[ | ||||||
|  |                                                     'releaseDateAsVersion'] != | ||||||
|  |                                                 true) { | ||||||
|  |                                               if (app.app.releaseDate != null) { | ||||||
|  |                                                 changedApp.latestVersion = app | ||||||
|  |                                                     .app | ||||||
|  |                                                     .releaseDate! | ||||||
|  |                                                     .microsecondsSinceEpoch | ||||||
|  |                                                     .toString(); | ||||||
|  |                                                 if (app.app.installedVersion == | ||||||
|  |                                                     app.app.latestVersion) { | ||||||
|  |                                                   changedApp.installedVersion = | ||||||
|  |                                                       changedApp.latestVersion; | ||||||
|  |                                                 } | ||||||
|  |                                               } | ||||||
|  |                                             } | ||||||
|  |                                           } else if (app.app.additionalSettings[ | ||||||
|  |                                                   'releaseDateAsVersion'] == | ||||||
|  |                                               true) { | ||||||
|  |                                             changedApp.additionalSettings[ | ||||||
|  |                                                 'noVersionDetection'] = false; | ||||||
|  |                                             changedApp.installedVersion = app | ||||||
|  |                                                     .installedInfo | ||||||
|  |                                                     ?.versionName ?? | ||||||
|  |                                                 changedApp.installedVersion; | ||||||
|  |                                           } | ||||||
|                                           appsProvider.saveApps( |                                           appsProvider.saveApps( | ||||||
|                                               [changedApp]).then((value) { |                                               [changedApp]).then((value) { | ||||||
|                                             getUpdate(changedApp.id); |                                             getUpdate(changedApp.id); | ||||||
|   | |||||||
| @@ -264,6 +264,7 @@ class AppsPageState extends State<AppsPage> { | |||||||
|                       sortedApps[index].installedInfo?.name ?? |                       sortedApps[index].installedInfo?.name ?? | ||||||
|                           sortedApps[index].app.name, |                           sortedApps[index].app.name, | ||||||
|                       style: TextStyle( |                       style: TextStyle( | ||||||
|  |                         overflow: TextOverflow.ellipsis, | ||||||
|                         fontWeight: sortedApps[index].app.pinned |                         fontWeight: sortedApps[index].app.pinned | ||||||
|                             ? FontWeight.bold |                             ? FontWeight.bold | ||||||
|                             : FontWeight.normal, |                             : FontWeight.normal, | ||||||
| @@ -289,12 +290,35 @@ class AppsPageState extends State<AppsPage> { | |||||||
|                                 mainAxisAlignment: MainAxisAlignment.center, |                                 mainAxisAlignment: MainAxisAlignment.center, | ||||||
|                                 crossAxisAlignment: CrossAxisAlignment.end, |                                 crossAxisAlignment: CrossAxisAlignment.end, | ||||||
|                                 children: [ |                                 children: [ | ||||||
|                                   SizedBox( |                                   Row( | ||||||
|                                       width: 100, |                                       mainAxisSize: MainAxisSize.min, | ||||||
|                                       child: Text( |                                       children: [ | ||||||
|  |                                         Text( | ||||||
|                                           '${sortedApps[index].app.installedVersion ?? tr('notInstalled')}${sortedApps[index].app.additionalSettings['trackOnly'] == true ? ' ${tr('estimateInBrackets')}' : ''}', |                                           '${sortedApps[index].app.installedVersion ?? tr('notInstalled')}${sortedApps[index].app.additionalSettings['trackOnly'] == true ? ' ${tr('estimateInBrackets')}' : ''}', | ||||||
|                                         overflow: TextOverflow.fade, |                                           overflow: TextOverflow.ellipsis, | ||||||
|                                           textAlign: TextAlign.end, |                                           textAlign: TextAlign.end, | ||||||
|  |                                         ) | ||||||
|  |                                       ]), | ||||||
|  |                                   GestureDetector( | ||||||
|  |                                       onTap: changesUrl == null | ||||||
|  |                                           ? null | ||||||
|  |                                           : () { | ||||||
|  |                                               launchUrlString(changesUrl, | ||||||
|  |                                                   mode: LaunchMode | ||||||
|  |                                                       .externalApplication); | ||||||
|  |                                             }, | ||||||
|  |                                       child: Text( | ||||||
|  |                                         sortedApps[index].app.releaseDate == | ||||||
|  |                                                 null | ||||||
|  |                                             ? tr('changes') | ||||||
|  |                                             : DateFormat('yyyy-MM-dd').format( | ||||||
|  |                                                 sortedApps[index] | ||||||
|  |                                                     .app | ||||||
|  |                                                     .releaseDate!), | ||||||
|  |                                         style: const TextStyle( | ||||||
|  |                                             fontStyle: FontStyle.italic, | ||||||
|  |                                             decoration: | ||||||
|  |                                                 TextDecoration.underline), | ||||||
|                                       )), |                                       )), | ||||||
|                                   sortedApps[index].app.installedVersion != |                                   sortedApps[index].app.installedVersion != | ||||||
|                                               null && |                                               null && | ||||||
| @@ -304,29 +328,47 @@ class AppsPageState extends State<AppsPage> { | |||||||
|                                               sortedApps[index] |                                               sortedApps[index] | ||||||
|                                                   .app |                                                   .app | ||||||
|                                                   .latestVersion |                                                   .latestVersion | ||||||
|                                       ? GestureDetector( |                                       ? appsProvider.areDownloadsRunning() | ||||||
|                                           onTap: changesUrl == null |  | ||||||
|                                               ? null |  | ||||||
|                                               : () { |  | ||||||
|                                                   launchUrlString(changesUrl, |  | ||||||
|                                                       mode: LaunchMode |  | ||||||
|                                                           .externalApplication); |  | ||||||
|                                                 }, |  | ||||||
|                                           child: appsProvider |  | ||||||
|                                                   .areDownloadsRunning() |  | ||||||
|                                           ? Text(tr('pleaseWait')) |                                           ? Text(tr('pleaseWait')) | ||||||
|                                               : Text( |                                           : Row( | ||||||
|                                                   '${tr('updateAvailable')}${sortedApps[index].app.additionalSettings['trackOnly'] == true ? ' ${tr('estimateInBracketsShort')}' : ''}', |                                               mainAxisSize: MainAxisSize.min, | ||||||
|  |                                               mainAxisAlignment: | ||||||
|  |                                                   MainAxisAlignment.end, | ||||||
|  |                                               children: [ | ||||||
|  |                                                 GestureDetector( | ||||||
|  |                                                     onTap: () { | ||||||
|  |                                                       appsProvider | ||||||
|  |                                                           .downloadAndInstallLatestApps( | ||||||
|  |                                                               [ | ||||||
|  |                                                             sortedApps[index] | ||||||
|  |                                                                 .app | ||||||
|  |                                                                 .id | ||||||
|  |                                                           ], | ||||||
|  |                                                               globalNavigatorKey | ||||||
|  |                                                                   .currentContext).catchError( | ||||||
|  |                                                               (e) { | ||||||
|  |                                                         showError(e, context); | ||||||
|  |                                                       }); | ||||||
|  |                                                     }, | ||||||
|  |                                                     child: Text( | ||||||
|  |                                                       sortedApps[index] | ||||||
|  |                                                                       .app | ||||||
|  |                                                                       .additionalSettings[ | ||||||
|  |                                                                   'trackOnly'] == | ||||||
|  |                                                               true | ||||||
|  |                                                           ? tr('markUpdated') | ||||||
|  |                                                           : tr('update'), | ||||||
|                                                       style: TextStyle( |                                                       style: TextStyle( | ||||||
|                                                       fontStyle: |                                                           color: | ||||||
|                                                           FontStyle.italic, |                                                               Theme.of(context) | ||||||
|                                                       decoration: changesUrl == |                                                                   .colorScheme | ||||||
|                                                               null |                                                                   .primary, | ||||||
|                                                           ? TextDecoration.none |                                                           fontWeight: | ||||||
|                                                           : TextDecoration |                                                               FontWeight.bold), | ||||||
|                                                               .underline), |                                                     )), | ||||||
|                                                 )) |                                               ], | ||||||
|                                       : const SizedBox(), |                                             ) | ||||||
|  |                                       : const SizedBox.shrink(), | ||||||
|                                 ], |                                 ], | ||||||
|                               ))), |                               ))), | ||||||
|                     onTap: () { |                     onTap: () { | ||||||
|   | |||||||
| @@ -33,8 +33,9 @@ class APKDetails { | |||||||
|   late String version; |   late String version; | ||||||
|   late List<String> apkUrls; |   late List<String> apkUrls; | ||||||
|   late AppNames names; |   late AppNames names; | ||||||
|  |   late DateTime? releaseDate; | ||||||
|  |  | ||||||
|   APKDetails(this.version, this.apkUrls, this.names); |   APKDetails(this.version, this.apkUrls, this.names, {this.releaseDate}); | ||||||
| } | } | ||||||
|  |  | ||||||
| class App { | class App { | ||||||
| @@ -50,6 +51,7 @@ class App { | |||||||
|   late DateTime? lastUpdateCheck; |   late DateTime? lastUpdateCheck; | ||||||
|   bool pinned = false; |   bool pinned = false; | ||||||
|   List<String> categories; |   List<String> categories; | ||||||
|  |   late DateTime? releaseDate; | ||||||
|   App( |   App( | ||||||
|       this.id, |       this.id, | ||||||
|       this.url, |       this.url, | ||||||
| @@ -62,7 +64,8 @@ class App { | |||||||
|       this.additionalSettings, |       this.additionalSettings, | ||||||
|       this.lastUpdateCheck, |       this.lastUpdateCheck, | ||||||
|       this.pinned, |       this.pinned, | ||||||
|       {this.categories = const []}); |       {this.categories = const [], | ||||||
|  |       this.releaseDate}); | ||||||
|  |  | ||||||
|   @override |   @override | ||||||
|   String toString() { |   String toString() { | ||||||
| @@ -134,7 +137,11 @@ class App { | |||||||
|               .toList() |               .toList() | ||||||
|           : json['category'] != null |           : json['category'] != null | ||||||
|               ? [json['category'] as String] |               ? [json['category'] as String] | ||||||
|                 : []); |               : [], | ||||||
|  |       releaseDate: json['releaseDate'] == null | ||||||
|  |           ? null | ||||||
|  |           : DateTime.fromMicrosecondsSinceEpoch(json['releaseDate']), | ||||||
|  |     ); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   Map<String, dynamic> toJson() => { |   Map<String, dynamic> toJson() => { | ||||||
| @@ -149,7 +156,8 @@ class App { | |||||||
|         'additionalSettings': jsonEncode(additionalSettings), |         'additionalSettings': jsonEncode(additionalSettings), | ||||||
|         'lastUpdateCheck': lastUpdateCheck?.microsecondsSinceEpoch, |         'lastUpdateCheck': lastUpdateCheck?.microsecondsSinceEpoch, | ||||||
|         'pinned': pinned, |         'pinned': pinned, | ||||||
|         'categories': categories |         'categories': categories, | ||||||
|  |         'releaseDate': releaseDate?.microsecondsSinceEpoch | ||||||
|       }; |       }; | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -225,6 +233,10 @@ class AppSource { | |||||||
|         label: tr('trackOnly'), |         label: tr('trackOnly'), | ||||||
|       ) |       ) | ||||||
|     ], |     ], | ||||||
|  |     [ | ||||||
|  |       GeneratedFormSwitch('releaseDateAsVersion', | ||||||
|  |           label: tr('useReleaseDateAsVersion')) | ||||||
|  |     ], | ||||||
|     [ |     [ | ||||||
|       GeneratedFormSwitch('noVersionDetection', label: tr('noVersionDetection')) |       GeneratedFormSwitch('noVersionDetection', label: tr('noVersionDetection')) | ||||||
|     ], |     ], | ||||||
| @@ -359,16 +371,19 @@ class SourceProvider { | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   Future<App> getApp( |   Future<App> getApp( | ||||||
|     AppSource source, |       AppSource source, String url, Map<String, dynamic> additionalSettings, | ||||||
|     String url, |       {App? currentApp, | ||||||
|     Map<String, dynamic> additionalSettings, { |  | ||||||
|     App? currentApp, |  | ||||||
|       bool trackOnlyOverride = false, |       bool trackOnlyOverride = false, | ||||||
|     noVersionDetectionOverride = false, |       bool noVersionDetectionOverride = false, | ||||||
|   }) async { |       bool releaseDateAsVersionOverride = false}) async { | ||||||
|     if (trackOnlyOverride || source.enforceTrackOnly) { |     if (trackOnlyOverride || source.enforceTrackOnly) { | ||||||
|       additionalSettings['trackOnly'] = true; |       additionalSettings['trackOnly'] = true; | ||||||
|     } |     } | ||||||
|  |     if (releaseDateAsVersionOverride) { | ||||||
|  |       additionalSettings['releaseDateAsVersion'] = true; | ||||||
|  |       noVersionDetectionOverride = | ||||||
|  |           true; // Rel. date as version means no ver. det. | ||||||
|  |     } | ||||||
|     if (noVersionDetectionOverride) { |     if (noVersionDetectionOverride) { | ||||||
|       additionalSettings['noVersionDetection'] = true; |       additionalSettings['noVersionDetection'] = true; | ||||||
|     } |     } | ||||||
| @@ -376,6 +391,10 @@ class SourceProvider { | |||||||
|     String standardUrl = source.standardizeURL(preStandardizeUrl(url)); |     String standardUrl = source.standardizeURL(preStandardizeUrl(url)); | ||||||
|     APKDetails apk = |     APKDetails apk = | ||||||
|         await source.getLatestAPKDetails(standardUrl, additionalSettings); |         await source.getLatestAPKDetails(standardUrl, additionalSettings); | ||||||
|  |     if (additionalSettings['releaseDateAsVersion'] == true && | ||||||
|  |         apk.releaseDate != null) { | ||||||
|  |       apk.version = apk.releaseDate!.microsecondsSinceEpoch.toString(); | ||||||
|  |     } | ||||||
|     if (additionalSettings['apkFilterRegEx'] != null) { |     if (additionalSettings['apkFilterRegEx'] != null) { | ||||||
|       var reg = RegExp(additionalSettings['apkFilterRegEx']); |       var reg = RegExp(additionalSettings['apkFilterRegEx']); | ||||||
|       apk.apkUrls = |       apk.apkUrls = | ||||||
| @@ -404,7 +423,8 @@ class SourceProvider { | |||||||
|         additionalSettings, |         additionalSettings, | ||||||
|         DateTime.now(), |         DateTime.now(), | ||||||
|         currentApp?.pinned ?? false, |         currentApp?.pinned ?? false, | ||||||
|         categories: currentApp?.categories ?? const []); |         categories: currentApp?.categories ?? const [], | ||||||
|  |         releaseDate: apk.releaseDate); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   // Returns errors in [results, errors] instead of throwing them |   // Returns errors in [results, errors] instead of throwing them | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user