Skip to content

Commit 08050bf

Browse files
Merge branch 'master' into nmc/2169-media_theming_customisation
2 parents 2f2d75d + 973e7cd commit 08050bf

File tree

143 files changed

+931
-547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+931
-547
lines changed

Brand/Database.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ import Foundation
88
//
99
let databaseName = "nextcloud.realm"
1010
let tableAccountBackup = "tableAccountBackup.json"
11-
let databaseSchemaVersion: UInt64 = 402
11+
let fileUploadStore = "uploads.json"
12+
let databaseSchemaVersion: UInt64 = 403

Brand/NCBrand.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ final class NCBrandColor: @unchecked Sendable {
142142
private var themingColorText = ThreadSafeDictionary<String, UIColor>()
143143

144144
var userColors: [CGColor] = []
145-
let yellowFavorite: UIColor = UIColor(red: 248.0 / 255.0, green: 205.0 / 255.0, blue: 70.0 / 255.0, alpha: 1.0)
145+
let yellowFavorite: UIColor = UIColor(red: 0.6118, green: 0.4549, blue: 0.1451, alpha: 1.0)
146146
let iconImageColor: UIColor = .label
147147
let iconImageColor2: UIColor = .secondaryLabel
148148
let iconImageMultiColors: [UIColor] = [.secondaryLabel, .label]

File Provider Extension/FileProviderEnumerator.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@ class FileProviderEnumerator: NSObject, NSFileProviderEnumerator {
1515
let database = NCManageDatabase.shared
1616
let utilityFileSystem = NCUtilityFileSystem()
1717
var anchor: UInt64 = 0
18+
1819
// X-NC-PAGINATE
1920
var recordsPerPage: Int = 100
21+
// X-NC-PAGINATE
22+
2023
var paginateToken: String?
2124
var paginatedTotal: Int = 0
2225

Nextcloud.xcodeproj/project.pbxproj

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@
160160
F359D86B2A7D03420023F405 /* NCUtility+Exif.swift in Sources */ = {isa = PBXBuildFile; fileRef = F359D8662A7D03420023F405 /* NCUtility+Exif.swift */; };
161161
F359D86C2A7D03420023F405 /* NCUtility+Exif.swift in Sources */ = {isa = PBXBuildFile; fileRef = F359D8662A7D03420023F405 /* NCUtility+Exif.swift */; };
162162
F359D86D2A7D03420023F405 /* NCUtility+Exif.swift in Sources */ = {isa = PBXBuildFile; fileRef = F359D8662A7D03420023F405 /* NCUtility+Exif.swift */; };
163+
F36C514E2E89393C0097E5F7 /* UIView+BlurVibrancy.swift in Sources */ = {isa = PBXBuildFile; fileRef = F36C514D2E89393C0097E5F7 /* UIView+BlurVibrancy.swift */; };
164+
F36C514F2E89393C0097E5F7 /* UIView+BlurVibrancy.swift in Sources */ = {isa = PBXBuildFile; fileRef = F36C514D2E89393C0097E5F7 /* UIView+BlurVibrancy.swift */; };
163165
F36E64F72B9245210085ABB5 /* NCCollectionViewCommon+SelectTabBarDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F36E64F62B9245210085ABB5 /* NCCollectionViewCommon+SelectTabBarDelegate.swift */; };
164166
F36E64FA2B96236C0085ABB5 /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E41315294A19B300839300 /* UIView+Extension.swift */; };
165167
F36E64FB2B9733F10085ABB5 /* UIView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7E41315294A19B300839300 /* UIView+Extension.swift */; };
@@ -1389,6 +1391,7 @@
13891391
F343A4BA2A1E734600DDA874 /* Optional+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Optional+Extension.swift"; sourceTree = "<group>"; };
13901392
F351D1A52D0AF24A00930F94 /* PHAssetCollection+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PHAssetCollection+Extension.swift"; sourceTree = "<group>"; };
13911393
F359D8662A7D03420023F405 /* NCUtility+Exif.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCUtility+Exif.swift"; sourceTree = "<group>"; };
1394+
F36C514D2E89393C0097E5F7 /* UIView+BlurVibrancy.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+BlurVibrancy.swift"; sourceTree = "<group>"; };
13921395
F36E64F62B9245210085ABB5 /* NCCollectionViewCommon+SelectTabBarDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCCollectionViewCommon+SelectTabBarDelegate.swift"; sourceTree = "<group>"; };
13931396
F37208742BAB4AB0006B5430 /* TestConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TestConstants.swift; sourceTree = "<group>"; };
13941397
F3754A7C2CF87D600009312E /* SetupPasscodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SetupPasscodeView.swift; sourceTree = "<group>"; };
@@ -2590,6 +2593,7 @@
25902593
F751247B2C42919C00E63DB8 /* NCPhotoCell.xib */,
25912594
F75D901E2D2BE12E003E740B /* NCRecommendationsCell.xib */,
25922595
F75D90202D2BE26C003E740B /* NCRecommendationsCell.swift */,
2596+
F36C514D2E89393C0097E5F7 /* UIView+BlurVibrancy.swift */,
25932597
);
25942598
path = Cell;
25952599
sourceTree = "<group>";
@@ -4423,6 +4427,7 @@
44234427
F799DF832C4B7DCC003410B5 /* NCSectionFooter.swift in Sources */,
44244428
AF22B218277D196700DAB0CC /* NCShareExtension+Files.swift in Sources */,
44254429
F799DF862C4B7E56003410B5 /* NCSectionHeader.swift in Sources */,
4430+
F36C514E2E89393C0097E5F7 /* UIView+BlurVibrancy.swift in Sources */,
44264431
F702F2D025EE5B5C008F8E80 /* NCGlobal.swift in Sources */,
44274432
F343A4BE2A1E734600DDA874 /* Optional+Extension.swift in Sources */,
44284433
F72437802C10B92400C7C68D /* NCSharePermissions.swift in Sources */,
@@ -4896,6 +4901,7 @@
48964901
F75D19E325EFE09000D74598 /* NCTrash+Menu.swift in Sources */,
48974902
F70CAE3A1F8CF31A008125FD /* NCEndToEndEncryption.m in Sources */,
48984903
AA8D316E2D4123B200FE2775 /* NCShareDownloadLimitTableViewControllerDelegate.swift in Sources */,
4904+
F36C514F2E89393C0097E5F7 /* UIView+BlurVibrancy.swift in Sources */,
48994905
AA8D316F2D4123B200FE2775 /* NCShareDownloadLimitTableViewController.swift in Sources */,
49004906
AA8D31702D4123B200FE2775 /* DownloadLimitViewModel.swift in Sources */,
49014907
AA8D31712D4123B200FE2775 /* NCShareDownloadLimitViewController.swift in Sources */,
@@ -6001,7 +6007,7 @@
60016007
CLANG_WARN_UNREACHABLE_CODE = YES;
60026008
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
60036009
COPY_PHASE_STRIP = NO;
6004-
CURRENT_PROJECT_VERSION = 2;
6010+
CURRENT_PROJECT_VERSION = 1;
60056011
DEBUG_INFORMATION_FORMAT = dwarf;
60066012
DEVELOPMENT_TEAM = NKUJUXUJ3B;
60076013
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -6028,7 +6034,7 @@
60286034
"@executable_path/Frameworks",
60296035
"@executable_path/../../Frameworks",
60306036
);
6031-
MARKETING_VERSION = 7.1.7;
6037+
MARKETING_VERSION = 7.1.8;
60326038
ONLY_ACTIVE_ARCH = YES;
60336039
OTHER_CFLAGS = "-v";
60346040
OTHER_LDFLAGS = "";
@@ -6067,7 +6073,7 @@
60676073
CLANG_WARN_UNREACHABLE_CODE = YES;
60686074
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
60696075
COPY_PHASE_STRIP = NO;
6070-
CURRENT_PROJECT_VERSION = 2;
6076+
CURRENT_PROJECT_VERSION = 1;
60716077
DEVELOPMENT_TEAM = NKUJUXUJ3B;
60726078
ENABLE_STRICT_OBJC_MSGSEND = YES;
60736079
ENABLE_TESTABILITY = YES;
@@ -6091,7 +6097,7 @@
60916097
"@executable_path/Frameworks",
60926098
"@executable_path/../../Frameworks",
60936099
);
6094-
MARKETING_VERSION = 7.1.7;
6100+
MARKETING_VERSION = 7.1.8;
60956101
ONLY_ACTIVE_ARCH = YES;
60966102
OTHER_CFLAGS = "-v";
60976103
OTHER_LDFLAGS = "";
@@ -6372,8 +6378,8 @@
63726378
isa = XCRemoteSwiftPackageReference;
63736379
repositoryURL = "https://github.com/nextcloud/NextcloudKit";
63746380
requirement = {
6375-
kind = exactVersion;
6376-
version = 7.1.5;
6381+
branch = main;
6382+
kind = branch;
63776383
};
63786384
};
63796385
F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */ = {

iOSClient/Account/NCAccount.swift

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,6 @@ class NCAccount: NSObject {
108108
// set theming color
109109
NCBrandColor.shared.settingThemingColor(account: account, capabilities: capabilities)
110110
}
111-
// Start the auto upload
112-
let num = await NCAutoUpload.shared.initAutoUpload(tblAccount: tblAccount)
113-
nkLog(start: "Auto upload with \(num) photo")
114111
// Networking Process
115112
await NCNetworkingProcess.shared.setCurrentAccount(account)
116113

iOSClient/AppDelegate.swift

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -199,12 +199,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
199199
task.setTaskCompleted(success: true)
200200
}
201201

202-
guard let tblAccount = await NCManageDatabase.shared.getActiveTableAccountAsync() else {
203-
nkLog(tag: self.global.logTagTask, emoji: .info, message: "No active account or background task already running")
204-
return
205-
}
206-
207-
await backgroundSync(tblAccount: tblAccount, task: task)
202+
await backgroundSync(task: task)
208203
}
209204
}
210205

@@ -224,25 +219,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
224219
task.setTaskCompleted(success: true)
225220
}
226221

227-
guard let tblAccount = await NCManageDatabase.shared.getActiveTableAccountAsync() else {
228-
nkLog(tag: self.global.logTagTask, emoji: .info, message: "No active account or background task already running")
229-
return
230-
}
231-
232-
await backgroundSync(tblAccount: tblAccount, task: task)
222+
await backgroundSync(task: task)
233223
}
234224
}
235225

236-
func backgroundSync(tblAccount: tableAccount, task: BGTask? = nil) async {
226+
func backgroundSync(task: BGTask? = nil) async {
237227
// BGTask expiration flag
238228
var expired = false
239229
task?.expirationHandler = {
240230
expired = true
241231
}
242232

243233
// Discover new items for Auto Upload
244-
let numAutoUpload = await NCAutoUpload.shared.initAutoUpload(tblAccount: tblAccount)
245-
nkLog(tag: self.global.logTagBgSync, emoji: .start, message: "Auto upload found \(numAutoUpload) new items for \(tblAccount.account)")
234+
let numAutoUpload = await NCAutoUpload.shared.initAutoUpload()
235+
nkLog(tag: self.global.logTagBgSync, emoji: .start, message: "Auto upload found \(numAutoUpload) new items")
246236
guard !expired else {
247237
return
248238
}
@@ -252,8 +242,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
252242
predicate: NSPredicate(format: "status != %d", self.global.metadataStatusNormal),
253243
withSort: [RealmSwift.SortDescriptor(keyPath: "sessionDate", ascending: true)],
254244
withLimit: NCBrandOptions.shared.numMaximumProcess),
255-
!allMetadatas.isEmpty,
256-
!expired else {
245+
!allMetadatas.isEmpty,
246+
!expired else {
257247
return
258248
}
259249

@@ -263,17 +253,17 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
263253
$0.sessionSelector == self.global.selectorUploadAutoUpload
264254
}
265255

266-
for meta in pendingCreateFolders {
256+
for metadata in pendingCreateFolders {
267257
guard !expired else {
268258
return
269259
}
270260
let err = await NCNetworking.shared.createFolderForAutoUpload(
271-
serverUrlFileName: meta.serverUrlFileName,
272-
account: meta.account
261+
serverUrlFileName: metadata.serverUrlFileName,
262+
account: metadata.account
273263
)
274264
// Fail-fast: abort the whole sync on first failure
275265
if err != .success {
276-
nkLog(tag: self.global.logTagBgSync, emoji: .error, message: "Create folder '\(meta.serverUrlFileName)' failed: \(err.errorCode) – aborting sync")
266+
nkLog(tag: self.global.logTagBgSync, emoji: .error, message: "Create folder '\(metadata.serverUrlFileName)' failed: \(err.errorCode) – aborting sync")
277267
return
278268
}
279269
}
@@ -283,7 +273,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
283273
let uploading = allMetadatas.lazy.filter { $0.status == self.global.metadataStatusUploading }.count
284274
let used = downloading + uploading
285275
let maximum = NCBrandOptions.shared.numMaximumProcess
286-
let available = Swift.max(0, maximum - used)
276+
let available = max(0, maximum - used)
287277

288278
// Only inject more work if overall utilization <= 20%
289279
let utilization = Double(used) / Double(maximum)
@@ -294,7 +284,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
294284
}
295285

296286
// Start Auto Uploads (cap by available slots)
297-
let seedsToUpload = Array(
287+
let metadatasToUpload = Array(
298288
allMetadatas.lazy.filter {
299289
$0.status == self.global.metadataStatusWaitUpload &&
300290
$0.sessionSelector == self.global.selectorUploadAutoUpload &&
@@ -304,12 +294,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
304294
)
305295

306296
let cameraRoll = NCCameraRoll()
307-
for seed in seedsToUpload {
297+
for metadata in metadatasToUpload {
308298
guard !expired else {
309299
return
310300
}
311301
// Expand seed into concrete metadatas (e.g., Live Photo pair)
312-
let extracted = await cameraRoll.extractCameraRoll(from: seed)
302+
let extracted = await cameraRoll.extractCameraRoll(from: metadata)
313303

314304
for metadata in extracted {
315305
// Sequential await keeps ordering and simplifies backpressure
@@ -328,10 +318,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
328318
func application(_ application: UIApplication, handleEventsForBackgroundURLSession identifier: String, completionHandler: @escaping () -> Void) {
329319
nkLog(debug: "Handle events For background URLSession: \(identifier)")
330320

331-
if NCManageDatabase.shared.openRealmBackground() {
332-
WidgetCenter.shared.reloadAllTimelines()
333-
}
334-
335321
backgroundSessionCompletionHandler = completionHandler
336322
}
337323

iOSClient/Data/NCManageDatabase+Account.swift

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ class tableAccount: Object {
2121
@objc dynamic var autoUploadVideo: Bool = false
2222
@objc dynamic var autoUploadWWAnPhoto: Bool = false
2323
@objc dynamic var autoUploadWWAnVideo: Bool = false
24-
@objc dynamic var autoUploadOnlyNew: Bool = true
25-
@objc dynamic var autoUploadOnlyNewSinceDate: Date = Date()
24+
@objc dynamic var autoUploadSinceDate: Date?
2625
@objc dynamic var backend = ""
2726
@objc dynamic var backendCapabilitiesSetDisplayName: Bool = false
2827
@objc dynamic var backendCapabilitiesSetPassword: Bool = false
@@ -73,8 +72,7 @@ class tableAccount: Object {
7372
autoUploadVideo: self.autoUploadVideo,
7473
autoUploadWWAnPhoto: self.autoUploadWWAnPhoto,
7574
autoUploadWWAnVideo: self.autoUploadWWAnVideo,
76-
autoUploadOnlyNew: self.autoUploadOnlyNew,
77-
autoUploadOnlyNewSinceDate: self.autoUploadOnlyNewSinceDate,
75+
autoUploadSinceDate: self.autoUploadSinceDate,
7876
user: self.user,
7977
userId: self.userId,
8078
urlBase: self.urlBase)
@@ -116,8 +114,7 @@ struct tableAccountCodable: Codable {
116114
var autoUploadVideo: Bool
117115
var autoUploadWWAnPhoto: Bool
118116
var autoUploadWWAnVideo: Bool
119-
var autoUploadOnlyNew: Bool
120-
var autoUploadOnlyNewSinceDate: Date
117+
var autoUploadSinceDate: Date?
121118

122119
var user: String
123120
var userId: String
@@ -389,6 +386,18 @@ extension NCManageDatabase {
389386
}
390387
}
391388

389+
/// Asynchronously retrieves `tableAccount` matching the given predicate.
390+
/// - Parameter predicate: The NSPredicate used to filter the `tableAccount` objects.
391+
/// - Returns: A copy of matching `tableAccount`, or `nil` if none is found.
392+
func getTableAccountsAsync(predicate: NSPredicate) async -> [tableAccount] {
393+
await performRealmReadAsync { realm in
394+
realm.objects(tableAccount.self)
395+
.filter(predicate)
396+
.sorted(byKeyPath: "active", ascending: false)
397+
.map { tableAccount(value: $0) }
398+
} ?? []
399+
}
400+
392401
func getAllTableAccount() -> [tableAccount] {
393402
performRealmRead { realm in
394403
let sorted = [SortDescriptor(keyPath: "active", ascending: false),
@@ -529,15 +538,6 @@ extension NCManageDatabase {
529538
} ?? NCGlobal.shared.subfolderGranularityMonthly
530539
}
531540

532-
func getAccountAutoUploadOnlyNewSinceDate() -> Date? {
533-
return performRealmRead { realm in
534-
realm.objects(tableAccount.self)
535-
.filter("active == true")
536-
.first?
537-
.autoUploadOnlyNewSinceDate
538-
}
539-
}
540-
541541
func getActiveTableAccount() -> tableAccount? {
542542
performRealmRead { realm in
543543
realm.objects(tableAccount.self)

iOSClient/Data/NCManageDatabase+Directory.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class tableDirectory: Object {
1414
@objc dynamic var favorite: Bool = false
1515
@objc dynamic var fileId = ""
1616
@objc dynamic var lastOpeningDate = NSDate()
17+
@objc dynamic var lastSyncDate: NSDate?
1718
@objc dynamic var ocId = ""
1819
@objc dynamic var offline: Bool = false
1920
@objc dynamic var permissions = ""

iOSClient/Data/NCManageDatabase+Metadata+Session.swift

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,8 @@ extension NCManageDatabase {
120120
.first else {
121121
return
122122
}
123-
124-
if abs(metadata.progress - progress) > 0.001 {
125-
metadata.progress = progress
126-
print(progress)
127-
}
123+
metadata.progress = progress
124+
print(progress)
128125
}
129126
}
130127

@@ -136,11 +133,8 @@ extension NCManageDatabase {
136133
.first else {
137134
return
138135
}
139-
140-
if abs(metadata.progress - progress) > 0.001 {
141-
metadata.progress = progress
142-
print(progress)
143-
}
136+
metadata.progress = progress
137+
print(progress)
144138
}
145139
}
146140

@@ -211,23 +205,4 @@ extension NCManageDatabase {
211205
}
212206
}
213207
}
214-
215-
// MARK: - Realm Read
216-
217-
func updateBadge() async {
218-
#if !EXTENSION
219-
let num = await performRealmReadAsync { realm in
220-
realm.objects(tableMetadata.self)
221-
.filter(NSPredicate(format: "status != %i", NCGlobal.shared.metadataStatusNormal))
222-
.count
223-
} ?? 0
224-
DispatchQueue.main.async {
225-
UNUserNotificationCenter.current().setBadgeCount(num) { error in
226-
if let error {
227-
print("Failed to set badge count: \(error)")
228-
}
229-
}
230-
}
231-
#endif
232-
}
233208
}

0 commit comments

Comments
 (0)