mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-31 13:33:28 +01:00 
			
		
		
		
	Add warning popup toggles + fix breaking bug in add app
This commit is contained in:
		| @@ -332,13 +332,16 @@ class AppsProvider with ChangeNotifier { | ||||
|         getHost(apkUrl.value) != getHost(app.url) && | ||||
|         context != null) { | ||||
|       // ignore: use_build_context_synchronously | ||||
|       if (await showDialog( | ||||
|               context: context, | ||||
|               builder: (BuildContext ctx) { | ||||
|                 return APKOriginWarningDialog( | ||||
|                     sourceUrl: app.url, apkUrl: apkUrl!.value); | ||||
|               }) != | ||||
|           true) { | ||||
|       var settingsProvider = context.read<SettingsProvider>(); | ||||
|       if (!(settingsProvider.hideAPKOriginWarning) && | ||||
|           // ignore: use_build_context_synchronously | ||||
|           await showDialog( | ||||
|                   context: context, | ||||
|                   builder: (BuildContext ctx) { | ||||
|                     return APKOriginWarningDialog( | ||||
|                         sourceUrl: app.url, apkUrl: apkUrl!.value); | ||||
|                   }) != | ||||
|               true) { | ||||
|         apkUrl = null; | ||||
|       } | ||||
|     } | ||||
|   | ||||
| @@ -163,6 +163,24 @@ class SettingsProvider with ChangeNotifier { | ||||
|     notifyListeners(); | ||||
|   } | ||||
|  | ||||
|   bool get hideTrackOnlyWarning { | ||||
|     return prefs?.getBool('hideTrackOnlyWarning') ?? false; | ||||
|   } | ||||
|  | ||||
|   set hideTrackOnlyWarning(bool show) { | ||||
|     prefs?.setBool('hideTrackOnlyWarning', show); | ||||
|     notifyListeners(); | ||||
|   } | ||||
|  | ||||
|   bool get hideAPKOriginWarning { | ||||
|     return prefs?.getBool('hideAPKOriginWarning') ?? false; | ||||
|   } | ||||
|  | ||||
|   set hideAPKOriginWarning(bool show) { | ||||
|     prefs?.setBool('hideAPKOriginWarning', show); | ||||
|     notifyListeners(); | ||||
|   } | ||||
|  | ||||
|   String? getSettingString(String settingId) { | ||||
|     return prefs?.getString(settingId); | ||||
|   } | ||||
|   | ||||
| @@ -470,7 +470,7 @@ class SourceProvider { | ||||
|     } | ||||
|     AppSource? source; | ||||
|     for (var s in sources.where((element) => element.host != null)) { | ||||
|       if (RegExp('://${s.host}').hasMatch(url)) { | ||||
|       if (RegExp('://${s.host}(/|\\z)?').hasMatch(url)) { | ||||
|         source = s; | ||||
|         break; | ||||
|       } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user