mirror of
https://github.com/permissionlesstech/bitchat.git
synced 2026-07-26 02:45:19 +00:00
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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user