From 2eabf7f5eeeb421a698c938d789d24b2404ffddc Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Sun, 23 Jun 2024 17:08:13 +0100 Subject: [PATCH] Various updates --- .../ConfigurationProxy.swift | 5 ++- Yggdrasil Network.xcodeproj/project.pbxproj | 20 ++++----- .../xcschemes/YggdrasilSwiftUI.xcscheme | 12 ++--- Yggdrasil.xcframework/Info.plist | 45 ++++++------------- YggdrasilSwiftUI/PeersView.swift | 21 ++++++++- 5 files changed, 53 insertions(+), 50 deletions(-) diff --git a/Yggdrasil Network Cross-Platform/ConfigurationProxy.swift b/Yggdrasil Network Cross-Platform/ConfigurationProxy.swift index e193278..5e449b2 100644 --- a/Yggdrasil Network Cross-Platform/ConfigurationProxy.swift +++ b/Yggdrasil Network Cross-Platform/ConfigurationProxy.swift @@ -15,6 +15,7 @@ import Yggdrasil import NetworkExtension import Foundation import CoreData +import Combine #if os(iOS) class PlatformItemSource: NSObject, UIActivityItemSource { @@ -34,12 +35,12 @@ class ConfigurationProxy: PlatformItemSource { private var manager: NETunnelProviderManager? private var json: Data? = nil { didSet { - summary = MobileSummaryFromConfig(json) + //summary = MobileSummaryFromConfig(json) } } private var dict: [String: Any]? = [:] private var timer: Timer? - public var summary: MobileParsedConfig? + //public var summary: MobileParsedConfig? init(manager: NETunnelProviderManager) { self.manager = manager diff --git a/Yggdrasil Network.xcodeproj/project.pbxproj b/Yggdrasil Network.xcodeproj/project.pbxproj index bc0109d..406a1ae 100644 --- a/Yggdrasil Network.xcodeproj/project.pbxproj +++ b/Yggdrasil Network.xcodeproj/project.pbxproj @@ -74,7 +74,7 @@ 39BF9FC12A2E9E51000E7269 /* YggdrasilNetworkExtension-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "YggdrasilNetworkExtension-Bridging-Header.h"; sourceTree = ""; }; 39CC924B221DEDCE004960DC /* IPCResponses.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IPCResponses.swift; sourceTree = ""; }; 39DB9BEC2BCF28FA009BF2A4 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = Info.plist; sourceTree = ""; }; - 39F0205B2996CD760093F603 /* YggdrasilSwiftUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = YggdrasilSwiftUI.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 39F0205B2996CD760093F603 /* Yggdrasil.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Yggdrasil.app; sourceTree = BUILT_PRODUCTS_DIR; }; 39F0205D2996CD760093F603 /* Application.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Application.swift; sourceTree = ""; }; 39F0205F2996CD760093F603 /* StatusView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusView.swift; sourceTree = ""; }; 39F020612996CD770093F603 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -165,7 +165,7 @@ isa = PBXGroup; children = ( E593CE971DF905AF00D7265D /* YggdrasilNetworkExtension.appex */, - 39F0205B2996CD760093F603 /* YggdrasilSwiftUI.app */, + 39F0205B2996CD760093F603 /* Yggdrasil.app */, ); name = Products; sourceTree = ""; @@ -187,9 +187,9 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 39F0205A2996CD760093F603 /* YggdrasilSwiftUI */ = { + 39F0205A2996CD760093F603 /* Yggdrasil */ = { isa = PBXNativeTarget; - buildConfigurationList = 39F020672996CD770093F603 /* Build configuration list for PBXNativeTarget "YggdrasilSwiftUI" */; + buildConfigurationList = 39F020672996CD770093F603 /* Build configuration list for PBXNativeTarget "Yggdrasil" */; buildPhases = ( 39F020572996CD760093F603 /* Sources */, 39F020582996CD760093F603 /* Frameworks */, @@ -201,9 +201,9 @@ dependencies = ( 39F99B362A48F70F0045BD10 /* PBXTargetDependency */, ); - name = YggdrasilSwiftUI; + name = Yggdrasil; productName = YggdrasilSwiftUI; - productReference = 39F0205B2996CD760093F603 /* YggdrasilSwiftUI.app */; + productReference = 39F0205B2996CD760093F603 /* Yggdrasil.app */; productType = "com.apple.product-type.application"; }; E593CE961DF905AF00D7265D /* YggdrasilNetworkExtension */ = { @@ -269,7 +269,7 @@ projectRoot = ""; targets = ( E593CE961DF905AF00D7265D /* YggdrasilNetworkExtension */, - 39F0205A2996CD760093F603 /* YggdrasilSwiftUI */, + 39F0205A2996CD760093F603 /* Yggdrasil */, ); }; /* End PBXProject section */ @@ -342,7 +342,7 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_ENTITLEMENTS = YggdrasilSwiftUI/YggdrasilSwiftUI.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 42; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"YggdrasilSwiftUI/Preview Content\""; DEVELOPMENT_TEAM = R9AV23TXF2; @@ -396,7 +396,7 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CODE_SIGN_ENTITLEMENTS = YggdrasilSwiftUI/YggdrasilSwiftUI.entitlements; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 1; + CURRENT_PROJECT_VERSION = 42; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"YggdrasilSwiftUI/Preview Content\""; DEVELOPMENT_TEAM = R9AV23TXF2; @@ -643,7 +643,7 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - 39F020672996CD770093F603 /* Build configuration list for PBXNativeTarget "YggdrasilSwiftUI" */ = { + 39F020672996CD770093F603 /* Build configuration list for PBXNativeTarget "Yggdrasil" */ = { isa = XCConfigurationList; buildConfigurations = ( 39F020682996CD770093F603 /* Debug */, diff --git a/Yggdrasil Network.xcodeproj/xcshareddata/xcschemes/YggdrasilSwiftUI.xcscheme b/Yggdrasil Network.xcodeproj/xcshareddata/xcschemes/YggdrasilSwiftUI.xcscheme index e0f02e0..d0c4f3c 100644 --- a/Yggdrasil Network.xcodeproj/xcshareddata/xcschemes/YggdrasilSwiftUI.xcscheme +++ b/Yggdrasil Network.xcodeproj/xcshareddata/xcschemes/YggdrasilSwiftUI.xcscheme @@ -16,8 +16,8 @@ @@ -45,8 +45,8 @@ @@ -62,8 +62,8 @@ diff --git a/Yggdrasil.xcframework/Info.plist b/Yggdrasil.xcframework/Info.plist index f271b9e..4189859 100644 --- a/Yggdrasil.xcframework/Info.plist +++ b/Yggdrasil.xcframework/Info.plist @@ -4,37 +4,6 @@ AvailableLibraries - - BinaryPath - Yggdrasil.framework/Versions/A/Yggdrasil - LibraryIdentifier - ios-arm64 - LibraryPath - Yggdrasil.framework - SupportedArchitectures - - arm64 - - SupportedPlatform - ios - - - BinaryPath - Yggdrasil.framework/Versions/A/Yggdrasil - LibraryIdentifier - ios-arm64_x86_64-simulator - LibraryPath - Yggdrasil.framework - SupportedArchitectures - - arm64 - x86_64 - - SupportedPlatform - ios - SupportedPlatformVariant - simulator - BinaryPath Yggdrasil.framework/Versions/A/Yggdrasil @@ -50,6 +19,20 @@ SupportedPlatform macos + + BinaryPath + Yggdrasil.framework/Versions/A/Yggdrasil + LibraryIdentifier + ios-arm64 + LibraryPath + Yggdrasil.framework + SupportedArchitectures + + arm64 + + SupportedPlatform + ios + CFBundlePackageType XFWK diff --git a/YggdrasilSwiftUI/PeersView.swift b/YggdrasilSwiftUI/PeersView.swift index a4f809f..6068650 100644 --- a/YggdrasilSwiftUI/PeersView.swift +++ b/YggdrasilSwiftUI/PeersView.swift @@ -13,6 +13,9 @@ struct PeersView: View { @Environment(\.editMode) var editMode #endif + @State private var isAddingPeer = false + @State private var addPeerURI = "" + var body: some View { Form { Section(content: { @@ -97,7 +100,16 @@ struct PeersView: View { .toolbar { if editMode!.wrappedValue.isEditing { Button("Add", systemImage: "plus") { - appDelegate.yggdrasilConfig.peers.append("") + //appDelegate.yggdrasilConfig.peers.append("") + addPeerURI = "" + isAddingPeer.toggle() + }.alert("Add new peer", isPresented: $isAddingPeer) { + TextField("tls://host:port", text: $addPeerURI) + .textInputAutocapitalization(.never) + Button("Add", action: addPeer) + Button("Cancel", role: .cancel) { } + } message: { + Text("Specify the peer URI to add.") } } EditButton() @@ -110,6 +122,13 @@ struct PeersView: View { .navigationBarTitleDisplayMode(.large) #endif } + + func addPeer() { + if addPeerURI != "" { + appDelegate.yggdrasilConfig.peers.append(addPeerURI) + } + addPeerURI = "" + } } struct PeersView_Previews: PreviewProvider {