mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-26 03:03:45 +01:00 
			
		
		
		
	Fixed code smells
This commit is contained in:
		| @@ -1,6 +1,5 @@ | ||||
| import 'package:easy_localization/easy_localization.dart'; | ||||
| import 'package:html/parser.dart'; | ||||
| import 'package:http/http.dart'; | ||||
| import 'package:obtainium/custom_errors.dart'; | ||||
| import 'package:obtainium/providers/source_provider.dart'; | ||||
|  | ||||
| @@ -85,7 +84,6 @@ class APKCombo extends AppSource { | ||||
|     Map<String, dynamic> additionalSettings, | ||||
|   ) async { | ||||
|     String appId = tryInferringAppId(standardUrl)!; | ||||
|     String host = Uri.parse(standardUrl).host; | ||||
|     var preres = await sourceRequest(standardUrl); | ||||
|     if (preres.statusCode != 200) { | ||||
|       throw getObtainiumHttpError(preres); | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| import 'package:easy_localization/easy_localization.dart'; | ||||
| import 'package:html/parser.dart'; | ||||
| import 'package:http/http.dart'; | ||||
| import 'package:obtainium/custom_errors.dart'; | ||||
| import 'package:obtainium/providers/source_provider.dart'; | ||||
|  | ||||
|   | ||||
| @@ -1,6 +1,4 @@ | ||||
| import 'dart:convert'; | ||||
| import 'package:easy_localization/easy_localization.dart'; | ||||
| import 'package:http/http.dart'; | ||||
| import 'package:obtainium/app_sources/github.dart'; | ||||
| import 'package:obtainium/components/generated_form.dart'; | ||||
| import 'package:obtainium/custom_errors.dart'; | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| import 'package:easy_localization/easy_localization.dart'; | ||||
| import 'package:html/parser.dart'; | ||||
| import 'package:http/http.dart'; | ||||
| import 'package:obtainium/components/generated_form.dart'; | ||||
| import 'package:obtainium/custom_errors.dart'; | ||||
| import 'package:obtainium/providers/source_provider.dart'; | ||||
|   | ||||
| @@ -83,12 +83,12 @@ class GitLab extends AppSource { | ||||
|     } | ||||
|     var json = jsonDecode(res.body) as List<dynamic>; | ||||
|     Map<String, List<String>> results = {}; | ||||
|     json.forEach((element) { | ||||
|     for (var element in json) { | ||||
|       results['https://$host/${element['path_with_namespace']}'] = [ | ||||
|         element['name_with_namespace'], | ||||
|         element['description'] ?? tr('noDescription') | ||||
|       ]; | ||||
|     }); | ||||
|     } | ||||
|     return results; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -1,4 +1,3 @@ | ||||
| import 'package:http/http.dart'; | ||||
| import 'package:obtainium/app_sources/fdroid.dart'; | ||||
| import 'package:obtainium/custom_errors.dart'; | ||||
| import 'package:obtainium/providers/source_provider.dart'; | ||||
|   | ||||
| @@ -10,7 +10,6 @@ class Jenkins extends AppSource { | ||||
|     overrideVersionDetectionFormDefault('releaseDateAsVersion', true); | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   String trimJobUrl(String url) { | ||||
|     RegExp standardUrlRegEx = RegExp('.*/job/[^/]+'); | ||||
|     RegExpMatch? match = standardUrlRegEx.firstMatch(url); | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| import 'package:html/parser.dart'; | ||||
| import 'package:http/http.dart'; | ||||
| import 'package:obtainium/app_sources/github.dart'; | ||||
| import 'package:obtainium/app_sources/html.dart'; | ||||
| import 'package:obtainium/custom_errors.dart'; | ||||
| import 'package:obtainium/providers/source_provider.dart'; | ||||
| @@ -58,7 +57,6 @@ class SourceHut extends AppSource { | ||||
|           throw NoVersionError(); | ||||
|         } | ||||
|         String? releaseDateString = entry.querySelector('pubDate')?.innerHtml; | ||||
|         var link = entry.querySelector('link'); | ||||
|         String releasePage = '$standardUrl/refs/$version'; | ||||
|         DateTime? releaseDate = releaseDateString != null | ||||
|             ? DateFormat('EEE, dd MMM yyyy HH:mm:ss Z').parse(releaseDateString) | ||||
|   | ||||
| @@ -1,6 +1,5 @@ | ||||
| import 'package:html/parser.dart'; | ||||
| import 'package:http/http.dart'; | ||||
| import 'package:obtainium/app_sources/html.dart'; | ||||
| import 'package:obtainium/custom_errors.dart'; | ||||
| import 'package:obtainium/providers/source_provider.dart'; | ||||
|  | ||||
|   | ||||
| @@ -32,6 +32,7 @@ class _AppPageState extends State<AppPage> { | ||||
|     getUpdate(String id) { | ||||
|       appsProvider.checkUpdate(id).catchError((e) { | ||||
|         showError(e, context); | ||||
|         return null; | ||||
|       }); | ||||
|     } | ||||
|  | ||||
|   | ||||
| @@ -71,6 +71,7 @@ class AppsPageState extends State<AppsPage> { | ||||
|       }); | ||||
|       return appsProvider.checkUpdates().catchError((e) { | ||||
|         showError(e, context); | ||||
|         return <App>[]; | ||||
|       }).whenComplete(() { | ||||
|         setState(() { | ||||
|           refreshingSince = null; | ||||
| @@ -379,6 +380,7 @@ class AppsPageState extends State<AppsPage> { | ||||
|                       [listedApps[appIndex].app.id], | ||||
|                       globalNavigatorKey.currentContext).catchError((e) { | ||||
|                     showError(e, context); | ||||
|                     return <String>[]; | ||||
|                   }); | ||||
|                 }, | ||||
|           icon: Icon( | ||||
| @@ -681,6 +683,7 @@ class AppsPageState extends State<AppsPage> { | ||||
|                           settingsProvider: settingsProvider) | ||||
|                       .catchError((e) { | ||||
|                     showError(e, context); | ||||
|                     return <String>[]; | ||||
|                   }); | ||||
|                 } | ||||
|               }); | ||||
|   | ||||
| @@ -323,8 +323,8 @@ class _ImportExportPageState extends State<ImportExportPage> { | ||||
|                         ], | ||||
|                       ), | ||||
|                       if (importInProgress) | ||||
|                         Column( | ||||
|                           children: const [ | ||||
|                         const Column( | ||||
|                           children: [ | ||||
|                             SizedBox( | ||||
|                               height: 14, | ||||
|                             ), | ||||
|   | ||||
| @@ -7,7 +7,6 @@ import 'package:device_info_plus/device_info_plus.dart'; | ||||
| import 'package:easy_localization/easy_localization.dart'; | ||||
| import 'package:html/dom.dart'; | ||||
| import 'package:http/http.dart'; | ||||
| import 'package:obtainium/app_sources/apkcombo.dart'; | ||||
| import 'package:obtainium/app_sources/apkmirror.dart'; | ||||
| import 'package:obtainium/app_sources/apkpure.dart'; | ||||
| import 'package:obtainium/app_sources/codeberg.dart'; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user