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
+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 {