Skip to content

Commit

Permalink
Version 6.1.1 (#3148)
Browse files Browse the repository at this point in the history
  • Loading branch information
marinofaggiana authored Oct 31, 2024
1 parent 60f9f92 commit ab8a66f
Show file tree
Hide file tree
Showing 20 changed files with 66 additions and 58 deletions.
8 changes: 4 additions & 4 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5682,7 +5682,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -5709,7 +5709,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 6.1.0;
MARKETING_VERSION = 6.1.1;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-v";
OTHER_LDFLAGS = "";
Expand Down Expand Up @@ -5748,7 +5748,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand All @@ -5772,7 +5772,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 6.1.0;
MARKETING_VERSION = 6.1.1;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-v";
OTHER_LDFLAGS = "";
Expand Down
5 changes: 3 additions & 2 deletions Share/NCShareExtension+Files.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ import NextcloudKit

extension NCShareExtension {
@objc func reloadDatasource(withLoadFolder: Bool) {
let layoutForView = NCManageDatabase.shared.getLayoutForView(account: session.account, key: keyLayout, serverUrl: serverUrl) ?? NCDBLayoutForView()
let predicate = NSPredicate(format: "account == %@ AND serverUrl == %@ AND directory == true", session.account, serverUrl)
let metadatas = self.database.getResultsMetadatasPredicate(predicate, layoutForView: NCDBLayoutForView())
let metadatas = self.database.getResultsMetadatasPredicate(predicate, layoutForView: layoutForView)

self.dataSource = NCCollectionViewDataSource(metadatas: metadatas)

Expand All @@ -49,7 +50,7 @@ extension NCShareExtension {

self.serverUrl += "/" + metadata.fileName
self.reloadDatasource(withLoadFolder: true)
self.setNavigationBar(navigationTitle: metadata.fileName)
self.setNavigationBar(navigationTitle: metadata.fileNameView)
}

func loadFolder() {
Expand Down
6 changes: 6 additions & 0 deletions Share/NCShareExtension+NCAccountRequestDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ extension NCShareExtension: NCAccountRequestDelegate {
}
self.account = account

// CAPABILITIES
database.setCapabilities(account: account)

// COLORS
NCBrandColor.shared.settingThemingColor(account: account)
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterChangeTheming, userInfo: ["account": account])
Expand All @@ -80,6 +83,9 @@ extension NCShareExtension: NCAccountRequestDelegate {
nextcloudVersion: capabilities.capabilityServerVersionMajor,
groupIdentifier: NCBrandOptions.shared.capabilitiesGroup)

// SESSION
NCSession.shared.appendSession(account: tableAccount.account, urlBase: tableAccount.urlBase, user: tableAccount.user, userId: tableAccount.userId)

// get auto upload folder
autoUploadFileName = self.database.getAccountAutoUploadFileName()
autoUploadDirectory = self.database.getAccountAutoUploadDirectory(session: session)
Expand Down
2 changes: 1 addition & 1 deletion Share/NCShareExtension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ class NCShareExtension: UIViewController {
}

@objc func actionCreateFolder() {
let alertController = UIAlertController.createFolder(serverUrl: serverUrl, account: session.account) { error in
let alertController = UIAlertController.createFolder(serverUrl: serverUrl, session: session) { error in
guard error != .success else { return }
self.showAlert(title: "_error_createsubfolders_upload_", description: error.errorDescription)
}
Expand Down
42 changes: 21 additions & 21 deletions iOSClient/Data/NCManageDatabase+Metadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1065,34 +1065,34 @@ extension NCManageDatabase {
do {
let realm = try Realm()
var results = realm.objects(tableMetadata.self).filter(predicate).freeze()
if let layoutForView {
if layoutForView.sort == "fileName" {
let sortedResults = results.sorted {
// 1. favorite order
if $0.favorite == $1.favorite {
// 2. directory order TOP
if layoutForView.directoryOnTop {
if $0.directory == $1.directory {
// 3. natural fileName
return $0.fileNameView.localizedStandardCompare($1.fileNameView) == .orderedAscending
} else {
return $0.directory && !$1.directory
}
} else {
let layout: NCDBLayoutForView = layoutForView ?? NCDBLayoutForView()

if layout.sort == "fileName" {
let sortedResults = results.sorted {
// 1. favorite order
if $0.favorite == $1.favorite {
// 2. directory order TOP
if layout.directoryOnTop {
if $0.directory == $1.directory {
// 3. natural fileName
return $0.fileNameView.localizedStandardCompare($1.fileNameView) == .orderedAscending
} else {
return $0.directory && !$1.directory
}
} else {
return $0.favorite && !$1.favorite
return $0.fileNameView.localizedStandardCompare($1.fileNameView) == .orderedAscending
}
}
return sortedResults
} else {
if layoutForView.directoryOnTop {
results = results.sorted(byKeyPath: layoutForView.sort, ascending: layoutForView.ascending).sorted(byKeyPath: "directory", ascending: false).sorted(byKeyPath: "favorite", ascending: false)
} else {
results = results.sorted(byKeyPath: layoutForView.sort, ascending: layoutForView.ascending).sorted(byKeyPath: "favorite", ascending: false)
return $0.favorite && !$1.favorite
}
}
return sortedResults
} else {
if layout.directoryOnTop {
results = results.sorted(byKeyPath: layout.sort, ascending: layout.ascending).sorted(byKeyPath: "favorite", ascending: false).sorted(byKeyPath: "directory", ascending: false)
} else {
results = results.sorted(byKeyPath: layout.sort, ascending: layout.ascending).sorted(byKeyPath: "favorite", ascending: false)
}
}
return Array(results)

Expand Down
33 changes: 9 additions & 24 deletions iOSClient/Extensions/UIAlertController+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,13 @@ extension UIAlertController {
/// - urlBase: UrlBase object
/// - completion: If not` nil` it overrides the default behavior which shows an error using `NCContentPresenter`
/// - Returns: The presentable alert controller
static func createFolder(serverUrl: String, account: String, markE2ee: Bool = false, sceneIdentifier: String? = nil, completion: ((_ error: NKError) -> Void)? = nil) -> UIAlertController {
static func createFolder(serverUrl: String, session: NCSession.Session, markE2ee: Bool = false, sceneIdentifier: String? = nil, completion: ((_ error: NKError) -> Void)? = nil) -> UIAlertController {
let alertController = UIAlertController(title: NSLocalizedString("_create_folder_", comment: ""), message: nil, preferredStyle: .alert)
let session = NCSession.shared.getSession(account: account)
let isDirectoryEncrypted = NCUtilityFileSystem().isDirectoryE2EE(session: session, serverUrl: serverUrl)

let okAction = UIAlertAction(title: NSLocalizedString("_save_", comment: ""), style: .default, handler: { _ in
guard let fileNameFolder = alertController.textFields?.first?.text else { return }
if markE2ee {
if NCNetworking.shared.isOffline {
return NCContentPresenter().showInfo(error: NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_offline_not_allowed_"))
}
Task {
let createFolderResults = await NCNetworking.shared.createFolder(serverUrlFileName: serverUrl + "/" + fileNameFolder, account: session.account)
if createFolderResults.error == .success {
Expand All @@ -55,28 +51,17 @@ extension UIAlertController {
}
}
} else if isDirectoryEncrypted {
if NCNetworking.shared.isOffline {
return NCContentPresenter().showInfo(error: NKError(errorCode: NCGlobal.shared.errorInternalError, errorDescription: "_offline_not_allowed_"))
}
#if !EXTENSION
Task {
await NCNetworkingE2EECreateFolder().createFolder(fileName: fileNameFolder, serverUrl: serverUrl, withPush: true, sceneIdentifier: sceneIdentifier, session: session)
}
#endif
} else {
let metadataForCreateFolder = NCManageDatabase.shared.createMetadata(fileName: fileNameFolder,
fileNameView: fileNameFolder,
ocId: NSUUID().uuidString,
serverUrl: serverUrl,
url: "",
contentType: "httpd/unix-directory",
directory: true,
session: session,
sceneIdentifier: sceneIdentifier)
metadataForCreateFolder.status = NCGlobal.shared.metadataStatusWaitCreateFolder
metadataForCreateFolder.sessionDate = Date()
NCManageDatabase.shared.addMetadata(metadataForCreateFolder)
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterCreateFolder, userInfo: ["ocId": metadataForCreateFolder.ocId, "serverUrl": metadataForCreateFolder.serverUrl, "account": metadataForCreateFolder.account, "withPush": true, "sceneIdentifier": sceneIdentifier as Any])
NCNetworking.shared.createFolder(fileName: fileNameFolder, serverUrl: serverUrl, overwrite: false, withPush: true, sceneIdentifier: sceneIdentifier, session: session) { error in
if let completion = completion {
DispatchQueue.main.async { completion(error) }
} else if error != .success {
NCContentPresenter().showError(error: error)
} // else: successful, no action
}
}
})

Expand All @@ -96,7 +81,7 @@ extension UIAlertController {
guard let text = alertController.textFields?.first?.text else { return }
let folderName = text.trimmingCharacters(in: .whitespaces)

let textCheck = FileNameValidator.shared.checkFileName(folderName, account: account)
let textCheck = FileNameValidator.shared.checkFileName(folderName, account: session.account)
okAction.isEnabled = textCheck?.error == nil && !folderName.isEmpty
alertController.message = textCheck?.error.localizedDescription
}
Expand Down
4 changes: 4 additions & 0 deletions iOSClient/Files/NCFiles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ class NCFiles: NCCollectionViewCommon {
// MARK: - DataSource

override func reloadDataSource() {
guard !isSearchingMode else {
return super.reloadDataSource()
}

var predicate = self.defaultPredicate
let predicateDirectory = NSPredicate(format: "account == %@ AND serverUrl == %@", session.account, self.serverUrl)
let dataSourceMetadatas = self.dataSource.getMetadatas()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ extension NCCollectionViewCommon: UICollectionViewDataSource {
}
}

// E2EE create preview
if self.isDirectoryEncrypted,
metadata.isImageOrVideo,
!utilityFileSystem.fileProviderStorageImageExists(metadata.ocId, etag: metadata.etag) {
utility.createImageFileFrom(metadata: metadata)
}

// LAYOUT PHOTO
if isLayoutPhoto {
if metadata.isImageOrVideo {
Expand Down
11 changes: 8 additions & 3 deletions iOSClient/Main/Collection Common/NCCollectionViewCommon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
var backgroundImageView = UIImageView()
var serverUrl: String = ""
var isEditMode = false
var isDirectoryEncrypted = false
var fileSelect: [String] = []
var metadataFolder: tableMetadata?
var richWorkspaceText: String?
Expand Down Expand Up @@ -825,7 +826,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS

NCKeychain().setPersonalFilesOnly(account: self.session.account, value: !personalFilesOnly)

self.reloadDataSource()
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource, userInfo: ["serverUrl": self.serverUrl, "clearDataSource": true])
self.setNavigationRightItems()
}

Expand All @@ -834,7 +835,7 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS

NCKeychain().showDescription = !showDescriptionKeychain

self.reloadDataSource()
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterReloadDataSource, userInfo: ["serverUrl": self.serverUrl, "clearDataSource": true])
self.setNavigationRightItems()
}
showDescription.subtitle = richWorkspaceText == nil ? NSLocalizedString("_no_description_available_", comment: "") : ""
Expand Down Expand Up @@ -1038,7 +1039,11 @@ class NCCollectionViewCommon: UIViewController, UIGestureRecognizerDelegate, UIS
// MARK: - DataSource

@objc func reloadDataSource() {
guard !session.account.isEmpty, !self.isSearchingMode else { return }
if isSearchingMode {
isDirectoryEncrypted = false
} else {
isDirectoryEncrypted = NCUtilityFileSystem().isDirectoryE2EE(session: session, serverUrl: serverUrl)
}

DispatchQueue.main.async {
UIView.transition(with: self.collectionView,
Expand Down
4 changes: 2 additions & 2 deletions iOSClient/Menu/AppDelegate+Menu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ extension AppDelegate {
actions.append(
NCMenuAction(title: titleCreateFolder,
icon: imageCreateFolder, action: { _ in
let alertController = UIAlertController.createFolder(serverUrl: serverUrl, account: session.account, sceneIdentifier: controller.sceneIdentifier)
let alertController = UIAlertController.createFolder(serverUrl: serverUrl, session: session, sceneIdentifier: controller.sceneIdentifier)
controller.present(alertController, animated: true, completion: nil)
}
)
Expand All @@ -117,7 +117,7 @@ extension AppDelegate {
NCMenuAction(title: NSLocalizedString("_create_folder_e2ee_", comment: ""),
icon: NCImageCache.shared.getFolderEncrypted(account: session.account),
action: { _ in
let alertController = UIAlertController.createFolder(serverUrl: serverUrl, account: session.account, markE2ee: true, sceneIdentifier: controller.sceneIdentifier)
let alertController = UIAlertController.createFolder(serverUrl: serverUrl, session: session, markE2ee: true, sceneIdentifier: controller.sceneIdentifier)
controller.present(alertController, animated: true, completion: nil)
})
)
Expand Down
2 changes: 1 addition & 1 deletion iOSClient/Select/NCSelect.swift
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class NCSelect: UIViewController, UIGestureRecognizerDelegate, UIAdaptivePresent
}

func createFolderButtonPressed(_ sender: UIButton) {
let alertController = UIAlertController.createFolder(serverUrl: serverUrl, account: session.account)
let alertController = UIAlertController.createFolder(serverUrl: serverUrl, session: session)
self.present(alertController, animated: true, completion: nil)
}

Expand Down
Binary file modified iOSClient/Supporting Files/ar.lproj/Localizable.strings
Binary file not shown.
Binary file modified iOSClient/Supporting Files/de.lproj/Localizable.strings
Binary file not shown.
Binary file modified iOSClient/Supporting Files/fr.lproj/Localizable.strings
Binary file not shown.
Binary file modified iOSClient/Supporting Files/gl.lproj/Localizable.strings
Binary file not shown.
Binary file modified iOSClient/Supporting Files/it.lproj/Localizable.strings
Binary file not shown.
Binary file modified iOSClient/Supporting Files/pl.lproj/Localizable.strings
Binary file not shown.
Binary file modified iOSClient/Supporting Files/sv.lproj/Localizable.strings
Binary file not shown.
Binary file not shown.
Binary file modified iOSClient/Supporting Files/zh_HK.lproj/Localizable.strings
Binary file not shown.

0 comments on commit ab8a66f

Please sign in to comment.