Skip to content

Commit fe207fb

Browse files
NMC 2172 - Dashboard theming customisation changes
1 parent 1d8fa38 commit fe207fb

12 files changed

Lines changed: 923 additions & 754 deletions

Nextcloud.xcodeproj/project.pbxproj

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@
9292
AFCE353527E4ED5900FEA6C2 /* DateFormatter+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353427E4ED5900FEA6C2 /* DateFormatter+Extension.swift */; };
9393
AFCE353727E4ED7B00FEA6C2 /* NCShareCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353627E4ED7B00FEA6C2 /* NCShareCells.swift */; };
9494
AFCE353927E5DE0500FEA6C2 /* Shareable.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353827E5DE0400FEA6C2 /* Shareable.swift */; };
95+
AFCE353927E5DE0500FEA6C2 /* NCShare+Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353827E5DE0400FEA6C2 /* NCShare+Helper.swift */; };
96+
B5C9801E2DACEB5A0041B146 /* NCCollectionViewCommon+SwipeCollectionViewCellDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C9801D2DACEB5A0041B146 /* NCCollectionViewCommon+SwipeCollectionViewCellDelegate.swift */; };
97+
B5C980202DAD201A0041B146 /* NCSortMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5C9801F2DAD201A0041B146 /* NCSortMenu.swift */; };
98+
C04E2F232A17BB4D001BAD85 /* FilesIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C04E2F222A17BB4D001BAD85 /* FilesIntegrationTests.swift */; };
9599
D575039F27146F93008DC9DC /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7A0D1342591FBC5008F8A13 /* String+Extension.swift */; };
96100
D5B6AA7827200C7200D49C24 /* NCActivityTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B6AA7727200C7200D49C24 /* NCActivityTableViewCell.swift */; };
97101
F310B1EF2BA862F1001C42F5 /* NCViewerMedia+VisionKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = F310B1EE2BA862F1001C42F5 /* NCViewerMedia+VisionKit.swift */; };
@@ -1326,6 +1330,9 @@
13261330
AFCE353427E4ED5900FEA6C2 /* DateFormatter+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DateFormatter+Extension.swift"; sourceTree = "<group>"; };
13271331
AFCE353627E4ED7B00FEA6C2 /* NCShareCells.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareCells.swift; sourceTree = "<group>"; };
13281332
AFCE353827E5DE0400FEA6C2 /* Shareable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shareable.swift; sourceTree = "<group>"; };
1333+
AFCE353827E5DE0400FEA6C2 /* NCShare+Helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCShare+Helper.swift"; sourceTree = "<group>"; };
1334+
B5C9801D2DACEB5A0041B146 /* NCCollectionViewCommon+SwipeCollectionViewCellDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCCollectionViewCommon+SwipeCollectionViewCellDelegate.swift"; sourceTree = "<group>"; };
1335+
B5C9801F2DAD201A0041B146 /* NCSortMenu.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCSortMenu.swift; sourceTree = "<group>"; };
13291336
C0046CDA2A17B98400D87C9D /* NextcloudUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NextcloudUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
13301337
C04E2F202A17BB4D001BAD85 /* NextcloudIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NextcloudIntegrationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
13311338
D5B6AA7727200C7200D49C24 /* NCActivityTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCActivityTableViewCell.swift; sourceTree = "<group>"; };
@@ -2073,6 +2080,7 @@
20732080
371B5A2F23D0B04B00FAFAE9 /* Menu */ = {
20742081
isa = PBXGroup;
20752082
children = (
2083+
B5C9801F2DAD201A0041B146 /* NCSortMenu.swift */,
20762084
3704EB2923D5A58400455C5B /* NCMenu.storyboard */,
20772085
371B5A2D23D0B04500FAFAE9 /* NCMenu.swift */,
20782086
AF68326927BE65A90010BF0B /* NCMenuAction.swift */,
@@ -2534,6 +2542,7 @@
25342542
F7603298252F0E550015A421 /* Collection Common */ = {
25352543
isa = PBXGroup;
25362544
children = (
2545+
B5C9801D2DACEB5A0041B146 /* NCCollectionViewCommon+SwipeCollectionViewCellDelegate.swift */,
25372546
F75FE06B2BB01D0D00A0EFEF /* Cell */,
25382547
F78ACD50219046AC0088454D /* Section Header Footer */,
25392548
F70D7C3525FFBF81002B9E34 /* NCCollectionViewCommon.swift */,
@@ -4628,6 +4637,7 @@
46284637
F72944F52A8424F800246839 /* NCEndToEndMetadataV1.swift in Sources */,
46294638
F710D2022405826100A6033D /* NCViewer+Menu.swift in Sources */,
46304639
F765E9CD295C585800A09ED8 /* NCUploadScanDocument.swift in Sources */,
4640+
B5C980202DAD201A0041B146 /* NCSortMenu.swift in Sources */,
46314641
F741C2242B6B9FD600E849BB /* NCMediaSelectTabBar.swift in Sources */,
46324642
F77A697D250A0FBC00FF1708 /* NCCollectionViewCommon+Menu.swift in Sources */,
46334643
F7BF9D822934CA21009EE9A6 /* NCManageDatabase+LayoutForView.swift in Sources */,
@@ -4660,6 +4670,7 @@
46604670
F7D4BF402CA2E8D800A5E746 /* TOPasscodeButtonLabel.m in Sources */,
46614671
F7D4BF412CA2E8D800A5E746 /* TOPasscodeViewControllerAnimatedTransitioning.m in Sources */,
46624672
F7D4BF422CA2E8D800A5E746 /* TOPasscodeSettingsViewController.m in Sources */,
4673+
B5C9801E2DACEB5A0041B146 /* NCCollectionViewCommon+SwipeCollectionViewCellDelegate.swift in Sources */,
46634674
F7D4BF432CA2E8D800A5E746 /* TOPasscodeCircleImage.m in Sources */,
46644675
F7D4BF442CA2E8D800A5E746 /* TOPasscodeView.m in Sources */,
46654676
F7D4BF452CA2E8D800A5E746 /* TOPasscodeCircleButton.m in Sources */,

iOSClient/Main/Collection Common/Cell/NCCellProtocol.swift

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ protocol NCCellProtocol {
3939
var fileSharedImage: UIImageView? { get set }
4040
var fileMoreImage: UIImageView? { get set }
4141
var cellSeparatorView: UIView? { get set }
42-
var indexPath: IndexPath { get set }
4342
var fileSharedLabel: UILabel? { get set }
43+
var fileProgressView: UIProgressView? { get set }
4444

4545
func titleInfoTrailingDefault()
4646
func titleInfoTrailingFull()
4747
func writeInfoDateSize(date: NSDate, size: Int64)
48-
func setButtonMore(image: UIImage)
48+
func setButtonMore(named: String, image: UIImage)
4949
func hideImageItem(_ status: Bool)
5050
func hideImageFavorite(_ status: Bool)
5151
func hideImageStatus(_ status: Bool)
@@ -55,6 +55,8 @@ protocol NCCellProtocol {
5555
func hideLabelSubinfo(_ status: Bool)
5656
func hideButtonShare(_ status: Bool)
5757
func hideButtonMore(_ status: Bool)
58+
func selectMode(_ status: Bool)
59+
func selected(_ status: Bool)
5860
func selected(_ status: Bool, isEditMode: Bool)
5961
func setAccessibility(label: String, value: String)
6062
func setTags(tags: [String])
@@ -121,11 +123,19 @@ extension NCCellProtocol {
121123
get { return nil }
122124
set { }
123125
}
124-
126+
var fileProgressView: UIProgressView? {
127+
get { return nil }
128+
set {}
129+
}
130+
var fileSelectImage: UIImageView? {
131+
get { return nil }
132+
set {}
133+
}
134+
125135
func titleInfoTrailingDefault() {}
126136
func titleInfoTrailingFull() {}
127137
func writeInfoDateSize(date: NSDate, size: Int64) {}
128-
func setButtonMore(image: UIImage) {}
138+
func setButtonMore(named: String, image: UIImage) {}
129139
func hideImageItem(_ status: Bool) {}
130140
func hideImageFavorite(_ status: Bool) {}
131141
func hideImageStatus(_ status: Bool) {}
@@ -135,6 +145,8 @@ extension NCCellProtocol {
135145
func hideLabelSubinfo(_ status: Bool) {}
136146
func hideButtonShare(_ status: Bool) {}
137147
func hideButtonMore(_ status: Bool) {}
148+
func selectMode(_ status: Bool) {}
149+
func selected(_ status: Bool) {}
138150
func selected(_ status: Bool, isEditMode: Bool) {}
139151
func setAccessibility(label: String, value: String) {}
140152
func setTags(tags: [String]) {}

iOSClient/Main/Collection Common/Cell/NCListCell.swift

Lines changed: 52 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,19 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
4444
@IBOutlet weak var separatorHeightConstraint: NSLayoutConstraint!
4545
@IBOutlet weak var subInfoTrailingConstraint: NSLayoutConstraint!
4646

47-
private var objectId = ""
47+
private var ocId = ""
48+
private var ocIdTransfer = ""
4849
private var user = ""
49-
var indexPath = IndexPath()
5050

5151
weak var listCellDelegate: NCListCellDelegate?
5252
var namedButtonMore = ""
5353

5454
var fileAvatarImageView: UIImageView? {
5555
return imageShared
5656
}
57-
var fileObjectId: String? {
58-
get { return objectId }
59-
set { objectId = newValue ?? "" }
57+
var fileOcId: String? {
58+
get { return ocId }
59+
set { ocId = newValue ?? "" }
6060
}
6161
var filePreviewImageView: UIImageView? {
6262
get { return imageItem }
@@ -118,7 +118,11 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
118118

119119
override func awakeFromNib() {
120120
super.awakeFromNib()
121+
initCell()
122+
}
121123

124+
func initCell() {
125+
122126
imageItem.layer.cornerRadius = 6
123127
imageItem.layer.masksToBounds = true
124128

@@ -128,9 +132,10 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
128132
accessibilityValue = nil
129133
isAccessibilityElement = true
130134

131-
progressView.tintColor = NCBrandColor.shared.brandElement
135+
progressView.tintColor = NCBrandColor.shared.brand
132136
progressView.transform = CGAffineTransform(scaleX: 1.0, y: 0.5)
133137
progressView.trackTintColor = .clear
138+
imageSelect.isHidden = true
134139

135140
let longPressedGesture = UILongPressGestureRecognizer(target: self, action: #selector(longPress(gestureRecognizer:)))
136141
longPressedGesture.minimumPressDuration = 0.5
@@ -140,36 +145,41 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
140145

141146
separator.backgroundColor = .separator
142147
separatorHeightConstraint.constant = 0.5
148+
titleInfoTrailingDefault()
143149

144150
labelTitle.text = ""
145151
labelInfo.text = ""
146152
labelTitle.textColor = .label
147153
labelInfo.textColor = .systemGray
148154
labelSubinfo.textColor = .systemGray
155+
setButtonMore(named: NCGlobal.shared.buttonMoreMore, image: NCImageCache.images.buttonMore)
156+
imageMore.isHidden = false
157+
buttonMore.isHidden = false
149158
}
150159

151160
override func prepareForReuse() {
152161
super.prepareForReuse()
153-
imageItem.backgroundColor = nil
154-
accessibilityHint = nil
155-
accessibilityLabel = nil
156-
accessibilityValue = nil
162+
initCell()
157163
}
158164

159165
override func snapshotView(afterScreenUpdates afterUpdates: Bool) -> UIView? {
160166
return nil
161167
}
162168

163169
@IBAction func touchUpInsideShare(_ sender: Any) {
164-
listCellDelegate?.tapShareListItem(with: objectId, indexPath: indexPath, sender: sender)
170+
listCellDelegate?.tapShareListItem(with: ocId, ocIdTransfer: ocIdTransfer, sender: sender)
165171
}
166172

167173
@IBAction func touchUpInsideMore(_ sender: Any) {
168-
listCellDelegate?.tapMoreListItem(with: objectId, namedButtonMore: namedButtonMore, image: imageItem.image, indexPath: indexPath, sender: sender)
174+
listCellDelegate?.tapMoreListItem(with: ocId, ocIdTransfer: ocIdTransfer, namedButtonMore: namedButtonMore, image: imageItem.image, sender: sender)
169175
}
170176

171177
@objc func longPress(gestureRecognizer: UILongPressGestureRecognizer) {
172-
listCellDelegate?.longPressListItem(with: objectId, indexPath: indexPath, gestureRecognizer: gestureRecognizer)
178+
listCellDelegate?.longPressListItem(with: ocId, ocIdTransfer: ocIdTransfer, namedButtonMore: namedButtonMore, gestureRecognizer: gestureRecognizer)
179+
}
180+
181+
@objc func longPressInsideMore(gestureRecognizer: UILongPressGestureRecognizer) {
182+
listCellDelegate?.longPressMoreListItem(with: ocId, namedButtonMore: namedButtonMore, gestureRecognizer: gestureRecognizer)
173183
}
174184

175185
fileprivate func setA11yActions() {
@@ -215,40 +225,57 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
215225
separator.isHidden = status
216226
}
217227

218-
func selected(_ status: Bool, isEditMode: Bool) {
219-
if isEditMode {
228+
func selectMode(_ status: Bool) {
229+
if status {
220230
imageItemLeftConstraint.constant = 45
221231
imageSelect.isHidden = false
222-
imageShared.isHidden = true
223232
imageMore.isHidden = true
224233
buttonShared.isHidden = true
225234
buttonMore.isHidden = true
226235
accessibilityCustomActions = nil
227236
} else {
228237
imageItemLeftConstraint.constant = 10
229238
imageSelect.isHidden = true
230-
imageShared.isHidden = false
231239
imageMore.isHidden = false
232240
buttonShared.isHidden = false
233241
buttonMore.isHidden = false
234242
backgroundView = nil
235243
setA11yActions()
236244
}
245+
}
246+
247+
func selected(_ status: Bool, isEditMode: Bool) {
248+
// NMC-1190 - iOS - Files - Deleting files while files are still uploading won't delete properly : to fix this issue remove check for !metadata.isInTransfer in below line
249+
guard let metadata = NCManageDatabase.shared.getMetadataFromOcId(ocId), !metadata.isInTransfer, !metadata.e2eEncrypted else {
250+
backgroundView = nil
251+
separator.isHidden = false
252+
imageSelect.isHidden = true
253+
254+
return
255+
}
256+
237257
if status {
258+
var blurEffect: UIVisualEffect?
238259
var blurEffectView: UIView?
239-
blurEffectView = UIVisualEffectView(effect: UIBlurEffect(style: .systemMaterial))
240-
blurEffectView?.backgroundColor = .lightGray
260+
if traitCollection.userInterfaceStyle == .dark {
261+
blurEffect = UIBlurEffect(style: .dark)
262+
blurEffectView = UIVisualEffectView(effect: blurEffect)
263+
blurEffectView?.backgroundColor = .black
264+
} else {
265+
blurEffect = UIBlurEffect(style: .extraLight)
266+
blurEffectView = UIVisualEffectView(effect: blurEffect)
267+
blurEffectView?.backgroundColor = .lightGray
268+
}
241269
blurEffectView?.frame = self.bounds
242270
blurEffectView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
243-
imageSelect.image = NCImageCache.images.checkedYes
244271
backgroundView = blurEffectView
272+
imageSelect.image = NCImageCache.images.checkedYes
245273
separator.isHidden = true
246274
} else {
247275
imageSelect.image = NCImageCache.images.checkedNo
248276
backgroundView = nil
249277
separator.isHidden = false
250278
}
251-
252279
}
253280

254281
func writeInfoDateSize(date: NSDate, size: Int64) {
@@ -263,9 +290,10 @@ class NCListCell: UICollectionViewCell, UIGestureRecognizerDelegate, NCCellProto
263290
}
264291

265292
protocol NCListCellDelegate: AnyObject {
266-
func tapShareListItem(with objectId: String, indexPath: IndexPath, sender: Any)
267-
func tapMoreListItem(with objectId: String, namedButtonMore: String, image: UIImage?, indexPath: IndexPath, sender: Any)
268-
func longPressListItem(with objectId: String, indexPath: IndexPath, gestureRecognizer: UILongPressGestureRecognizer)
293+
func tapShareListItem(with ocId: String, ocIdTransfer: String, sender: Any)
294+
func tapMoreListItem(with ocId: String, ocIdTransfer: String, namedButtonMore: String, image: UIImage?, sender: Any)
295+
func longPressMoreListItem(with ocId: String, namedButtonMore: String, gestureRecognizer: UILongPressGestureRecognizer)
296+
func longPressListItem(with ocId: String, ocIdTransfer: String, namedButtonMore: String, gestureRecognizer: UILongPressGestureRecognizer)
269297
}
270298

271299
// MARK: - List Layout

0 commit comments

Comments
 (0)