update ios project
update ios project
@@ -0,0 +1,134 @@
|
||||
import UIKit
|
||||
import Flutter
|
||||
import NetworkExtension
|
||||
import os
|
||||
|
||||
@UIApplicationMain
|
||||
@objc class AppDelegate: FlutterAppDelegate {
|
||||
override func application(
|
||||
_ application: UIApplication,
|
||||
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
|
||||
) -> Bool {
|
||||
// GeneratedPluginRegistrant.register(with: self)
|
||||
|
||||
let controller : FlutterViewController = window?.rootViewController as! FlutterViewController;
|
||||
let vpnManagerChannel = FlutterMethodChannel.init(name: "com.vpntunnel.vpnzeus/vpn_manager",
|
||||
binaryMessenger: controller.binaryMessenger);
|
||||
let manager = VPNManager.shared()
|
||||
|
||||
vpnManagerChannel.setMethodCallHandler({
|
||||
(call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
|
||||
|
||||
switch call.method {
|
||||
case "toggle":
|
||||
manager.loadVPNPreference() { error in
|
||||
guard error == nil else {
|
||||
fatalError("load VPN preference failed: \(error.debugDescription)")
|
||||
}
|
||||
|
||||
manager.enableVPNManager() { error in
|
||||
guard error == nil else {
|
||||
fatalError("enable VPN failed: \(error.debugDescription)")
|
||||
}
|
||||
manager.toggleVPNConnection() { error in
|
||||
guard error == nil else {
|
||||
fatalError("toggle VPN connection failed: \(error.debugDescription)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result(true)
|
||||
break
|
||||
case "getStatus":
|
||||
let status = manager.getStatus()
|
||||
|
||||
switch status {
|
||||
case NEVPNStatus.disconnected:
|
||||
result(0)
|
||||
case NEVPNStatus.connecting:
|
||||
result(1)
|
||||
case NEVPNStatus.reasserting:
|
||||
result(4)
|
||||
case NEVPNStatus.disconnecting:
|
||||
result(5)
|
||||
case NEVPNStatus.connected:
|
||||
result(2)
|
||||
default:
|
||||
result(3)
|
||||
}
|
||||
|
||||
break
|
||||
case "getConnectedDate":
|
||||
let connectedDate = manager.getConnectedDate()
|
||||
|
||||
result(connectedDate?.timeIntervalSince1970)
|
||||
break
|
||||
case "getTunnelLog":
|
||||
let fm = FileManager.default
|
||||
|
||||
guard let conf = fm.leafLogFile?.contents else {
|
||||
fatalError("get leaf log file contents fail")
|
||||
}
|
||||
|
||||
result(conf)
|
||||
break
|
||||
case "getTunnelConfiguration":
|
||||
LeafAdapater.shared().getRuntimeConfiguration { conf in
|
||||
guard conf != nil else {
|
||||
fatalError("get runtime VPN configuratioin failed")
|
||||
}
|
||||
|
||||
result(conf)
|
||||
}
|
||||
break
|
||||
case "setTunnelConfiguration":
|
||||
guard let conf = call.arguments as? String else {
|
||||
fatalError("call arguments is empty")
|
||||
}
|
||||
LeafAdapater.shared().setRuntimeConfiguration(conf: conf) { error in
|
||||
guard error == nil else {
|
||||
fatalError("set runtime configuration failed: \(error.debugDescription)")
|
||||
}
|
||||
}
|
||||
case "update":
|
||||
guard let conf = call.arguments as? String else {
|
||||
fatalError("call arguments is empty")
|
||||
}
|
||||
|
||||
LeafAdapater.shared().update(conf: conf) { error in
|
||||
guard error == nil else {
|
||||
fatalError("update tunnel failed: \(error.debugDescription)")
|
||||
}
|
||||
}
|
||||
default:
|
||||
result(FlutterMethodNotImplemented)
|
||||
return
|
||||
}
|
||||
})
|
||||
|
||||
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
|
||||
}
|
||||
|
||||
override func applicationWillResignActive(_ application: UIApplication) {
|
||||
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
|
||||
}
|
||||
|
||||
override func applicationDidEnterBackground(_ application: UIApplication) {
|
||||
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
|
||||
}
|
||||
|
||||
override func applicationWillEnterForeground(_ application: UIApplication) {
|
||||
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
|
||||
}
|
||||
|
||||
override func applicationDidBecomeActive(_ application: UIApplication) {
|
||||
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
}
|
||||
|
||||
override func applicationWillTerminate(_ application: UIApplication) {
|
||||
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"scale" : "2x",
|
||||
"platform" : "ios",
|
||||
"filename" : "icon-20@2x.png",
|
||||
"size" : "20x20",
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"filename" : "icon-20@3x.png",
|
||||
"platform" : "ios",
|
||||
"idiom" : "universal",
|
||||
"size" : "20x20",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"size" : "29x29",
|
||||
"platform" : "ios",
|
||||
"scale" : "2x",
|
||||
"filename" : "icon-29@2x.png"
|
||||
},
|
||||
{
|
||||
"size" : "29x29",
|
||||
"scale" : "3x",
|
||||
"filename" : "icon-29@3x.png",
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios"
|
||||
},
|
||||
{
|
||||
"platform" : "ios",
|
||||
"idiom" : "universal",
|
||||
"filename" : "icon-38@2x.png",
|
||||
"size" : "38x38",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"size" : "38x38",
|
||||
"platform" : "ios",
|
||||
"filename" : "icon-38@3x.png",
|
||||
"scale" : "3x"
|
||||
},
|
||||
{
|
||||
"scale" : "2x",
|
||||
"filename" : "icon-40@2x.png",
|
||||
"platform" : "ios",
|
||||
"idiom" : "universal",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"filename" : "icon-40@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"size" : "40x40",
|
||||
"platform" : "ios"
|
||||
},
|
||||
{
|
||||
"size" : "60x60",
|
||||
"filename" : "icon-60@2x.png",
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "icon-60@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x",
|
||||
"platform" : "ios",
|
||||
"size" : "60x60"
|
||||
},
|
||||
{
|
||||
"platform" : "ios",
|
||||
"size" : "64x64",
|
||||
"scale" : "2x",
|
||||
"filename" : "icon-64@2x.png",
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"platform" : "ios",
|
||||
"size" : "64x64",
|
||||
"filename" : "icon-64@3x.png",
|
||||
"scale" : "3x",
|
||||
"idiom" : "universal"
|
||||
},
|
||||
{
|
||||
"size" : "68x68",
|
||||
"scale" : "2x",
|
||||
"idiom" : "universal",
|
||||
"filename" : "icon-68@2x.png",
|
||||
"platform" : "ios"
|
||||
},
|
||||
{
|
||||
"platform" : "ios",
|
||||
"filename" : "icon-76@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x",
|
||||
"size" : "76x76"
|
||||
},
|
||||
{
|
||||
"platform" : "ios",
|
||||
"scale" : "2x",
|
||||
"filename" : "icon-83_5@2x.png",
|
||||
"idiom" : "universal",
|
||||
"size" : "83.5x83.5"
|
||||
},
|
||||
{
|
||||
"filename" : "ios-marketing.png",
|
||||
"size" : "1024x1024",
|
||||
"idiom" : "universal",
|
||||
"platform" : "ios"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 6.4 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 9.0 KiB |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 9.6 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 50 KiB |
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage.png",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@2x.png",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "LaunchImage@3x.png",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,5 @@
|
||||
# Launch Screen Assets
|
||||
|
||||
You can customize the launch screen with your own desired assets by replacing the image files in this directory.
|
||||
|
||||
You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="Ydg-fD-yQy"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="xbc-2k-c8Z"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFill" image="LaunchImage" translatesAutoresizingMaskIntoConstraints="NO" id="YRO-k0-Ey4">
|
||||
<rect key="frame" x="147" y="388" width="120" height="120"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="120" id="EAZ-hM-gXy"/>
|
||||
<constraint firstAttribute="width" constant="120" id="uE3-Rw-bjV"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.24625229840000001" green="0.62884336709999999" blue="0.26844969390000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerX" secondItem="Ze5-6b-2t3" secondAttribute="centerX" id="1a2-6s-vTC"/>
|
||||
<constraint firstItem="YRO-k0-Ey4" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" id="4X2-HB-R7a"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="76.811594202898561" y="251.11607142857142"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<image name="LaunchImage" width="96" height="96"/>
|
||||
</resources>
|
||||
</document>
|
||||
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="20037" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="20020"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Flutter View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="FlutterViewController" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="y3c-jy-aDJ"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="wfy-db-euE"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-16" y="-5"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||
<true/>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>UUVPN</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>UUVPN</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>$(FLUTTER_BUILD_NAME)</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>$(FLUTTER_BUILD_NUMBER)</string>
|
||||
<key>LSRequiresIPhoneOS</key>
|
||||
<true/>
|
||||
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||
<true/>
|
||||
<key>UIBackgroundModes</key>
|
||||
<array>
|
||||
<string>fetch</string>
|
||||
<string>remote-notification</string>
|
||||
</array>
|
||||
<key>UILaunchStoryboardName</key>
|
||||
<string>LaunchScreen</string>
|
||||
<key>UIMainStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
<key>UIStatusBarHidden</key>
|
||||
<false/>
|
||||
<key>UISupportedInterfaceOrientations</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||
<array>
|
||||
<string>UIInterfaceOrientationPortrait</string>
|
||||
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||
</array>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1 @@
|
||||
#import "GeneratedPluginRegistrant.h"
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>aps-environment</key>
|
||||
<string>development</string>
|
||||
<key>com.apple.developer.networking.networkextension</key>
|
||||
<array>
|
||||
<string>packet-tunnel-provider</string>
|
||||
</array>
|
||||
<key>com.apple.security.application-groups</key>
|
||||
<array>
|
||||
<string>group.com.vpntunnel.vpnzeus</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// TESWT.h
|
||||
// Runner
|
||||
//
|
||||
// Created by Zeus on 2024/7/24.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface TESWT : NSObject
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// TESWT.m
|
||||
// Runner
|
||||
//
|
||||
// Created by Zeus on 2024/7/24.
|
||||
//
|
||||
|
||||
#import "TESWT.h"
|
||||
|
||||
@implementation TESWT
|
||||
|
||||
@end
|
||||