mirror of
https://github.com/ImranR98/Obtainium.git
synced 2025-07-13 13:26:43 +02:00
Merge remote-tracking branch 'origin/main' into dev
This commit is contained in:
@ -25,9 +25,32 @@ class AppPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _AppPageState extends State<AppPage> {
|
class _AppPageState extends State<AppPage> {
|
||||||
|
late final WebViewController _webViewController;
|
||||||
|
bool _wasWebViewOpened = false;
|
||||||
AppInMemory? prevApp;
|
AppInMemory? prevApp;
|
||||||
bool updating = false;
|
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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var appsProvider = context.watch<AppsProvider>();
|
var appsProvider = context.watch<AppsProvider>();
|
||||||
@ -81,6 +104,11 @@ class _AppPageState extends State<AppPage> {
|
|||||||
(app?.app.installedVersion != null &&
|
(app?.app.installedVersion != null &&
|
||||||
app?.app.additionalSettings['versionDetection'] != true);
|
app?.app.additionalSettings['versionDetection'] != true);
|
||||||
|
|
||||||
|
if (app != null && !_wasWebViewOpened) {
|
||||||
|
_wasWebViewOpened = true;
|
||||||
|
_webViewController.loadRequest(Uri.parse(app.app.url));
|
||||||
|
}
|
||||||
|
|
||||||
getInfoColumn() {
|
getInfoColumn() {
|
||||||
String versionLines = '';
|
String versionLines = '';
|
||||||
bool installed = app?.app.installedVersion != null;
|
bool installed = app?.app.installedVersion != null;
|
||||||
@ -340,25 +368,9 @@ class _AppPageState extends State<AppPage> {
|
|||||||
|
|
||||||
getAppWebView() => app != null
|
getAppWebView() => app != null
|
||||||
? WebViewWidget(
|
? WebViewWidget(
|
||||||
controller: WebViewController()
|
key: ObjectKey(_webViewController),
|
||||||
..setJavaScriptMode(JavaScriptMode.unrestricted)
|
controller: _webViewController
|
||||||
..setBackgroundColor(Theme.of(context).colorScheme.surface)
|
..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)))
|
|
||||||
: Container();
|
: Container();
|
||||||
|
|
||||||
showMarkUpdatedDialog() {
|
showMarkUpdatedDialog() {
|
||||||
|
Reference in New Issue
Block a user