Implement group app containers

This commit is contained in:
Maurice Parker
2019-09-22 13:09:06 -05:00
parent 3cd33902cf
commit e14a75d515
3 changed files with 24 additions and 12 deletions

View File

@@ -23,7 +23,12 @@ class ShareViewController: SLComposeServiceViewController, ShareFolderPickerCont
override func viewDidLoad() {
AccountManager.shared = AccountManager(accountsFolder: RSDataSubfolder(nil, "Accounts")!)
let rootID = Bundle.main.bundleIdentifier!.replacingOccurrences(of: ".Share-Extension", with: "")
let accountsURL = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: "group.\(rootID)")
let accountsFolder = accountsURL!.appendingPathComponent("Accounts").absoluteString
let accountsFolderPath = accountsFolder.suffix(from: accountsFolder.index(accountsFolder.startIndex, offsetBy: 7))
AccountManager.shared = AccountManager(accountsFolder: String(accountsFolderPath))
pickerData = FlattenedAccountFolderPickerData()
if pickerData?.containers.count ?? 0 > 0 {