Skip to content

Commit

Permalink
Version 5.5.3 (#3015)
Browse files Browse the repository at this point in the history
  • Loading branch information
marinofaggiana authored Aug 7, 2024
1 parent 9e4e7af commit 775af0c
Show file tree
Hide file tree
Showing 186 changed files with 440 additions and 423 deletions.
2 changes: 1 addition & 1 deletion File Provider Extension/FileProviderEnumerator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class FileProviderEnumerator: NSObject, NSFileProviderEnumerator {
let predicate = NSPredicate(format: "account == %@ AND serverUrl == %@", fileProviderData.shared.account, serverUrl)

if pageNumber == 1 {
NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "1", showHiddenFiles: NCKeychain().showHiddenFiles) { _, files, _, error in
NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrl, depth: "1", showHiddenFiles: NCKeychain().showHiddenFiles, account: fileProviderData.shared.account) { _, files, _, error in
if error == .success {
NCManageDatabase.shared.convertFilesToMetadatas(files, useFirstAsMetadataFolder: true) { metadataFolder, metadatas in
/// FOLDER
Expand Down
12 changes: 6 additions & 6 deletions File Provider Extension/FileProviderExtension+Actions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ extension FileProviderExtension {
let directoryName = utilityFileSystem.createFileName(directoryName, serverUrl: tableDirectory.serverUrl, account: fileProviderData.shared.account)
let serverUrlFileName = tableDirectory.serverUrl + "/" + directoryName

NextcloudKit.shared.createFolder(serverUrlFileName: serverUrlFileName) { _, ocId, _, error in
NextcloudKit.shared.createFolder(serverUrlFileName: serverUrlFileName, account: fileProviderData.shared.account) { _, ocId, _, error in
if error == .success {
NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: NCKeychain().showHiddenFiles) { _, files, _, error in
NextcloudKit.shared.readFileOrFolder(serverUrlFileName: serverUrlFileName, depth: "0", showHiddenFiles: NCKeychain().showHiddenFiles, account: fileProviderData.shared.account) { _, files, _, error in
if error == .success, let file = files.first {
let isDirectoryEncrypted = self.utilityFileSystem.isDirectoryE2EE(file: file)
let metadata = NCManageDatabase.shared.convertFileToMetadata(file, isDirectoryE2EE: isDirectoryEncrypted)
Expand Down Expand Up @@ -69,7 +69,7 @@ extension FileProviderExtension {
let serverUrl = metadata.serverUrl
let fileName = metadata.fileName

NextcloudKit.shared.deleteFileOrFolder(serverUrlFileName: serverUrlFileName) { account, error in
NextcloudKit.shared.deleteFileOrFolder(serverUrlFileName: serverUrlFileName, account: metadata.account) { account, error in
if error == .success { // || error == kOCErrorServerPathNotFound {
let fileNamePath = self.utilityFileSystem.getDirectoryProviderStorageOcId(itemIdentifier.rawValue)

Expand Down Expand Up @@ -107,7 +107,7 @@ extension FileProviderExtension {
let serverUrlTo = tableDirectoryTo.serverUrl
let fileNameTo = serverUrlTo + "/" + itemFrom.filename

NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNameFrom, serverUrlFileNameDestination: fileNameTo, overwrite: false) { account, error in
NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNameFrom, serverUrlFileNameDestination: fileNameTo, overwrite: false, account: metadataFrom.account) { account, error in
if error == .success {
if metadataFrom.directory {
NCManageDatabase.shared.deleteDirectoryAndSubDirectory(serverUrl: serverUrlFrom, account: account)
Expand Down Expand Up @@ -138,7 +138,7 @@ extension FileProviderExtension {
let fileNamePathTo = metadata.serverUrl + "/" + itemName
let ocId = metadata.ocId

NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNamePathFrom, serverUrlFileNameDestination: fileNamePathTo, overwrite: false) { account, error in
NextcloudKit.shared.moveFileOrFolder(serverUrlFileNameSource: fileNamePathFrom, serverUrlFileNameDestination: fileNamePathTo, overwrite: false, account: metadata.account) { account, error in
if error == .success {
// Rename metadata
NCManageDatabase.shared.renameMetadata(fileNameTo: itemName, ocId: ocId)
Expand Down Expand Up @@ -185,7 +185,7 @@ extension FileProviderExtension {

if (favorite == true && metadata.favorite == false) || (favorite == false && metadata.favorite == true) {
let fileNamePath = utilityFileSystem.getFileNamePath(metadata.fileName, serverUrl: metadata.serverUrl, urlBase: metadata.urlBase, userId: metadata.userId)
NextcloudKit.shared.setFavorite(fileName: fileNamePath, favorite: favorite) { _, error in
NextcloudKit.shared.setFavorite(fileName: fileNamePath, favorite: favorite, account: metadata.account) { _, error in
if error == .success {
guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId) else {
return completionHandler(nil, NSFileProviderError(.noSuchItem))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extension FileProviderExtension {
}
let fileNameIconLocalPath = utilityFileSystem.getDirectoryProviderStorageIconOcId(metadata.ocId, etag: metadata.etag)

NextcloudKit.shared.downloadPreview(fileId: metadata.fileId, widthPreview: Int(size.width), heightPreview: Int(size.height), etag: metadata.etag) { _ in
NextcloudKit.shared.downloadPreview(fileId: metadata.fileId, widthPreview: Int(size.width), heightPreview: Int(size.height), etag: metadata.etag, account: metadata.account) { _ in
} completion: { _, data, error in
if error == .success, let data {
do {
Expand Down
6 changes: 3 additions & 3 deletions File Provider Extension/FileProviderExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class FileProviderExtension: NSFileProviderExtension {
/// SIGNAL
fileProviderData.shared.signalEnumerator(ocId: metadata.ocId, type: .update)

NextcloudKit.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, requestHandler: { _ in
NextcloudKit.shared.download(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, account: metadata.account, requestHandler: { _ in
}, taskHandler: { task in
NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId,
taskIdentifier: task.taskIdentifier)
Expand Down Expand Up @@ -254,7 +254,7 @@ class FileProviderExtension: NSFileProviderExtension {
sessionError: "",
selector: "",
status: NCGlobal.shared.metadataStatusUploading)
if let task = NKBackground(nkCommonInstance: NextcloudKit.shared.nkCommonInstance).upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: url.path, dateCreationFile: nil, dateModificationFile: nil, session: NCNetworking.shared.sessionManagerUploadBackgroundExtension) {
if let task = NKBackground(nkCommonInstance: NextcloudKit.shared.nkCommonInstance).upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: url.path, dateCreationFile: nil, dateModificationFile: nil, account: metadata.account, session: NCNetworking.shared.sessionManagerUploadBackgroundExtension) {
NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId,
status: NCGlobal.shared.metadataStatusUploading,
taskIdentifier: task.taskIdentifier)
Expand Down Expand Up @@ -318,7 +318,7 @@ class FileProviderExtension: NSFileProviderExtension {
let serverUrlFileName = tableDirectory.serverUrl + "/" + fileName
let fileNameLocalPath = self.utilityFileSystem.getDirectoryProviderStorageOcId(ocIdTemp, fileNameView: fileName)

if let task = NKBackground(nkCommonInstance: NextcloudKit.shared.nkCommonInstance).upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: nil, dateModificationFile: nil, session: NCNetworking.shared.sessionManagerUploadBackgroundExtension) {
if let task = NKBackground(nkCommonInstance: NextcloudKit.shared.nkCommonInstance).upload(serverUrlFileName: serverUrlFileName, fileNameLocalPath: fileNameLocalPath, dateCreationFile: nil, dateModificationFile: nil, account: metadata.account, session: NCNetworking.shared.sessionManagerUploadBackgroundExtension) {
NCManageDatabase.shared.setMetadataSession(ocId: metadata.ocId,
status: NCGlobal.shared.metadataStatusUploading,
taskIdentifier: task.taskIdentifier)
Expand Down
10 changes: 5 additions & 5 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5414,7 +5414,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 13;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -5441,7 +5441,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.5.2;
MARKETING_VERSION = 5.5.3;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-v";
OTHER_LDFLAGS = "";
Expand Down Expand Up @@ -5480,7 +5480,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 2;
CURRENT_PROJECT_VERSION = 13;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand All @@ -5504,7 +5504,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 5.5.2;
MARKETING_VERSION = 5.5.3;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-v";
OTHER_LDFLAGS = "";
Expand Down Expand Up @@ -5779,7 +5779,7 @@
repositoryURL = "https://github.com/nextcloud/NextcloudKit";
requirement = {
kind = exactVersion;
version = 4.0.3;
version = 4.0.4;
};
};
F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */ = {
Expand Down
2 changes: 1 addition & 1 deletion Share/NCShareExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ class NCShareExtension: UIViewController {
}

@objc func actionCreateFolder() {
let alertController = UIAlertController.createFolder(serverUrl: serverUrl, urlBase: activeAccount) { error in
let alertController = UIAlertController.createFolder(serverUrl: serverUrl, userBaseUrl: activeAccount) { error in
guard error != .success else { return }
self.showAlert(title: "_error_createsubfolders_upload_", description: error.errorDescription)
}
Expand Down
4 changes: 2 additions & 2 deletions Widget/Dashboard/DashboardData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
let titleImage = imagetmp

let options = NKRequestOptions(timeout: 90, queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
NextcloudKit.shared.getDashboardWidgetsApplication(id, options: options) { _, results, data, error in
NextcloudKit.shared.getDashboardWidgetsApplication(id, account: account.account, options: options) { _, results, data, error in
Task {
var datas = [DashboardData]()
var numberItems = 0
Expand Down Expand Up @@ -225,7 +225,7 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
if FileManager().fileExists(atPath: fileNamePath), let image = UIImage(contentsOfFile: fileNamePath) {
icon = image
} else {
let (_, data, error) = await NCNetworking.shared.downloadPreview(url: url)
let (_, data, error) = await NCNetworking.shared.downloadPreview(url: url, account: account.account)
if error == .success,
let image = convertDataToImage(data: data, size: CGSize(width: 256, height: 256), fileNameToWrite: fileName) {
icon = image
Expand Down
4 changes: 2 additions & 2 deletions Widget/Files/FilesData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func getFilesDataEntry(configuration: AccountIntent?, isPreview: Bool, displaySi
}

let options = NKRequestOptions(timeout: 30, queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
NextcloudKit.shared.searchBodyRequest(serverUrl: account.urlBase, requestBody: requestBody, showHiddenFiles: NCKeychain().showHiddenFiles, options: options) { _, files, data, error in
NextcloudKit.shared.searchBodyRequest(serverUrl: account.urlBase, requestBody: requestBody, showHiddenFiles: NCKeychain().showHiddenFiles, account: account.account, options: options) { _, files, data, error in
Task {
var datas: [FilesData] = []
let title = getTitleFilesWidget(account: account)
Expand Down Expand Up @@ -223,7 +223,7 @@ func getFilesDataEntry(configuration: AccountIntent?, isPreview: Bool, displaySi
}
if image == nil, file.hasPreview {
let sizePreview = NCUtility().getSizePreview(width: Int(file.width), height: Int(file.height))
let (_, _, imageIcon, _, _, _) = await NCNetworking.shared.downloadPreview(fileId: file.fileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, fileNameIconLocalPath: fileNameIconLocalPath, widthPreview: Int(sizePreview.width), heightPreview: Int(sizePreview.height), sizeIcon: NCGlobal.shared.sizeIcon, options: options)
let (_, _, imageIcon, _, _, _) = await NCNetworking.shared.downloadPreview(fileId: file.fileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, fileNameIconLocalPath: fileNameIconLocalPath, widthPreview: Int(sizePreview.width), heightPreview: Int(sizePreview.height), sizeIcon: NCGlobal.shared.sizeIcon, account: account.account, options: options)
image = imageIcon
}
if image == nil {
Expand Down
6 changes: 3 additions & 3 deletions Widget/Lockscreen/LockscreenData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func getLockscreenDataEntry(configuration: AccountIntent?, isPreview: Bool, fami
account = NCManageDatabase.shared.getAccount(predicate: NSPredicate(format: "account == %@", accountIdentifier))
}

guard let account = account else {
guard let account else {
return completion(LockscreenData(date: Date(), isPlaceholder: true, activity: "", link: URL(string: "https://")!, quotaRelative: 0, quotaUsed: "", quotaTotal: "", error: false))
}

Expand All @@ -78,7 +78,7 @@ func getLockscreenDataEntry(configuration: AccountIntent?, isPreview: Bool, fami
let options = NKRequestOptions(timeout: 90, queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
if #available(iOSApplicationExtension 16.0, *) {
if family == .accessoryCircular {
NextcloudKit.shared.getUserProfile(options: options) { _, userProfile, _, error in
NextcloudKit.shared.getUserProfile(account: account.account, options: options) { _, userProfile, _, error in
if error == .success, let userProfile = userProfile {
if userProfile.quotaRelative > 0 {
quotaRelative = Float(userProfile.quotaRelative) / 100
Expand All @@ -102,7 +102,7 @@ func getLockscreenDataEntry(configuration: AccountIntent?, isPreview: Bool, fami
}
}
} else if family == .accessoryRectangular {
NextcloudKit.shared.getDashboardWidgetsApplication("activity", options: options) { _, results, _, error in
NextcloudKit.shared.getDashboardWidgetsApplication("activity", account: account.account, options: options) { _, results, _, error in
var activity: String = NSLocalizedString("_no_data_available_", comment: "")
var link = URL(string: "https://")!
if error == .success, let result = results?.first {
Expand Down
16 changes: 9 additions & 7 deletions iOSClient/Activity/NCActivity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class NCActivity: UIViewController, NCSharePagingContent {
commentView = Bundle.main.loadNibNamed("NCActivityCommentView", owner: self, options: nil)?.first as? NCActivityCommentView
commentView?.setup(urlBase: appDelegate, account: activeAccount) { newComment in
guard let newComment = newComment, !newComment.isEmpty, let metadata = self.metadata else { return }
NextcloudKit.shared.putComments(fileId: metadata.fileId, message: newComment) { _, error in
NextcloudKit.shared.putComments(fileId: metadata.fileId, message: newComment, account: self.appDelegate.account) { _, error in
if error == .success {
self.commentView?.newCommentField.text?.removeAll()
self.loadComments()
Expand Down Expand Up @@ -264,7 +264,7 @@ extension NCActivity: UITableViewDataSource {
cell.icon.image = image.withTintColor(NCBrandColor.shared.textColor, renderingMode: .alwaysOriginal)
}
} else {
NextcloudKit.shared.downloadContent(serverUrl: activity.icon) { _, data, error in
NextcloudKit.shared.downloadContent(serverUrl: activity.icon, account: appDelegate.account) { _, data, error in
if error == .success {
do {
try data!.write(to: NSURL(fileURLWithPath: fileNameLocalPath) as URL, options: .atomic)
Expand Down Expand Up @@ -393,7 +393,7 @@ extension NCActivity {
guard showComments, let metadata = metadata else { return }
disptachGroup?.enter()

NextcloudKit.shared.getComments(fileId: metadata.fileId) { _, comments, _, error in
NextcloudKit.shared.getComments(fileId: metadata.fileId, account: metadata.account) { _, comments, _, error in
if error == .success, let comments = comments {
NCManageDatabase.shared.addComments(comments, account: metadata.account, objectId: metadata.fileId)
} else if error.errorCode != NCGlobal.shared.errorResourceNotFound {
Expand Down Expand Up @@ -422,7 +422,8 @@ extension NCActivity {
limit: 1,
objectId: nil,
objectType: objectType,
previews: true) { task in
previews: true,
account: appDelegate.account) { task in
self.dataSourceTask = task
} completion: { account, _, activityFirstKnown, activityLastGiven, _, error in
defer { disptachGroup.leave() }
Expand Down Expand Up @@ -450,7 +451,8 @@ extension NCActivity {
limit: min(limit, 200),
objectId: metadata?.fileId,
objectType: objectType,
previews: true) { task in
previews: true,
account: appDelegate.account) { task in
self.dataSourceTask = task
} completion: { account, activities, activityFirstKnown, activityLastGiven, _, error in
defer { disptachGroup.leave() }
Expand Down Expand Up @@ -507,7 +509,7 @@ extension NCActivity: NCShareCommentsCellDelegate {
alert.addAction(UIAlertAction(title: NSLocalizedString("_ok_", comment: ""), style: .default, handler: { _ in
guard let message = alert.textFields?.first?.text, !message.isEmpty else { return }

NextcloudKit.shared.updateComments(fileId: metadata.fileId, messageId: tableComments.messageId, message: message) { _, error in
NextcloudKit.shared.updateComments(fileId: metadata.fileId, messageId: tableComments.messageId, message: message, account: self.appDelegate.account) { _, error in
if error == .success {
self.loadComments()
} else {
Expand All @@ -529,7 +531,7 @@ extension NCActivity: NCShareCommentsCellDelegate {
action: { _ in
guard let metadata = self.metadata, let tableComments = tableComments else { return }

NextcloudKit.shared.deleteComments(fileId: metadata.fileId, messageId: tableComments.messageId) { _, error in
NextcloudKit.shared.deleteComments(fileId: metadata.fileId, messageId: tableComments.messageId, account: metadata.account) { _, error in
if error == .success {
self.loadComments()
} else {
Expand Down
2 changes: 0 additions & 2 deletions iOSClient/Activity/NCActivityCommentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,4 @@ extension NCActivityCommentView: UISearchBarDelegate {
searchBar.resignFirstResponder()
completionHandler?(searchBar.text)
}

func searchBarTextDidEndEditing(_ searchBar: UISearchBar) { }
}
Loading

0 comments on commit 775af0c

Please sign in to comment.