Skip to content

Commit cc5e176

Browse files
author
Marino Faggiana
authored
Version 5.2.4 (#2861)
1 parent 69d1122 commit cc5e176

Some content is hidden

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

54 files changed

+713
-809
lines changed

.swiftlint.yml

-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
opt_in_rules: # some rules are turned off by default, so you need to opt-in
22
- empty_collection_literal
3-
- empty_count
43
- empty_string
54
- explicit_init
65
- unneeded_parentheses_in_closure_argument
76
- operator_usage_whitespace
87

9-
empty_count:
10-
severity: warning
11-
128
line_length:
139
warning: 1000
1410
error: 5000

Nextcloud.xcodeproj/project.pbxproj

+32-30
Large diffs are not rendered by default.

Share/NCShareExtension+DataSource.swift

+29-3
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,34 @@ extension NCShareExtension: UICollectionViewDelegate {
3939
reloadDatasource(withLoadFolder: true)
4040
setNavigationBar(navigationTitle: metadata.fileNameView)
4141
}
42+
43+
func collectionView(_ collectionView: UICollectionView, viewForSupplementaryElementOfKind kind: String, at indexPath: IndexPath) -> UICollectionReusableView {
44+
if kind == UICollectionView.elementKindSectionHeader {
45+
guard let header = collectionView.dequeueReusableSupplementaryView(ofKind: kind, withReuseIdentifier: "sectionHeaderEmptyData", for: indexPath) as? NCSectionHeaderEmptyData else { return NCSectionHeaderEmptyData() }
46+
if self.dataSourceTask?.state == .running {
47+
header.emptyImage.image = UIImage(named: "networkInProgress")?.image(color: .gray, size: UIScreen.main.bounds.width)
48+
header.emptyTitle.text = NSLocalizedString("_request_in_progress_", comment: "")
49+
header.emptyDescription.text = ""
50+
} else {
51+
header.emptyImage.image = UIImage(named: "folder")?.image(color: NCBrandColor.shared.brandElement, size: UIScreen.main.bounds.width)
52+
header.emptyTitle.text = NSLocalizedString("_files_no_folders_", comment: "")
53+
header.emptyDescription.text = ""
54+
}
55+
return header
56+
} else {
57+
return UICollectionReusableView()
58+
}
59+
}
60+
}
61+
62+
extension NCShareExtension: UICollectionViewDelegateFlowLayout {
63+
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, referenceSizeForHeaderInSection section: Int) -> CGSize {
64+
var height: CGFloat = 0
65+
if dataSource.getMetadataSourceForAllSections().isEmpty {
66+
height = NCGlobal.shared.getHeightHeaderEmptyData(view: view, portraitOffset: 0, landscapeOffset: -50)
67+
}
68+
return CGSize(width: collectionView.frame.width, height: height)
69+
}
4270
}
4371

4472
extension NCShareExtension: UICollectionViewDataSource {
@@ -48,9 +76,7 @@ extension NCShareExtension: UICollectionViewDataSource {
4876
}
4977

5078
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
51-
let numberOfItems = dataSource.numberOfItemsInSection(section)
52-
emptyDataSet?.numberOfItemsInSection(numberOfItems, section: section)
53-
return numberOfItems
79+
return dataSource.numberOfItemsInSection(section)
5480
}
5581

5682
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {

Share/NCShareExtension+NCDelegate.swift

+1-15
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,7 @@
2424
import NextcloudKit
2525
import UIKit
2626

27-
extension NCShareExtension: NCEmptyDataSetDelegate, NCAccountRequestDelegate {
28-
// MARK: - Empty
29-
30-
func emptyDataSetView(_ view: NCEmptyView) {
31-
32-
if self.dataSourceTask?.state == .running {
33-
view.emptyImage.image = UIImage(named: "networkInProgress")?.image(color: .gray, size: UIScreen.main.bounds.width)
34-
view.emptyTitle.text = NSLocalizedString("_request_in_progress_", comment: "")
35-
view.emptyDescription.text = ""
36-
} else {
37-
view.emptyImage.image = UIImage(named: "folder")?.image(color: NCBrandColor.shared.brandElement, size: UIScreen.main.bounds.width)
38-
view.emptyTitle.text = NSLocalizedString("_files_no_folders_", comment: "")
39-
view.emptyDescription.text = ""
40-
}
41-
}
27+
extension NCShareExtension: NCAccountRequestDelegate {
4228

4329
// MARK: - Account
4430

Share/NCShareExtension.swift

+1-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ class NCShareExtension: UIViewController {
5454
var filesName: [String] = []
5555
// -------------------------------------------------------------
5656

57-
var emptyDataSet: NCEmptyDataSet?
5857
let keyLayout = NCGlobal.shared.layoutViewShareExtension
5958
var metadataFolder: tableMetadata?
6059
var dataSourceTask: URLSessionTask?
@@ -82,6 +81,7 @@ class NCShareExtension: UIViewController {
8281

8382
self.navigationController?.navigationBar.prefersLargeTitles = false
8483

84+
collectionView.register(UINib(nibName: "NCSectionHeaderEmptyData", bundle: nil), forSupplementaryViewOfKind: UICollectionView.elementKindSectionHeader, withReuseIdentifier: "sectionHeaderEmptyData")
8585
collectionView.register(UINib(nibName: "NCListCell", bundle: nil), forCellWithReuseIdentifier: "listCell")
8686
collectionView.collectionViewLayout = NCListLayout()
8787

@@ -265,10 +265,7 @@ class NCShareExtension: UIViewController {
265265
if filesName.count <= 3 {
266266
self.tableView.isScrollEnabled = false
267267
}
268-
// Label upload button
269268
uploadLabel.text = NSLocalizedString("_upload_", comment: "") + " \(filesName.count) " + NSLocalizedString("_files_", comment: "")
270-
// Empty
271-
emptyDataSet = NCEmptyDataSet(view: collectionView, offset: -50 * counter, delegate: self)
272269
self.tableView.reloadData()
273270
}
274271

iOSClient/EmptyView/NCEmptyDataSet.swift

-129
This file was deleted.

iOSClient/EmptyView/NCEmptyView.xib

-71
This file was deleted.

iOSClient/Favorites/NCFavorite.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ import NextcloudKit
2626

2727
class NCFavorite: NCCollectionViewCommon {
2828

29-
// MARK: - View Life Cycle
30-
3129
required init?(coder aDecoder: NSCoder) {
3230
super.init(coder: aDecoder)
3331

@@ -40,6 +38,8 @@ class NCFavorite: NCCollectionViewCommon {
4038
emptyDescription = "_tutorial_favorite_view_"
4139
}
4240

41+
// MARK: - View Life Cycle
42+
4343
override func viewWillAppear(_ animated: Bool) {
4444
super.viewWillAppear(animated)
4545

iOSClient/Files/NCFiles.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ class NCFiles: NCCollectionViewCommon {
3030
internal var fileNameBlink: String?
3131
internal var fileNameOpen: String?
3232

33-
// MARK: - View Life Cycle
34-
3533
required init?(coder aDecoder: NSCoder) {
3634
super.init(coder: aDecoder)
3735

@@ -45,6 +43,8 @@ class NCFiles: NCCollectionViewCommon {
4543
emptyDescription = "_no_file_pull_down_"
4644
}
4745

46+
// MARK: - View Life Cycle
47+
4848
override func viewDidLoad() {
4949
super.viewDidLoad()
5050

iOSClient/Groupfolders/NCGroupfolders.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ import NextcloudKit
2626

2727
class NCGroupfolders: NCCollectionViewCommon {
2828

29-
// MARK: - View Life Cycle
30-
3129
required init?(coder aDecoder: NSCoder) {
3230
super.init(coder: aDecoder)
3331

@@ -40,6 +38,8 @@ class NCGroupfolders: NCCollectionViewCommon {
4038
emptyDescription = "_tutorial_groupfolders_view_"
4139
}
4240

41+
// MARK: - View Life Cycle
42+
4343
override func viewWillAppear(_ animated: Bool) {
4444
super.viewWillAppear(animated)
4545

iOSClient/Images.xcassets/Image.imageset/Contents.json

-9
This file was deleted.

iOSClient/Images.xcassets/Image.imageset/folder_link.svg

-10
This file was deleted.

0 commit comments

Comments
 (0)