mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-30 04:53:28 +01:00 
			
		
		
		
	UI bugfixes on add app page (#1866)
This commit is contained in:
		| @@ -30,6 +30,7 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|   String userInput = ''; | ||||
|   String searchQuery = ''; | ||||
|   String? pickedSourceOverride; | ||||
|   String? previousPickedSourceOverride; | ||||
|   AppSource? pickedSource; | ||||
|   Map<String, dynamic> additionalSettings = {}; | ||||
|   bool additionalSettingsValid = true; | ||||
| @@ -58,6 +59,9 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|         if (overrideSource != null) { | ||||
|           pickedSourceOverride = overrideSource; | ||||
|         } | ||||
|         bool overrideChanged = | ||||
|             pickedSourceOverride != previousPickedSourceOverride; | ||||
|         previousPickedSourceOverride = pickedSourceOverride; | ||||
|         if (updateUrlInput) { | ||||
|           urlInputKey++; | ||||
|         } | ||||
| @@ -69,6 +73,7 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|                 overrideSource: pickedSourceOverride) | ||||
|             : null; | ||||
|         if (pickedSource.runtimeType != source.runtimeType || | ||||
|             overrideChanged || | ||||
|             (prevHost != null && prevHost != source?.hosts[0])) { | ||||
|           pickedSource = source; | ||||
|           pickedSource?.runOnAddAppInputChange(userInput); | ||||
| @@ -487,7 +492,8 @@ class AddAppPageState extends State<AddAppPage> { | ||||
|               height: 16, | ||||
|             ), | ||||
|             GeneratedForm( | ||||
|                 key: Key(pickedSource.runtimeType.toString()), | ||||
|                 key: Key( | ||||
|                     '${pickedSource.runtimeType.toString()}-${pickedSource?.hostChanged.toString()}-${pickedSource?.hostIdenticalDespiteAnyChange.toString()}'), | ||||
|                 items: [ | ||||
|                   ...pickedSource!.combinedAppSpecificSettingFormItems, | ||||
|                   ...(pickedSourceOverride != null | ||||
|   | ||||
| @@ -414,6 +414,7 @@ HttpClient createHttpClient(bool insecure) { | ||||
| abstract class AppSource { | ||||
|   List<String> hosts = []; | ||||
|   bool hostChanged = false; | ||||
|   bool hostIdenticalDespiteAnyChange = false; | ||||
|   late String name; | ||||
|   bool enforceTrackOnly = false; | ||||
|   bool changeLogIfAnyIsMarkDown = true; | ||||
| @@ -628,9 +629,10 @@ abstract class AppSource { | ||||
|       SettingsProvider settingsProvider) async { | ||||
|     Map<String, String> results = {}; | ||||
|     for (var e in sourceConfigSettingFormItems) { | ||||
|       var val = hostChanged | ||||
|       var val = hostChanged && !hostIdenticalDespiteAnyChange | ||||
|           ? additionalSettings[e.key] | ||||
|           : settingsProvider.getSettingString(e.key); | ||||
|           : additionalSettings[e.key] ?? | ||||
|               settingsProvider.getSettingString(e.key); | ||||
|       if (val != null) { | ||||
|         results[e.key] = val; | ||||
|       } | ||||
| @@ -813,9 +815,14 @@ class SourceProvider { | ||||
|         throw UnsupportedURLError(); | ||||
|       } | ||||
|       var res = srcs.first; | ||||
|       res.hosts = [Uri.parse(url).host]; | ||||
|       var originalHosts = res.hosts; | ||||
|       var newHost = Uri.parse(url).host; | ||||
|       res.hosts = [newHost]; | ||||
|       res.hostChanged = true; | ||||
|       return srcs.first; | ||||
|       if (originalHosts.contains(newHost)) { | ||||
|         res.hostIdenticalDespiteAnyChange = true; | ||||
|       } | ||||
|       return res; | ||||
|     } | ||||
|     AppSource? source; | ||||
|     for (var s in sources.where((element) => element.hosts.isNotEmpty)) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user