mirror of
				https://github.com/ImranR98/Obtainium.git
				synced 2025-10-28 12:03:45 +01:00 
			
		
		
		
	Fix [suppress] duplicated apps webpage view
This commit is contained in:
		| @@ -25,9 +25,32 @@ class AppPage extends StatefulWidget { | ||||
| } | ||||
|  | ||||
| class _AppPageState extends State<AppPage> { | ||||
|   late final WebViewController _webViewController; | ||||
|   bool _wasWebViewOpened = false; | ||||
|   AppInMemory? prevApp; | ||||
|   bool updating = false; | ||||
|  | ||||
|   @override | ||||
|   void initState() { | ||||
|     super.initState(); | ||||
|     _webViewController = WebViewController() | ||||
|       ..setJavaScriptMode(JavaScriptMode.unrestricted) | ||||
|       ..setNavigationDelegate( | ||||
|         NavigationDelegate( | ||||
|           onWebResourceError: (WebResourceError error) { | ||||
|             if (error.isForMainFrame == true) { | ||||
|               showError( | ||||
|                   ObtainiumError(error.description, unexpected: true), context); | ||||
|             } | ||||
|           }, | ||||
|           onNavigationRequest: (NavigationRequest request) => | ||||
|               request.url.startsWith("rustore://") | ||||
|                   ? NavigationDecision.prevent | ||||
|                   : NavigationDecision.navigate, | ||||
|         ), | ||||
|       ); | ||||
|   } | ||||
|  | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     var appsProvider = context.watch<AppsProvider>(); | ||||
| @@ -81,6 +104,11 @@ class _AppPageState extends State<AppPage> { | ||||
|         (app?.app.installedVersion != null && | ||||
|             app?.app.additionalSettings['versionDetection'] != true); | ||||
|  | ||||
|     if (app != null && !_wasWebViewOpened) { | ||||
|       _wasWebViewOpened = true; | ||||
|       _webViewController.loadRequest(Uri.parse(app.app.url)); | ||||
|     } | ||||
|  | ||||
|     getInfoColumn() { | ||||
|       String versionLines = ''; | ||||
|       bool installed = app?.app.installedVersion != null; | ||||
| @@ -340,25 +368,9 @@ class _AppPageState extends State<AppPage> { | ||||
|  | ||||
|     getAppWebView() => app != null | ||||
|         ? WebViewWidget( | ||||
|             controller: WebViewController() | ||||
|               ..setJavaScriptMode(JavaScriptMode.unrestricted) | ||||
|               ..setBackgroundColor(Theme.of(context).colorScheme.surface) | ||||
|               ..setNavigationDelegate( | ||||
|                 NavigationDelegate( | ||||
|                   onWebResourceError: (WebResourceError error) { | ||||
|                     if (error.isForMainFrame == true) { | ||||
|                       showError( | ||||
|                           ObtainiumError(error.description, unexpected: true), | ||||
|                           context); | ||||
|                     } | ||||
|                   }, | ||||
|                   onNavigationRequest: (NavigationRequest request) => | ||||
|                       request.url.startsWith("rustore://") | ||||
|                           ? NavigationDecision.prevent | ||||
|                           : NavigationDecision.navigate, | ||||
|                 ), | ||||
|               ) | ||||
|               ..loadRequest(Uri.parse(app.app.url))) | ||||
|             key: ObjectKey(_webViewController), | ||||
|             controller: _webViewController | ||||
|               ..setBackgroundColor(Theme.of(context).colorScheme.surface)) | ||||
|         : Container(); | ||||
|  | ||||
|     showMarkUpdatedDialog() { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user