Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
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
22 changes: 11 additions & 11 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@
F71F6D0B2B6A6A5E00F1EB15 /* ThreadSafeArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = F71F6D062B6A6A5E00F1EB15 /* ThreadSafeArray.swift */; };
F71F6D0C2B6A6A5E00F1EB15 /* ThreadSafeArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = F71F6D062B6A6A5E00F1EB15 /* ThreadSafeArray.swift */; };
F71F6D0D2B6A6A5E00F1EB15 /* ThreadSafeArray.swift in Sources */ = {isa = PBXBuildFile; fileRef = F71F6D062B6A6A5E00F1EB15 /* ThreadSafeArray.swift */; };
F71FA7992F3508C600E86192 /* NCNetworking+WebDAV.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7327E2F2B73A86700A462C7 /* NCNetworking+WebDAV.swift */; };
F722133B2D40EF9D002F7438 /* NCFilesNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F722133A2D40EF8C002F7438 /* NCFilesNavigationController.swift */; };
F7226EDC1EE4089300EBECB1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F7226EDB1EE4089300EBECB1 /* Main.storyboard */; };
F722F0112CFF569500065FB5 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F722F0102CFF569500065FB5 /* MainInterface.storyboard */; };
Expand Down Expand Up @@ -308,7 +309,6 @@
F7327E202B73A42F00A462C7 /* NCNetworking+Download.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7327E1F2B73A42F00A462C7 /* NCNetworking+Download.swift */; };
F7327E232B73A42F00A462C7 /* NCNetworking+Download.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7327E1F2B73A42F00A462C7 /* NCNetworking+Download.swift */; };
F7327E302B73A86700A462C7 /* NCNetworking+WebDAV.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7327E2F2B73A86700A462C7 /* NCNetworking+WebDAV.swift */; };
F7327E322B73A86700A462C7 /* NCNetworking+WebDAV.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7327E2F2B73A86700A462C7 /* NCNetworking+WebDAV.swift */; };
F7327E352B73AEDE00A462C7 /* NCNetworking+LivePhoto.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7327E342B73AEDE00A462C7 /* NCNetworking+LivePhoto.swift */; };
F7327E3B2B73B8D600A462C7 /* Array+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7AC1CAF28AB94490032D99F /* Array+Extension.swift */; };
F732D23327CF8AED000B0F1B /* NCPlayerToolBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = F732D23227CF8AED000B0F1B /* NCPlayerToolBar.xib */; };
Expand Down Expand Up @@ -599,6 +599,7 @@
F7864ACE2A78FE73004870E0 /* NCManageDatabase+LocalFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7864ACB2A78FE73004870E0 /* NCManageDatabase+LocalFile.swift */; };
F7864ACF2A78FE73004870E0 /* NCManageDatabase+LocalFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7864ACB2A78FE73004870E0 /* NCManageDatabase+LocalFile.swift */; };
F7864AD22A78FE73004870E0 /* NCManageDatabase+LocalFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7864ACB2A78FE73004870E0 /* NCManageDatabase+LocalFile.swift */; };
F7865FF12F39D32F00D09AE4 /* NCCollectionViewCommon+Search.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7865FF02F39D32500D09AE4 /* NCCollectionViewCommon+Search.swift */; };
F787704F22E7019900F287A9 /* NCShareLinkCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F787704E22E7019900F287A9 /* NCShareLinkCell.xib */; };
F787AC09298BCB4A0001BB00 /* SVGKitSwift in Frameworks */ = {isa = PBXBuildFile; productRef = F787AC08298BCB4A0001BB00 /* SVGKitSwift */; };
F787AC0B298BCB540001BB00 /* SVGKitSwift in Frameworks */ = {isa = PBXBuildFile; productRef = F787AC0A298BCB540001BB00 /* SVGKitSwift */; };
Expand Down Expand Up @@ -867,7 +868,6 @@
F7E742FB2EC0A5FD00E2362A /* NCManageDatabase+Metadata+Session.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B769A72B7A0B2000C1AAEB /* NCManageDatabase+Metadata+Session.swift */; };
F7E742FC2EC0A5FD00E2362A /* NCManageDatabase+Metadata+Session.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7B769A72B7A0B2000C1AAEB /* NCManageDatabase+Metadata+Session.swift */; };
F7E7AEA52BA32C6500512E52 /* NCCollectionViewDownloadThumbnail.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E7AEA42BA32C6500512E52 /* NCCollectionViewDownloadThumbnail.swift */; };
F7E7AEA72BA32D0000512E52 /* NCCollectionViewUnifiedSearch.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E7AEA62BA32D0000512E52 /* NCCollectionViewUnifiedSearch.swift */; };
F7E8A391295DC5E0006CB2D0 /* View+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E8A390295DC5E0006CB2D0 /* View+Extension.swift */; };
F7E98C1627E0D0FC001F9F19 /* NCManageDatabase+Video.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E98C1527E0D0FC001F9F19 /* NCManageDatabase+Video.swift */; };
F7E98C1727E0D0FC001F9F19 /* NCManageDatabase+Video.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E98C1527E0D0FC001F9F19 /* NCManageDatabase+Video.swift */; };
Expand Down Expand Up @@ -1526,6 +1526,7 @@
F785129A2D79899E0087DDD0 /* NCNetworking+TermsOfService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCNetworking+TermsOfService.swift"; sourceTree = "<group>"; };
F785EE9C246196DF00B3F945 /* NCNetworkingE2EE.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCNetworkingE2EE.swift; sourceTree = "<group>"; };
F7864ACB2A78FE73004870E0 /* NCManageDatabase+LocalFile.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NCManageDatabase+LocalFile.swift"; sourceTree = "<group>"; };
F7865FF02F39D32500D09AE4 /* NCCollectionViewCommon+Search.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCCollectionViewCommon+Search.swift"; sourceTree = "<group>"; };
F787704E22E7019900F287A9 /* NCShareLinkCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = NCShareLinkCell.xib; sourceTree = "<group>"; };
F78A10BE29322E8A008499B8 /* NCManageDatabase+Directory.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NCManageDatabase+Directory.swift"; sourceTree = "<group>"; };
F78A18B523CDD07D00F681F3 /* NCViewerRichWorkspaceWebView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerRichWorkspaceWebView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1769,7 +1770,6 @@
F7E45E6D21E75BF200579249 /* ja-JP */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "ja-JP"; path = "ja-JP.lproj/Localizable.strings"; sourceTree = "<group>"; };
F7E4D9C322ED929B003675FD /* NCShareCommentsCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareCommentsCell.swift; sourceTree = "<group>"; };
F7E7AEA42BA32C6500512E52 /* NCCollectionViewDownloadThumbnail.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCollectionViewDownloadThumbnail.swift; sourceTree = "<group>"; };
F7E7AEA62BA32D0000512E52 /* NCCollectionViewUnifiedSearch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCCollectionViewUnifiedSearch.swift; sourceTree = "<group>"; };
F7E8A390295DC5E0006CB2D0 /* View+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+Extension.swift"; sourceTree = "<group>"; };
F7E98C1527E0D0FC001F9F19 /* NCManageDatabase+Video.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCManageDatabase+Video.swift"; sourceTree = "<group>"; };
F7EB9B122BBC12F300EDF036 /* UIApplication+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIApplication+Extension.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2493,14 +2493,14 @@
F7D890742BD25C570050B8A6 /* NCCollectionViewCommon+DragDrop.swift */,
F799DF872C4B83CC003410B5 /* NCCollectionViewCommon+EasyTipView.swift */,
F799DF8A2C4B84EB003410B5 /* NCCollectionViewCommon+EndToEndInitialize.swift */,
F7865FF02F39D32500D09AE4 /* NCCollectionViewCommon+Search.swift */,
F7CCAB502ECF315F00F8E68B /* NCCollectionViewCommon+SyncMetadata.swift */,
F778231D2C42C07C001BB94F /* NCCollectionViewCommon+MediaLayout.swift */,
F36E64F62B9245210085ABB5 /* NCCollectionViewCommon+SelectTabBarDelegate.swift */,
F7D4BF002CA1831600A5E746 /* NCCollectionViewCommonPinchGesture.swift */,
F38F71242B6BBDC300473CDC /* NCCollectionViewCommonSelectTabBar.swift */,
F7C1EEA425053A9C00866ACC /* NCCollectionViewDataSource.swift */,
F7E7AEA42BA32C6500512E52 /* NCCollectionViewDownloadThumbnail.swift */,
F7E7AEA62BA32D0000512E52 /* NCCollectionViewUnifiedSearch.swift */,
);
path = "Collection Common";
sourceTree = "<group>";
Expand Down Expand Up @@ -4292,10 +4292,10 @@
AF22B208277B4E4C00DAB0CC /* NCCreateFormUploadConflictCell.swift in Sources */,
F73EF7C22B02250B0087E6E9 /* NCManageDatabase+GPS.swift in Sources */,
F7148041262EBE4000693E51 /* NCShareExtension.swift in Sources */,
F71FA7992F3508C600E86192 /* NCNetworking+WebDAV.swift in Sources */,
F76B3CCF1EAE01BD00921AC9 /* NCBrand.swift in Sources */,
F72944F32A84246400246839 /* NCEndToEndMetadataV20.swift in Sources */,
F7BAADCC1ED5A87C00B7EAD4 /* NCManageDatabase.swift in Sources */,
F7327E322B73A86700A462C7 /* NCNetworking+WebDAV.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -4418,7 +4418,6 @@
CB3666201AF7550816B5CD6A /* NCContextMenuComment.swift in Sources */,
2F96A1BAFB10ACFEAC68EF1C /* NCContextMenuPlayerTracks.swift in Sources */,
F7E402332BA89551007E5609 /* NCTrash+Networking.swift in Sources */,
F7E7AEA72BA32D0000512E52 /* NCCollectionViewUnifiedSearch.swift in Sources */,
F73EF7A72B0223900087E6E9 /* NCManageDatabase+Comments.swift in Sources */,
F33918C42C7CD8F2002D9AA1 /* FileNameValidator+Extensions.swift in Sources */,
F39170AD2CB82024006127BC /* FileAutoRenamer+Extensions.swift in Sources */,
Expand Down Expand Up @@ -4705,6 +4704,7 @@
F3BB46522A39EC4900461F6E /* NCMoreAppSuggestionsCell.swift in Sources */,
F704B5E52430AA8000632F5F /* NCCreateFormUploadConflict.swift in Sources */,
F765608F23BF813600765969 /* NCContentPresenter.swift in Sources */,
F7865FF12F39D32F00D09AE4 /* NCCollectionViewCommon+Search.swift in Sources */,
F7327E352B73AEDE00A462C7 /* NCNetworking+LivePhoto.swift in Sources */,
F76687072B7D067400779E3F /* NCAudioRecorderViewController.swift in Sources */,
AA8E03DA2D2ED83300E7E89C /* TransientShare.swift in Sources */,
Expand Down Expand Up @@ -5759,7 +5759,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 0;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -5786,7 +5786,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 7.2.3;
MARKETING_VERSION = 7.2.4;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-v";
OTHER_LDFLAGS = "";
Expand Down Expand Up @@ -5825,7 +5825,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 7;
CURRENT_PROJECT_VERSION = 0;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand All @@ -5849,7 +5849,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 7.2.3;
MARKETING_VERSION = 7.2.4;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-v";
OTHER_LDFLAGS = "";
Expand Down Expand Up @@ -6122,7 +6122,7 @@
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/nextcloud/NextcloudKit";
requirement = {
branch = 7.2.4;
branch = main;
kind = branch;
};
};
Expand Down
1 change: 1 addition & 0 deletions iOSClient/Data/NCManageDatabase+Metadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class tableMetadata: Object {

/// Used only for UI state (not persisted, not observed by Realm)
var isOffline: Bool = false
var section: String = ""

override static func primaryKey() -> String {
return "ocId"
Expand Down
25 changes: 3 additions & 22 deletions iOSClient/Extensions/UINavigationController+Extension.swift
Original file line number Diff line number Diff line change
@@ -1,25 +1,6 @@
//
// UINavigationController+Extension.swift
// Nextcloud
//
// Created by Marino Faggiana on 02/08/2022.
// Copyright © 2022 Marino Faggiana. All rights reserved.
//
// Author Marino Faggiana <marino.faggiana@nextcloud.com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// SPDX-FileCopyrightText: Nextcloud GmbH
// SPDX-FileCopyrightText: 2022 Marino Faggiana
// SPDX-License-Identifier: GPL-3.0-or-later

import Foundation
import UIKit
Expand Down
41 changes: 21 additions & 20 deletions iOSClient/Files/NCFiles.swift
Original file line number Diff line number Diff line change
Expand Up @@ -185,27 +185,11 @@ class NCFiles: NCCollectionViewCommon {
startSyncMetadata(metadatas: self.dataSource.getMetadatas())
}

Task {
await networking.networkingTasks.cancel(identifier: "\(self.serverUrl)_NCFiles")
}
await networking.networkingTasks.cancel(identifier: "\(self.serverUrl)_NCFiles")

guard !isSearchingMode else {
return networkSearch()
}

func downloadMetadata(_ metadata: tableMetadata) async -> Bool {
let fileSize = utilityFileSystem.fileProviderStorageSize(metadata.ocId,
fileName: metadata.fileNameView,
userId: metadata.userId,
urlBase: metadata.urlBase)
guard fileSize > 0 else { return false }

if let tblLocalFile = await database.getTableLocalFileAsync(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) {
if tblLocalFile.etag != metadata.etag {
return true
}
}
return false
await self.search()
return
}

let resultsReadFolder = await networkReadFolderAsync(serverUrl: self.serverUrl, forced: forced)
Expand All @@ -216,7 +200,7 @@ class NCFiles: NCCollectionViewCommon {
let metadatasForDownload: [tableMetadata] = resultsReadFolder.metadatas ?? self.dataSource.getMetadatas()
Task.detached(priority: .utility) {
for metadata in metadatasForDownload where !metadata.directory {
if await downloadMetadata(metadata) {
if await self.downloadMetadata(metadata) {
if let metadata = await self.database.setMetadataSessionInWaitDownloadAsync(ocId: metadata.ocId,
session: NCNetworking.shared.sessionDownload,
selector: NCGlobal.shared.selectorDownloadFile,
Expand All @@ -230,6 +214,23 @@ class NCFiles: NCCollectionViewCommon {
await self.reloadDataSource()
}

private func downloadMetadata(_ metadata: tableMetadata) async -> Bool {
let fileSize = utilityFileSystem.fileProviderStorageSize(metadata.ocId,
fileName: metadata.fileNameView,
userId: metadata.userId,
urlBase: metadata.urlBase)
guard fileSize > 0 else {
return false
}

if let tblLocalFile = await database.getTableLocalFileAsync(predicate: NSPredicate(format: "ocId == %@", metadata.ocId)) {
if tblLocalFile.etag != metadata.etag {
return true
}
}
return false
}

private func networkReadFolderAsync(serverUrl: String, forced: Bool) async -> (metadatas: [tableMetadata]?, error: NKError, reloadRequired: Bool) {
var reloadRequired: Bool = false
let resultsReadFile = await NCNetworking.shared.readFileAsync(serverUrlFileName: serverUrl, account: session.account) { task in
Expand Down
Loading
Loading