Fix file providers (#346)

* Make file providers work at all

NSExtensionFileProviderDocumentGroup must be a valid app group. This
updates it to use the new name of the app group including the team ID.

* Update AltStore/Operations/ResignAppOperation.swift
This commit is contained in:
Theodore Dubois
2020-09-04 16:29:01 -07:00
committed by GitHub
parent cace7576e2
commit 47d85b7bab

View File

@@ -113,15 +113,24 @@ private extension ResignAppOperation
infoDictionary[kCFBundleIdentifierKey as String] = profile.bundleIdentifier infoDictionary[kCFBundleIdentifierKey as String] = profile.bundleIdentifier
infoDictionary[Bundle.Info.altBundleID] = identifier infoDictionary[Bundle.Info.altBundleID] = identifier
for (key, value) in additionalInfoDictionaryValues for (key, value) in additionalInfoDictionaryValues
{ {
infoDictionary[key] = value infoDictionary[key] = value
} }
if let appGroups = profile.entitlements[.appGroups] as? [String] if let appGroups = profile.entitlements[.appGroups] as? [String]
{ {
infoDictionary[Bundle.Info.appGroups] = appGroups infoDictionary[Bundle.Info.appGroups] = appGroups
// To keep file providers working, remap the NSExtensionFileProviderDocumentGroup, if there is one.
if var extensionInfo = infoDictionary["NSExtension"] as? [String: Any],
let appGroup = extensionInfo["NSExtensionFileProviderDocumentGroup"] as? String,
let localAppGroup = appGroups.filter({ $0.contains(appGroup) }).min(by: { $0.count < $1.count })
{
extensionInfo["NSExtensionFileProviderDocumentGroup"] = localAppGroup
infoDictionary["NSExtension"] = extensionInfo
}
} }
// Add app-specific exported UTI so we can check later if this app (extension) is installed or not. // Add app-specific exported UTI so we can check later if this app (extension) is installed or not.