Fixed App Groups
This commit is contained in:
@@ -589,6 +589,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_ENTITLEMENTS = GIFCollectorShare/GIFCollectorShare.entitlements;
|
CODE_SIGN_ENTITLEMENTS = GIFCollectorShare/GIFCollectorShare.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "";
|
CODE_SIGN_IDENTITY = "";
|
||||||
|
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = YES;
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Manual;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_TEAM = "";
|
DEVELOPMENT_TEAM = "";
|
||||||
@@ -617,6 +618,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
CODE_SIGN_ENTITLEMENTS = GIFCollectorShare/GIFCollectorShare.entitlements;
|
CODE_SIGN_ENTITLEMENTS = GIFCollectorShare/GIFCollectorShare.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "";
|
CODE_SIGN_IDENTITY = "";
|
||||||
|
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = YES;
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Manual;
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_TEAM = "";
|
DEVELOPMENT_TEAM = "";
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Removed SwiftData dependency to ensure compatibility across targets
|
// Removed SwiftData dependency to ensure compatibility across targets
|
||||||
struct GIF: Codable, Identifiable, Equatable {
|
struct GIF: Codable, Identifiable, Equatable {
|
||||||
let id: UUID
|
let id: UUID
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>com.apple.security.application-groups</key>
|
<key>com.apple.security.application-groups</key>
|
||||||
<array>
|
<array>
|
||||||
<string>group.gifcollector</string>
|
<string>group.com.abunchofknowitalls.GIFCollector</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
var appGroupID = "group."+Bundle.main.bundleIdentifier.unsafelyUnwrapped
|
||||||
|
|
||||||
class GIFFileManager {
|
class GIFFileManager {
|
||||||
static let shared = GIFFileManager()
|
static let shared = GIFFileManager()
|
||||||
|
|
||||||
@@ -12,9 +14,6 @@ class GIFFileManager {
|
|||||||
|
|
||||||
// Always use the App Group container for consistent storage between extensions
|
// Always use the App Group container for consistent storage between extensions
|
||||||
private var documentsDirectory: URL {
|
private var documentsDirectory: URL {
|
||||||
// Use a constant app group ID to ensure consistency across targets
|
|
||||||
let appGroupID = "group.gifcollector"
|
|
||||||
|
|
||||||
if let containerURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupID) {
|
if let containerURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: appGroupID) {
|
||||||
return containerURL
|
return containerURL
|
||||||
} else {
|
} else {
|
||||||
@@ -162,7 +161,7 @@ class GIFFileManager {
|
|||||||
let fileURLs = try FileManager.default.contentsOfDirectory(at: gifsDirectory, includingPropertiesForKeys: nil)
|
let fileURLs = try FileManager.default.contentsOfDirectory(at: gifsDirectory, includingPropertiesForKeys: nil)
|
||||||
|
|
||||||
// Find any shared GIF that matches our URL (usually won't find any, but helps avoid duplicates)
|
// Find any shared GIF that matches our URL (usually won't find any, but helps avoid duplicates)
|
||||||
let userDefaults = UserDefaults(suiteName: "group.gifcollector")
|
let userDefaults = UserDefaults(suiteName: appGroupID)
|
||||||
if let pendingGIFs = userDefaults?.array(forKey: "pendingGIFs") as? [[String: Any]] {
|
if let pendingGIFs = userDefaults?.array(forKey: "pendingGIFs") as? [[String: Any]] {
|
||||||
for gifInfo in pendingGIFs {
|
for gifInfo in pendingGIFs {
|
||||||
if let originURL = gifInfo["originalURL"] as? String,
|
if let originURL = gifInfo["originalURL"] as? String,
|
||||||
@@ -179,4 +178,4 @@ class GIFFileManager {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ class GIFStorageService {
|
|||||||
static let shared = GIFStorageService()
|
static let shared = GIFStorageService()
|
||||||
|
|
||||||
// Use constant App Group ID to ensure consistency across targets
|
// Use constant App Group ID to ensure consistency across targets
|
||||||
private let appGroupID = "group.gifcollector"
|
private let userDefaults = UserDefaults(suiteName: appGroupID)
|
||||||
private let userDefaults = UserDefaults(suiteName: "group.gifcollector")
|
|
||||||
|
|
||||||
// Use a consistent key for saved GIFs across all extensions
|
// Use a consistent key for saved GIFs across all extensions
|
||||||
private let savedGIFsKey = "sharedGIFs"
|
private let savedGIFsKey = "sharedGIFs"
|
||||||
@@ -217,4 +216,4 @@ class GIFStorageService {
|
|||||||
userDefaults?.synchronize()
|
userDefaults?.synchronize()
|
||||||
print("Cleared pending GIFs from shared storage")
|
print("Cleared pending GIFs from shared storage")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>com.apple.security.application-groups</key>
|
<key>com.apple.security.application-groups</key>
|
||||||
<array>
|
<array>
|
||||||
<string>group.gifcollector</string>
|
<string>group.com.abunchofknowitalls.GIFCollector</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>com.apple.security.application-groups</key>
|
<key>com.apple.security.application-groups</key>
|
||||||
<array>
|
<array>
|
||||||
<string>group.gifcollector</string>
|
<string>group.com.abunchofknowitalls.GIFCollector</string>
|
||||||
</array>
|
</array>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class ShareViewController: SLComposeServiceViewController {
|
|||||||
private var debugMessages: [String] = []
|
private var debugMessages: [String] = []
|
||||||
|
|
||||||
// Use the same constants as in the main app
|
// Use the same constants as in the main app
|
||||||
private let appGroupID = "group.gifcollector"
|
private let appGroupID = "group."+Bundle.main.bundleIdentifier.unsafelyUnwrapped
|
||||||
private let pendingGIFsKey = "pendingGIFs"
|
private let pendingGIFsKey = "pendingGIFs"
|
||||||
|
|
||||||
override func viewDidLoad() {
|
override func viewDidLoad() {
|
||||||
|
|||||||
Reference in New Issue
Block a user