Skip to content

Commit

Permalink
Merge pull request #2522 from nextcloud/develop
Browse files Browse the repository at this point in the history
V 4.8.5
  • Loading branch information
marinofaggiana authored Jul 7, 2023
2 parents 577bdcb + 0152f6a commit b11cd42
Show file tree
Hide file tree
Showing 37 changed files with 906 additions and 940 deletions.
17 changes: 1 addition & 16 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ disabled_rules:
- cyclomatic_complexity
- nesting
- shorthand_operator
- force_try
- type_name

excluded:
- Carthage
Expand Down Expand Up @@ -70,21 +70,6 @@ excluded:
- iOSClient/AppDelegate.swift
- iOSClient/BackgroundImageColor/NCBackgroundImageColor.swift
- iOSClient/BrowserWeb/NCBrowserWeb.swift
- iOSClient/Data/NCDataSource.swift
- iOSClient/Data/NCDatabase.swift
- iOSClient/Data/NCElementsJSON.swift
- iOSClient/Data/NCManageDatabase+Capabilities.swift
- iOSClient/Data/NCManageDatabase+Account.swift
- iOSClient/Data/NCManageDatabase+Activity.swift
- iOSClient/Data/NCManageDatabase+Avatar.swift
- iOSClient/Data/NCManageDatabase+E2EE.swift
- iOSClient/Data/NCManageDatabase.swift
- iOSClient/Data/NCManageDatabase+Metadata.swift
- iOSClient/Data/NCManageDatabase+Directory.swift
- iOSClient/Data/NCManageDatabase+Share.swift
- iOSClient/Data/NCManageDatabase+Video.swift
- iOSClient/Data/NCManageDatabase+LayoutForView.swift
- iOSClient/Data/NCManageDatabase+DashboardWidget.swift
- iOSClient/Diagnostics/NCCapabilitiesViewController.swift
- iOSClient/EmptyView/NCEmptyDataSet.swift
- iOSClient/Extensions/UIColor+Extensions.swift
Expand Down
2 changes: 1 addition & 1 deletion Brand/Database.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ import Foundation
// Database Realm
//
let databaseName = "nextcloud.realm"
let databaseSchemaVersion: UInt64 = 297
let databaseSchemaVersion: UInt64 = 299
2 changes: 1 addition & 1 deletion Cartfile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github "https://github.com/marinofaggiana/TOPasscodeViewController" "master"
binary "https://code.videolan.org/videolan/VLCKit/raw/master/Packaging/MobileVLCKit.json" ~> 3.3.0
binary "https://code.videolan.org/videolan/VLCKit/raw/master/Packaging/MobileVLCKit.json" ~> 3.5.1
8 changes: 4 additions & 4 deletions Nextcloud.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -4566,7 +4566,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
Expand All @@ -4592,7 +4592,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 4.8.4;
MARKETING_VERSION = 4.8.5;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SDKROOT = iphoneos;
Expand Down Expand Up @@ -4631,7 +4631,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 4;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = NKUJUXUJ3B;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
Expand All @@ -4654,7 +4654,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
MARKETING_VERSION = 4.8.4;
MARKETING_VERSION = 4.8.5;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SDKROOT = iphoneos;
Expand Down
47 changes: 23 additions & 24 deletions iOSClient/Data/NCDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ class NCDataSource: NSObject {

// Unified search
if let providers = self.providers, !providers.isEmpty {
let sectionsDictionary = ThreadSafeDictionary<String,Int>()
let sectionsDictionary = ThreadSafeDictionary<String, Int>()
for section in self.sectionsValue {
if let provider = providers.filter({ $0.id == section}).first {
sectionsDictionary[section] = provider.order
}
}
self.sectionsValue.removeAll()
let sectionsDictionarySorted = sectionsDictionary.sorted(by: { $0.value < $1.value } )
let sectionsDictionarySorted = sectionsDictionary.sorted(by: {$0.value < $1.value })
for section in sectionsDictionarySorted {
if section.key == NCGlobal.shared.appName {
self.sectionsValue.insert(section.key, at: 0)
Expand Down Expand Up @@ -173,15 +173,15 @@ class NCDataSource: NSObject {
searchResult = searchResults.filter({ $0.id == sectionValue}).first
}
let metadatas = self.metadatas.filter({ getSectionValue(metadata: $0) == sectionValue})
let metadataForSection = NCMetadataForSection.init(sectionValue: sectionValue,
metadatas: metadatas,
localFiles: self.localFiles,
lastSearchResult: searchResult,
sort: self.sort,
ascending: self.ascending,
directoryOnTop: self.directoryOnTop,
favoriteOnTop: self.favoriteOnTop,
filterLivePhoto: self.filterLivePhoto)
let metadataForSection = NCMetadataForSection(sectionValue: sectionValue,
metadatas: metadatas,
localFiles: self.localFiles,
lastSearchResult: searchResult,
sort: self.sort,
ascending: self.ascending,
directoryOnTop: self.directoryOnTop,
favoriteOnTop: self.favoriteOnTop,
filterLivePhoto: self.filterLivePhoto)
metadatasForSection.append(metadataForSection)
}

Expand All @@ -200,8 +200,8 @@ class NCDataSource: NSObject {

@discardableResult
func appendMetadatasToSection(_ metadatas: [tableMetadata], metadataForSection: NCMetadataForSection, lastSearchResult: NKSearchResult) -> [IndexPath] {
guard let sectionIndex = getSectionIndex(metadataForSection.sectionValue) else { return [] }

guard let sectionIndex = getSectionIndex(metadataForSection.sectionValue) else { return [] }
var indexPaths: [IndexPath] = []

self.metadatas.append(contentsOf: metadatas)
Expand Down Expand Up @@ -268,7 +268,7 @@ class NCDataSource: NSObject {
let (indexPath, metadataForSection) = self.getIndexPathMetadata(ocId: ocId)
if let indexPath = indexPath, let metadataForSection = metadataForSection, indexPath.row < metadataForSection.metadatas.count {
metadataForSection.metadatas.remove(at: indexPath.row)
if metadataForSection.metadatas.count == 0 {
if metadataForSection.metadatas.isEmpty {
// REMOVE sectionsValue / metadatasForSection
sectionValue = metadataForSection.sectionValue
if let sectionIndex = getSectionIndex(sectionValue) {
Expand Down Expand Up @@ -329,32 +329,32 @@ class NCDataSource: NSObject {
}

func isSameNumbersOfSections(numberOfSections: Int) -> Bool {
guard self.metadatasForSection.count > 0 else { return false }
guard !self.metadatasForSection.isEmpty else { return false }
return numberOfSections == self.numberOfSections()
}

func numberOfSections() -> Int {
guard self.sectionsValue.count > 0 else { return 1 }
guard !self.sectionsValue.isEmpty else { return 1 }
return self.sectionsValue.count
}

func numberOfItemsInSection(_ section: Int) -> Int {
guard self.sectionsValue.count > 0 && self.metadatas.count > 0, let metadataForSection = getMetadataForSection(section) else { return 0}
guard !self.sectionsValue.isEmpty && !self.metadatas.isEmpty, let metadataForSection = getMetadataForSection(section) else { return 0}
return metadataForSection.metadatas.count
}

func cellForItemAt(indexPath: IndexPath) -> tableMetadata? {
guard metadatasForSection.count > 0 && indexPath.section < metadatasForSection.count, let metadataForSection = getMetadataForSection(indexPath.section), indexPath.row < metadataForSection.metadatas.count else { return nil }
guard !metadatasForSection.isEmpty && indexPath.section < metadatasForSection.count, let metadataForSection = getMetadataForSection(indexPath.section), indexPath.row < metadataForSection.metadatas.count else { return nil }
return metadataForSection.metadatas[indexPath.row]
}

func getSectionValue(indexPath: IndexPath) -> String {
guard metadatasForSection.count > 0 , let metadataForSection = self.getMetadataForSection(indexPath.section) else { return ""}
guard !metadatasForSection.isEmpty, let metadataForSection = self.getMetadataForSection(indexPath.section) else { return ""}
return metadataForSection.sectionValue
}

func getSectionValueLocalization(indexPath: IndexPath) -> String {
guard metadatasForSection.count > 0 , let metadataForSection = self.getMetadataForSection(indexPath.section) else { return ""}
guard !metadatasForSection.isEmpty, let metadataForSection = self.getMetadataForSection(indexPath.section) else { return ""}
if let searchResults = self.searchResults, let searchResult = searchResults.filter({ $0.id == metadataForSection.sectionValue}).first {
return searchResult.name
}
Expand Down Expand Up @@ -423,7 +423,7 @@ class NCMetadataForSection: NSObject {
var lastSearchResult: NKSearchResult?
var unifiedSearchInProgress: Bool = false

private var sort : String
private var sort: String
private var ascending: Bool
private var directoryOnTop: Bool
private var favoriteOnTop: Bool
Expand Down Expand Up @@ -478,7 +478,7 @@ class NCMetadataForSection: NSObject {

// Metadata order
//
if sort != "none" && sort != "" {
if sort != "none" && !sort.isEmpty {
metadatasSorted = metadatas.sorted {

switch sort {
Expand Down Expand Up @@ -543,7 +543,6 @@ class NCMetadataForSection: NSObject {
metadatasFile.append(metadata)
}

//Info
if metadata.directory {
ocIds.append(metadata.ocId)
numDirectory += 1
Expand Down
Loading

0 comments on commit b11cd42

Please sign in to comment.