diff --git a/ios/Flutter/AppFrameworkInfo.plist b/ios/Flutter/AppFrameworkInfo.plist index 7c56964..1dc6cf7 100644 --- a/ios/Flutter/AppFrameworkInfo.plist +++ b/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 12.0 + 13.0 diff --git a/ios/Podfile b/ios/Podfile index a1d6ad8..eabeabb 100644 --- a/ios/Podfile +++ b/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -platform :ios, '12.0' +platform :ios, '13.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 6f4036a..1749bfb 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -767,7 +767,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -899,7 +899,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -949,7 +949,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -1030,7 +1030,7 @@ INFOPLIST_FILE = ProxyPin/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = ProxyPin; INFOPLIST_KEY_NSHumanReadableCopyright = ""; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1070,7 +1070,7 @@ INFOPLIST_FILE = ProxyPin/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = ProxyPin; INFOPLIST_KEY_NSHumanReadableCopyright = ""; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1107,7 +1107,7 @@ INFOPLIST_FILE = ProxyPin/Info.plist; INFOPLIST_KEY_CFBundleDisplayName = ProxyPin; INFOPLIST_KEY_NSHumanReadableCopyright = ""; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/ios/Runner/AppDelegate.swift b/ios/Runner/AppDelegate.swift index 1043130..f321236 100644 --- a/ios/Runner/AppDelegate.swift +++ b/ios/Runner/AppDelegate.swift @@ -11,7 +11,7 @@ import NetworkExtension didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { GeneratedPluginRegistrant.register(with: self) - let controller: FlutterViewController = window.rootViewController as! FlutterViewController ; + let controller: FlutterViewController = window?.rootViewController as! FlutterViewController let vpnChannel = FlutterMethodChannel.init(name: "com.proxy/proxyVpn", binaryMessenger: controller as! FlutterBinaryMessenger); vpnChannel.setMethodCallHandler({(call: FlutterMethodCall, result: FlutterResult) -> Void in if ("stopVpn" == call.method) { @@ -33,6 +33,10 @@ import NetworkExtension MethodHandler.register(with: self.registrar(forPlugin: MethodHandler.name)!) } + if let window = self.window { + window.rootViewController = controller + } + return super.application(application, didFinishLaunchingWithOptions: launchOptions) } diff --git a/lib/ui/desktop/desktop.dart b/lib/ui/desktop/desktop.dart index dd1d2e6..100c90f 100644 --- a/lib/ui/desktop/desktop.dart +++ b/lib/ui/desktop/desktop.dart @@ -117,7 +117,6 @@ class _DesktopHomePagePageState extends State implements EventL padding: EdgeInsets.only(bottom: 2.5), margin: EdgeInsets.only(bottom: 2.5), decoration: BoxDecoration( - color: Theme.of(context).brightness == Brightness.dark ? null : Color(0xFFF9F9F9), border: Border( bottom: BorderSide( color: Theme.of(context).dividerColor.withOpacity(0.3), width: Platform.isMacOS ? 0.2 : 0.55))), diff --git a/lib/ui/launch/launch.dart b/lib/ui/launch/launch.dart index 807c70c..1973783 100644 --- a/lib/ui/launch/launch.dart +++ b/lib/ui/launch/launch.dart @@ -61,15 +61,17 @@ class _SocketLaunchState extends State with WindowListener, Widget @override void initState() { super.initState(); - windowManager.addListener(this); + if (Platforms.isDesktop()) { + windowManager.addListener(this); + windowManager.setPreventClose(true); + } + WidgetsBinding.instance.addObserver(this); //启动代理服务器 if (widget.startup) { start(); } - if (Platforms.isDesktop()) { - windowManager.setPreventClose(true); - } + SocketLaunch.startStatus.addListener(() { if (SocketLaunch.startStatus.value.get() == started) { return; @@ -117,7 +119,7 @@ class _SocketLaunchState extends State with WindowListener, Widget widget.proxyServer.retryBind(); } - if (Platforms.isMobile()) { + if (Platforms.isMobile() && started == false) { Vpn.isRunning().then((value) { Vpn.isVpnStarted = value; SocketLaunch.startStatus.value = ValueWrap.of(value); @@ -163,7 +165,7 @@ class _SocketLaunchState extends State with WindowListener, Widget } ///启动代理服务器 - start() async { + Future start() async { if (!widget.serverLaunch) { await widget.onStart?.call(); setState(() { diff --git a/lib/ui/mobile/setting/script.dart b/lib/ui/mobile/setting/script.dart index 7e18191..d3cacdf 100644 --- a/lib/ui/mobile/setting/script.dart +++ b/lib/ui/mobile/setting/script.dart @@ -18,6 +18,7 @@ import 'dart:convert'; import 'package:file_picker/file_picker.dart'; import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_code_editor/flutter_code_editor.dart'; import 'package:proxypin/l10n/app_localizations.dart'; import 'package:flutter_highlight/themes/monokai-sublime.dart'; @@ -151,7 +152,7 @@ class _MobileScriptState extends State { } /// 添加脚本 - scriptEdit() async { + Future scriptEdit() async { Navigator.of(context).push(MaterialPageRoute(builder: (context) => const ScriptEdit())).then((value) { if (value != null) { setState(() {}); @@ -468,7 +469,19 @@ class _ScriptEditState extends State { padding: const EdgeInsets.symmetric(horizontal: 10), child: textField("URL:", urlController, "github.com/api/*", keyboardType: TextInputType.url)), const SizedBox(height: 10), - Padding(padding: const EdgeInsets.symmetric(horizontal: 10), child: Text("${localizations.script}:")), + Row(children: [ + SizedBox(width: 10), + Text("${localizations.script}:"), + SizedBox(width: 10), + IconButton( + tooltip: localizations.copy, + onPressed: () { + //复制 + Clipboard.setData(ClipboardData(text: script.text)); + FlutterToastr.show(localizations.copied, context, position: FlutterToastr.top); + }, + icon: Icon(Icons.copy_all_outlined, size: 22)) + ]), const SizedBox(height: 5), CodeTheme( data: CodeThemeData(styles: monokaiSublimeTheme),