Skip to content

Commit

Permalink
v1.26.5 (#65)
Browse files Browse the repository at this point in the history
* feat(home): always keep webview

* feat: upgrade core

* chore: v1.26.5

* refactor: remove unused code

* refactor: remove unused code
  • Loading branch information
igoogolx authored Jan 4, 2025
1 parent f62b421 commit 6b224a7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 37 deletions.
17 changes: 1 addition & 16 deletions lib/dashboard.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:webview_flutter/webview_flutter.dart';
Expand All @@ -12,9 +10,8 @@ class WebViewDashboard extends StatefulWidget {
final String baseUrl;
final String urlStr;
final String homeDir;
final ValueChanged<String> onUrlChanged;

const WebViewDashboard(this.homeDir, this.baseUrl, this.urlStr, this.onUrlChanged, {super.key});
const WebViewDashboard(this.homeDir, this.baseUrl, this.urlStr, {super.key});

@override
State<WebViewDashboard> createState() => _WebViewDashboardState();
Expand All @@ -25,17 +22,6 @@ class _WebViewDashboardState extends State<WebViewDashboard> {

_WebViewDashboardState();

@override
void dispose() async {
super.dispose();
var curUrl = await _controller?.currentUrl();
if(curUrl!=null){
widget.onUrlChanged(curUrl);
}
_controller=null;
}


@override
void initState() {
super.initState();
Expand All @@ -53,7 +39,6 @@ class _WebViewDashboardState extends State<WebViewDashboard> {
controller.setNavigationDelegate(
NavigationDelegate(onNavigationRequest: (NavigationRequest request) {
if (request.url.startsWith(widget.baseUrl)) {
widget.onUrlChanged(request.url);
return NavigationDecision.navigate;
}
launchUrl(Uri.parse(request.url));
Expand Down
20 changes: 1 addition & 19 deletions lib/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:io';

import 'package:flutter/material.dart';
import 'package:lux/dashboard.dart';
import 'package:lux/progress_indicator.dart';
import 'package:window_manager/window_manager.dart';

class Home extends StatefulWidget {
Expand All @@ -17,13 +16,7 @@ class Home extends StatefulWidget {

class _HomeState extends State<Home> with WindowListener {

bool isWebviewHidden = false;

String? dashboardUrl;

void onChanged(String newUrl){
dashboardUrl= newUrl;
}

void _init() async {
windowManager.addListener(this);
Expand All @@ -48,27 +41,16 @@ class _HomeState extends State<Home> with WindowListener {
} else {
await windowManager.minimize();
}
setState(() {
isWebviewHidden= true;
});
} else {
await windowManager.hide();
}

}

@override
void onWindowFocus() async {
setState(() {
isWebviewHidden= false;
});
}

@override
Widget build(BuildContext context) {
var preUrl = dashboardUrl ?? widget.urlStr;
return Scaffold(
body: isWebviewHidden ? AppProgressIndicator() : WebViewDashboard(widget.homeDir, widget.baseUrl,preUrl,onChanged)
body: WebViewDashboard(widget.homeDir, widget.baseUrl, widget.urlStr)
);
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.26.4
version: 1.26.5

environment:
sdk: '>=3.0.6 <4.0.0'
Expand Down
2 changes: 1 addition & 1 deletion scripts/init.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ final assetsPath =
final binDir = Directory(path.join(assetsPath, 'bin'));

const rawCoreName = 'itun2socks';
const rawCoreVersion = '1.23.2';
const rawCoreVersion = '1.23.3';

Future downloadLatestCore(String arch, String token) async {
final dio = Dio();
Expand Down

0 comments on commit 6b224a7

Please sign in to comment.