Prepare airdrop support

This commit is contained in:
世界
2023-07-26 20:38:51 +08:00
parent 486a685bb5
commit 2bd462c789
52 changed files with 488 additions and 455 deletions
+15
View File
@@ -6,6 +6,21 @@
<array>
<string>io.nekohasekai.sfa.update_profiles</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>CFBundleURLIconFile</key>
<string>AppIcon.icns</string>
<key>CFBundleURLName</key>
<string>sing-box</string>
<key>CFBundleURLSchemes</key>
<array>
<string>sing-box</string>
</array>
</dict>
</array>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>NSUbiquitousContainers</key>
+19 -1
View File
@@ -1,4 +1,5 @@
import ApplicationLibrary
import Libbox
import Library
import SwiftUI
@@ -14,6 +15,8 @@ struct MainView: View {
@State private var serviceNotificationContent = ""
@State private var serviceNotificationPresented = false
@State private var importRemoteProfile: LibboxImportRemoteProfile?
var body: some View {
viewBuilder {
if profileLoading {
@@ -54,7 +57,22 @@ struct MainView: View {
.environment(\.selection, $selection)
.environment(\.extensionProfile, $extensionProfile)
.environment(\.logClient, $logClient)
.preferredColorScheme(.dark)
.environment(\.importRemoteProfile, $importRemoteProfile)
.handlesExternalEvents(preferring: [], allowing: ["*"])
.onOpenURL(perform: openURL)
}
private func openURL(url: URL) {
if url.host == "import-remote-profile" {
var error: NSError?
importRemoteProfile = LibboxParseRemoteProfileImportLink(url.absoluteString, &error)
if error != nil {
return
}
if selection != .profiles {
selection = .profiles
}
}
}
private func loadProfile() async {