diff --git a/Brand/NCBrand.swift b/Brand/NCBrand.swift index 055a2e5dd3..cfeef5ca6d 100755 --- a/Brand/NCBrand.swift +++ b/Brand/NCBrand.swift @@ -52,7 +52,7 @@ let userAgent: String = { var folderDefaultAutoUpload: String = "Photos" // Capabilities Group - var capabilitiesGroups: String = "group.it.twsweb.Crypto-Cloud" + var capabilitiesGroup: String = "group.it.twsweb.Crypto-Cloud" var capabilitiesGroupApps: String = "group.com.nextcloud.apps" // BRAND ONLY diff --git a/File Provider Extension/FileProviderData.swift b/File Provider Extension/FileProviderData.swift index efd7a4f22c..a05552d340 100644 --- a/File Provider Extension/FileProviderData.swift +++ b/File Provider Extension/FileProviderData.swift @@ -84,7 +84,7 @@ class fileProviderData: NSObject { homeServerUrl = utilityFileSystem.getHomeServer(urlBase: activeAccount.urlBase, userId: activeAccount.userId) NCManageDatabase.shared.setCapabilities(account: account) - NextcloudKit.shared.setup(account: activeAccount.account, user: activeAccount.user, userId: activeAccount.userId, password: NCKeychain().getPassword(account: activeAccount.account), urlBase: activeAccount.urlBase, userAgent: userAgent, nextcloudVersion: NCGlobal.shared.capabilityServerVersionMajor, delegate: NCNetworking.shared) + NextcloudKit.shared.setup(account: activeAccount.account, user: activeAccount.user, userId: activeAccount.userId, password: NCKeychain().getPassword(account: activeAccount.account), urlBase: activeAccount.urlBase, userAgent: userAgent, nextcloudVersion: NCGlobal.shared.capabilityServerVersionMajor, groupIdentifier: NCBrandOptions.shared.capabilitiesGroup, delegate: NCNetworking.shared) NCNetworking.shared.delegate = providerExtension as? NCNetworkingDelegate return tableAccount.init(value: activeAccount) @@ -108,7 +108,7 @@ class fileProviderData: NSObject { NCManageDatabase.shared.setCapabilities(account: account) - NextcloudKit.shared.setup(account: activeAccount.account, user: activeAccount.user, userId: activeAccount.userId, password: NCKeychain().getPassword(account: activeAccount.account), urlBase: activeAccount.urlBase, userAgent: userAgent, nextcloudVersion: NCGlobal.shared.capabilityServerVersionMajor, delegate: NCNetworking.shared) + NextcloudKit.shared.setup(account: activeAccount.account, user: activeAccount.user, userId: activeAccount.userId, password: NCKeychain().getPassword(account: activeAccount.account), urlBase: activeAccount.urlBase, userAgent: userAgent, nextcloudVersion: NCGlobal.shared.capabilityServerVersionMajor, groupIdentifier: NCBrandOptions.shared.capabilitiesGroup, delegate: NCNetworking.shared) NCNetworking.shared.delegate = providerExtension as? NCNetworkingDelegate return tableAccount.init(value: activeAccount) diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index 6393442ee2..77621d28c7 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -5754,8 +5754,8 @@ isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/nextcloud/NextcloudKit"; requirement = { - kind = exactVersion; - version = 4.0.2; + branch = develop; + kind = branch; }; }; F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */ = { diff --git a/Notification Service Extension/NotificationService.swift b/Notification Service Extension/NotificationService.swift index 24efbc8e92..b2d6bc1490 100644 --- a/Notification Service Extension/NotificationService.swift +++ b/Notification Service Extension/NotificationService.swift @@ -46,7 +46,7 @@ class NotificationService: UNNotificationServiceExtension { if var json = try JSONSerialization.jsonObject(with: data) as? [String: AnyObject], let subject = json["subject"] as? String { bestAttemptContent.body = subject - if let pref = UserDefaults(suiteName: NCBrandOptions.shared.capabilitiesGroups) { + if let pref = UserDefaults(suiteName: NCBrandOptions.shared.capabilitiesGroup) { json["account"] = tableAccount.account as AnyObject pref.set(json, forKey: "NOTIFICATION_DATA") pref.synchronize() diff --git a/iOSClient/AppDelegate.swift b/iOSClient/AppDelegate.swift index 54e7ed0a3d..f91e894327 100644 --- a/iOSClient/AppDelegate.swift +++ b/iOSClient/AppDelegate.swift @@ -111,7 +111,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD userId = activeAccount.userId password = NCKeychain().getPassword(account: account) - NextcloudKit.shared.setup(account: account, user: user, userId: userId, password: password, urlBase: urlBase) + NextcloudKit.shared.setup(account: account, user: user, userId: userId, password: password, urlBase: urlBase, groupIdentifier: NCBrandOptions.shared.capabilitiesGroup) NCManageDatabase.shared.setCapabilities(account: account) NCBrandColor.shared.settingThemingColor(account: activeAccount.account) @@ -287,7 +287,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD } func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) { - if let pref = UserDefaults(suiteName: NCBrandOptions.shared.capabilitiesGroups), + if let pref = UserDefaults(suiteName: NCBrandOptions.shared.capabilitiesGroup), let data = pref.object(forKey: "NOTIFICATION_DATA") as? [String: AnyObject] { nextcloudPushNotificationAction(data: data) pref.set(nil, forKey: "NOTIFICATION_DATA") @@ -474,7 +474,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD let account: String = "\(username) \(urlBase)" let user = username - NextcloudKit.shared.setup(account: account, user: user, userId: user, password: password, urlBase: urlBase) + NextcloudKit.shared.setup(account: account, user: user, userId: user, password: password, urlBase: urlBase, groupIdentifier: NCBrandOptions.shared.capabilitiesGroup) NextcloudKit.shared.getUserProfile { _, userProfile, _, error in if error == .success, let userProfile { @@ -520,7 +520,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD self.userId = tableAccount.userId self.password = NCKeychain().getPassword(account: tableAccount.account) - NextcloudKit.shared.setup(account: account, user: user, userId: userId, password: password, urlBase: urlBase) + NextcloudKit.shared.setup(account: account, user: user, userId: userId, password: password, urlBase: urlBase, groupIdentifier: NCBrandOptions.shared.capabilitiesGroup) NCManageDatabase.shared.setCapabilities(account: account) if let userProfile { diff --git a/iOSClient/Data/NCManageDatabase.swift b/iOSClient/Data/NCManageDatabase.swift index e61b0f005d..44ce135ab7 100644 --- a/iOSClient/Data/NCManageDatabase.swift +++ b/iOSClient/Data/NCManageDatabase.swift @@ -40,7 +40,7 @@ class NCManageDatabase: NSObject { let utilityFileSystem = NCUtilityFileSystem() override init() { - let dirGroup = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroups) + let dirGroup = FileManager.default.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroup) let databaseFileUrlPath = dirGroup?.appendingPathComponent(NCGlobal.shared.appDatabaseNextcloud + "/" + databaseName) if let databaseFilePath = databaseFileUrlPath?.path { diff --git a/iOSClient/Login/NCLogin.swift b/iOSClient/Login/NCLogin.swift index ef3fcbe59f..d3b75a3a8d 100644 --- a/iOSClient/Login/NCLogin.swift +++ b/iOSClient/Login/NCLogin.swift @@ -436,7 +436,7 @@ class NCLogin: UIViewController, UITextFieldDelegate, NCLoginQRCodeDelegate { let urlBase = url let account = user + " " + user - NextcloudKit.shared.setup(account: account, user: user, userId: user, password: password, urlBase: urlBase) + NextcloudKit.shared.setup(account: account, user: user, userId: user, password: password, urlBase: urlBase, groupIdentifier: NCBrandOptions.shared.capabilitiesGroup) NextcloudKit.shared.getUserProfile { _, userProfile, _, error in if error == .success, let userProfile { diff --git a/iOSClient/Login/NCLoginProvider.swift b/iOSClient/Login/NCLoginProvider.swift index ed231ffec3..5acee809d5 100644 --- a/iOSClient/Login/NCLoginProvider.swift +++ b/iOSClient/Login/NCLoginProvider.swift @@ -168,7 +168,7 @@ extension NCLoginProvider: WKNavigationDelegate { let account: String = "\(username) \(urlBase)" let user = username - NextcloudKit.shared.setup(account: account, user: user, userId: user, password: password, urlBase: urlBase) + NextcloudKit.shared.setup(account: account, user: user, userId: user, password: password, urlBase: urlBase, groupIdentifier: NCBrandOptions.shared.capabilitiesGroup) NextcloudKit.shared.getUserProfile { _, userProfile, _, error in if error == .success, let userProfile { diff --git a/iOSClient/Networking/NCNetworking.swift b/iOSClient/Networking/NCNetworking.swift index f43720cec1..b175e8055d 100644 --- a/iOSClient/Networking/NCNetworking.swift +++ b/iOSClient/Networking/NCNetworking.swift @@ -109,7 +109,9 @@ class NCNetworking: NSObject, NKCommonDelegate { configuration.isDiscretionary = false configuration.httpMaximumConnectionsPerHost = sessionMaximumConnectionsPerHost configuration.requestCachePolicy = NSURLRequest.CachePolicy.reloadIgnoringLocalCacheData + configuration.httpCookieStorage = HTTPCookieStorage.sharedCookieStorage(forGroupContainerIdentifier: NCBrandOptions.shared.capabilitiesGroup) let session = URLSession(configuration: configuration, delegate: nkBackground, delegateQueue: OperationQueue.main) + return session }() @@ -120,6 +122,7 @@ class NCNetworking: NSObject, NKCommonDelegate { configuration.isDiscretionary = false configuration.httpMaximumConnectionsPerHost = sessionMaximumConnectionsPerHost configuration.requestCachePolicy = NSURLRequest.CachePolicy.reloadIgnoringLocalCacheData + configuration.httpCookieStorage = HTTPCookieStorage.sharedCookieStorage(forGroupContainerIdentifier: NCBrandOptions.shared.capabilitiesGroup) let session = URLSession(configuration: configuration, delegate: nkBackground, delegateQueue: OperationQueue.main) return session }() @@ -131,6 +134,7 @@ class NCNetworking: NSObject, NKCommonDelegate { configuration.isDiscretionary = false configuration.httpMaximumConnectionsPerHost = sessionMaximumConnectionsPerHost configuration.requestCachePolicy = NSURLRequest.CachePolicy.reloadIgnoringLocalCacheData + configuration.httpCookieStorage = HTTPCookieStorage.sharedCookieStorage(forGroupContainerIdentifier: NCBrandOptions.shared.capabilitiesGroup) let session = URLSession(configuration: configuration, delegate: nkBackground, delegateQueue: OperationQueue.main) return session }() @@ -142,7 +146,8 @@ class NCNetworking: NSObject, NKCommonDelegate { configuration.isDiscretionary = false configuration.httpMaximumConnectionsPerHost = sessionMaximumConnectionsPerHost configuration.requestCachePolicy = NSURLRequest.CachePolicy.reloadIgnoringLocalCacheData - configuration.sharedContainerIdentifier = NCBrandOptions.shared.capabilitiesGroups + configuration.sharedContainerIdentifier = NCBrandOptions.shared.capabilitiesGroup + configuration.httpCookieStorage = HTTPCookieStorage.sharedCookieStorage(forGroupContainerIdentifier: NCBrandOptions.shared.capabilitiesGroup) let session = URLSession(configuration: configuration, delegate: nkBackground, delegateQueue: OperationQueue.main) return session }() diff --git a/iOSClient/Supporting Files/sl.lproj/Localizable.strings b/iOSClient/Supporting Files/sl.lproj/Localizable.strings index e36258ea4f..d77b0a39c7 100644 Binary files a/iOSClient/Supporting Files/sl.lproj/Localizable.strings and b/iOSClient/Supporting Files/sl.lproj/Localizable.strings differ diff --git a/iOSClient/Utility/NCUtilityFileSystem.swift b/iOSClient/Utility/NCUtilityFileSystem.swift index dd6baa28d6..f5dbc2c00c 100644 --- a/iOSClient/Utility/NCUtilityFileSystem.swift +++ b/iOSClient/Utility/NCUtilityFileSystem.swift @@ -28,13 +28,13 @@ import PhotosUI class NCUtilityFileSystem: NSObject { let fileManager = FileManager.default var directoryGroup: String { - return fileManager.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroups)?.path ?? "" + return fileManager.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroup)?.path ?? "" } var directoryDocuments: String { return NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first ?? "" } var directoryCertificates: String { - guard let directoryGroup = fileManager.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroups) else { return "" } + guard let directoryGroup = fileManager.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroup) else { return "" } let path = directoryGroup.appendingPathComponent(NCGlobal.shared.appCertificates).path if !fileManager.fileExists(atPath: path) { do { @@ -44,7 +44,7 @@ class NCUtilityFileSystem: NSObject { return path } var directoryUserData: String { - guard let directoryGroup = fileManager.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroups) else { return "" } + guard let directoryGroup = fileManager.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroup) else { return "" } let path = directoryGroup.appendingPathComponent(NCGlobal.shared.appUserData).path if !fileManager.fileExists(atPath: path) { do { @@ -54,7 +54,7 @@ class NCUtilityFileSystem: NSObject { return path } var directoryScan: String { - guard let directoryGroup = fileManager.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroups) else { return "" } + guard let directoryGroup = fileManager.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroup) else { return "" } let path = directoryGroup.appendingPathComponent(NCGlobal.shared.appScan).path if !fileManager.fileExists(atPath: path) { do { @@ -64,7 +64,7 @@ class NCUtilityFileSystem: NSObject { return path } var directoryProviderStorage: String { - guard let directoryGroup = fileManager.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroups) else { return "" } + guard let directoryGroup = fileManager.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroup) else { return "" } let path = directoryGroup.appendingPathComponent(NCGlobal.shared.directoryProviderStorage).path if !fileManager.fileExists(atPath: path) { do { @@ -151,7 +151,7 @@ class NCUtilityFileSystem: NSObject { } func createDirectoryStandard() { - guard let directoryGroup = fileManager.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroups)?.path else { return } + guard let directoryGroup = fileManager.containerURL(forSecurityApplicationGroupIdentifier: NCBrandOptions.shared.capabilitiesGroup)?.path else { return } if !fileManager.fileExists(atPath: directoryDocuments) { try? fileManager.createDirectory(atPath: directoryDocuments, withIntermediateDirectories: true) } let appDatabaseNextcloud = directoryGroup + "/" + NCGlobal.shared.appDatabaseNextcloud if !fileManager.fileExists(atPath: appDatabaseNextcloud) { try? fileManager.createDirectory(atPath: appDatabaseNextcloud, withIntermediateDirectories: true) }