Skip to content

Commit

Permalink
Version 6.2.4 (#3290)
Browse files Browse the repository at this point in the history
  • Loading branch information
marinofaggiana authored Jan 30, 2025
1 parent fe920b4 commit a4d6eb9
Show file tree
Hide file tree
Showing 168 changed files with 1,267 additions and 938 deletions.
2 changes: 1 addition & 1 deletion Brand/Database.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ import Foundation
// Database Realm
//
let databaseName = "nextcloud.realm"
let databaseSchemaVersion: UInt64 = 370
let databaseSchemaVersion: UInt64 = 371
13 changes: 7 additions & 6 deletions Brand/NCBrand.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ let userAgent: String = {
var pushNotificationServerProxy: String = "https://push-notifications.nextcloud.com"
var linkLoginHost: String = "https://nextcloud.com/install"
var linkloginPreferredProviders: String = "https://nextcloud.com/signup-ios"
var webLoginAutenticationProtocol: String = "nc://" // example "abc://"
var webLoginAutenticationProtocol: String = "nc://" // example "abc://"
var privacy: String = "https://nextcloud.com/privacy"
var sourceCode: String = "https://github.com/nextcloud/ios"
var mobileconfig: String = "/remote.php/dav/provisioning/apple-provisioning.mobileconfig"
Expand All @@ -65,7 +65,7 @@ let userAgent: String = {
var disable_request_login_url: Bool = false
var disable_multiaccount: Bool = false
var disable_more_external_site: Bool = false
var disable_openin_file: Bool = false // Don't touch me !!
var disable_openin_file: Bool = false // Don't touch me !!
var disable_crash_service: Bool = false
var disable_log: Bool = false
var disable_mobileconfig: Bool = false
Expand All @@ -79,11 +79,12 @@ let userAgent: String = {
var enforce_servers: [(name: String, url: String)] = []

// Internal option behaviour
var cleanUpDay: Int = 0 // Set default "Delete all cached files older than" possible days value are: 0, 1, 7, 30, 90, 180, 365
var cleanUpDay: Int = 0 // Set default "Delete all cached files older than" possible days value are: 0, 1, 7, 30, 90, 180, 365

// Max download/upload concurrent
let maxConcurrentOperationDownload: Int = 5
let maxConcurrentOperationUpload: Int = 5
// Max request/download/upload concurrent
let httpMaximumConnectionsPerHost: Int = 6
let httpMaximumConnectionsPerHostInDownload: Int = 6
let httpMaximumConnectionsPerHostInUpload: Int = 6

// Number of failed attempts after reset app
let resetAppPasscodeAttempts: Int = 10
Expand Down
3 changes: 3 additions & 0 deletions File Provider Extension/FileProviderData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ class fileProviderData: NSObject {
password: NCKeychain().getPassword(account: tblAccount.account),
userAgent: userAgent,
nextcloudVersion: NCCapabilities.shared.getCapabilities(account: tblAccount.account).capabilityServerVersionMajor,
httpMaximumConnectionsPerHost: NCBrandOptions.shared.httpMaximumConnectionsPerHost,
httpMaximumConnectionsPerHostInDownload: NCBrandOptions.shared.httpMaximumConnectionsPerHostInDownload,
httpMaximumConnectionsPerHostInUpload: NCBrandOptions.shared.httpMaximumConnectionsPerHostInUpload,
groupIdentifier: NCBrandOptions.shared.capabilitiesGroup)
NCNetworking.shared.delegate = providerExtension as? NCNetworkingDelegate

Expand Down
43 changes: 38 additions & 5 deletions Nextcloud.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions Share/NCShareExtension+Files.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,10 @@ 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: layoutForView)
let directoryOnTop = NCKeychain().getDirectoryOnTop(account: session.account)
let metadatas = self.database.getResultsMetadatasPredicate(predicate, layoutForView: layoutForView, directoryOnTop: directoryOnTop)

self.dataSource = NCCollectionViewDataSource(metadatas: metadatas)
self.dataSource = NCCollectionViewDataSource(metadatas: metadatas, directoryOnTop: directoryOnTop)

if withLoadFolder {
loadFolder()
Expand Down
3 changes: 3 additions & 0 deletions Share/NCShareExtension+NCAccountRequestDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ extension NCShareExtension: NCAccountRequestDelegate {
password: NCKeychain().getPassword(account: tableAccount.account),
userAgent: userAgent,
nextcloudVersion: capabilities.capabilityServerVersionMajor,
httpMaximumConnectionsPerHost: NCBrandOptions.shared.httpMaximumConnectionsPerHost,
httpMaximumConnectionsPerHostInDownload: NCBrandOptions.shared.httpMaximumConnectionsPerHostInDownload,
httpMaximumConnectionsPerHostInUpload: NCBrandOptions.shared.httpMaximumConnectionsPerHostInUpload,
groupIdentifier: NCBrandOptions.shared.capabilitiesGroup)

// SESSION
Expand Down
3 changes: 3 additions & 0 deletions Widget/Dashboard/DashboardData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
password: password,
userAgent: userAgent,
nextcloudVersion: capabilities.capabilityServerVersionMajor,
httpMaximumConnectionsPerHost: NCBrandOptions.shared.httpMaximumConnectionsPerHost,
httpMaximumConnectionsPerHostInDownload: NCBrandOptions.shared.httpMaximumConnectionsPerHostInDownload,
httpMaximumConnectionsPerHostInUpload: NCBrandOptions.shared.httpMaximumConnectionsPerHostInUpload,
groupIdentifier: NCBrandOptions.shared.capabilitiesGroup)

// LOG
Expand Down
3 changes: 3 additions & 0 deletions Widget/Files/FilesData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ func getFilesDataEntry(configuration: AccountIntent?, isPreview: Bool, displaySi
password: password,
userAgent: userAgent,
nextcloudVersion: NCCapabilities.shared.getCapabilities(account: activeTableAccount.account).capabilityServerVersionMajor,
httpMaximumConnectionsPerHost: NCBrandOptions.shared.httpMaximumConnectionsPerHost,
httpMaximumConnectionsPerHostInDownload: NCBrandOptions.shared.httpMaximumConnectionsPerHostInDownload,
httpMaximumConnectionsPerHostInUpload: NCBrandOptions.shared.httpMaximumConnectionsPerHostInUpload,
groupIdentifier: NCBrandOptions.shared.capabilitiesGroup)

let requestBodyRecent =
Expand Down
18 changes: 18 additions & 0 deletions Widget/Intent/el.lproj/Intent.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"13zjVT" = "Account";

"CAIVXf" = "Applications";

"DN8Bxl" = "Account";

"LIw8E9" = "Widget";

"NO1rJU" = "Dashboard";

"V3exc2" = "Account";

"VfbA9C" = "Account";

"ZgvlYN" = "Dashboard Widget";

"tAlZ1R" = "Accounts";

3 changes: 3 additions & 0 deletions Widget/Lockscreen/LockscreenData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ func getLockscreenDataEntry(configuration: AccountIntent?, isPreview: Bool, fami
password: password,
userAgent: userAgent,
nextcloudVersion: capabilities.capabilityServerVersionMajor,
httpMaximumConnectionsPerHost: NCBrandOptions.shared.httpMaximumConnectionsPerHost,
httpMaximumConnectionsPerHostInDownload: NCBrandOptions.shared.httpMaximumConnectionsPerHostInDownload,
httpMaximumConnectionsPerHostInUpload: NCBrandOptions.shared.httpMaximumConnectionsPerHostInUpload,
groupIdentifier: NCBrandOptions.shared.capabilitiesGroup)

let options = NKRequestOptions(timeout: 90, queue: NextcloudKit.shared.nkCommonInstance.backgroundQueue)
Expand Down
3 changes: 1 addition & 2 deletions iOSClient/Data/NCManageDatabase+Capabilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,7 @@ extension NCManageDatabase {
capabilities.capabilityForbiddenFileNameCharacters = data.capabilities.files?.forbiddenFileNameCharacters ?? []
capabilities.capabilityForbiddenFileNameExtensions = data.capabilities.files?.forbiddenFileNameExtensions ?? []

// TODO: not yet available (IN TEST)
// capabilities.capabilityRecommendations = data.capabilities.recommendations?.enabled ?? false
capabilities.capabilityRecommendations = data.capabilities.recommendations?.enabled ?? false

NCCapabilities.shared.appendCapabilities(account: account, capabilities: capabilities)

Expand Down
5 changes: 0 additions & 5 deletions iOSClient/Data/NCManageDatabase+LayoutForView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ class NCDBLayoutForView: Object {
@Persisted var sort: String = "fileName"
@Persisted var ascending: Bool = true
@Persisted var groupBy: String = "none"
@Persisted var directoryOnTop: Bool = true
@Persisted var titleButtonHeader: String = "_sorted_by_name_a_z_"
@Persisted var columnGrid: Int = 3
@Persisted var columnPhoto: Int = 3
Expand All @@ -49,7 +48,6 @@ extension NCManageDatabase {
sort: String? = nil,
ascending: Bool? = nil,
groupBy: String? = nil,
directoryOnTop: Bool? = nil,
titleButtonHeader: String? = nil,
columnGrid: Int? = nil,
columnPhoto: Int? = nil) -> NCDBLayoutForView? {
Expand Down Expand Up @@ -83,9 +81,6 @@ extension NCManageDatabase {
if let groupBy {
addObject.groupBy = groupBy
}
if let directoryOnTop {
addObject.directoryOnTop = directoryOnTop
}
if let titleButtonHeader {
addObject.titleButtonHeader = titleButtonHeader
}
Expand Down
6 changes: 3 additions & 3 deletions iOSClient/Data/NCManageDatabase+Metadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@ extension NCManageDatabase {

// MARK: - GetResult(s)Metadata

func getResultsMetadatasPredicate(_ predicate: NSPredicate, layoutForView: NCDBLayoutForView?) -> [tableMetadata] {
func getResultsMetadatasPredicate(_ predicate: NSPredicate, layoutForView: NCDBLayoutForView?, directoryOnTop: Bool) -> [tableMetadata] {
do {
let realm = try Realm()
var results = realm.objects(tableMetadata.self).filter(predicate).freeze()
Expand All @@ -1064,7 +1064,7 @@ extension NCManageDatabase {
// 1. favorite order
if $0.favorite == $1.favorite {
// 2. directory order TOP
if layout.directoryOnTop {
if directoryOnTop {
if $0.directory == $1.directory {
// 3. natural fileName
return $0.fileNameView.localizedStandardCompare($1.fileNameView) == ordered
Expand All @@ -1080,7 +1080,7 @@ extension NCManageDatabase {
}
return sortedResults
} else {
if layout.directoryOnTop {
if 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)
Expand Down
14 changes: 13 additions & 1 deletion iOSClient/Data/NCManageDatabase+RecommendedFiles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ extension NCManageDatabase {
func getRecommendedFiles(account: String) -> [tableRecommendedFiles] {
do {
let realm = try Realm()
let results = realm.objects(tableRecommendedFiles.self).filter("account == %@", account)
let results = realm.objects(tableRecommendedFiles.self).filter("account == %@", account).sorted(byKeyPath: "timestamp", ascending: false)

return Array(results.map { tableRecommendedFiles.init(value: $0) })
} catch let error {
Expand All @@ -68,4 +68,16 @@ extension NCManageDatabase {

return []
}

func deleteAllRecommendedFiles(account: String) {
do {
let realm = try Realm()

try realm.write {
realm.delete(realm.objects(tableRecommendedFiles.self).filter("account == %@", account))
}
} catch let error {
NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)")
}
}
}
5 changes: 3 additions & 2 deletions iOSClient/Favorites/NCFavorite.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ class NCFavorite: NCCollectionViewCommon {

override func reloadDataSource() {
var predicate = self.defaultPredicate
let directoryOnTop = NCKeychain().getDirectoryOnTop(account: session.account)

if self.serverUrl.isEmpty {
predicate = NSPredicate(format: "account == %@ AND favorite == true AND NOT (status IN %@)", session.account, global.metadataStatusHideInView)
}

let metadatas = self.database.getResultsMetadatasPredicate(predicate, layoutForView: layoutForView)
let metadatas = self.database.getResultsMetadatasPredicate(predicate, layoutForView: layoutForView, directoryOnTop: directoryOnTop)

self.dataSource = NCCollectionViewDataSource(metadatas: metadatas, layoutForView: layoutForView)
self.dataSource = NCCollectionViewDataSource(metadatas: metadatas, layoutForView: layoutForView, directoryOnTop: directoryOnTop)

super.reloadDataSource()
}
Expand Down
61 changes: 61 additions & 0 deletions iOSClient/Favorites/NCFavoriteNavigationController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2025 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later

import UIKit

class NCFavoriteNavigationController: NCMainNavigationController {
override func setNavigationRightItems() {
guard let collectionViewCommon else {
return
}

func createMenu() -> UIMenu? {
guard let items = self.createMenuActions()
else {
return nil
}

if collectionViewCommon.layoutKey == global.layoutViewFavorite {
return UIMenu(children: [items.select, items.viewStyleSubmenu, items.sortSubmenu])
} else {
let additionalSubmenu = UIMenu(title: "", options: .displayInline, children: [items.foldersOnTop, items.personalFilesOnlyAction, items.showDescription])
return UIMenu(children: [items.select, items.viewStyleSubmenu, items.sortSubmenu, additionalSubmenu])
}
}

if collectionViewCommon.isEditMode {
collectionViewCommon.tabBarSelect?.update(fileSelect: collectionViewCommon.fileSelect, metadatas: collectionViewCommon.getSelectedMetadatas(), userId: session.userId)
collectionViewCommon.tabBarSelect?.show()

let select = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: .done) {
collectionViewCommon.setEditMode(false)
collectionViewCommon.collectionView.reloadData()
}

self.collectionViewCommon?.navigationItem.rightBarButtonItems = [select]

} else if self.collectionViewCommon?.navigationItem.rightBarButtonItems == nil || (!collectionViewCommon.isEditMode && !(collectionViewCommon.tabBarSelect?.isHidden() ?? true)) {
collectionViewCommon.tabBarSelect?.hide()

let menuButton = UIBarButtonItem(image: utility.loadImage(named: "ellipsis.circle"), menu: createMenu())
menuButton.tag = menuButtonTag
menuButton.tintColor = NCBrandColor.shared.iconImageColor

self.collectionViewCommon?.navigationItem.rightBarButtonItems = [menuButton]

} else {

if let rightBarButtonItems = self.collectionViewCommon?.navigationItem.rightBarButtonItems,
let menuBarButtonItem = rightBarButtonItems.first(where: { $0.tag == menuButtonTag }) {
menuBarButtonItem.menu = createMenu()
}
}

// fix, if the tabbar was hidden before the update, set it in hidden
if self.tabBarController?.tabBar.isHidden ?? true,
collectionViewCommon.tabBarSelect?.isHidden() ?? true {
self.tabBarController?.tabBar.isHidden = true
}
}
}
Loading

0 comments on commit a4d6eb9

Please sign in to comment.