mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-25 20:03:44 +02:00 
			
		
		
		
	Basic custom App name support (only when adding)
This commit is contained in:
		| @@ -22,6 +22,7 @@ class _AddAppPageState extends State<AddAppPage> { | |||||||
|   String userInput = ''; |   String userInput = ''; | ||||||
|   AppSource? pickedSource; |   AppSource? pickedSource; | ||||||
|   List<String> additionalData = []; |   List<String> additionalData = []; | ||||||
|  |   String customName = ''; | ||||||
|   bool validAdditionalData = true; |   bool validAdditionalData = true; | ||||||
|  |  | ||||||
|   @override |   @override | ||||||
| @@ -79,6 +80,9 @@ class _AddAppPageState extends State<AddAppPage> { | |||||||
|                                                 .doesSourceHaveRequiredAdditionalData( |                                                 .doesSourceHaveRequiredAdditionalData( | ||||||
|                                                     source) |                                                     source) | ||||||
|                                             : true; |                                             : true; | ||||||
|  |                                         if (source == null) { | ||||||
|  |                                           customName = ''; | ||||||
|  |                                         } | ||||||
|                                       } |                                       } | ||||||
|                                     }); |                                     }); | ||||||
|                                   }, |                                   }, | ||||||
| @@ -100,7 +104,8 @@ class _AddAppPageState extends State<AddAppPage> { | |||||||
|                                       }); |                                       }); | ||||||
|                                       sourceProvider |                                       sourceProvider | ||||||
|                                           .getApp(pickedSource!, userInput, |                                           .getApp(pickedSource!, userInput, | ||||||
|                                               additionalData) |                                               additionalData, | ||||||
|  |                                               customName: customName) | ||||||
|                                           .then((app) { |                                           .then((app) { | ||||||
|                                         var appsProvider = |                                         var appsProvider = | ||||||
|                                             context.read<AppsProvider>(); |                                             context.read<AppsProvider>(); | ||||||
| @@ -162,7 +167,30 @@ class _AddAppPageState extends State<AddAppPage> { | |||||||
|                                   }); |                                   }); | ||||||
|                                 }, |                                 }, | ||||||
|                                 defaultValues: |                                 defaultValues: | ||||||
|                                     pickedSource!.additionalDataDefaults) |                                     pickedSource!.additionalDataDefaults), | ||||||
|  |                             if (pickedSource != null) | ||||||
|  |                               Column( | ||||||
|  |                                   crossAxisAlignment: | ||||||
|  |                                       CrossAxisAlignment.stretch, | ||||||
|  |                                   children: [ | ||||||
|  |                                     const SizedBox( | ||||||
|  |                                       height: 8, | ||||||
|  |                                     ), | ||||||
|  |                                     GeneratedForm( | ||||||
|  |                                         items: [ | ||||||
|  |                                           [ | ||||||
|  |                                             GeneratedFormItem( | ||||||
|  |                                                 label: 'Custom App Name', | ||||||
|  |                                                 required: false) | ||||||
|  |                                           ] | ||||||
|  |                                         ], | ||||||
|  |                                         onValueChanges: (values, valid) { | ||||||
|  |                                           setState(() { | ||||||
|  |                                             customName = values[0]; | ||||||
|  |                                           }); | ||||||
|  |                                         }, | ||||||
|  |                                         defaultValues: [customName]) | ||||||
|  |                                   ]), | ||||||
|                           ], |                           ], | ||||||
|                         ) |                         ) | ||||||
|                       else |                       else | ||||||
|   | |||||||
| @@ -176,8 +176,8 @@ class SourceProvider { | |||||||
|     return false; |     return false; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   Future<App> getApp( |   Future<App> getApp(AppSource source, String url, List<String> additionalData, | ||||||
|       AppSource source, String url, List<String> additionalData) async { |       {String customName = ''}) async { | ||||||
|     String standardUrl = source.standardizeURL(makeUrlHttps(url)); |     String standardUrl = source.standardizeURL(makeUrlHttps(url)); | ||||||
|     AppNames names = source.getAppNames(standardUrl); |     AppNames names = source.getAppNames(standardUrl); | ||||||
|     APKDetails apk = |     APKDetails apk = | ||||||
| @@ -186,7 +186,9 @@ class SourceProvider { | |||||||
|         '${names.author.toLowerCase()}_${names.name.toLowerCase()}_${source.host}', |         '${names.author.toLowerCase()}_${names.name.toLowerCase()}_${source.host}', | ||||||
|         standardUrl, |         standardUrl, | ||||||
|         names.author[0].toUpperCase() + names.author.substring(1), |         names.author[0].toUpperCase() + names.author.substring(1), | ||||||
|         names.name[0].toUpperCase() + names.name.substring(1), |         customName.trim().isNotEmpty | ||||||
|  |             ? customName | ||||||
|  |             : names.name[0].toUpperCase() + names.name.substring(1), | ||||||
|         null, |         null, | ||||||
|         apk.version, |         apk.version, | ||||||
|         apk.apkUrls, |         apk.apkUrls, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user