mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-11-04 07:13:28 +01:00 
			
		
		
		
	Adds Source-specific options + other changes (#26)
* Started work on dynamic forms * dynamic form progress (switch doesn't work) * dynamic forms work * Gen. form improvements, source specific data (untested) * Gen form bugfix * Removed redundant generated modal code * Added custom validators to gen. forms * Progress on source options (incomplete), gen form bugfixes * Tweaks, more * More * Progress * Changed a default * Additional options done!
This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
			
		||||
import 'package:html/parser.dart';
 | 
			
		||||
import 'package:http/http.dart';
 | 
			
		||||
import 'package:obtainium/app_sources/github.dart';
 | 
			
		||||
import 'package:obtainium/components/generated_form.dart';
 | 
			
		||||
import 'package:obtainium/providers/source_provider.dart';
 | 
			
		||||
 | 
			
		||||
class GitLab implements AppSource {
 | 
			
		||||
@@ -12,13 +13,14 @@ class GitLab implements AppSource {
 | 
			
		||||
    RegExp standardUrlRegEx = RegExp('^https?://$host/[^/]+/[^/]+');
 | 
			
		||||
    RegExpMatch? match = standardUrlRegEx.firstMatch(url.toLowerCase());
 | 
			
		||||
    if (match == null) {
 | 
			
		||||
      throw notValidURL;
 | 
			
		||||
      throw notValidURL(runtimeType.toString());
 | 
			
		||||
    }
 | 
			
		||||
    return url.substring(0, match.end);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  Future<APKDetails> getLatestAPKDetails(String standardUrl) async {
 | 
			
		||||
  Future<APKDetails> getLatestAPKDetails(
 | 
			
		||||
      String standardUrl, List<String> additionalData) async {
 | 
			
		||||
    Response res = await get(Uri.parse('$standardUrl/-/tags?format=atom'));
 | 
			
		||||
    if (res.statusCode == 200) {
 | 
			
		||||
      var standardUri = Uri.parse(standardUrl);
 | 
			
		||||
@@ -60,4 +62,10 @@ class GitLab implements AppSource {
 | 
			
		||||
    // Same as GitHub
 | 
			
		||||
    return GitHub().getAppNames(standardUrl);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  List<List<GeneratedFormItem>> additionalDataFormItems = [];
 | 
			
		||||
 | 
			
		||||
  @override
 | 
			
		||||
  List<String> additionalDataDefaults = [];
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user