Fix share extension functionality

- Add debugging logs to help diagnose sharing issues
- Improve completion handling in share extension
- Check for shared content when app becomes active
- Fix async handling of shared content processing
This commit is contained in:
jack
2025-07-08 04:26:02 +02:00
parent 6a7b33047a
commit 244af2197c
4 changed files with 226 additions and 35 deletions
+13 -2
View File
@@ -35,6 +35,12 @@ struct BitchatApp: App {
.onOpenURL { url in
handleURL(url)
}
#if os(iOS)
.onReceive(NotificationCenter.default.publisher(for: UIApplication.didBecomeActiveNotification)) { _ in
// Check for shared content when app becomes active
checkForSharedContent()
}
#endif
}
#if os(macOS)
.windowStyle(.hiddenTitleBar)
@@ -51,9 +57,14 @@ struct BitchatApp: App {
private func checkForSharedContent() {
// Check app group for shared content from extension
guard let userDefaults = UserDefaults(suiteName: "group.chat.bitchat"),
let sharedContent = userDefaults.string(forKey: "sharedContent"),
guard let userDefaults = UserDefaults(suiteName: "group.chat.bitchat") else {
print("Failed to access app group UserDefaults")
return
}
guard let sharedContent = userDefaults.string(forKey: "sharedContent"),
let sharedDate = userDefaults.object(forKey: "sharedContentDate") as? Date else {
print("No shared content found in UserDefaults")
return
}
-11
View File
@@ -40,16 +40,5 @@
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>bitchat</string>
</array>
<key>CFBundleURLName</key>
<string>chat.bitchat</string>
</dict>
</array>
</dict>
</plist>