Various fixes for iOS (#126)

* Readme update, solution for wireguard make in M1 machines,
* import file and restore enabled.
* xcode_patcher.rb fixed, Now no need to add openVPN framewrok in Embed frameworks manually.
* Now xcode_patcher.rb will add OpenVPN Framework to Embed Frameworks in main target, instead of Network extension.
* Update iosvpnprotocol.swift
* Protocol wasn't detected because it is working on localized description of tunnel, fixed cases.
* Code cleanup
* Speed issue fixed for wireguard.
* GetDeviceIp and bytes(speed of OpenVPN) fixed.
*Device IP method wasn't working as expected, so I replaced. and for speed in OpenVPN we need to handle message seperately for bytes.
*QR progress added with progressbar and text.
This commit is contained in:
dartsyms 2022-12-12 16:16:12 +04:00 committed by GitHub
parent a9217810e7
commit 814b66c04a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 189 additions and 323 deletions

1
.gitignore vendored
View file

@ -125,3 +125,4 @@ captures/
# Android Profiling # Android Profiling
*.hprof *.hprof
client/3rd/ShadowSocks/ss_ios.xcconfig

View file

@ -87,6 +87,11 @@ Error 1
Add a user defined variable to both AmneziaVPN and WireGuardNetworkExtension targets' build settings with Add a user defined variable to both AmneziaVPN and WireGuardNetworkExtension targets' build settings with
key `PATH` and value `${PATH}/path/to/bin/folder/with/go/executable`, e.g. `${PATH}:/usr/local/go/bin`. key `PATH` and value `${PATH}/path/to/bin/folder/with/go/executable`, e.g. `${PATH}:/usr/local/go/bin`.
if above error still persists on you M1 Mac, then most proably you need to install arch based cmake
```
arch -arm64 brew install cmake
```
Build might fail with "source files not found" error the first time you try it, because modern XCode build system compiles Build might fail with "source files not found" error the first time you try it, because modern XCode build system compiles
dependencies in parallel, and some dependencies end up being built after the ones that dependencies in parallel, and some dependencies end up being built after the ones that
require them. In this case simply restart the build. require them. In this case simply restart the build.

View file

@ -1,23 +0,0 @@
SUPPORTED_PLATFORMS = iphoneos
TARGETED_DEVICE_FAMILY = 1,2
HEADER_SEARCH_PATHS = $(inherited) $(SRCROOT)/ShadowSocks
//HEADER_SEARCH_PATHS = $(inherited) $(SRCROOT)/ShadowSocks $(SRCROOT)/ShadowSocks/libcares/include $(SRCROOT)/ShadowSocks/libev/arm64/include $(SRCROOT)/ShadowSocks/libsodium/include $(SRCROOT)/ShadowSocks/mbedtls/include $(SRCROOT)/ShadowSocks/pcre/arm64/include $(SRCROOT)/ShadowSocks/shadowsocks-libev/include
//CLANG_CXX_LANGUAGE_STANDARD = gnu++14
//CLANG_CXX_LIBRARY = libc++
////////////////////////////////////////////////////////////////////////////////
//
// iOS-specific settings
//
IPHONEOS_DEPLOYMENT_TARGET = 9.3
SDKROOT[arch=arm64] = iphoneos
SDKROOT[arch=armv7] = iphoneos
SDKROOT[arch=armv7s] = iphoneos
VALID_ARCHS[sdk=iphoneos*] = arm64
PROJECT_TEMP_DIR = /Users/sanchez/work/vied/ios/vpn/desktop-client-bkp/client/3rd/ShadowSocks/build/ShadowSocks.build
CONFIGURATION_BUILD_DIR = /Users/sanchez/work/vied/ios/vpn/desktop-client-bkp/client/3rd/ShadowSocks/build/Release-iphoneos
BUILT_PRODUCTS_DIR = /Users/sanchez/work/vied/ios/vpn/desktop-client-bkp/client/3rd/ShadowSocks/build/Release-iphoneos

View file

@ -301,6 +301,7 @@ ios {
LIBS += -framework Foundation LIBS += -framework Foundation
LIBS += -framework StoreKit LIBS += -framework StoreKit
LIBS += -framework UserNotifications LIBS += -framework UserNotifications
LIBS += -framework AVFoundation
DEFINES += MVPN_IOS DEFINES += MVPN_IOS

View file

@ -107,21 +107,5 @@ constexpr const char* PLATFORM_NAME =
constexpr const char* PLACEHOLDER_USER_DNS = "127.0.0.1"; constexpr const char* PLACEHOLDER_USER_DNS = "127.0.0.1";
#if defined(MVPN_ADJUST) };
// These are the two auto-generated token from the Adjust dashboard for the
// "Subscription Completed" event. We have two since in the Adjust dashboard we
// have defined two apps for iOS and Android with a event token each.
constexpr const char* ADJUST_SUBSCRIPTION_COMPLETED =
# if defined(MVPN_IOS)
"jl72xm"
# elif defined(MVPN_ANDROID)
"o1mn9m"
# else
""
# endif
;
#endif
}; // namespace Constants
#endif // CONSTANTS_H #endif // CONSTANTS_H

View file

@ -1,58 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="fastlane.lanes">
<testcase classname="fastlane.lanes" name="0: default_platform" time="0.000215">
</testcase>
<testcase classname="fastlane.lanes" name="1: Switch to certificates lane" time="0.000162">
</testcase>
<testcase classname="fastlane.lanes" name="2: match" time="2.707099">
</testcase>
<testcase classname="fastlane.lanes" name="3: notification" time="0.226435">
</testcase>
<testcase classname="fastlane.lanes" name="4: clean_build_artifacts" time="0.000648">
</testcase>
<testcase classname="fastlane.lanes" name="5: build_app" time="259.546685">
</testcase>
<testcase classname="fastlane.lanes" name="6: testflight" time="84.84052">
</testcase>
<testcase classname="fastlane.lanes" name="7: get_version_number" time="0.114899">
</testcase>
<testcase classname="fastlane.lanes" name="8: get_build_number" time="1.332216">
</testcase>
<testcase classname="fastlane.lanes" name="9: increment_build_number" time="2.325473">
</testcase>
</testsuite>
</testsuites>

View file

@ -38,13 +38,15 @@
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string> <string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2</string> <string>7</string>
<key>ITSAppUsesNonExemptEncryption</key> <key>ITSAppUsesNonExemptEncryption</key>
<false/> <false/>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>UIFileSharingEnabled</key>
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key> <key>LSSupportsOpeningDocumentsInPlace</key>
<false/> <true/>
<key>NSCameraUsageDescription</key> <key>NSCameraUsageDescription</key>
<string>Amnezia VPN needs access to the camera for reading QR-codes.</string> <string>Amnezia VPN needs access to the camera for reading QR-codes.</string>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>

View file

@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string> <string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2</string> <string>$(CURRENT_PROJECT_VERSION)</string>
<key>ITSAppUsesNonExemptEncryption</key> <key>ITSAppUsesNonExemptEncryption</key>
<false/> <false/>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>

View file

@ -2,7 +2,9 @@
#include <QFile> #include <QFile>
@implementation QtAppDelegate @implementation QtAppDelegate {
UIView *_screen;
}
+(QtAppDelegate *)sharedQtAppDelegate { +(QtAppDelegate *)sharedQtAppDelegate {
static dispatch_once_t pred; static dispatch_once_t pred;
@ -26,6 +28,13 @@
{ {
// 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. // 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 throttle down OpenGL ES frame rates. Games should use this method to pause the game. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
_screen = [UIScreen.mainScreen snapshotViewAfterScreenUpdates: false];
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle: UIBlurEffectStyleDark];
UIVisualEffectView *blurBackround = [[UIVisualEffectView alloc] initWithEffect: blurEffect];
[_screen addSubview: blurBackround];
blurBackround.frame = _screen.frame;
UIWindow *_window = UIApplication.sharedApplication.keyWindow;
[_window addSubview: _screen];
} }
- (void)applicationDidEnterBackground:(UIApplication *)application - (void)applicationDidEnterBackground:(UIApplication *)application
@ -44,6 +53,7 @@
- (void)applicationDidBecomeActive:(UIApplication *)application - (void)applicationDidBecomeActive:(UIApplication *)application
{ {
// 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. // 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.
[_screen removeFromSuperview];
} }
- (void)applicationWillTerminate:(UIApplication *)application - (void)applicationWillTerminate:(UIApplication *)application

View file

@ -125,7 +125,7 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
case .wireguard: case .wireguard:
handleWireguardAppMessage(messageData, completionHandler: completionHandler) handleWireguardAppMessage(messageData, completionHandler: completionHandler)
case .openvpn: case .openvpn:
handleWireguardAppMessage(messageData, completionHandler: completionHandler) handleOpenVPNAppMessage(messageData, completionHandler: completionHandler)
case .shadowsocks: case .shadowsocks:
break break
// handleShadowSocksAppMessage(messageData, completionHandler: completionHandler) // handleShadowSocksAppMessage(messageData, completionHandler: completionHandler)
@ -297,6 +297,21 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
} }
} }
private func handleOpenVPNAppMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)? = nil) {
guard let completionHandler = completionHandler else { return }
if messageData.count == 1 && messageData[0] == 0 {
let bytesin = ovpnAdapter.transportStatistics.bytesIn
let strBytesin = "rx_bytes=" + String(bytesin);
let bytesout = ovpnAdapter.transportStatistics.bytesOut
let strBytesout = "tx_bytes=" + String(bytesout);
let strData = strBytesin + "\n" + strBytesout;
let data = Data(strData.utf8)
completionHandler(data)
}
}
/* /*
private func handleShadowSocksAppMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)? = nil) { private func handleShadowSocksAppMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)? = nil) {
guard let completionHandler = completionHandler else { return } guard let completionHandler = completionHandler else { return }

View file

@ -388,7 +388,7 @@ public class IOSVpnProtocolImpl : NSObject {
proto.providerBundleIdentifier = vpnBundleID proto.providerBundleIdentifier = vpnBundleID
tunnel!.protocolConfiguration = proto tunnel!.protocolConfiguration = proto
tunnel!.localizedDescription = vpnName tunnel!.localizedDescription = "Amnezia Wireguard"
tunnel!.isEnabled = true tunnel!.isEnabled = true
tunnel!.saveToPreferences { [unowned self] saveError in tunnel!.saveToPreferences { [unowned self] saveError in
@ -527,8 +527,9 @@ public class IOSVpnProtocolImpl : NSObject {
@objc func checkStatus(callback: @escaping (String, String, String) -> Void) { @objc func checkStatus(callback: @escaping (String, String, String) -> Void) {
Logger.global?.log(message: "Check status") Logger.global?.log(message: "Check status")
// assert(tunnel != nil) // assert(tunnel != nil)
print("check status")
let protoType = (tunnel!.localizedDescription ?? "").toTunnelType let protoType = (tunnel!.localizedDescription ?? "").toTunnelType
print(protoType);
switch protoType { switch protoType {
case .wireguard: case .wireguard:
@ -559,7 +560,7 @@ public class IOSVpnProtocolImpl : NSObject {
print("server IP: \(serverIpv4Gateway)") print("server IP: \(serverIpv4Gateway)")
let deviceIpv4Address = getTunIPAddress() let deviceIpv4Address = getWiFiAddress()
print("device IP: \(serverIpv4Gateway)") print("device IP: \(serverIpv4Gateway)")
if deviceIpv4Address == nil { if deviceIpv4Address == nil {
callback("", "", "") callback("", "", "")
@ -610,8 +611,9 @@ public class IOSVpnProtocolImpl : NSObject {
print("server IP: \(serverIpv4Gateway)") print("server IP: \(serverIpv4Gateway)")
let deviceIpv4Address = getTunIPAddress()
print("device IP: \(serverIpv4Gateway)") let deviceIpv4Address = getWiFiAddress()
print("device IP: \(deviceIpv4Address)")
if deviceIpv4Address == nil { if deviceIpv4Address == nil {
callback("", "", "") callback("", "", "")
return return
@ -690,38 +692,45 @@ public class IOSVpnProtocolImpl : NSObject {
} }
} }
private func getTunIPAddress() -> String? { func getWiFiAddress() -> String? {
var address: String? = nil var address : String?
var interfaces: UnsafeMutablePointer<ifaddrs>? = nil
var temp_addr: UnsafeMutablePointer<ifaddrs>? = nil // Get list of all interfaces on the local machine:
var success: Int = 0 var ifaddr : UnsafeMutablePointer<ifaddrs>?
guard getifaddrs(&ifaddr) == 0 else { return nil }
// retrieve the current interfaces - returns 0 on success guard let firstAddr = ifaddr else { return nil }
success = Int(getifaddrs(&interfaces))
if success == 0 { // For each interface ...
// Loop through linked list of interfaces for ifptr in sequence(first: firstAddr, next: { $0.pointee.ifa_next }) {
temp_addr = interfaces let interface = ifptr.pointee
while temp_addr != nil {
if temp_addr?.pointee.ifa_addr == nil { // Check for IPv4 or IPv6 interface:
continue let addrFamily = interface.ifa_addr.pointee.sa_family
//if addrFamily == UInt8(AF_INET) || addrFamily == UInt8(AF_INET6) { // **ipv6 committed
if addrFamily == UInt8(AF_INET){
// Check interface name:
let name = String(cString: interface.ifa_name)
if name == "en0" {
// Convert interface address to a human readable string:
var hostname = [CChar](repeating: 0, count: Int(NI_MAXHOST))
getnameinfo(interface.ifa_addr, socklen_t(interface.ifa_addr.pointee.sa_len),
&hostname, socklen_t(hostname.count),
nil, socklen_t(0), NI_NUMERICHOST)
address = String(cString: hostname)
} }
if temp_addr?.pointee.ifa_addr.pointee.sa_family == UInt8(AF_INET) {
// Check if interface is en0 which is the wifi connection on the iPhone
if let name = temp_addr?.pointee.ifa_name, ((String(utf8String: name)?.contains("tun")) != nil) {
// Get NSString from C String
if let value = temp_addr?.pointee.ifa_addr as? sockaddr_in {
address = String(utf8String: inet_ntoa(value.sin_addr))
}
}
}
temp_addr = temp_addr?.pointee.ifa_next
} }
} }
freeifaddrs(interfaces) freeifaddrs(ifaddr)
return address return address
} }
} }
enum TunnelType: String { enum TunnelType: String {
case wireguard, openvpn, shadowsocks, empty case wireguard, openvpn, shadowsocks, empty
} }
@ -729,9 +738,9 @@ enum TunnelType: String {
extension String { extension String {
var toTunnelType: TunnelType { var toTunnelType: TunnelType {
switch self { switch self {
case "wireguard": return .wireguard case "Amnezia Wireguard": return .wireguard
case "openvpn": return .openvpn case "Amnezia OpenVPN": return .openvpn
case "shadowsocks": return .shadowsocks case "Amnezia ShadowSocks": return .shadowsocks
default: default:
return .empty return .empty
} }

View file

@ -10,13 +10,11 @@ fi
RELEASE=1 RELEASE=1
OS= OS=
NETWORKEXTENSION= NETWORKEXTENSION=
ADJUST_SDK_TOKEN=
ADJUST="CONFIG-=adjust"
WORKINGDIR=`pwd` WORKINGDIR=`pwd`
helpFunction() { helpFunction() {
print G "Usage:" print G "Usage:"
print N "\t$0 <macos|ios|> [-d|--debug] [-n|--networkextension] [-a|--adjusttoken <adjust_token>]" print N "\t$0 <macos|ios|> [-d|--debug] [-n|--networkextension]"
print N "" print N ""
print N "By default, the project is compiled in release mode. Use -d or --debug for a debug build." print N "By default, the project is compiled in release mode. Use -d or --debug for a debug build."
print N "Use -n or --networkextension to force the network-extension component for MacOS too." print N "Use -n or --networkextension to force the network-extension component for MacOS too."
@ -26,7 +24,6 @@ helpFunction() {
print G "Config variables:" print G "Config variables:"
print N "\tQT_MACOS_BIN=</path/of/the/qt/bin/folder/for/macos>" print N "\tQT_MACOS_BIN=</path/of/the/qt/bin/folder/for/macos>"
print N "\tQT_IOS_BIN=</path/of/the/qt/bin/folder/for/ios>" print N "\tQT_IOS_BIN=</path/of/the/qt/bin/folder/for/ios>"
print N "\tMVPN_IOS_ADJUST_TOKEN=<token>"
print N "" print N ""
exit 0 exit 0
} }
@ -38,11 +35,6 @@ while [[ $# -gt 0 ]]; do
key="$1" key="$1"
case $key in case $key in
-a | --adjusttoken)
ADJUST_SDK_TOKEN="$2"
shift
shift
;;
-d | --debug) -d | --debug)
RELEASE= RELEASE=
shift shift
@ -97,11 +89,6 @@ if [[ "$OS" != "macos" ]] && [[ "$OS" != "ios" ]] && [[ "$OS" != "macostest" ]];
helpFunction helpFunction
fi fi
if ! [[ "$ADJUST_SDK_TOKEN" ]] && [[ "$MVPN_IOS_ADJUST_TOKEN" ]]; then
print Y "Using the MVPN_IOS_ADJUST_TOKEN value for the adjust token"
ADJUST_SDK_TOKEN=$MVPN_IOS_ADJUST_TOKEN
fi
if [[ "$OS" == "ios" ]]; then if [[ "$OS" == "ios" ]]; then
# Network-extension is the default for IOS # Network-extension is the default for IOS
NETWORKEXTENSION=1 NETWORKEXTENSION=1
@ -150,7 +137,6 @@ MACOS_FLAGS="
QTPLUGIN+=qsvg QTPLUGIN+=qsvg
CONFIG-=static CONFIG-=static
CONFIG+=balrog CONFIG+=balrog
MVPN_MACOS=1
" "
MACOSTEST_FLAGS=" MACOSTEST_FLAGS="
@ -160,7 +146,6 @@ MACOSTEST_FLAGS="
" "
IOS_FLAGS=" IOS_FLAGS="
MVPN_IOS=1
Q_OS_IOS=1 Q_OS_IOS=1
" "
@ -183,11 +168,6 @@ elif [ "$OS" = "macostest" ]; then
PLATFORM=$MACOSTEST_FLAGS PLATFORM=$MACOSTEST_FLAGS
elif [ "$OS" = "ios" ]; then elif [ "$OS" = "ios" ]; then
PLATFORM=$IOS_FLAGS PLATFORM=$IOS_FLAGS
if [[ "$ADJUST_SDK_TOKEN" ]]; then
printn Y "ADJUST_SDK_TOKEN: "
print G "$ADJUST_SDK_TOKEN"
ADJUST="CONFIG+=adjust"
fi
else else
killProcess "Why are we here?" killProcess "Why are we here?"
fi fi
@ -249,7 +229,7 @@ else
print Y "No Tun2Socks will be built" print Y "No Tun2Socks will be built"
fi fi
print Y "Creating the xcode project via qmake..." print Y "Creating the Xcode project via qmake..."
$QMAKE \ $QMAKE \
VERSION=$SHORTVERSION \ VERSION=$SHORTVERSION \
BUILD_ID=$FULLVERSION \ BUILD_ID=$FULLVERSION \
@ -258,11 +238,10 @@ $QMAKE \
$VPNMODE \ $VPNMODE \
$WEMODE \ $WEMODE \
$PLATFORM \ $PLATFORM \
$ADJUST \
./client.pro || killProcess "Compilation failed" ./client.pro || killProcess "Compilation failed"
print Y "Patching the xcode project..." print Y "Patching the xcode project..."
ruby scripts/xcode_patcher.rb "AmneziaVPN.xcodeproj" "$SHORTVERSION" "$FULLVERSION" "$OSRUBY" "$NETWORKEXTENSION" "$ADJUST_SDK_TOKEN" || killProcess "Failed to merge xcode with wireguard" ruby scripts/xcode_patcher.rb "AmneziaVPN.xcodeproj" "$SHORTVERSION" "$FULLVERSION" "$OSRUBY" "$NETWORKEXTENSION" || killProcess "Failed to merge xcode with wireguard"
print G "done." print G "done."
if command -v "sed" &>/dev/null; then if command -v "sed" &>/dev/null; then
@ -270,6 +249,6 @@ print G "done."
sed -i '' '/<string>Original<\/string>/d' AmneziaVPN.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings sed -i '' '/<string>Original<\/string>/d' AmneziaVPN.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
fi fi
# print Y "Opening in XCode..."
# open AmneziaVPN.xcodeproj
print G "All done!" print G "All done!"
print Y "Opening project in Xcode..."
open AmneziaVPN.xcodeproj

View file

@ -9,7 +9,7 @@ class XCodeprojPatcher
attr :target_main attr :target_main
attr :target_extension attr :target_extension
def run(file, shortVersion, fullVersion, platform, networkExtension, configHash, adjust_sdk_token) def run(file, shortVersion, fullVersion, platform, networkExtension, configHash)
open_project file open_project file
setup_project setup_project
open_target_main open_target_main
@ -19,13 +19,7 @@ class XCodeprojPatcher
group = @project.main_group.new_group('Configuration') group = @project.main_group.new_group('Configuration')
@configFile = group.new_file('xcode.xconfig') @configFile = group.new_file('xcode.xconfig')
setup_target_main shortVersion, fullVersion, platform, networkExtension, configHash, adjust_sdk_token setup_target_main shortVersion, fullVersion, platform, networkExtension, configHash
# if platform == 'macos'
# setup_target_loginitem shortVersion, fullVersion, configHash
# setup_target_nativemessaging shortVersion, fullVersion, configHash
# end
if networkExtension if networkExtension
setup_target_extension shortVersion, fullVersion, platform, configHash setup_target_extension shortVersion, fullVersion, platform, configHash
@ -59,7 +53,7 @@ class XCodeprojPatcher
end end
def setup_target_main(shortVersion, fullVersion, platform, networkExtension, configHash, adjust_sdk_token) def setup_target_main(shortVersion, fullVersion, platform, networkExtension, configHash)
@target_main.build_configurations.each do |config| @target_main.build_configurations.each do |config|
config.base_configuration_reference = @configFile config.base_configuration_reference = @configFile
@ -72,10 +66,8 @@ class XCodeprojPatcher
"$(PROJECT_DIR)/3rd", "$(PROJECT_DIR)/3rd",
"$(PROJECT_DIR)/3rd/OpenVPNAdapter/build/Release-iphoneos", "$(PROJECT_DIR)/3rd/OpenVPNAdapter/build/Release-iphoneos",
"$(PROJECT_DIR)/3rd/ShadowSocks/build/Release-iphoneos", "$(PROJECT_DIR)/3rd/ShadowSocks/build/Release-iphoneos",
# "$(PROJECT_DIR)/3rd/PacketProcessor/build/Release-iphoneos",
"$(PROJECT_DIR)/3rd/outline-go-tun2socks/build/ios", "$(PROJECT_DIR)/3rd/outline-go-tun2socks/build/ios",
"${PROJECT_DIR}/3rd/CocoaAsyncSocket/build/Release-iphoneos", "${PROJECT_DIR}/3rd/CocoaAsyncSocket/build/Release-iphoneos",
# "${PROJECT_DIR}/3rd/CocoaLumberjack/build/Release-iphoneos",
] ]
# Versions and names # Versions and names
@ -91,9 +83,6 @@ class XCodeprojPatcher
config.build_settings['INFOPLIST_FILE'] ||= platform + '/app/Info.plist' config.build_settings['INFOPLIST_FILE'] ||= platform + '/app/Info.plist'
if platform == 'ios' if platform == 'ios'
config.build_settings['CODE_SIGN_ENTITLEMENTS'] ||= 'ios/app/main.entitlements' config.build_settings['CODE_SIGN_ENTITLEMENTS'] ||= 'ios/app/main.entitlements'
if adjust_sdk_token != ""
config.build_settings['ADJUST_SDK_TOKEN'] = adjust_sdk_token
end
elsif networkExtension elsif networkExtension
config.build_settings['CODE_SIGN_ENTITLEMENTS'] ||= 'macos/app/app.entitlements' config.build_settings['CODE_SIGN_ENTITLEMENTS'] ||= 'macos/app/app.entitlements'
else else
@ -104,7 +93,7 @@ class XCodeprojPatcher
config.build_settings['ENABLE_BITCODE'] ||= 'NO' if platform == 'ios' config.build_settings['ENABLE_BITCODE'] ||= 'NO' if platform == 'ios'
config.build_settings['SDKROOT'] = 'iphoneos' if platform == 'ios' config.build_settings['SDKROOT'] = 'iphoneos' if platform == 'ios'
config.build_settings['SWIFT_PRECOMPILE_BRIDGING_HEADER'] = 'NO' if platform == 'ios' config.build_settings['SWIFT_PRECOMPILE_BRIDGING_HEADER'] = 'NO' if platform == 'ios'
config.build_settings['PATH'] = '${PATH}:/usr/local/go/bin:/usr/local/bin:/opt/homebrew/bin' config.build_settings['PATH'] = '${PATH}:/opt/local/bin:/usr/local/go/bin:/usr/local/bin:/opt/homebrew/bin'
groupId = ""; groupId = "";
if (platform == 'macos') if (platform == 'macos')
@ -173,96 +162,23 @@ class XCodeprojPatcher
} }
end end
if (platform == 'ios' && adjust_sdk_token != "") if(platform == 'ios')
frameworks_group = @project.groups.find { |group| group.display_name == 'Frameworks' } frameworks_group = @project.groups.find { |group| group.display_name == 'Frameworks' }
frameworks_build_phase = @target_main.build_phases.find { |build_phase| build_phase.to_s == 'FrameworksBuildPhase' } frameworks_build_phase = @target_main.build_phases.find { |build_phase| build_phase.to_s == 'FrameworksBuildPhase' }
framework_ref = frameworks_group.new_file('AdServices.framework') embed_frameworks_build_phase = project.new(Xcodeproj::Project::Object::PBXCopyFilesBuildPhase)
build_file = frameworks_build_phase.add_file_reference(framework_ref) embed_frameworks_build_phase.name = 'Embed Frameworks'
build_file.settings = { 'ATTRIBUTES' => ['Weak'] } embed_frameworks_build_phase.symbol_dst_subfolder_spec = :frameworks
@target_main.build_phases << embed_frameworks_build_phase
framework_ref = frameworks_group.new_file('iAd.framework') framework_ref = frameworks_group.new_file('3rd/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework')
frameworks_build_phase.add_file_reference(framework_ref) build_file = embed_frameworks_build_phase.add_file_reference(framework_ref)
# Adjust SDK frameworks_build_phase.add_file_reference(framework_ref)
group = @project.main_group.new_group('AdjustSDK') build_file.settings = { 'ATTRIBUTES' => ['CodeSignOnCopy', 'RemoveHeadersOnCopy'] }
[
'3rd/adjust-ios-sdk/Adjust/ADJActivityHandler.h',
'3rd/adjust-ios-sdk/Adjust/ADJActivityKind.h',
'3rd/adjust-ios-sdk/Adjust/ADJActivityPackage.h',
'3rd/adjust-ios-sdk/Adjust/ADJActivityState.h',
'3rd/adjust-ios-sdk/Adjust/ADJAdjustFactory.h',
'3rd/adjust-ios-sdk/Adjust/ADJAdRevenue.h',
'3rd/adjust-ios-sdk/Adjust/ADJAttribution.h',
'3rd/adjust-ios-sdk/Adjust/ADJAttributionHandler.h',
'3rd/adjust-ios-sdk/Adjust/ADJBackoffStrategy.h',
'3rd/adjust-ios-sdk/Adjust/ADJAdditions/NSData+ADJAdditions.h',
'3rd/adjust-ios-sdk/Adjust/ADJAdditions/NSNumber+ADJAdditions.h',
'3rd/adjust-ios-sdk/Adjust/ADJAdditions/NSString+ADJAdditions.h',
'3rd/adjust-ios-sdk/Adjust/ADJConfig.h',
'3rd/adjust-ios-sdk/Adjust/ADJEvent.h',
'3rd/adjust-ios-sdk/Adjust/ADJEventFailure.h',
'3rd/adjust-ios-sdk/Adjust/ADJEventSuccess.h',
'3rd/adjust-ios-sdk/Adjust/ADJLinkResolution.h',
'3rd/adjust-ios-sdk/Adjust/ADJLogger.h',
'3rd/adjust-ios-sdk/Adjust/ADJPackageBuilder.h',
'3rd/adjust-ios-sdk/Adjust/ADJPackageHandler.h',
'3rd/adjust-ios-sdk/Adjust/ADJPackageParams.h',
'3rd/adjust-ios-sdk/Adjust/ADJRequestHandler.h',
'3rd/adjust-ios-sdk/Adjust/ADJResponseData.h',
'3rd/adjust-ios-sdk/Adjust/ADJSdkClickHandler.h',
'3rd/adjust-ios-sdk/Adjust/ADJSessionFailure.h',
'3rd/adjust-ios-sdk/Adjust/ADJSessionParameters.h',
'3rd/adjust-ios-sdk/Adjust/ADJSessionSuccess.h',
'3rd/adjust-ios-sdk/Adjust/ADJSubscription.h',
'3rd/adjust-ios-sdk/Adjust/ADJThirdPartySharing.h',
'3rd/adjust-ios-sdk/Adjust/ADJTimerCycle.h',
'3rd/adjust-ios-sdk/Adjust/ADJTimerOnce.h',
'3rd/adjust-ios-sdk/Adjust/ADJUrlStrategy.h',
'3rd/adjust-ios-sdk/Adjust/ADJUserDefaults.h',
'3rd/adjust-ios-sdk/Adjust/Adjust.h',
'3rd/adjust-ios-sdk/Adjust/ADJUtil.h',
'3rd/adjust-ios-sdk/Adjust/ADJActivityHandler.m',
'3rd/adjust-ios-sdk/Adjust/ADJActivityKind.m',
'3rd/adjust-ios-sdk/Adjust/ADJActivityPackage.m',
'3rd/adjust-ios-sdk/Adjust/ADJActivityState.m',
'3rd/adjust-ios-sdk/Adjust/ADJAdjustFactory.m',
'3rd/adjust-ios-sdk/Adjust/ADJAdRevenue.m',
'3rd/adjust-ios-sdk/Adjust/ADJAttribution.m',
'3rd/adjust-ios-sdk/Adjust/ADJAttributionHandler.m',
'3rd/adjust-ios-sdk/Adjust/ADJBackoffStrategy.m',
'3rd/adjust-ios-sdk/Adjust/ADJAdditions/NSData+ADJAdditions.m',
'3rd/adjust-ios-sdk/Adjust/ADJAdditions/NSNumber+ADJAdditions.m',
'3rd/adjust-ios-sdk/Adjust/ADJAdditions/NSString+ADJAdditions.m',
'3rd/adjust-ios-sdk/Adjust/ADJConfig.m',
'3rd/adjust-ios-sdk/Adjust/ADJEvent.m',
'3rd/adjust-ios-sdk/Adjust/ADJEventFailure.m',
'3rd/adjust-ios-sdk/Adjust/ADJEventSuccess.m',
'3rd/adjust-ios-sdk/Adjust/ADJLinkResolution.m',
'3rd/adjust-ios-sdk/Adjust/ADJLogger.m',
'3rd/adjust-ios-sdk/Adjust/ADJPackageBuilder.m',
'3rd/adjust-ios-sdk/Adjust/ADJPackageHandler.m',
'3rd/adjust-ios-sdk/Adjust/ADJPackageParams.m',
'3rd/adjust-ios-sdk/Adjust/ADJRequestHandler.m',
'3rd/adjust-ios-sdk/Adjust/ADJResponseData.m',
'3rd/adjust-ios-sdk/Adjust/ADJSdkClickHandler.m',
'3rd/adjust-ios-sdk/Adjust/ADJSessionFailure.m',
'3rd/adjust-ios-sdk/Adjust/ADJSessionParameters.m',
'3rd/adjust-ios-sdk/Adjust/ADJSessionSuccess.m',
'3rd/adjust-ios-sdk/Adjust/ADJSubscription.m',
'3rd/adjust-ios-sdk/Adjust/ADJThirdPartySharing.m',
'3rd/adjust-ios-sdk/Adjust/ADJTimerCycle.m',
'3rd/adjust-ios-sdk/Adjust/ADJTimerOnce.m',
'3rd/adjust-ios-sdk/Adjust/ADJUrlStrategy.m',
'3rd/adjust-ios-sdk/Adjust/ADJUserDefaults.m',
'3rd/adjust-ios-sdk/Adjust/Adjust.m',
'3rd/adjust-ios-sdk/Adjust/ADJUtil.m',
].each { |filename|
file = group.new_file(filename)
file_reference = @target_main.add_file_references([file], '-fobjc-arc')
}
end end
end end
def setup_target_extension(shortVersion, fullVersion, platform, configHash) def setup_target_extension(shortVersion, fullVersion, platform, configHash)
@ -288,12 +204,9 @@ class XCodeprojPatcher
"$(PROJECT_DIR)/3rd/OpenVPNAdapter/build/Release-iphoneos", "$(PROJECT_DIR)/3rd/OpenVPNAdapter/build/Release-iphoneos",
"$(PROJECT_DIR)/3rd/libleaf/lib", "$(PROJECT_DIR)/3rd/libleaf/lib",
"$(PROJECT_DIR)/3rd/ShadowSocks/build/Release-iphoneos", "$(PROJECT_DIR)/3rd/ShadowSocks/build/Release-iphoneos",
# "$(PROJECT_DIR)/3rd/PacketProcessor/build/Release-iphoneos",
"$(PROJECT_DIR)/3rd/outline-go-tun2socks/build/ios", "$(PROJECT_DIR)/3rd/outline-go-tun2socks/build/ios",
"${PROJECT_DIR}/3rd/CocoaAsyncSocket/build/Release-iphoneos", "${PROJECT_DIR}/3rd/CocoaAsyncSocket/build/Release-iphoneos",
# "${PROJECT_DIR}/3rd/CocoaLumberjack/build/Release-iphoneos",
] ]
# config.build_settings['LIBRARY_SEARCH_PATHS'] = [config.build_settings['LIBRARY_SEARCH_PATHS'], "$(PROJECT_DIR)/3rd/libleaf/lib"]
# Versions and names # Versions and names
config.build_settings['MARKETING_VERSION'] ||= shortVersion config.build_settings['MARKETING_VERSION'] ||= shortVersion
@ -325,7 +238,7 @@ class XCodeprojPatcher
"-framework", "-framework",
"OpenGLES", "OpenGLES",
] ]
config.build_settings['PATH'] = '${PATH}:/usr/local/go/bin' config.build_settings['PATH'] = '${PATH}:/opt/local/bin:/usr/local/go/bin'
end end
groupId = ""; groupId = "";
@ -379,17 +292,7 @@ class XCodeprojPatcher
'platforms/ios/iostunnel.swift', 'platforms/ios/iostunnel.swift',
'platforms/ios/ioslogger.swift', 'platforms/ios/ioslogger.swift',
'platforms/ios/iosinterface.swift', 'platforms/ios/iosinterface.swift',
# 'platforms/ios/ssprovider.swift',
'platforms/ios/iosglue.mm', 'platforms/ios/iosglue.mm',
# 'platforms/ios/ssconnectivity.h',
# 'platforms/ios/ssconnectivity.m',
# 'platforms/ios/iosopenvpn2ssadapter.h',
# 'platforms/ios/iosopenvpn2ssadapter.m',
# 'platforms/ios/sspacket.h',
# 'platforms/ios/sspacket.m',
# 'platforms/ios/ssadapterpacketflow.h',
# 'platforms/ios/tun2ssprovider.swift',
# 'platforms/ios/tun2sockswriter.swift',
].each { |filename| ].each { |filename|
file = group.new_file(filename) file = group.new_file(filename)
@target_extension.add_file_references([file]) @target_extension.add_file_references([file])
@ -402,40 +305,10 @@ class XCodeprojPatcher
framework_ref = frameworks_group.new_file('libwg-go.a') framework_ref = frameworks_group.new_file('libwg-go.a')
frameworks_build_phase.add_file_reference(framework_ref) frameworks_build_phase.add_file_reference(framework_ref)
# framework_ref = frameworks_group.new_file('3rd/libleaf/lib/libleaf.a')
# frameworks_build_phase.add_file_reference(framework_ref)
framework_ref = frameworks_group.new_file('NetworkExtension.framework') framework_ref = frameworks_group.new_file('NetworkExtension.framework')
frameworks_build_phase.add_file_reference(framework_ref) frameworks_build_phase.add_file_reference(framework_ref)
# framework_ref = frameworks_group.new_file('3rd/OpenVPNAdapter/build/Release-iphoneos/LZ4.framework')
# frameworks_build_phase.add_file_reference(framework_ref)
#
# framework_ref = frameworks_group.new_file('3rd/OpenVPNAdapter/build/Release-iphoneos/mbedTLS.framework')
# frameworks_build_phase.add_file_reference(framework_ref)
#
# framework_ref = frameworks_group.new_file('3rd/OpenVPNAdapter/build/Release-iphoneos/OpenVPNClient.framework')
# frameworks_build_phase.add_file_reference(framework_ref)
framework_ref = frameworks_group.new_file('3rd/OpenVPNAdapter/build/Release-iphoneos/OpenVPNAdapter.framework')
frameworks_build_phase.add_file_reference(framework_ref)
# framework_ref = frameworks_group.new_file('3rd/ShadowSocks/build/Release-iphoneos/ShadowSocks.framework')
# frameworks_build_phase.add_file_reference(framework_ref)
#
# framework_ref = frameworks_group.new_file('3rd/CocoaAsyncSocket/build/Release-iphoneos/CocoaAsyncSocket.framework')
# frameworks_build_phase.add_file_reference(framework_ref)
#
# framework_ref = frameworks_group.new_file('3rd/outline-go-tun2socks/build/ios/Tun2socks.xcframework')
# frameworks_build_phase.add_file_reference(framework_ref)
# framework_ref = frameworks_group.new_file('3rd/CocoaLumberjack/build/Release-iphoneos/CocoaLumberjack.framework')
# frameworks_build_phase.add_file_reference(framework_ref)
# This fails: @target_main.add_dependency @target_extension # This fails: @target_main.add_dependency @target_extension
container_proxy = @project.new(Xcodeproj::Project::PBXContainerItemProxy) container_proxy = @project.new(Xcodeproj::Project::PBXContainerItemProxy)
container_proxy.container_portal = @project.root_object.uuid container_proxy.container_portal = @project.root_object.uuid
@ -492,6 +365,7 @@ class XCodeprojPatcher
framework_ref = frameworks_group.new_file('balrog/balrog.a') framework_ref = frameworks_group.new_file('balrog/balrog.a')
frameworks_build_phase.add_file_reference(framework_ref) frameworks_build_phase.add_file_reference(framework_ref)
# This fails: @target_main.add_dependency target_balrog # This fails: @target_main.add_dependency target_balrog
container_proxy = @project.new(Xcodeproj::Project::PBXContainerItemProxy) container_proxy = @project.new(Xcodeproj::Project::PBXContainerItemProxy)
container_proxy.container_portal = @project.root_object.uuid container_proxy.container_portal = @project.root_object.uuid
@ -599,7 +473,7 @@ class XCodeprojPatcher
# other configs # other configs
config.build_settings['INFOPLIST_FILE'] ||= 'macos/loginitem/Info.plist' config.build_settings['INFOPLIST_FILE'] ||= 'macos/loginitem/Info.plist'
config.build_settings['CODE_SIGN_ENTITLEMENTS'] ||= 'macos/loginitem/MozillaVPNLoginItem.entitlements' config.build_settings['CODE_SIGN_ENTITLEMENTS'] ||= 'macos/loginitem/MozillaVPNLoginItem.entitlements' #TODO need to check this
config.build_settings['CODE_SIGN_IDENTITY'] = 'Apple Development' config.build_settings['CODE_SIGN_IDENTITY'] = 'Apple Development'
config.build_settings['SKIP_INSTALL'] = 'YES' config.build_settings['SKIP_INSTALL'] = 'YES'
@ -708,7 +582,7 @@ class XCodeprojPatcher
copy_nativeMessagingManifest.dst_path = 'Contents/Resources/utils' copy_nativeMessagingManifest.dst_path = 'Contents/Resources/utils'
group = @project.main_group.new_group('WireGuardHelper') group = @project.main_group.new_group('WireGuardHelper')
file = group.new_file 'extension/app/manifests/macos/mozillavpn.json' file = group.new_file 'extension/app/manifests/macos/mozillavpn.json' #TODO Need to check this
nativeMessagingManifest_file = copy_nativeMessagingManifest.add_file_reference file nativeMessagingManifest_file = copy_nativeMessagingManifest.add_file_reference file
nativeMessagingManifest_file.settings = { "ATTRIBUTES" => ['RemoveHeadersOnCopy'] } nativeMessagingManifest_file.settings = { "ATTRIBUTES" => ['RemoveHeadersOnCopy'] }
@ -744,8 +618,7 @@ configFile.each { |line|
platform = "macos" platform = "macos"
platform = "ios" if ARGV[3] == "ios" platform = "ios" if ARGV[3] == "ios"
networkExtension = true if ARGV[4] == "1" networkExtension = true if ARGV[4] == "1"
adjust_sdk_token = ARGV[5]
r = XCodeprojPatcher.new r = XCodeprojPatcher.new
r.run ARGV[0], ARGV[1], ARGV[2], platform, networkExtension, config, adjust_sdk_token r.run ARGV[0], ARGV[1], ARGV[2], platform, networkExtension, config
exit 0 exit 0

View file

@ -83,8 +83,8 @@ void AppSettingsLogic::onPushButtonBackupAppConfigClicked()
void AppSettingsLogic::onPushButtonRestoreAppConfigClicked() void AppSettingsLogic::onPushButtonRestoreAppConfigClicked()
{ {
QString fileName = QFileDialog::getOpenFileName(nullptr, tr("Open backup"), QString fileName = QFileDialog::getOpenFileName(Q_NULLPTR, tr("Open backup"),
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.backup"); QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.backup");
if (fileName.isEmpty()) return; if (fileName.isEmpty()) return;

View file

@ -135,9 +135,8 @@ void StartPageLogic::onPushButtonImport()
void StartPageLogic::onPushButtonImportOpenFile() void StartPageLogic::onPushButtonImportOpenFile()
{ {
QString fileName = QFileDialog::getOpenFileName(nullptr, tr("Open profile"), QString fileName = QFileDialog::getOpenFileName(Q_NULLPTR, tr("Open profile"),
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), "*.vpn"); QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation), tr("*.vpn"));
if (fileName.isEmpty()) return; if (fileName.isEmpty()) return;
QFile file(fileName); QFile file(fileName);

View file

@ -40,11 +40,29 @@ PageBase {
id: loader id: loader
anchors.top: caption.bottom anchors.top: caption.bottom
anchors.bottom: parent.bottom anchors.bottom: progressColumn.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
} }
Column{
height: 40
id: progressColumn
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
ProgressBar {
id: progress
anchors.left: parent.left
anchors.right: parent.right
value: QrDecoderLogic.totalChunksCount === 0? 0 : (QrDecoderLogic.receivedChunksCount/QrDecoderLogic.totalChunksCount)
}
Text {
id: chunksCount
text: "Progress: " + QrDecoderLogic.receivedChunksCount +"/"+QrDecoderLogic.totalChunksCount
}
}
Component { Component {
id: component id: component

View file

@ -266,8 +266,6 @@ void UiLogic::onGotoCurrentProtocolsPage()
emit goToPage(Page::ServerContainers); emit goToPage(Page::ServerContainers);
} }
//void UiLogic::showEvent(QShowEvent *event) //void UiLogic::showEvent(QShowEvent *event)
//{ //{
//#if defined Q_OS_MACX //#if defined Q_OS_MACX

View file

@ -1,2 +1,2 @@
# current build 1 # current build 6
!defined(BUILDVERSION, var):BUILDVERSION = 2 !defined(BUILDVERSION, var):BUILDVERSION = 7

View file

@ -1,3 +1,4 @@
#include "qtimer.h"
#include <QApplication> #include <QApplication>
#include <QDebug> #include <QDebug>
#include <QFile> #include <QFile>
@ -34,7 +35,10 @@ VpnConnection::VpnConnection(std::shared_ptr<Settings> settings,
std::shared_ptr<ServerController> serverController, QObject* parent) : QObject(parent), std::shared_ptr<ServerController> serverController, QObject* parent) : QObject(parent),
m_settings(settings), m_settings(settings),
m_configurator(configurator), m_configurator(configurator),
m_serverController(serverController) m_serverController(serverController),
m_receivedBytes(0),
m_sentBytes(0),
m_isIOSConnected(false)
{ {
} }
@ -48,11 +52,16 @@ VpnConnection::~VpnConnection()
void VpnConnection::onBytesChanged(quint64 receivedBytes, quint64 sentBytes) void VpnConnection::onBytesChanged(quint64 receivedBytes, quint64 sentBytes)
{ {
emit bytesChanged(receivedBytes, sentBytes); emit bytesChanged(receivedBytes - m_receivedBytes, sentBytes - m_sentBytes);
m_receivedBytes = receivedBytes;
m_sentBytes = sentBytes;
} }
void VpnConnection::onConnectionStateChanged(VpnProtocol::VpnConnectionState state) void VpnConnection::onConnectionStateChanged(VpnProtocol::VpnConnectionState state)
{ {
#ifdef AMNEZIA_DESKTOP #ifdef AMNEZIA_DESKTOP
if (IpcClient::Interface()) { if (IpcClient::Interface()) {
if (state == VpnProtocol::Connected){ if (state == VpnProtocol::Connected){
@ -94,9 +103,35 @@ void VpnConnection::onConnectionStateChanged(VpnProtocol::VpnConnectionState sta
} }
} }
#endif #endif
#ifdef Q_OS_IOS
qDebug() << state;
if(state == VpnProtocol::Connected){
m_isIOSConnected = true;
checkIOSStatus();
}else{
m_isIOSConnected = false;
m_receivedBytes = 0;
m_sentBytes = 0;
}
#endif
emit connectionStateChanged(state); emit connectionStateChanged(state);
} }
void VpnConnection::checkIOSStatus()
{
QTimer::singleShot(1000, [this]() {
if(m_isIOSConnected){
iosVpnProtocol->checkStatus();
checkIOSStatus();
}
} );
}
const QString &VpnConnection::remoteAddress() const const QString &VpnConnection::remoteAddress() const
{ {
return m_remoteAddress; return m_remoteAddress;
@ -333,7 +368,10 @@ void VpnConnection::connectToVpn(int serverIndex,
m_vpnProtocol.reset(androidVpnProtocol); m_vpnProtocol.reset(androidVpnProtocol);
#elif defined Q_OS_IOS #elif defined Q_OS_IOS
Proto proto = ContainerProps::defaultProtocol(container); Proto proto = ContainerProps::defaultProtocol(container);
IOSVpnProtocol *iosVpnProtocol = new IOSVpnProtocol(proto, m_vpnConfiguration); //if (iosVpnProtocol==NULL) {
iosVpnProtocol = new IOSVpnProtocol(proto, m_vpnConfiguration);
//}
// IOSVpnProtocol *iosVpnProtocol = new IOSVpnProtocol(proto, m_vpnConfiguration);
if (!iosVpnProtocol->initialize()) { if (!iosVpnProtocol->initialize()) {
qDebug() << QString("Init failed") ; qDebug() << QString("Init failed") ;
emit VpnProtocol::Error; emit VpnProtocol::Error;
@ -384,12 +422,19 @@ void VpnConnection::disconnectFromVpn()
VpnProtocol::VpnConnectionState VpnConnection::connectionState() VpnProtocol::VpnConnectionState VpnConnection::connectionState()
{ {
if (!m_vpnProtocol) return VpnProtocol::Disconnected; if (!m_vpnProtocol) return VpnProtocol::Disconnected;
return m_vpnProtocol->connectionState(); return m_vpnProtocol->connectionState();
} }
bool VpnConnection::isConnected() const bool VpnConnection::isConnected() const
{ {
#ifdef Q_OS_IOS
#endif
if (!m_vpnProtocol.data()) { if (!m_vpnProtocol.data()) {
return false; return false;
} }

View file

@ -9,6 +9,7 @@
#include "protocols/vpnprotocol.h" #include "protocols/vpnprotocol.h"
#include "core/defs.h" #include "core/defs.h"
#include "settings.h" #include "settings.h"
#include "protocols/ios_vpnprotocol.h"
#ifdef AMNEZIA_DESKTOP #ifdef AMNEZIA_DESKTOP
#include "core/ipcclient.h" #include "core/ipcclient.h"
@ -73,6 +74,7 @@ signals:
protected slots: protected slots:
void onBytesChanged(quint64 receivedBytes, quint64 sentBytes); void onBytesChanged(quint64 receivedBytes, quint64 sentBytes);
void onConnectionStateChanged(VpnProtocol::VpnConnectionState state); void onConnectionStateChanged(VpnProtocol::VpnConnectionState state);
void checkIOSStatus();
protected: protected:
QSharedPointer<VpnProtocol> m_vpnProtocol; QSharedPointer<VpnProtocol> m_vpnProtocol;
@ -85,10 +87,16 @@ private:
QJsonObject m_vpnConfiguration; QJsonObject m_vpnConfiguration;
QJsonObject m_routeMode; QJsonObject m_routeMode;
QString m_remoteAddress; QString m_remoteAddress;
quint64 m_receivedBytes;
quint64 m_sentBytes;
bool m_isIOSConnected; //remove later move to isConnected,
#ifdef AMNEZIA_DESKTOP #ifdef AMNEZIA_DESKTOP
IpcClient *m_IpcClient {nullptr}; IpcClient *m_IpcClient {nullptr};
#endif #endif
#ifdef Q_OS_IOS
IOSVpnProtocol * iosVpnProtocol{nullptr};
#endif
}; };
#endif // VPNCONNECTION_H #endif // VPNCONNECTION_H

View file

@ -2,4 +2,4 @@ DEVELOPMENT_TEAM = X7UJ388FXK
GROUP_ID_IOS = group.org.amnezia.AmneziaVPN GROUP_ID_IOS = group.org.amnezia.AmneziaVPN
APP_ID_IOS = org.amnezia.AmneziaVPN APP_ID_IOS = org.amnezia.AmneziaVPN
NETEXT_ID_IOS = org.amnezia.AmneziaVPN.network-extension NETEXT_ID_IOS = org.amnezia.AmneziaVPN.network-extension