mirror of
https://github.com/wanghongenpin/proxypin.git
synced 2026-05-10 00:44:12 +08:00
mobile script copy
This commit is contained in:
@@ -21,6 +21,6 @@
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>MinimumOSVersion</key>
|
||||
<string>12.0</string>
|
||||
<string>13.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -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'
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
@@ -117,7 +117,6 @@ class _DesktopHomePagePageState extends State<DesktopHomePage> 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))),
|
||||
|
||||
@@ -61,15 +61,17 @@ class _SocketLaunchState extends State<SocketLaunch> 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<SocketLaunch> 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<SocketLaunch> with WindowListener, Widget
|
||||
}
|
||||
|
||||
///启动代理服务器
|
||||
start() async {
|
||||
Future<void> start() async {
|
||||
if (!widget.serverLaunch) {
|
||||
await widget.onStart?.call();
|
||||
setState(() {
|
||||
|
||||
@@ -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<MobileScript> {
|
||||
}
|
||||
|
||||
/// 添加脚本
|
||||
scriptEdit() async {
|
||||
Future<void> 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<ScriptEdit> {
|
||||
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),
|
||||
|
||||
Reference in New Issue
Block a user