Skip to content

Commit 4e08a3f

Browse files
committed
Merge branch 'develop' of https://github.com/nextcloud/ios into backup-marino-au
2 parents 0f7041f + e773a2b commit 4e08a3f

File tree

157 files changed

+419
-459
lines changed

Some content is hidden

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

157 files changed

+419
-459
lines changed

Nextcloud.xcodeproj/project.pbxproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -5855,7 +5855,7 @@
58555855
CLANG_WARN_UNREACHABLE_CODE = YES;
58565856
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
58575857
COPY_PHASE_STRIP = NO;
5858-
CURRENT_PROJECT_VERSION = 10;
5858+
CURRENT_PROJECT_VERSION = 1;
58595859
DEBUG_INFORMATION_FORMAT = dwarf;
58605860
DEVELOPMENT_TEAM = NKUJUXUJ3B;
58615861
ENABLE_STRICT_OBJC_MSGSEND = YES;
@@ -5882,7 +5882,7 @@
58825882
"@executable_path/Frameworks",
58835883
"@executable_path/../../Frameworks",
58845884
);
5885-
MARKETING_VERSION = 6.4.0;
5885+
MARKETING_VERSION = 6.5.0;
58865886
ONLY_ACTIVE_ARCH = YES;
58875887
OTHER_CFLAGS = "-v";
58885888
OTHER_LDFLAGS = "";
@@ -5921,7 +5921,7 @@
59215921
CLANG_WARN_UNREACHABLE_CODE = YES;
59225922
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
59235923
COPY_PHASE_STRIP = NO;
5924-
CURRENT_PROJECT_VERSION = 10;
5924+
CURRENT_PROJECT_VERSION = 1;
59255925
DEVELOPMENT_TEAM = NKUJUXUJ3B;
59265926
ENABLE_STRICT_OBJC_MSGSEND = YES;
59275927
ENABLE_TESTABILITY = YES;
@@ -5945,7 +5945,7 @@
59455945
"@executable_path/Frameworks",
59465946
"@executable_path/../../Frameworks",
59475947
);
5948-
MARKETING_VERSION = 6.4.0;
5948+
MARKETING_VERSION = 6.5.0;
59495949
ONLY_ACTIVE_ARCH = YES;
59505950
OTHER_CFLAGS = "-v";
59515951
OTHER_LDFLAGS = "";
@@ -6227,8 +6227,8 @@
62276227
isa = XCRemoteSwiftPackageReference;
62286228
repositoryURL = "https://github.com/nextcloud/NextcloudKit";
62296229
requirement = {
6230-
branch = develop;
6231-
kind = branch;
6230+
kind = exactVersion;
6231+
version = 6.0.5;
62326232
};
62336233
};
62346234
F788ECC5263AAAF900ADC67F /* XCRemoteSwiftPackageReference "MarkdownKit" */ = {

Share/NCShareExtension+Files.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@ extension NCShareExtension {
3030
@objc func reloadDatasource(withLoadFolder: Bool) {
3131
let layoutForView = NCManageDatabase.shared.getLayoutForView(account: session.account, key: keyLayout, serverUrl: serverUrl) ?? NCDBLayoutForView()
3232
let predicate = NSPredicate(format: "account == %@ AND serverUrl == %@ AND directory == true", session.account, serverUrl)
33-
let directoryOnTop = NCKeychain().getDirectoryOnTop(account: session.account)
34-
let metadatas = self.database.getResultsMetadatasPredicate(predicate, layoutForView: layoutForView, directoryOnTop: directoryOnTop)
33+
let metadatas = self.database.getResultsMetadatasPredicate(predicate, layoutForView: layoutForView)
3534

36-
self.dataSource = NCCollectionViewDataSource(metadatas: metadatas, directoryOnTop: directoryOnTop)
35+
self.dataSource = NCCollectionViewDataSource(metadatas: metadatas)
3736

3837
if withLoadFolder {
3938
loadFolder()

iOSClient/AppDelegate.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -303,12 +303,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
303303
func openNotification(controller: NCMainTabBarController) {
304304
if app == NCGlobal.shared.termsOfServiceName {
305305
NotificationCenter.default.postOnMainThread(name: NCGlobal.shared.notificationCenterGetServerData, second: 0.5)
306-
} else if let viewController = UIStoryboard(name: "NCNotification", bundle: nil).instantiateInitialViewController() as? NCNotification {
306+
} else if let navigationController = UIStoryboard(name: "NCNotification", bundle: nil).instantiateInitialViewController() as? UINavigationController,
307+
let viewController = navigationController.topViewController as? NCNotification {
308+
viewController.modalPresentationStyle = .pageSheet
307309
viewController.session = NCSession.shared.getSession(account: account)
308310
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
309-
let navigationController = UINavigationController(rootViewController: viewController)
310-
navigationController.modalPresentationStyle = .fullScreen
311-
controller.present(navigationController, animated: true)
311+
controller.present(navigationController, animated: true, completion: nil)
312312
}
313313
}
314314
}

iOSClient/Assistant/Create Task/NCAssistantCreateNewTask.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ struct NCAssistantCreateNewTask: View {
5959
#Preview {
6060
let model = NCAssistantModel(controller: nil)
6161

62-
return NCAssistantCreateNewTask()
62+
NCAssistantCreateNewTask()
6363
.environmentObject(model)
6464
.onAppear {
6565
model.loadDummyData()

iOSClient/Assistant/Models/NCAssistantModel.swift

-2
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ class NCAssistantModel: ObservableObject {
209209
}
210210
}
211211

212-
#if DEBUG
213212
extension NCAssistantModel {
214213
public func loadDummyData() {
215214
let loremIpsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
@@ -233,7 +232,6 @@ extension NCAssistantModel {
233232
self.selectedTask = filteredTasks[0]
234233
}
235234
}
236-
#endif
237235

238236
extension AssistantTask {
239237
struct StatusInfo {

iOSClient/Assistant/NCAssistant.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ struct NCAssistant: View {
7878
#Preview {
7979
let model = NCAssistantModel(controller: nil)
8080

81-
return NCAssistant()
81+
NCAssistant()
8282
.environmentObject(model)
8383
.onAppear {
8484
model.loadDummyData()

iOSClient/Assistant/Task Detail/NCAssistantTaskDetail.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct NCAssistantTaskDetail: View {
3737
#Preview {
3838
let model = NCAssistantModel(controller: nil)
3939

40-
return NCAssistantTaskDetail(task: model.selectedTask!)
40+
NCAssistantTaskDetail(task: model.selectedTask!)
4141
.environmentObject(model)
4242
.onAppear {
4343
model.loadDummyData()

iOSClient/Data/NCManageDatabase+Activity.swift

-5
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,6 @@ extension NCManageDatabase {
189189
func getActivity(predicate: NSPredicate, filterFileId: String?) -> (all: [tableActivity], filter: [tableActivity]) {
190190
do {
191191
let realm = try Realm()
192-
realm.refresh()
193192
let results = realm.objects(tableActivity.self).filter(predicate).sorted(byKeyPath: "idActivity", ascending: false)
194193
let allActivity = Array(results.map(tableActivity.init))
195194
guard let filterFileId = filterFileId else {
@@ -207,7 +206,6 @@ extension NCManageDatabase {
207206
func getActivitySubjectRich(account: String, idActivity: Int, key: String) -> tableActivitySubjectRich? {
208207
do {
209208
let realm = try Realm()
210-
realm.refresh()
211209
let results = realm.objects(tableActivitySubjectRich.self).filter("account == %@ && idActivity == %d && key == %@", account, idActivity, key).first
212210
return results.map { tableActivitySubjectRich.init(value: $0) }
213211
} catch let error as NSError {
@@ -219,7 +217,6 @@ extension NCManageDatabase {
219217
func getActivitySubjectRich(account: String, idActivity: Int, id: String) -> tableActivitySubjectRich? {
220218
do {
221219
let realm = try Realm()
222-
realm.refresh()
223220
let results = realm.objects(tableActivitySubjectRich.self).filter("account == %@ && idActivity == %d && id == %@", account, idActivity, id)
224221
var activitySubjectRich = results.first
225222
if results.count == 2 {
@@ -241,7 +238,6 @@ extension NCManageDatabase {
241238

242239
do {
243240
let realm = try Realm()
244-
realm.refresh()
245241
for id in orderKeysId {
246242
if let result = realm.objects(tableActivityPreview.self).filter("account == %@ && idActivity == %d && fileId == %d", account, idActivity, Int(id) ?? 0).first {
247243
results.append(result)
@@ -272,7 +268,6 @@ extension NCManageDatabase {
272268
func getLatestActivityId(account: String) -> tableActivityLatestId? {
273269
do {
274270
let realm = try Realm()
275-
realm.refresh()
276271
return realm.objects(tableActivityLatestId.self).filter("account == %@", account).first
277272
} catch let error as NSError {
278273
NextcloudKit.shared.nkCommonInstance.writeLog("[ERROR] Could not access database: \(error)")

iOSClient/Data/NCManageDatabase+Avatar.swift

-2
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ extension NCManageDatabase {
5757
func getTableAvatar(fileName: String) -> tableAvatar? {
5858
do {
5959
let realm = try Realm()
60-
realm.refresh()
6160
guard let result = realm.objects(tableAvatar.self).filter("fileName == %@", fileName).first else { return nil }
6261
return tableAvatar.init(value: result)
6362
} catch let error as NSError {
@@ -110,7 +109,6 @@ extension NCManageDatabase {
110109

111110
do {
112111
let realm = try Realm()
113-
realm.refresh()
114112
let result = realm.objects(tableAvatar.self).filter("fileName == %@", fileName).first
115113
if result == nil {
116114
utilityFileSystem.removeFile(atPath: fileNameLocalPath)

iOSClient/Data/NCManageDatabase+Capabilities.swift

-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ extension NCManageDatabase {
5353
func getCapabilities(account: String) -> Data? {
5454
do {
5555
let realm = try Realm()
56-
realm.refresh()
5756
guard let result = realm.objects(tableCapabilities.self).filter("account == %@", account).first else { return nil }
5857
return result.jsondata
5958
} catch let error as NSError {

iOSClient/Data/NCManageDatabase+Chunk.swift

-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ extension NCManageDatabase {
3939
func getChunkFolder(account: String, ocId: String) -> String {
4040
do {
4141
let realm = try Realm()
42-
realm.refresh()
4342
guard let result = realm.objects(tableChunk.self).filter("account == %@ AND ocId == %@", account, ocId).first else { return NSUUID().uuidString }
4443
return result.chunkFolder
4544
} catch let error as NSError {
@@ -53,7 +52,6 @@ extension NCManageDatabase {
5352

5453
do {
5554
let realm = try Realm()
56-
realm.refresh()
5755
let results = realm.objects(tableChunk.self).filter("account == %@ AND ocId == %@", account, ocId).sorted(byKeyPath: "fileName", ascending: true)
5856
for result in results {
5957
filesChunk.append((fileName: "\(result.fileName)", size: result.size))

iOSClient/Data/NCManageDatabase+Comments.swift

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ extension NCManageDatabase {
7979
func getComments(account: String, objectId: String) -> [tableComments] {
8080
do {
8181
let realm = try Realm()
82-
realm.refresh()
8382
let results = realm.objects(tableComments.self).filter("account == %@ AND objectId == %@", account, objectId).sorted(byKeyPath: "creationDateTime", ascending: false)
8483
return Array(results.map(tableComments.init))
8584
} catch let error as NSError {

iOSClient/Data/NCManageDatabase+DashboardWidget.swift

-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ extension NCManageDatabase {
5151
func getDashboardWidget(account: String, id: String) -> (tableDashboardWidget?, [tableDashboardWidgetButton]?) {
5252
do {
5353
let realm = try Realm()
54-
realm.refresh()
5554
guard let resultDashboard = realm.objects(tableDashboardWidget.self).filter("account == %@ AND id == %@", account, id).first else { return (nil, nil) }
5655
let resultsButton = realm.objects(tableDashboardWidgetButton.self).filter("account == %@ AND id == %@", account, id).sorted(byKeyPath: "type", ascending: true)
5756
return (tableDashboardWidget.init(value: resultDashboard), Array(resultsButton.map { tableDashboardWidgetButton.init(value: $0) }))
@@ -64,7 +63,6 @@ extension NCManageDatabase {
6463
func getDashboardWidgetApplications(account: String) -> [tableDashboardWidget] {
6564
do {
6665
let realm = try Realm()
67-
realm.refresh()
6866
let sortProperties = [SortDescriptor(keyPath: "order", ascending: true), SortDescriptor(keyPath: "title", ascending: true)]
6967
let results = realm.objects(tableDashboardWidget.self).filter("account == %@", account).sorted(by: sortProperties)
7068
return Array(results.map { tableDashboardWidget.init(value: $0) })

iOSClient/Data/NCManageDatabase+DirectEditing.swift

-3
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ extension NCManageDatabase {
9696
func getDirectEditingCreators(account: String) -> [tableDirectEditingCreators]? {
9797
do {
9898
let realm = try Realm()
99-
realm.refresh()
10099
let results = realm.objects(tableDirectEditingCreators.self).filter("account == %@", account)
101100
if results.isEmpty {
102101
return nil
@@ -112,7 +111,6 @@ extension NCManageDatabase {
112111
func getDirectEditingCreators(predicate: NSPredicate) -> [tableDirectEditingCreators]? {
113112
do {
114113
let realm = try Realm()
115-
realm.refresh()
116114
let results = realm.objects(tableDirectEditingCreators.self).filter(predicate)
117115
if results.isEmpty {
118116
return nil
@@ -128,7 +126,6 @@ extension NCManageDatabase {
128126
func getDirectEditingEditors(account: String) -> [tableDirectEditingEditors]? {
129127
do {
130128
let realm = try Realm()
131-
realm.refresh()
132129
let results = realm.objects(tableDirectEditingEditors.self).filter("account == %@", account)
133130
if results.isEmpty {
134131
return nil

iOSClient/Data/NCManageDatabase+Directory.swift

-3
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ extension NCManageDatabase {
140140
func getTableDirectory(predicate: NSPredicate) -> tableDirectory? {
141141
do {
142142
let realm = try Realm()
143-
realm.refresh()
144143
guard let result = realm.objects(tableDirectory.self).filter(predicate).first else { return nil }
145144
return tableDirectory.init(value: result)
146145
} catch let error as NSError {
@@ -162,7 +161,6 @@ extension NCManageDatabase {
162161
func getTableDirectory(ocId: String) -> tableDirectory? {
163162
do {
164163
let realm = try Realm()
165-
realm.refresh()
166164
if let result = realm.objects(tableDirectory.self).filter("ocId == %@", ocId).first {
167165
return tableDirectory(value: result)
168166
} else {
@@ -177,7 +175,6 @@ extension NCManageDatabase {
177175
func getTablesDirectory(predicate: NSPredicate, sorted: String, ascending: Bool) -> [tableDirectory]? {
178176
do {
179177
let realm = try Realm()
180-
realm.refresh()
181178
let results = realm.objects(tableDirectory.self).filter(predicate).sorted(byKeyPath: sorted, ascending: ascending)
182179
if results.isEmpty {
183180
return nil

iOSClient/Data/NCManageDatabase+ExternalSites.swift

-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ extension NCManageDatabase {
7373
func getAllExternalSites(account: String) -> [tableExternalSites]? {
7474
do {
7575
let realm = try Realm()
76-
realm.refresh()
7776
let results = realm.objects(tableExternalSites.self).filter("account == %@", account).sorted(byKeyPath: "idExternalSite", ascending: true)
7877
if results.isEmpty {
7978
return nil

iOSClient/Data/NCManageDatabase+GPS.swift

-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ extension NCManageDatabase {
3737
func addGeocoderLocation(_ location: String, latitude: Double, longitude: Double) {
3838
do {
3939
let realm = try Realm()
40-
realm.refresh()
4140
guard realm.objects(tableGPS.self).filter("latitude == %@ AND longitude == %@", latitude, longitude).first == nil else { return }
4241
try realm.write {
4342
let addObject = tableGPS()
@@ -54,7 +53,6 @@ extension NCManageDatabase {
5453
func getLocationFromLatAndLong(latitude: Double, longitude: Double) -> String? {
5554
do {
5655
let realm = try Realm()
57-
realm.refresh()
5856
let result = realm.objects(tableGPS.self).filter("latitude == %@ AND longitude == %@", latitude, longitude).first
5957
return result?.location
6058
} catch let error as NSError {

iOSClient/Data/NCManageDatabase+LayoutForView.swift

-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ extension NCManageDatabase {
121121

122122
do {
123123
let realm = try Realm()
124-
realm.refresh()
125124
if let result = realm.objects(NCDBLayoutForView.self).filter("index == %@", index).first {
126125
return NCDBLayoutForView(value: result)
127126
} else {

iOSClient/Data/NCManageDatabase+Metadata.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ extension NCManageDatabase {
10521052

10531053
// MARK: - GetResult(s)Metadata
10541054

1055-
func getResultsMetadatasPredicate(_ predicate: NSPredicate, layoutForView: NCDBLayoutForView?, directoryOnTop: Bool) -> [tableMetadata] {
1055+
func getResultsMetadatasPredicate(_ predicate: NSPredicate, layoutForView: NCDBLayoutForView?, directoryOnTop: Bool = true) -> [tableMetadata] {
10561056
do {
10571057
let realm = try Realm()
10581058
var results = realm.objects(tableMetadata.self).filter(predicate).freeze()
@@ -1235,7 +1235,6 @@ extension NCManageDatabase {
12351235
func getResultsMetadatas(predicate: NSPredicate, sortedByKeyPath: String? = nil, ascending: Bool = false, freeze: Bool = false) -> Results<tableMetadata>? {
12361236
do {
12371237
let realm = try Realm()
1238-
realm.refresh()
12391238
if let sortedByKeyPath {
12401239
let results = realm.objects(tableMetadata.self).filter(predicate).sorted(byKeyPath: sortedByKeyPath, ascending: ascending)
12411240
if freeze {

iOSClient/Data/NCManageDatabase+PhotoLibrary.swift

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ extension NCManageDatabase {
8383

8484
do {
8585
let realm = try Realm()
86-
realm.refresh()
8786
let results = realm.objects(tablePhotoLibrary.self).filter(predicate)
8887
let idsAsset = results.map { $0.idAsset }
8988
return Array(idsAsset)

iOSClient/Data/NCManageDatabase+Share.swift

-5
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ extension NCManageDatabase {
147147
func getTableShares(account: String) -> [tableShare] {
148148
do {
149149
let realm = try Realm()
150-
realm.refresh()
151150
let sortProperties = [SortDescriptor(keyPath: "shareType", ascending: false), SortDescriptor(keyPath: "idShare", ascending: false)]
152151
let results = realm.objects(tableShare.self).filter("account == %@", account).sorted(by: sortProperties)
153152
return Array(results.map { tableShare.init(value: $0) })
@@ -160,7 +159,6 @@ extension NCManageDatabase {
160159
func getTableShares(metadata: tableMetadata) -> (firstShareLink: tableShare?, share: [tableShare]?) {
161160
do {
162161
let realm = try Realm()
163-
realm.refresh()
164162
let sortProperties = [SortDescriptor(keyPath: "shareType", ascending: false), SortDescriptor(keyPath: "idShare", ascending: false)]
165163
let firstShareLink = realm.objects(tableShare.self).filter("account == %@ AND serverUrl == %@ AND fileName == %@ AND shareType == 3", metadata.account, metadata.serverUrl, metadata.fileName).first
166164
if let firstShareLink = firstShareLink {
@@ -179,7 +177,6 @@ extension NCManageDatabase {
179177
func getTableShare(account: String, idShare: Int) -> tableShare? {
180178
do {
181179
let realm = try Realm()
182-
realm.refresh()
183180
guard let result = realm.objects(tableShare.self).filter("account = %@ AND idShare = %d", account, idShare).first else { return nil }
184181
return tableShare.init(value: result)
185182
} catch let error as NSError {
@@ -191,7 +188,6 @@ extension NCManageDatabase {
191188
func getTableShares(account: String, serverUrl: String) -> [tableShare] {
192189
do {
193190
let realm = try Realm()
194-
realm.refresh()
195191
let sortProperties = [SortDescriptor(keyPath: "shareType", ascending: false), SortDescriptor(keyPath: "idShare", ascending: false)]
196192
let results = realm.objects(tableShare.self).filter("account == %@ AND serverUrl == %@", account, serverUrl).sorted(by: sortProperties)
197193
return Array(results.map { tableShare.init(value: $0) })
@@ -207,7 +203,6 @@ extension NCManageDatabase {
207203
func getTableShares(account: String, serverUrl: String, fileName: String) -> [tableShare] {
208204
do {
209205
let realm = try Realm()
210-
realm.refresh()
211206
let sortProperties = [SortDescriptor(keyPath: "shareType", ascending: false), SortDescriptor(keyPath: "idShare", ascending: false)]
212207
let results = realm.objects(tableShare.self).filter("account == %@ AND serverUrl == %@ AND fileName == %@", account, serverUrl, fileName).sorted(by: sortProperties)
213208
return Array(results.map { tableShare.init(value: $0) })

0 commit comments

Comments
 (0)