Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@
F7245926289BB59300474787 /* ThreadSafeDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7245923289BB50B00474787 /* ThreadSafeDictionary.swift */; };
F7245927289BB59300474787 /* ThreadSafeDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7245923289BB50B00474787 /* ThreadSafeDictionary.swift */; };
F72685E727C78E490019EF5E /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F72685E927C78E490019EF5E /* InfoPlist.strings */; };
F72944F22A84246400246839 /* NCEndToEndMetadataV20.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72944F12A84246400246839 /* NCEndToEndMetadataV20.swift */; };
F72944F32A84246400246839 /* NCEndToEndMetadataV20.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72944F12A84246400246839 /* NCEndToEndMetadataV20.swift */; };
F72944F22A84246400246839 /* NCEndToEndMetadataV2.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72944F12A84246400246839 /* NCEndToEndMetadataV2.swift */; };
F72944F32A84246400246839 /* NCEndToEndMetadataV2.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72944F12A84246400246839 /* NCEndToEndMetadataV2.swift */; };
F72944F52A8424F800246839 /* NCEndToEndMetadataV1.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72944F42A8424F800246839 /* NCEndToEndMetadataV1.swift */; };
F72944F62A8424F800246839 /* NCEndToEndMetadataV1.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72944F42A8424F800246839 /* NCEndToEndMetadataV1.swift */; };
F72A17D828B221E300F3F159 /* DashboardWidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F72A17D728B221E300F3F159 /* DashboardWidgetView.swift */; };
Expand Down Expand Up @@ -1361,7 +1361,7 @@
F724377A2C10B83E00C7C68D /* NCSharePermissions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCSharePermissions.swift; sourceTree = "<group>"; };
F7245923289BB50B00474787 /* ThreadSafeDictionary.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ThreadSafeDictionary.swift; sourceTree = "<group>"; };
F72685E827C78E490019EF5E /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
F72944F12A84246400246839 /* NCEndToEndMetadataV20.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCEndToEndMetadataV20.swift; sourceTree = "<group>"; };
F72944F12A84246400246839 /* NCEndToEndMetadataV2.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCEndToEndMetadataV2.swift; sourceTree = "<group>"; };
F72944F42A8424F800246839 /* NCEndToEndMetadataV1.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCEndToEndMetadataV1.swift; sourceTree = "<group>"; };
F72A17D728B221E300F3F159 /* DashboardWidgetView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DashboardWidgetView.swift; sourceTree = "<group>"; };
F72CA0562F5048C3002E2F06 /* UIApplication+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIApplication+Extension.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3025,7 +3025,7 @@
F70CAE381F8CF31A008125FD /* NCEndToEndEncryption.h */,
F70CAE391F8CF31A008125FD /* NCEndToEndEncryption.m */,
F7F878AD1FB9E3B900599E4F /* NCEndToEndMetadata.swift */,
F72944F12A84246400246839 /* NCEndToEndMetadataV20.swift */,
F72944F12A84246400246839 /* NCEndToEndMetadataV2.swift */,
F72944F42A8424F800246839 /* NCEndToEndMetadataV1.swift */,
F785EE9C246196DF00B3F945 /* NCNetworkingE2EE.swift */,
F7C30DF9291BCF790017149B /* NCNetworkingE2EECreateFolder.swift */,
Expand Down Expand Up @@ -4324,7 +4324,7 @@
F7148041262EBE4000693E51 /* NCShareExtension.swift in Sources */,
F71FA7992F3508C600E86192 /* NCNetworking+WebDAV.swift in Sources */,
F76B3CCF1EAE01BD00921AC9 /* NCBrand.swift in Sources */,
F72944F32A84246400246839 /* NCEndToEndMetadataV20.swift in Sources */,
F72944F32A84246400246839 /* NCEndToEndMetadataV2.swift in Sources */,
F7BAADCC1ED5A87C00B7EAD4 /* NCManageDatabase.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -4633,7 +4633,7 @@
F3DDFE232F1FB4C300A784C8 /* NCAssistantChatModel.swift in Sources */,
F7501C332212E57500FB1415 /* NCMedia.swift in Sources */,
F7411C552D7B26D700F57358 /* NCNetworking+ServerError.swift in Sources */,
F72944F22A84246400246839 /* NCEndToEndMetadataV20.swift in Sources */,
F72944F22A84246400246839 /* NCEndToEndMetadataV2.swift in Sources */,
F78026122E9CFA6300B63436 /* NCTransfersModel.swift in Sources */,
F7EF2AEB2E43157B0081B2C9 /* NCNotification.swift in Sources */,
F70BFC7420E0FA7D00C67599 /* NCUtility.swift in Sources */,
Expand Down
8 changes: 8 additions & 0 deletions iOSClient/Data/NCManageDatabase+LocalFile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,14 @@ extension NCManageDatabase {
}
}

func deleteLocalFileAsync(predicate: NSPredicate) async {
await core.performRealmWriteAsync { realm in
let result = realm.objects(tableLocalFile.self)
.filter(predicate)
realm.delete(result)
}
}

func deleteLocalFileAsync(id: String?) async {
guard let id else { return }

Expand Down
4 changes: 2 additions & 2 deletions iOSClient/Extensions/UIAlertController+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ extension UIAlertController {
}
}
if createFolderResults.error == .success {
let error = await NCNetworkingE2EEMarkFolder().markFolderE2ee(account: session.account, serverUrlFileName: serverUrlFileName, userId: session.userId)
let error = await NCNetworkingE2EEMarkFolder().markFolderE2ee(account: session.account, serverUrlFileName: serverUrlFileName, userId: session.userId, sceneIdentifier: sceneIdentifier)
if let banner, let token {
if error == .success {
completeHudIndeterminateBannerSuccess(token: token, banner: banner)
Expand All @@ -80,7 +80,7 @@ extension UIAlertController {
}
completion?(error)
} else {
if let banner, let token {
if let banner {
banner.dismiss()
}
completion?(NKError(errorCode: createFolderResults.error.errorCode, errorDescription: createFolderResults.error.errorDescription))
Expand Down
2 changes: 1 addition & 1 deletion iOSClient/Files/NCFiles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ class NCFiles: NCCollectionViewCommon {

if error == .success {
let capabilities = await NKCapabilities.shared.getCapabilities(for: self.session.account)
if version == "v1", NCGlobal.shared.isE2eeVersion2(capabilities.e2EEApiVersion) {
if version == "v1", capabilities.e2EEApiVersion.hasPrefix("2.") {
await showInfoBanner(windowScene: windowScene, text: "Conversion metadata v1 to v2 required, please wait...")
nkLog(tag: self.global.logTagE2EE, message: "Conversion v1 to v2")
NCActivityIndicator.shared.start()
Expand Down
2 changes: 1 addition & 1 deletion iOSClient/GUI/Lucid Banner/AlertActionBannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ struct AlertActionBannerView: View {
// Title
if let title = state.payload.title, !title.isEmpty {
Text(title)
.cappedFont(.title3, maxDynamicType: .accessibility2)
.cappedFont(.headline, maxDynamicType: .accessibility2)
.fontWeight(.semibold)
.foregroundStyle(state.payload.textColor)
.multilineTextAlignment(.center)
Expand Down
2 changes: 1 addition & 1 deletion iOSClient/GUI/Lucid Banner/ErrorBannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct ErrorBannerView: View {
VStack(alignment: .leading, spacing: 7) {
if showTitle, let title = state.payload.title {
Text(title)
.cappedFont(.title3, maxDynamicType: .accessibility2)
.cappedFont(.headline, maxDynamicType: .accessibility2)
.fontWeight(.semibold)
.multilineTextAlignment(.leading)
.truncationMode(.tail)
Expand Down
2 changes: 1 addition & 1 deletion iOSClient/GUI/Lucid Banner/HudBannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ struct HudBannerView: View {
// TITLE
if let title = state.payload.title, !title.isEmpty {
Text(title)
.cappedFont(.title3, maxDynamicType: .accessibility2)
.cappedFont(.headline, maxDynamicType: .accessibility2)
.fontWeight(.semibold)
.foregroundStyle(textColor)
.multilineTextAlignment(.center)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ struct HudBannerViewIndeterminate: View {
// TITLE
if let title = state.payload.title, !title.isEmpty {
Text(title)
.cappedFont(.title3, maxDynamicType: .accessibility2)
.cappedFont(.headline, maxDynamicType: .accessibility2)
.fontWeight(.semibold)
.foregroundStyle(textColor)
.multilineTextAlignment(.center)
Expand Down
2 changes: 1 addition & 1 deletion iOSClient/GUI/Lucid Banner/InfoBannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ struct InfoBannerView: View {
VStack(alignment: .leading, spacing: 7) {
if showTitle, let title = state.payload.title {
Text(title)
.cappedFont(.title3, maxDynamicType: .accessibility2)
.cappedFont(.headline, maxDynamicType: .accessibility2)
.fontWeight(.semibold)
.multilineTextAlignment(.leading)
.truncationMode(.tail)
Expand Down
3 changes: 1 addition & 2 deletions iOSClient/GUI/Lucid Banner/ShowBanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ struct BannerView: View {
VStack(alignment: .leading, spacing: 7) {
if showTitle, let title = state.payload.title {
Text(title)
.cappedFont(.title3, maxDynamicType: .accessibility2)
.cappedFont(.headline, maxDynamicType: .accessibility2)
.fontWeight(.semibold)
.multilineTextAlignment(.leading)
.truncationMode(.tail)
Expand Down Expand Up @@ -178,4 +178,3 @@ struct BannerView: View {
.padding()
}
}

2 changes: 1 addition & 1 deletion iOSClient/GUI/Lucid Banner/UploadBannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ struct UploadBannerView: View {
VStack(alignment: .leading, spacing: 7) {
if showTitle, let title = state.payload.title {
Text(title)
.cappedFont(.title3, maxDynamicType: .accessibility2)
.cappedFont(.headline, maxDynamicType: .accessibility2)
.fontWeight(.semibold)
.multilineTextAlignment(.leading)
.truncationMode(.tail)
Expand Down
2 changes: 1 addition & 1 deletion iOSClient/GUI/Lucid Banner/WarningBannerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ struct WarningBannerView: View {
VStack(alignment: .leading, spacing: 7) {
if showTitle, let title = state.payload.title {
Text(title)
.cappedFont(.title3, maxDynamicType: .accessibility2)
.cappedFont(.headline, maxDynamicType: .accessibility2)
.fontWeight(.semibold)
.multilineTextAlignment(.leading)
.truncationMode(.tail)
Expand Down
28 changes: 17 additions & 11 deletions iOSClient/Main/Collection Common/NCCollectionViewCommon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,8 @@ extension NCCollectionViewCommon: NCSectionFooterDelegate {
}
}

// MARK: - Transfer Delegate

extension NCCollectionViewCommon: NCTransferDelegate {
func transferProgressDidUpdate(progress: Float, totalBytes: Int64, totalBytesExpected: Int64, fileName: String, serverUrl: String) { }

Expand All @@ -887,11 +889,20 @@ extension NCCollectionViewCommon: NCTransferDelegate {
error.errorCode != global.errorResourceNotFound {
await showErrorBanner(windowScene: windowScene, text: error.errorDescription, errorCode: error.errorCode)
}

guard session.account == account else {
return
}

if status == self.global.networkingStatusCreateFolder {
if self.isSearchingMode {
await self.debouncerNetworkSearch.call {
await self.search()
}
return
}

switch status {
case self.global.networkingStatusCreateFolder:
if error == .success,
serverUrl == self.serverUrl,
selector != self.global.selectorUploadAutoUpload,
Expand All @@ -902,16 +913,11 @@ extension NCCollectionViewCommon: NCTransferDelegate {
self.pushMetadata(metadata)
}
}
return
}

if self.isSearchingMode {
await self.debouncerNetworkSearch.call {
await self.search()
}
} else if self.serverUrl == serverUrl || destination == self.serverUrl || self.serverUrl.isEmpty {
await self.debouncerReloadDataSource.call {
await self.reloadDataSource()
default:
if self.serverUrl == serverUrl || destination == self.serverUrl || self.serverUrl.isEmpty {
await self.debouncerReloadDataSource.call {
await self.reloadDataSource()
}
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions iOSClient/Menu/NCContextMenuMain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,8 @@ class NCContextMenuMain: NSObject {
let error = await NCNetworkingE2EEMarkFolder().markFolderE2ee(
account: metadata.account,
serverUrlFileName: metadata.serverUrlFileName,
userId: metadata.userId
userId: metadata.userId,
sceneIdentifier: self.sceneIdentifier
)
if error != .success {
await showErrorBanner(windowScene: self.windowScene, text: error.errorDescription, errorCode: error.errorCode)
Expand Down Expand Up @@ -363,7 +364,7 @@ class NCContextMenuMain: NSObject {
return
}

let error = await NCNetworking.shared.setStatusWaitRename(metadata, fileNameNew: fileNameNew)
let error = await NCNetworking.shared.setStatusWaitRename(metadata, fileNameNew: fileNameNew, windowScene: self.windowScene)
if error != .success {
await showErrorBanner(windowScene: self.windowScene, error: error)
}
Expand Down
2 changes: 1 addition & 1 deletion iOSClient/Menu/NCContextMenuShare.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class NCContextMenuShare: NSObject {

if share.shareType != NKShare.ShareType.publicLink.rawValue,
let metadata = shareController.metadata,
metadata.e2eEncrypted && NCGlobal.shared.isE2eeVersion2(capabilities.e2EEApiVersion) {
metadata.e2eEncrypted && capabilities.e2EEApiVersion.hasPrefix("2.") {
if await NCNetworkingE2EE().isInUpload(account: metadata.account, serverUrl: metadata.serverUrlFileName) {
Task {
await showErrorBanner(windowScene: self.windowScene,
Expand Down
8 changes: 0 additions & 8 deletions iOSClient/NCGlobal.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,6 @@ final class NCGlobal: Sendable {
// E2EE
//
let e2eePassphraseTest = "more over television factory tendency independence international intellectual impress interest sentence pony"
let e2eeCompatibleVersions = ["1.1", "1.2", "2.0", "2.1", "2.2"]

func isE2eeVersion2(_ version: String) -> Bool {
if version.hasPrefix("2.") {
return true
}
return false
}

// CHUNK
let chunkSizeMBCellular = 10000000
Expand Down
8 changes: 4 additions & 4 deletions iOSClient/Networking/E2EE/NCEndToEndMetadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ class NCEndToEndMetadata: NSObject {
}
let capabilities = await NKCapabilities.shared.getCapabilities(for: session.account)

if capabilities.e2EEApiVersion == "1.2" {
return await encodeMetadataV12(account: session.account, serverUrl: serverUrl, ocIdServerUrl: directory.ocId)
} else if NCGlobal.shared.isE2eeVersion2(capabilities.e2EEApiVersion) {
return await encodeMetadataV20(serverUrl: serverUrl, ocIdServerUrl: directory.ocId, addUserId: addUserId, addCertificate: addCertificate, removeUserId: removeUserId, session: session)
if capabilities.e2EEApiVersion.hasPrefix("1.") {
return await encodeMetadataV1(account: session.account, serverUrl: serverUrl, ocIdServerUrl: directory.ocId)
} else if capabilities.e2EEApiVersion.hasPrefix("2.") {
return await encodeMetadataV2(serverUrl: serverUrl, ocIdServerUrl: directory.ocId, addUserId: addUserId, addCertificate: addCertificate, removeUserId: removeUserId, session: session)
} else {
return (nil, nil, 0, NKError(errorCode: NCGlobal.shared.errorE2EEVersion, errorDescription: "Server E2EE version " + capabilities.e2EEApiVersion + ", not compatible"))
}
Expand Down
2 changes: 1 addition & 1 deletion iOSClient/Networking/E2EE/NCEndToEndMetadataV1.swift
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ extension NCEndToEndMetadata {
// MARK: Ecode JSON Metadata V1.2
// --------------------------------------------------------------------------------------------

func encodeMetadataV12(account: String, serverUrl: String, ocIdServerUrl: String) async -> (metadata: String?, signature: String?, counter: Int, error: NKError) {
func encodeMetadataV1(account: String, serverUrl: String, ocIdServerUrl: String) async -> (metadata: String?, signature: String?, counter: Int, error: NKError) {

let encoder = JSONEncoder()
var metadataKey: String = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
// MARK: Encode JSON Metadata V2
// --------------------------------------------------------------------------------------------

func encodeMetadataV20(serverUrl: String, ocIdServerUrl: String, addUserId: String?, addCertificate: String?, removeUserId: String?, session: NCSession.Session) async -> (metadata: String?, signature: String?, counter: Int, error: NKError) {
func encodeMetadataV2(serverUrl: String, ocIdServerUrl: String, addUserId: String?, addCertificate: String?, removeUserId: String?, session: NCSession.Session) async -> (metadata: String?, signature: String?, counter: Int, error: NKError) {
guard let directoryTop = await utilityFileSystem.getMetadataE2EETopAsync(serverUrl: serverUrl, session: session) else {
return (nil, nil, 0, NKError(errorCode: NCGlobal.shared.errorE2EEKeyDirectoryTop,
errorDescription: NSLocalizedString("_e2ee_no_dir_", comment: "")))
Expand Down Expand Up @@ -379,7 +379,7 @@
// DELETE CHECK
//
if let deleted = jsonCiphertextMetadata.deleted, deleted {
// TODO: We need to check deleted, id yes ???

Check warning on line 382 in iOSClient/Networking/E2EE/NCEndToEndMetadataV2.swift

View workflow job for this annotation

GitHub Actions / Lint

Todo Violation: TODOs should be resolved (We need to check deleted, id y...) (todo)
}

await self.database.addE2eMetadataAsync(account: session.account,
Expand Down
9 changes: 3 additions & 6 deletions iOSClient/Networking/E2EE/NCNetworkingE2EE.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class NCNetworkingE2EE: NSObject {

func getOptions(account: String, capabilities: NKCapabilities.Capabilities) -> NKRequestOptions {
var version = e2EEApiVersion1
if NCGlobal.shared.isE2eeVersion2(capabilities.e2EEApiVersion) {
if capabilities.e2EEApiVersion.hasPrefix("2.") {
version = e2EEApiVersion2
}
return NKRequestOptions(version: version)
Expand Down Expand Up @@ -209,9 +209,7 @@ class NCNetworkingE2EE: NSObject {

// COUNTER
//
if NCGlobal.shared.isE2eeVersion2(capabilities.e2EEApiVersion) {
await self.database.updateCounterE2eMetadataAsync(account: session.account, ocIdServerUrl: ocIdServerUrl, counter: resultsEncodeMetadata.counter)
}
await self.database.updateCounterE2eMetadataAsync(account: session.account, ocIdServerUrl: ocIdServerUrl, counter: resultsEncodeMetadata.counter)

return NKError()
}
Expand Down Expand Up @@ -253,8 +251,7 @@ class NCNetworkingE2EE: NSObject {
e2eToken = tableLock.e2eToken
}

if NCGlobal.shared.isE2eeVersion2(capabilities.e2EEApiVersion),
var counter = await self.database.getCounterE2eMetadataAsync(account: account, ocIdServerUrl: directory.ocId) {
if var counter = await self.database.getCounterE2eMetadataAsync(account: account, ocIdServerUrl: directory.ocId) {
counter += 1
e2eCounter = "\(counter)"
}
Expand Down
Loading
Loading