Refactor to eliminate hardcoded identifiers
Read package identifier and app group ID from Info.plist at runtime via AppConfiguration. This enables SFM.System to use TeamID-prefixed app group format required by macOS Sequoia, fixing the privacy prompt when accessing app group data.
This commit is contained in:
@@ -4,8 +4,15 @@ import UniformTypeIdentifiers
|
||||
class FileProviderExtension: NSObject, NSFileProviderReplicatedExtension {
|
||||
let domain: NSFileProviderDomain
|
||||
|
||||
private static let appGroupID: String = {
|
||||
guard let value = Bundle.main.object(forInfoDictionaryKey: "AppGroupIdentifier") as? String else {
|
||||
fatalError("Missing AppGroupIdentifier in Info.plist")
|
||||
}
|
||||
return value
|
||||
}()
|
||||
|
||||
private var workingDirectory: URL {
|
||||
let groupURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.io.nekohasekai.sfavt")!
|
||||
let groupURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: Self.appGroupID)!
|
||||
return groupURL
|
||||
.appendingPathComponent("Library", isDirectory: true)
|
||||
.appendingPathComponent("Caches", isDirectory: true)
|
||||
|
||||
@@ -2,10 +2,14 @@
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BasePackageIdentifier</key>
|
||||
<string>$(BASE_PACKAGE_IDENTIFIER)</string>
|
||||
<key>AppGroupIdentifier</key>
|
||||
<string>$(APP_GROUP_IDENTIFIER)</string>
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionFileProviderDocumentGroup</key>
|
||||
<string>group.io.nekohasekai.sfavt</string>
|
||||
<string>$(APP_GROUP_IDENTIFIER)</string>
|
||||
<key>NSExtensionFileProviderSupportsEnumeration</key>
|
||||
<true/>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
|
||||
Reference in New Issue
Block a user