Skip to content

Commit

Permalink
Merge pull request #2254 from nextcloud/develop
Browse files Browse the repository at this point in the history
Version 4.5.5
  • Loading branch information
marinofaggiana authored Nov 11, 2022
2 parents 141fbcf + 61ec8d0 commit 7f4252f
Show file tree
Hide file tree
Showing 132 changed files with 294 additions and 225 deletions.
10 changes: 5 additions & 5 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3619,7 +3619,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 9;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand All @@ -3643,7 +3643,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 4.5.4;
MARKETING_VERSION = 4.5.5;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -3682,7 +3682,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 9;
CURRENT_PROJECT_VERSION = 2;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand All @@ -3704,7 +3704,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 4.5.4;
MARKETING_VERSION = 4.5.5;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -3912,7 +3912,7 @@
repositoryURL = "https://github.com/nextcloud/NextcloudKit";
requirement = {
kind = exactVersion;
version = 1.2.0;
version = 1.3.0;
};
};
F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */ = {
Expand Down
4 changes: 2 additions & 2 deletions Widget/Dashboard/DashboardData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis

let (tableDashboard, tableButton) = NCManageDatabase.shared.getDashboardWidget(account: account.account, id: id)
let existsButton = (tableButton?.isEmpty ?? true) ? false : true
let options = NKRequestOptions(timeout: 15, queue: NKCommon.shared.backgroundQueue)
let title = tableDashboard?.title ?? id

var imagetmp = UIImage(named: "widget")!
Expand All @@ -151,7 +150,8 @@ func getDashboardDataEntry(configuration: DashboardIntent?, isPreview: Bool, dis
}
}
let titleImage = imagetmp


let options = NKRequestOptions(timeout: 90, queue: NKCommon.shared.backgroundQueue)
NextcloudKit.shared.getDashboardWidgetsApplication(id, options: options) { _, results, data, error in

Task {
Expand Down
2 changes: 1 addition & 1 deletion Widget/Dashboard/DashboardWidgetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ struct DashboardWidgetView: View {
.background(brandColor)
.foregroundColor(brandTextColor)
.border(brandColor, width: 1)
.cornerRadius(16)
.cornerRadius(.infinity)
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions Widget/Files/FilesData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ func getFilesDataEntry(configuration: AccountIntent?, isPreview: Bool, displaySi
NKCommon.shared.writeLog("[INFO] Start \(NCBrandOptions.shared.brand) widget session with level \(levelLog) " + versionNextcloudiOS)
}

let options = NKRequestOptions(timeout: 15)
let options = NKRequestOptions(timeout: 90, queue: NKCommon.shared.backgroundQueue)
NextcloudKit.shared.searchBodyRequest(serverUrl: account.urlBase, requestBody: requestBody, showHiddenFiles: CCUtility.getShowHiddenFiles(), options: options) { _, files, data, error in
Task {
var datas: [FilesData] = []
Expand Down Expand Up @@ -230,7 +230,7 @@ func getFilesDataEntry(configuration: AccountIntent?, isPreview: Bool, displaySi
let fileNamePathOrFileId = CCUtility.returnFileNamePath(fromFileName: file.fileName, serverUrl: file.serverUrl, urlBase: file.urlBase, userId: file.userId, account: account.account)!
let fileNamePreviewLocalPath = CCUtility.getDirectoryProviderStoragePreviewOcId(file.ocId, etag: file.etag)!
let fileNameIconLocalPath = CCUtility.getDirectoryProviderStorageIconOcId(file.ocId, etag: file.etag)!
let (_, _, imageIcon, _, _, _) = await NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: fileNamePathOrFileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: NCGlobal.shared.sizePreview, heightPreview: NCGlobal.shared.sizePreview, fileNameIconLocalPath: fileNameIconLocalPath, sizeIcon: NCGlobal.shared.sizeIcon)
let (_, _, imageIcon, _, _, _) = await NextcloudKit.shared.downloadPreview(fileNamePathOrFileId: fileNamePathOrFileId, fileNamePreviewLocalPath: fileNamePreviewLocalPath, widthPreview: NCGlobal.shared.sizePreview, heightPreview: NCGlobal.shared.sizePreview, fileNameIconLocalPath: fileNameIconLocalPath, sizeIcon: NCGlobal.shared.sizeIcon, options: options)
if let image = imageIcon {
imageRecent = image
}
Expand Down
2 changes: 1 addition & 1 deletion Widget/Lockscreen/LockscreenData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func getLockscreenDataEntry(configuration: AccountIntent?, isPreview: Bool, fami

var account: tableAccount?
var quotaRelative: Float = 0
let options = NKRequestOptions(timeout: 15, queue: NKCommon.shared.backgroundQueue)

if isPreview {
return completion(LockscreenData(date: Date(), isPlaceholder: true, activity: "", link: URL(string: "https://")!, quotaRelative: 0, quotaUsed: "", quotaTotal: "", error: false))
Expand Down Expand Up @@ -73,6 +72,7 @@ func getLockscreenDataEntry(configuration: AccountIntent?, isPreview: Bool, fami
nextcloudVersion: 0,
delegate: NCNetworking.shared)

let options = NKRequestOptions(timeout: 90, queue: NKCommon.shared.backgroundQueue)
if #available(iOSApplicationExtension 16.0, *) {
if family == .accessoryCircular {
NextcloudKit.shared.getUserProfile(options: options) { _, userProfile, _, error in
Expand Down
11 changes: 8 additions & 3 deletions Widget/Lockscreen/LockscreenWidgetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,13 @@ struct LockscreenWidgetView: View {
} else {
Gauge(
value: entry.quotaRelative,
label: { Text(" " + entry.quotaTotal + " ") },
currentValueLabel: { Text(entry.quotaUsed) }
label: {
Text(" " + entry.quotaTotal + " ")
.font(.system(size: 8.0))
},
currentValueLabel: {
Text(entry.quotaUsed)
}
)
.gaugeStyle(.accessoryCircular)
.redacted(reason: entry.isPlaceholder ? .placeholder : [])
Expand Down Expand Up @@ -88,7 +93,7 @@ struct LockscreenWidgetView: View {
@available(iOSApplicationExtension 16.0, *)
struct LockscreenWidgetView_Previews: PreviewProvider {
static var previews: some View {
let entry = LockscreenData(date: Date(), isPlaceholder: false, activity: "Alba Mayoral changed Marketing / Regional Marketing / Agenda Meetings / Q4 2022 / OCTOBER / 13.11 Afrah Kahlid.md", link: URL(string: "https://")!, quotaRelative: 0.5, quotaUsed: "22 GB", quotaTotal: "50 GB", error: true)
let entry = LockscreenData(date: Date(), isPlaceholder: false, activity: "Alba Mayoral changed Marketing / Regional Marketing / Agenda Meetings / Q4 2022 / OCTOBER / 13.11 Afrah Kahlid.md", link: URL(string: "https://")!, quotaRelative: 0.5, quotaUsed: "999 GB", quotaTotal: "999 GB", error: false)
LockscreenWidgetView(entry: entry).previewContext(WidgetPreviewContext(family: .accessoryRectangular)).previewDisplayName("Rectangular")
LockscreenWidgetView(entry: entry).previewContext(WidgetPreviewContext(family: .accessoryCircular)).previewDisplayName("Circular")
}
Expand Down
20 changes: 10 additions & 10 deletions iOSClient/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,13 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
@objc var activeViewController: UIViewController?
var mainTabBar: NCMainTabBar?
var activeMetadata: tableMetadata?
var isSearchingMode: Bool = false

let listFilesVC = ThreadSafeDictionary<String,NCFiles>()
let listFavoriteVC = ThreadSafeDictionary<String,NCFavorite>()
let listOfflineVC = ThreadSafeDictionary<String,NCOffline>()

var disableSharesView: Bool = false
var documentPickerViewController: NCDocumentPickerViewController?
var shares: [tableShare] = []
var timerErrorNetworking: Timer?

private var privacyProtectionWindow: UIWindow?
Expand Down Expand Up @@ -190,6 +188,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD

NKCommon.shared.writeLog("[INFO] Application did become active")

// START OBSERVE/TIMER UPLOAD PROCESS
NCNetworkingProcessUpload.shared.observeTableMetadata()
NCNetworkingProcessUpload.shared.startTimer()

self.deletePasswordSession = false

if !NCAskAuthorization.shared.isRequesting {
Expand All @@ -207,9 +209,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
NKCommon.shared.writeLog("[INFO] Initialize Auto upload with \(items) uploads")
}

// START UPLOAD PROCESS
NCNetworkingProcessUpload.shared.startTimer()

NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterApplicationDidBecomeActive)
}

Expand Down Expand Up @@ -244,14 +243,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD

NKCommon.shared.writeLog("[INFO] Application will resign active")

// STOP OBSERVE/TIMER UPLOAD PROCESS
NCNetworkingProcessUpload.shared.invalidateObserveTableMetadata()
NCNetworkingProcessUpload.shared.stopTimer()

if CCUtility.getPrivacyScreenEnabled() {
// Privacy
showPrivacyProtectionWindow()
}

// STOP UPLOAD PROCESS
NCNetworkingProcessUpload.shared.stopTimer()

// Reload Widget
WidgetCenter.shared.reloadAllTimelines()

Expand Down Expand Up @@ -372,7 +372,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD

NCAutoUpload.shared.initAutoUpload(viewController: nil) { items in
NKCommon.shared.writeLog("[INFO] Refresh task auto upload with \(items) uploads")
NCNetworkingProcessUpload.shared.process { items in
NCNetworkingProcessUpload.shared.start { items in
NKCommon.shared.writeLog("[INFO] Refresh task upload process with \(items) uploads")
task.setTaskCompleted(success: true)
}
Expand Down Expand Up @@ -865,7 +865,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD

else if scheme == "nextcloud" && action == "open-file" {

if !isSearchingMode, let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) {
if let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false) {

let queryItems = urlComponents.queryItems
guard let userScheme = CCUtility.value(forKey: "user", fromQueryItems: queryItems) else { return false }
Expand Down
10 changes: 6 additions & 4 deletions iOSClient/BrowserWeb/NCBrowserWeb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,12 @@ class NCBrowserWeb: UIViewController {
extension NCBrowserWeb: WKNavigationDelegate {

public func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
if let serverTrust = challenge.protectionSpace.serverTrust {
completionHandler(Foundation.URLSession.AuthChallengeDisposition.useCredential, URLCredential(trust: serverTrust))
} else {
completionHandler(URLSession.AuthChallengeDisposition.useCredential, nil)
DispatchQueue.global().async {
if let serverTrust = challenge.protectionSpace.serverTrust {
completionHandler(Foundation.URLSession.AuthChallengeDisposition.useCredential, URLCredential(trust: serverTrust))
} else {
completionHandler(URLSession.AuthChallengeDisposition.useCredential, nil)
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion iOSClient/Data/NCElementsJSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,13 @@ import UIKit

@objc public let capabilitiesFileSharingApiEnabled: Array = ["ocs", "data", "capabilities", "files_sharing", "api_enabled"]
@objc public let capabilitiesFileSharingPubPasswdEnforced: Array = ["ocs", "data", "capabilities", "files_sharing", "public", "password", "enforced"]
@objc public let capabilitiesFileSharingPubExpireDateEnforced: Array = ["ocs", "data", "capabilities", "files_sharing", "public", "expire_date", "enforced"]
@objc public let capabilitiesFileSharingPubExpireDateDays: Array = ["ocs", "data", "capabilities", "files_sharing", "public", "expire_date", "days"]
@objc public let capabilitiesFileSharingInternalExpireDateEnforced: Array = ["ocs", "data", "capabilities", "files_sharing", "public", "expire_date_internal", "enforced"]
@objc public let capabilitiesFileSharingInternalExpireDateDays: Array = ["ocs", "data", "capabilities", "files_sharing", "public", "expire_date_internal", "days"]
@objc public let capabilitiesFileSharingRemoteExpireDateEnforced: Array = ["ocs", "data", "capabilities", "files_sharing", "public", "expire_date_remote", "enforced"]
@objc public let capabilitiesFileSharingRemoteExpireDateDays: Array = ["ocs", "data", "capabilities", "files_sharing", "public", "expire_date_remote", "days"]
@objc public let capabilitiesFileSharingDefaultPermissions: Array = ["ocs", "data", "capabilities", "files_sharing", "default_permissions"]
// NC >= 23
@objc public let capabilitiesFileSharingSendPasswordMail: Array = ["ocs", "data", "capabilities", "files_sharing", "sharebymail", "send_password_by_mail"]

@objc public let capabilitiesThemingColor: Array = ["ocs", "data", "capabilities", "theming", "color"]
Expand Down
4 changes: 0 additions & 4 deletions iOSClient/Data/NCManageDatabase+Account.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ import NextcloudKit

extension NCManageDatabase {

@objc func copyObject(account: tableAccount) -> tableAccount {
return tableAccount.init(value: account)
}

@objc func addAccount(_ account: String, urlBase: String, user: String, password: String) {

let realm = try! Realm()
Expand Down
16 changes: 0 additions & 16 deletions iOSClient/Data/NCManageDatabase+Metadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -285,22 +285,6 @@ extension NCManageDatabase {
}
}

@objc func addMetadataServerUrl(ocId: String, serverUrl: String) {

let realm = try! Realm()

do {
try realm.write {
let results = realm.objects(tableMetadata.self).filter("ocId == %@", ocId)
for result in results {
result.serverUrl = serverUrl
}
}
} catch let error {
NKCommon.shared.writeLog("Could not write to database: \(error)")
}
}

@objc func renameMetadata(fileNameTo: String, ocId: String) {

let realm = try! Realm()
Expand Down
8 changes: 0 additions & 8 deletions iOSClient/Data/NCManageDatabase.swift
Original file line number Diff line number Diff line change
Expand Up @@ -641,10 +641,6 @@ class NCManageDatabase: NSObject {
// MARK: -
// MARK: Table Directory

@objc func copyObject(directory: tableDirectory) -> tableDirectory {
return tableDirectory.init(value: directory)
}

@objc func addDirectory(encrypted: Bool, favorite: Bool, ocId: String, fileId: String, etag: String? = nil, permissions: String? = nil, serverUrl: String, account: String) {

let realm = try! Realm()
Expand Down Expand Up @@ -1078,10 +1074,6 @@ class NCManageDatabase: NSObject {
// MARK: -
// MARK: Table LocalFile

@objc func copyObject(localFile: tableLocalFile) -> tableLocalFile {
return tableLocalFile.init(value: localFile)
}

func addLocalFile(metadata: tableMetadata) {

let realm = try! Realm()
Expand Down
4 changes: 2 additions & 2 deletions iOSClient/Files/NCFiles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class NCFiles: NCCollectionViewCommon {

DispatchQueue.main.async { self.refreshControl.endRefreshing() }
DispatchQueue.global().async {
guard !self.appDelegate.isSearchingMode, !self.appDelegate.account.isEmpty, !self.appDelegate.urlBase.isEmpty, !self.serverUrl.isEmpty else { return }
guard !self.isSearchingMode, !self.appDelegate.account.isEmpty, !self.appDelegate.urlBase.isEmpty, !self.serverUrl.isEmpty else { return }

let metadatas = NCManageDatabase.shared.getMetadatas(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@", self.appDelegate.account, self.serverUrl))
if self.metadataFolder == nil {
Expand Down Expand Up @@ -136,7 +136,7 @@ class NCFiles: NCCollectionViewCommon {

override func reloadDataSourceNetwork(forced: Bool = false) {
super.reloadDataSourceNetwork(forced: forced)
guard !appDelegate.isSearchingMode else {
guard !isSearchingMode else {
networkSearch()
return
}
Expand Down
10 changes: 6 additions & 4 deletions iOSClient/Login/NCLoginWeb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -259,10 +259,12 @@ extension NCLoginWeb: WKNavigationDelegate {
}

func webView(_ webView: WKWebView, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) {
if let serverTrust = challenge.protectionSpace.serverTrust {
completionHandler(Foundation.URLSession.AuthChallengeDisposition.useCredential, URLCredential(trust: serverTrust))
} else {
completionHandler(URLSession.AuthChallengeDisposition.useCredential, nil)
DispatchQueue.global().async {
if let serverTrust = challenge.protectionSpace.serverTrust {
completionHandler(Foundation.URLSession.AuthChallengeDisposition.useCredential, URLCredential(trust: serverTrust))
} else {
completionHandler(URLSession.AuthChallengeDisposition.useCredential, nil)
}
}
}

Expand Down
Loading

0 comments on commit 7f4252f

Please sign in to comment.