From 8c6a08bcc396fc1c304dafc65647824ef998d11d Mon Sep 17 00:00:00 2001 From: TSI-amrutwaghmare <96108296+TSI-amrutwaghmare@users.noreply.github.com> Date: Mon, 23 Oct 2023 14:24:51 +0530 Subject: [PATCH 1/4] NMC 1935 - Notification screen customisation --- .../NCNotificationText.swift | 85 ++++++++ .../Notification/NCNotification.storyboard | 202 ++++++++---------- iOSClient/Notification/NCNotification.swift | 60 ++---- 3 files changed, 193 insertions(+), 154 deletions(-) create mode 100644 Tests/NextcloudUnitTests/NCNotificationText.swift diff --git a/Tests/NextcloudUnitTests/NCNotificationText.swift b/Tests/NextcloudUnitTests/NCNotificationText.swift new file mode 100644 index 0000000000..1a7e0b2345 --- /dev/null +++ b/Tests/NextcloudUnitTests/NCNotificationText.swift @@ -0,0 +1,85 @@ +// +// NCNotificationText.swift +// NextcloudUnitTests +// +// Created by Amrut Waghmare on 18/10/23. +// Copyright © 2023 Marino Faggiana. All rights reserved. +// + +@testable import Nextcloud +import XCTest +import NextcloudKit + +class NCNotificationText: XCTestCase { + var viewController : NCNotification! + + override func setUpWithError() throws { + // Step 1. Create an instance of UIStoryboard + let storyboard = UIStoryboard(name: "NCNotification", bundle: nil) + // Step 2. Instantiate UIViewController with Storyboard ID + viewController = storyboard.instantiateViewController(withIdentifier: "NCNotification.storyboard") as? NCNotification + + // Step 3. Make the viewDidLoad() execute. + viewController.loadViewIfNeeded() + } + + override func tearDownWithError() throws { + viewController = nil + } + + //Test that a cell with the correct reuse identifier is dequeued + func testTableViewCellDequeue() { + let notification = NKNotifications() + viewController.notifications = [notification] + let tableView = UITableView() + tableView.register(NCNotificationCell.self, forCellReuseIdentifier: "Cell") + let indexPath = IndexPath(row: 0, section: 0) + let cell = viewController.tableView(tableView, cellForRowAt: indexPath) as? NCNotificationCell + XCTAssertNotNil(cell) + XCTAssertEqual(cell?.reuseIdentifier, "Cell") + } + + //Test that the cell's icon is set image + func testTableViewCellIcon() { + let notification = NKNotifications() + viewController.notifications = [notification] + let tableView = UITableView() + tableView.register(NCNotificationCell.self, forCellReuseIdentifier: "Cell") + let indexPath = IndexPath(row: 0, section: 0) + let cell = viewController.tableView(tableView, cellForRowAt: indexPath) as? NCNotificationCell + XCTAssertNotNil(cell?.icon.image) + } + + //Test that the cell's primary and secondary buttons are set up correctly + func testTableViewCellButtons() { + let notification = NKNotifications() + notification.actions = Data("[{\"label\":\"OK\",\"primary\":true},{\"label\":\"Cancel\",\"primary\":false}]".utf8) + viewController.notifications = [notification] + let tableView = UITableView() + tableView.register(NCNotificationCell.self, forCellReuseIdentifier: "Cell") + let indexPath = IndexPath(row: 0, section: 0) + let cell = viewController.tableView(tableView, cellForRowAt: indexPath) as? NCNotificationCell + XCTAssertEqual(cell?.primary.title(for: .normal), "OK") + XCTAssertEqual(cell?.secondary.title(for: .normal), "Cancel") + } + + //Test that the cell's date label is set correctly + func testTableViewCellDate() { + let notification = NKNotifications() + notification.date = NSDate() + viewController.notifications = [notification] + let tableView = UITableView() + tableView.register(NCNotificationCell.self, forCellReuseIdentifier: "Cell") + let indexPath = IndexPath(row: 0, section: 0) + let cell = viewController.tableView(tableView, cellForRowAt: indexPath) as? NCNotificationCell + XCTAssertEqual(cell?.date.text, "less than a minute ago") + } + + //Test with a color that is image not nil + func testImageNotNil() { + let color = UIColor(red: 0.5, green: 0.5, blue: 0.5, alpha: 1.0) + let image = UIImage().imageColor(color) + XCTAssertNotNil(image, "Image should not be nil.") + + } +} diff --git a/iOSClient/Notification/NCNotification.storyboard b/iOSClient/Notification/NCNotification.storyboard index fb122ec81a..a89ba02d24 100644 --- a/iOSClient/Notification/NCNotification.storyboard +++ b/iOSClient/Notification/NCNotification.storyboard @@ -1,193 +1,163 @@ - + - + - + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - + + + + + + + + + + + - - + + - - + + - - - - - - - - - - - - - - - - - - - + - + + diff --git a/iOSClient/Notification/NCNotification.swift b/iOSClient/Notification/NCNotification.swift index 00a2662c9e..e872a9d119 100644 --- a/iOSClient/Notification/NCNotification.swift +++ b/iOSClient/Notification/NCNotification.swift @@ -50,6 +50,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate { tableView.rowHeight = UITableView.automaticDimension tableView.estimatedRowHeight = 50.0 tableView.backgroundColor = .systemBackground + tableView.allowsSelection = false refreshControl?.action(for: .valueChanged) { _ in Task { @@ -83,6 +84,11 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate { @objc func viewClose() { self.dismiss(animated: true, completion: nil) } + + // MARK: - NotificationCenter + @objc func initialize() { + getNetwokingNotification() + } // MARK: - Table @@ -127,32 +133,13 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate { if let image = image { cell.icon.image = image.withTintColor(NCBrandColor.shared.getElement(account: session.account), renderingMode: .alwaysOriginal) + } else { + cell.icon.image = utility.loadImage(named: "bell", color: NCBrandColor.shared.iconColor) } // Avatar cell.avatar.isHidden = true cell.avatarLeadingMargin.constant = 10 - if let subjectRichParameters = notification.subjectRichParameters, - let json = JSON(subjectRichParameters).dictionary, - let user = json["user"]?["id"].stringValue { - cell.avatar.isHidden = false - cell.avatarLeadingMargin.constant = 50 - - let fileName = NCSession.shared.getFileName(urlBase: session.urlBase, user: user) - let results = NCManageDatabase.shared.getImageAvatarLoaded(fileName: fileName) - - if results.image == nil { - cell.fileAvatarImageView?.image = utility.loadUserImage(for: user, displayName: json["user"]?["name"].string, urlBase: session.urlBase) - } else { - cell.fileAvatarImageView?.image = results.image - } - - if !(results.tblAvatar?.loaded ?? false), - NCNetworking.shared.downloadAvatarQueue.operations.filter({ ($0 as? NCOperationDownloadAvatar)?.fileName == fileName }).isEmpty { - NCNetworking.shared.downloadAvatarQueue.addOperation(NCOperationDownloadAvatar(user: user, fileName: fileName, account: session.account, view: tableView)) - } - } - cell.date.text = DateFormatter.localizedString(from: notification.date as Date, dateStyle: .medium, timeStyle: .medium) cell.notification = notification cell.date.text = utility.getRelativeDateTitle(notification.date as Date) @@ -167,23 +154,15 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate { cell.primary.isEnabled = false cell.primary.isHidden = true cell.primary.titleLabel?.font = .systemFont(ofSize: 15) - cell.primary.layer.cornerRadius = 15 - cell.primary.layer.masksToBounds = true - cell.primary.layer.backgroundColor = NCBrandColor.shared.getElement(account: session.account).cgColor cell.primary.setTitleColor(.white, for: .normal) - - cell.more.isEnabled = false - cell.more.isHidden = true - cell.more.titleLabel?.font = .systemFont(ofSize: 15) - cell.more.layer.cornerRadius = 15 - cell.more.layer.masksToBounds = true - cell.more.layer.backgroundColor = NCBrandColor.shared.getElement(account: session.account).cgColor - cell.more.setTitleColor(.white, for: .normal) + cell.primary.layer.cornerRadius = 10 + cell.primary.layer.masksToBounds = true + cell.primary.layer.backgroundColor = NCBrandColor.shared.notificationAction.cgColor cell.secondary.isEnabled = false cell.secondary.isHidden = true cell.secondary.titleLabel?.font = .systemFont(ofSize: 15) - cell.secondary.layer.cornerRadius = 15 + cell.secondary.layer.cornerRadius = 10 cell.secondary.layer.masksToBounds = true cell.secondary.layer.borderWidth = 1 cell.secondary.layer.borderColor = NCBrandColor.shared.iconImageColor2.cgColor @@ -219,11 +198,17 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate { cell.secondary.setTitle(label, for: .normal) } } - } else if jsonActions.count >= 3 { + } + + let widthPrimary = cell.primary.intrinsicContentSize.width + 48; + let widthSecondary = cell.secondary.intrinsicContentSize.width + 48; - cell.more.isEnabled = true - cell.more.isHidden = false - cell.more.setTitle("…", for: .normal) + if widthPrimary > widthSecondary { + cell.primaryWidth.constant = widthPrimary + cell.secondaryWidth.constant = widthPrimary + } else { + cell.primaryWidth.constant = widthSecondary + cell.secondaryWidth.constant = widthSecondary } var buttonWidth = max(cell.primary.intrinsicContentSize.width, cell.secondary.intrinsicContentSize.width) @@ -356,7 +341,6 @@ class NCNotificationCell: UITableViewCell, NCCellProtocol { @IBOutlet weak var remove: UIButton! @IBOutlet weak var primary: UIButton! @IBOutlet weak var secondary: UIButton! - @IBOutlet weak var more: UIButton! @IBOutlet weak var avatarLeadingMargin: NSLayoutConstraint! @IBOutlet weak var primaryWidth: NSLayoutConstraint! @IBOutlet weak var secondaryWidth: NSLayoutConstraint! From 28b9c53acfc2325a8f5889f5b0b5d8d5b7e120d2 Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Wed, 9 Apr 2025 16:56:28 +0530 Subject: [PATCH 2/4] NMC 1935 - Notification screen customisation --- Nextcloud.xcodeproj/project.pbxproj | 10 ++++ iOSClient/Notification/NCNotification.swift | 60 ++++++++++++++++----- 2 files changed, 58 insertions(+), 12 deletions(-) diff --git a/Nextcloud.xcodeproj/project.pbxproj b/Nextcloud.xcodeproj/project.pbxproj index 8dd4c5545f..41ea48f875 100644 --- a/Nextcloud.xcodeproj/project.pbxproj +++ b/Nextcloud.xcodeproj/project.pbxproj @@ -85,6 +85,10 @@ AFCE353527E4ED5900FEA6C2 /* DateFormatter+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353427E4ED5900FEA6C2 /* DateFormatter+Extension.swift */; }; AFCE353727E4ED7B00FEA6C2 /* NCShareCells.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353627E4ED7B00FEA6C2 /* NCShareCells.swift */; }; AFCE353927E5DE0500FEA6C2 /* Shareable.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353827E5DE0400FEA6C2 /* Shareable.swift */; }; + AFCE353927E5DE0500FEA6C2 /* NCShare+Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AFCE353827E5DE0400FEA6C2 /* NCShare+Helper.swift */; }; + B543154C2DA690B700981E7E /* NCNotificationText.swift in Sources */ = {isa = PBXBuildFile; fileRef = B543154B2DA690B700981E7E /* NCNotificationText.swift */; }; + C04E2F232A17BB4D001BAD85 /* FilesIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = C04E2F222A17BB4D001BAD85 /* FilesIntegrationTests.swift */; }; + D575039F27146F93008DC9DC /* String+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7A0D1342591FBC5008F8A13 /* String+Extension.swift */; }; D5B6AA7827200C7200D49C24 /* NCActivityTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5B6AA7727200C7200D49C24 /* NCActivityTableViewCell.swift */; }; F310B1EF2BA862F1001C42F5 /* NCViewerMedia+VisionKit.swift in Sources */ = {isa = PBXBuildFile; fileRef = F310B1EE2BA862F1001C42F5 /* NCViewerMedia+VisionKit.swift */; }; F321DA8A2B71205A00DDA0E6 /* NCTrashSelectTabBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = F321DA892B71205A00DDA0E6 /* NCTrashSelectTabBar.swift */; }; @@ -1221,6 +1225,8 @@ AFCE353427E4ED5900FEA6C2 /* DateFormatter+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DateFormatter+Extension.swift"; sourceTree = ""; }; AFCE353627E4ED7B00FEA6C2 /* NCShareCells.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCShareCells.swift; sourceTree = ""; }; AFCE353827E5DE0400FEA6C2 /* Shareable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Shareable.swift; sourceTree = ""; }; + AFCE353827E5DE0400FEA6C2 /* NCShare+Helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NCShare+Helper.swift"; sourceTree = ""; }; + B543154B2DA690B700981E7E /* NCNotificationText.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCNotificationText.swift; sourceTree = ""; }; C0046CDA2A17B98400D87C9D /* NextcloudUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NextcloudUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; C04E2F202A17BB4D001BAD85 /* NextcloudIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = NextcloudIntegrationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; D5B6AA7727200C7200D49C24 /* NCActivityTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCActivityTableViewCell.swift; sourceTree = ""; }; @@ -2024,6 +2030,8 @@ isa = PBXGroup; children = ( AA52EB452D42AC5A0089C348 /* Placeholder.swift */, + B543154B2DA690B700981E7E /* NCNotificationText.swift */, + AF8ED1FB2757821000B8DBC4 /* NextcloudUnitTests.swift */, ); path = NextcloudUnitTests; sourceTree = ""; @@ -4084,6 +4092,8 @@ AA52EB472D42AC9E0089C348 /* Placeholder.swift in Sources */, F372087D2BAB4C0F006B5430 /* TestConstants.swift in Sources */, F78E2D6C29AF02DB0024D4F3 /* Database.swift in Sources */, + B543154C2DA690B700981E7E /* NCNotificationText.swift in Sources */, + F7817CFE29801A3500FFBC65 /* Data+Extension.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/iOSClient/Notification/NCNotification.swift b/iOSClient/Notification/NCNotification.swift index e872a9d119..1bcd1b773d 100644 --- a/iOSClient/Notification/NCNotification.swift +++ b/iOSClient/Notification/NCNotification.swift @@ -26,11 +26,13 @@ import UIKit import NextcloudKit import SwiftyJSON -class NCNotification: UITableViewController, NCNotificationCellDelegate { +class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmptyDataSetDelegate { let utilityFileSystem = NCUtilityFileSystem() let utility = NCUtility() var notifications: [NKNotifications] = [] var session: NCSession.Session! + private let appDelegate = (UIApplication.shared.delegate as? AppDelegate)! + var emptyDataSet: NCEmptyDataSet? var controller: NCMainTabBarController? { self.tabBarController as? NCMainTabBarController @@ -45,6 +47,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate { view.backgroundColor = .systemBackground navigationController?.setNavigationBarAppearance() + self.session = NCSession.shared.getSession(controller: controller) tableView.tableFooterView = UIView() tableView.rowHeight = UITableView.automaticDimension @@ -61,8 +64,17 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate { let close = UIBarButtonItem(title: NSLocalizedString("_close_", comment: ""), style: .plain) { self.dismiss(animated: true) } + // Empty + let offset = (self.navigationController?.navigationBar.bounds.height ?? 0) - 20 + emptyDataSet = NCEmptyDataSet(view: tableView, offset: -offset, delegate: self) + + } - self.navigationItem.leftBarButtonItems = [close] + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + appDelegate.activeViewController = self + navigationController?.setNavigationBarAppearance() + AnalyticsHelper.shared.trackEvent(eventName: .SCREEN_EVENT__NOTIFICATIONS) } override func viewDidAppear(_ animated: Bool) { @@ -87,16 +99,40 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate { // MARK: - NotificationCenter @objc func initialize() { - getNetwokingNotification() + getNetwokingNotification(nil) } + // MARK: - Empty + + func emptyDataSetView(_ view: NCEmptyView) { + + if self.dataSourceTask?.state == .running { + view.emptyImage.image = UIImage(named: "networkInProgress")?.image(color: .gray, size: UIScreen.main.bounds.width) + view.emptyTitle.text = NSLocalizedString("_request_in_progress_", comment: "") + view.emptyDescription.text = "" + } else { + view.emptyImage.image = utility.loadImage(named: "bell", colors: [.gray], size: UIScreen.main.bounds.width) + view.emptyTitle.text = NSLocalizedString("_no_notification_", comment: "") + view.emptyDescription.text = "" + } + } + // MARK: - Table override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + emptyDataSet?.numberOfItemsInSection(notifications.count, section: section) return notifications.count } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + + let notification = notifications[indexPath.row] + + if notification.app == "files_sharing" { + NCActionCenter.shared.viewerFile(account: session.account, fileId: notification.objectId, viewController: self) + } else { + NCApplicationHandle().didSelectNotification(notification, viewController: self) + } guard let notification = NCApplicationHandle().didSelectNotification(notifications[indexPath.row], viewController: self) else { return } do { @@ -132,9 +168,9 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate { } if let image = image { - cell.icon.image = image.withTintColor(NCBrandColor.shared.getElement(account: session.account), renderingMode: .alwaysOriginal) + cell.icon.image = image.withTintColor(NCBrandColor.shared.iconColor, renderingMode: .alwaysOriginal) } else { - cell.icon.image = utility.loadImage(named: "bell", color: NCBrandColor.shared.iconColor) + cell.icon.image = utility.loadImage(named: "bell", colors: [NCBrandColor.shared.iconColor]) } // Avatar @@ -142,14 +178,14 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate { cell.avatarLeadingMargin.constant = 10 cell.date.text = DateFormatter.localizedString(from: notification.date as Date, dateStyle: .medium, timeStyle: .medium) cell.notification = notification - cell.date.text = utility.getRelativeDateTitle(notification.date as Date) - cell.date.textColor = NCBrandColor.shared.iconImageColor2 + cell.date.text = utility.dateDiff(notification.date as Date) + cell.date.textColor = .gray cell.subject.text = notification.subject cell.subject.textColor = NCBrandColor.shared.textColor cell.message.text = notification.message.replacingOccurrences(of: "
", with: "\n") - cell.message.textColor = NCBrandColor.shared.textColor2 + cell.message.textColor = .gray - cell.remove.setImage(utility.loadImage(named: "xmark", colors: [NCBrandColor.shared.iconImageColor]), for: .normal) + cell.remove.setImage(UIImage(named: "xmark")!.image(color: .gray, size: 20), for: .normal) cell.primary.isEnabled = false cell.primary.isHidden = true @@ -165,9 +201,9 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate { cell.secondary.layer.cornerRadius = 10 cell.secondary.layer.masksToBounds = true cell.secondary.layer.borderWidth = 1 - cell.secondary.layer.borderColor = NCBrandColor.shared.iconImageColor2.cgColor - cell.secondary.layer.backgroundColor = UIColor.secondarySystemBackground.cgColor - cell.secondary.setTitleColor(NCBrandColor.shared.iconImageColor2, for: .normal) + cell.secondary.layer.borderColor = NCBrandColor.shared.notificationAction.cgColor + cell.secondary.layer.backgroundColor = UIColor.clear.cgColor + cell.secondary.setTitleColor(NCBrandColor.shared.notificationAction, for: .normal) // Action if let actions = notification.actions, From 87b58cd335707c681260d047b5849b22406728d5 Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Tue, 30 Sep 2025 22:04:13 +0530 Subject: [PATCH 3/4] NMC 1935 - Notification screen customisation changes --- iOSClient/Notification/NCNotification.swift | 163 +++++++++----------- 1 file changed, 69 insertions(+), 94 deletions(-) diff --git a/iOSClient/Notification/NCNotification.swift b/iOSClient/Notification/NCNotification.swift index 1bcd1b773d..bad8d1ed9d 100644 --- a/iOSClient/Notification/NCNotification.swift +++ b/iOSClient/Notification/NCNotification.swift @@ -30,6 +30,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty let utilityFileSystem = NCUtilityFileSystem() let utility = NCUtility() var notifications: [NKNotifications] = [] + var dataSourceTask: URLSessionTask? var session: NCSession.Session! private let appDelegate = (UIApplication.shared.delegate as? AppDelegate)! var emptyDataSet: NCEmptyDataSet? @@ -99,7 +100,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty // MARK: - NotificationCenter @objc func initialize() { - getNetwokingNotification(nil) + getNetwokingNotification() } // MARK: - Empty @@ -125,7 +126,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - + let notification = notifications[indexPath.row] if notification.app == "files_sharing" { @@ -168,7 +169,8 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty } if let image = image { - cell.icon.image = image.withTintColor(NCBrandColor.shared.iconColor, renderingMode: .alwaysOriginal) + cell.icon.image = image.withTintColor(NCBrandColor.shared.brandElement, renderingMode: .alwaysOriginal) +// cell.icon.image = image.withTintColor(NCBrandColor.shared.getElement(account: session.account), renderingMode: .alwaysOriginal) } else { cell.icon.image = utility.loadImage(named: "bell", colors: [NCBrandColor.shared.iconColor]) } @@ -178,7 +180,7 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty cell.avatarLeadingMargin.constant = 10 cell.date.text = DateFormatter.localizedString(from: notification.date as Date, dateStyle: .medium, timeStyle: .medium) cell.notification = notification - cell.date.text = utility.dateDiff(notification.date as Date) + cell.date.text = utility.getRelativeDateTitle(notification.date as Date) cell.date.textColor = .gray cell.subject.text = notification.subject cell.subject.textColor = NCBrandColor.shared.textColor @@ -258,15 +260,9 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty // MARK: - tap Action - func tapRemove(with notification: NKNotifications, sender: Any?) { - NextcloudKit.shared.setNotification(serverUrl: nil, idNotification: notification.idNotification, method: "DELETE", account: session.account) { task in - Task { - let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: self.session.account, - path: "\(notification.idNotification)", - name: "setNotification") - await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task) - } - } completion: { _, _, error in + func tapRemove(with notification: NKNotifications) { + + NextcloudKit.shared.setNotification(serverUrl: nil, idNotification: notification.idNotification, method: "DELETE", account: session.account) { _, _, error in if error == .success { if let index = self.notifications .firstIndex(where: { $0.idNotification == notification.idNotification }) { @@ -281,87 +277,70 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty } } - func tapAction(with notification: NKNotifications, label: String, sender: Any?) { - guard let actions = notification.actions, - let jsonActions = JSON(actions).array, - let action = jsonActions.first(where: { $0["label"].string == label }) - else { return } - - let serverUrl = action["link"].stringValue - let method = action["type"].stringValue - - if method == "WEB", var url = action["link"].url { - if notification.app == NCGlobal.shared.spreedName, - let roomToken = notification.objectId.split(separator: "/").first, - let talkUrl = URL(string: "nextcloudtalk://open-conversation?server=\(session.urlBase)&user=\(session.userId)&withRoomToken=\(roomToken)"), - UIApplication.shared.canOpenURL(talkUrl) { - - url = talkUrl + func tapAction(with notification: NKNotifications, label: String) { + if notification.app == NCGlobal.shared.spreedName, + let roomToken = notification.objectId.split(separator: "/").first, + let talkUrl = URL(string: "nextcloudtalk://open-conversation?server=\(session.urlBase)&user=\(session.userId)&withRoomToken=\(roomToken)"), + UIApplication.shared.canOpenURL(talkUrl) { + UIApplication.shared.open(talkUrl) + } else if let actions = notification.actions, + let jsonActions = JSON(actions).array, + let action = jsonActions.first(where: { $0["label"].string == label }) { + let serverUrl = action["link"].stringValue + let method = action["type"].stringValue + + if method == "WEB", let url = action["link"].url { + UIApplication.shared.open(url, options: [:], completionHandler: nil) + return } - UIApplication.shared.open(url) - return - } - - NextcloudKit.shared.setNotification(serverUrl: serverUrl, idNotification: 0, method: method, account: session.account) { task in - Task { - let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: self.session.account, - name: "setNotification") - await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task) - } - } completion: { _, _, error in - if error == .success { - if let index = self.notifications.firstIndex(where: { $0.idNotification == notification.idNotification }) { - self.notifications.remove(at: index) - } - self.tableView.reloadData() - if self.navigationController?.presentingViewController != nil, notification.app == NCGlobal.shared.twoFactorNotificatioName { - self.dismiss(animated: true) + NextcloudKit.shared.setNotification(serverUrl: serverUrl, idNotification: 0, method: method, account: session.account) { _, _, error in + if error == .success { + if let index = self.notifications.firstIndex(where: { $0.idNotification == notification.idNotification }) { + self.notifications.remove(at: index) + } + self.tableView.reloadData() + if self.navigationController?.presentingViewController != nil, notification.app == NCGlobal.shared.twoFactorNotificatioName { + self.dismiss(animated: true) + } + } else if error != .success { + NCContentPresenter().showError(error: error) + } else { + print("[Error] The user has been changed during networking process.") } - } else if error != .success { - NCContentPresenter().showError(error: error) - } else { - print("[Error] The user has been changed during networking process.") + } - } + } // else: Action not found } - func tapMore(with notification: NKNotifications, sender: Any?) { - toggleMenu(notification: notification, sender: sender) + func tapMore(with notification: NKNotifications) { + toggleMenu(notification: notification) } // MARK: - Load notification networking - @MainActor - func getNetwokingNotification() async { - // If is already in-flight, do nothing - if await NCNetworking.shared.networkingTasks.isReading(identifier: "NCNotification") { - return - } - - self.tableView.reloadData() - - let results = await NextcloudKit.shared.getNotificationsAsync(account: session.account) { task in - Task { - await NCNetworking.shared.networkingTasks.track(identifier: "NCNotification", task: task) - } - } - guard results.error == .success, let notifications = results.notifications else { - return - } - - self.notifications.removeAll() - let sortedNotifications = notifications.sorted { $0.date > $1.date } - for notification in sortedNotifications { - if let icon = notification.icon { - self.utility.convertSVGtoPNGWriteToUserData(svgUrlString: icon, width: 25, rewrite: false, account: session.account) { _, _ in - self.tableView.reloadData() - } - } - self.notifications.append(notification) - } - self.refreshControl?.endRefreshing() - self.tableView.reloadData() + @objc func getNetwokingNotification() { + + self.tableView.reloadData() + NextcloudKit.shared.getNotifications(account: session.account) { task in + self.dataSourceTask = task + self.tableView.reloadData() + } completion: { account, notifications, _, error in + if error == .success, let notifications = notifications { + self.notifications.removeAll() + let sortedNotifications = notifications.sorted { $0.date > $1.date } + for notification in sortedNotifications { + if let icon = notification.icon { + self.utility.convertSVGtoPNGWriteToUserData(svgUrlString: icon, width: 25, rewrite: false, account: account) { _, _ in + self.tableView.reloadData() + } + } + self.notifications.append(notification) + } + self.refreshControl?.endRefreshing() + self.tableView.reloadData() + } + } } } @@ -401,7 +380,7 @@ class NCNotificationCell: UITableViewCell, NCCellProtocol { @IBAction func touchUpInsideRemove(_ sender: Any) { guard let notification = notification else { return } - delegate?.tapRemove(with: notification, sender: sender) + delegate?.tapRemove(with: notification) } @IBAction func touchUpInsidePrimary(_ sender: Any) { @@ -409,7 +388,7 @@ class NCNotificationCell: UITableViewCell, NCCellProtocol { let button = sender as? UIButton, let label = button.titleLabel?.text else { return } - delegate?.tapAction(with: notification, label: label, sender: sender) + delegate?.tapAction(with: notification, label: label) } @IBAction func touchUpInsideSecondary(_ sender: Any) { @@ -417,17 +396,13 @@ class NCNotificationCell: UITableViewCell, NCCellProtocol { let button = sender as? UIButton, let label = button.titleLabel?.text else { return } - delegate?.tapAction(with: notification, label: label, sender: sender) + delegate?.tapAction(with: notification, label: label) } - @IBAction func touchUpInsideMore(_ sender: Any) { - guard let notification = notification else { return } - delegate?.tapMore(with: notification, sender: sender) - } } protocol NCNotificationCellDelegate: AnyObject { - func tapRemove(with notification: NKNotifications, sender: Any?) - func tapAction(with notification: NKNotifications, label: String, sender: Any?) - func tapMore(with notification: NKNotifications, sender: Any?) + func tapRemove(with notification: NKNotifications) + func tapAction(with notification: NKNotifications, label: String) + func tapMore(with notification: NKNotifications) } From e9330b230f6e0fcac98517a1291c510069ddc63b Mon Sep 17 00:00:00 2001 From: harshada-15-tsys Date: Mon, 15 Dec 2025 15:20:04 +0530 Subject: [PATCH 4/4] NMC 1935 - Notification screen customisation changes --- .../Notification/NCNotification.storyboard | 202 +++++++------ iOSClient/Notification/NCNotification.swift | 269 +++++++++--------- 2 files changed, 253 insertions(+), 218 deletions(-) diff --git a/iOSClient/Notification/NCNotification.storyboard b/iOSClient/Notification/NCNotification.storyboard index a89ba02d24..fb122ec81a 100644 --- a/iOSClient/Notification/NCNotification.storyboard +++ b/iOSClient/Notification/NCNotification.storyboard @@ -1,163 +1,193 @@ - + - + - + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + + - - + + - - + + - + + + + + + + + + + + + + + + + + + + - - + diff --git a/iOSClient/Notification/NCNotification.swift b/iOSClient/Notification/NCNotification.swift index bad8d1ed9d..00a2662c9e 100644 --- a/iOSClient/Notification/NCNotification.swift +++ b/iOSClient/Notification/NCNotification.swift @@ -26,14 +26,11 @@ import UIKit import NextcloudKit import SwiftyJSON -class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmptyDataSetDelegate { +class NCNotification: UITableViewController, NCNotificationCellDelegate { let utilityFileSystem = NCUtilityFileSystem() let utility = NCUtility() var notifications: [NKNotifications] = [] - var dataSourceTask: URLSessionTask? var session: NCSession.Session! - private let appDelegate = (UIApplication.shared.delegate as? AppDelegate)! - var emptyDataSet: NCEmptyDataSet? var controller: NCMainTabBarController? { self.tabBarController as? NCMainTabBarController @@ -48,13 +45,11 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty view.backgroundColor = .systemBackground navigationController?.setNavigationBarAppearance() - self.session = NCSession.shared.getSession(controller: controller) tableView.tableFooterView = UIView() tableView.rowHeight = UITableView.automaticDimension tableView.estimatedRowHeight = 50.0 tableView.backgroundColor = .systemBackground - tableView.allowsSelection = false refreshControl?.action(for: .valueChanged) { _ in Task { @@ -65,17 +60,8 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty let close = UIBarButtonItem(title: NSLocalizedString("_close_", comment: ""), style: .plain) { self.dismiss(animated: true) } - // Empty - let offset = (self.navigationController?.navigationBar.bounds.height ?? 0) - 20 - emptyDataSet = NCEmptyDataSet(view: tableView, offset: -offset, delegate: self) - - } - override func viewWillAppear(_ animated: Bool) { - super.viewWillAppear(animated) - appDelegate.activeViewController = self - navigationController?.setNavigationBarAppearance() - AnalyticsHelper.shared.trackEvent(eventName: .SCREEN_EVENT__NOTIFICATIONS) + self.navigationItem.leftBarButtonItems = [close] } override func viewDidAppear(_ animated: Bool) { @@ -97,43 +83,14 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty @objc func viewClose() { self.dismiss(animated: true, completion: nil) } - - // MARK: - NotificationCenter - @objc func initialize() { - getNetwokingNotification() - } - - // MARK: - Empty - func emptyDataSetView(_ view: NCEmptyView) { - - if self.dataSourceTask?.state == .running { - view.emptyImage.image = UIImage(named: "networkInProgress")?.image(color: .gray, size: UIScreen.main.bounds.width) - view.emptyTitle.text = NSLocalizedString("_request_in_progress_", comment: "") - view.emptyDescription.text = "" - } else { - view.emptyImage.image = utility.loadImage(named: "bell", colors: [.gray], size: UIScreen.main.bounds.width) - view.emptyTitle.text = NSLocalizedString("_no_notification_", comment: "") - view.emptyDescription.text = "" - } - } - // MARK: - Table override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - emptyDataSet?.numberOfItemsInSection(notifications.count, section: section) return notifications.count } override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - - let notification = notifications[indexPath.row] - - if notification.app == "files_sharing" { - NCActionCenter.shared.viewerFile(account: session.account, fileId: notification.objectId, viewController: self) - } else { - NCApplicationHandle().didSelectNotification(notification, viewController: self) - } guard let notification = NCApplicationHandle().didSelectNotification(notifications[indexPath.row], viewController: self) else { return } do { @@ -169,43 +126,69 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty } if let image = image { - cell.icon.image = image.withTintColor(NCBrandColor.shared.brandElement, renderingMode: .alwaysOriginal) -// cell.icon.image = image.withTintColor(NCBrandColor.shared.getElement(account: session.account), renderingMode: .alwaysOriginal) - } else { - cell.icon.image = utility.loadImage(named: "bell", colors: [NCBrandColor.shared.iconColor]) + cell.icon.image = image.withTintColor(NCBrandColor.shared.getElement(account: session.account), renderingMode: .alwaysOriginal) } // Avatar cell.avatar.isHidden = true cell.avatarLeadingMargin.constant = 10 + if let subjectRichParameters = notification.subjectRichParameters, + let json = JSON(subjectRichParameters).dictionary, + let user = json["user"]?["id"].stringValue { + cell.avatar.isHidden = false + cell.avatarLeadingMargin.constant = 50 + + let fileName = NCSession.shared.getFileName(urlBase: session.urlBase, user: user) + let results = NCManageDatabase.shared.getImageAvatarLoaded(fileName: fileName) + + if results.image == nil { + cell.fileAvatarImageView?.image = utility.loadUserImage(for: user, displayName: json["user"]?["name"].string, urlBase: session.urlBase) + } else { + cell.fileAvatarImageView?.image = results.image + } + + if !(results.tblAvatar?.loaded ?? false), + NCNetworking.shared.downloadAvatarQueue.operations.filter({ ($0 as? NCOperationDownloadAvatar)?.fileName == fileName }).isEmpty { + NCNetworking.shared.downloadAvatarQueue.addOperation(NCOperationDownloadAvatar(user: user, fileName: fileName, account: session.account, view: tableView)) + } + } + cell.date.text = DateFormatter.localizedString(from: notification.date as Date, dateStyle: .medium, timeStyle: .medium) cell.notification = notification cell.date.text = utility.getRelativeDateTitle(notification.date as Date) - cell.date.textColor = .gray + cell.date.textColor = NCBrandColor.shared.iconImageColor2 cell.subject.text = notification.subject cell.subject.textColor = NCBrandColor.shared.textColor cell.message.text = notification.message.replacingOccurrences(of: "
", with: "\n") - cell.message.textColor = .gray + cell.message.textColor = NCBrandColor.shared.textColor2 - cell.remove.setImage(UIImage(named: "xmark")!.image(color: .gray, size: 20), for: .normal) + cell.remove.setImage(utility.loadImage(named: "xmark", colors: [NCBrandColor.shared.iconImageColor]), for: .normal) cell.primary.isEnabled = false cell.primary.isHidden = true cell.primary.titleLabel?.font = .systemFont(ofSize: 15) - cell.primary.setTitleColor(.white, for: .normal) - cell.primary.layer.cornerRadius = 10 + cell.primary.layer.cornerRadius = 15 cell.primary.layer.masksToBounds = true - cell.primary.layer.backgroundColor = NCBrandColor.shared.notificationAction.cgColor + cell.primary.layer.backgroundColor = NCBrandColor.shared.getElement(account: session.account).cgColor + cell.primary.setTitleColor(.white, for: .normal) + + cell.more.isEnabled = false + cell.more.isHidden = true + cell.more.titleLabel?.font = .systemFont(ofSize: 15) + cell.more.layer.cornerRadius = 15 + cell.more.layer.masksToBounds = true + cell.more.layer.backgroundColor = NCBrandColor.shared.getElement(account: session.account).cgColor + cell.more.setTitleColor(.white, for: .normal) cell.secondary.isEnabled = false cell.secondary.isHidden = true cell.secondary.titleLabel?.font = .systemFont(ofSize: 15) - cell.secondary.layer.cornerRadius = 10 + cell.secondary.layer.cornerRadius = 15 cell.secondary.layer.masksToBounds = true cell.secondary.layer.borderWidth = 1 - cell.secondary.layer.borderColor = NCBrandColor.shared.notificationAction.cgColor - cell.secondary.layer.backgroundColor = UIColor.clear.cgColor - cell.secondary.setTitleColor(NCBrandColor.shared.notificationAction, for: .normal) + cell.secondary.layer.borderColor = NCBrandColor.shared.iconImageColor2.cgColor + cell.secondary.layer.backgroundColor = UIColor.secondarySystemBackground.cgColor + cell.secondary.setTitleColor(NCBrandColor.shared.iconImageColor2, for: .normal) // Action if let actions = notification.actions, @@ -236,17 +219,11 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty cell.secondary.setTitle(label, for: .normal) } } - } - - let widthPrimary = cell.primary.intrinsicContentSize.width + 48; - let widthSecondary = cell.secondary.intrinsicContentSize.width + 48; + } else if jsonActions.count >= 3 { - if widthPrimary > widthSecondary { - cell.primaryWidth.constant = widthPrimary - cell.secondaryWidth.constant = widthPrimary - } else { - cell.primaryWidth.constant = widthSecondary - cell.secondaryWidth.constant = widthSecondary + cell.more.isEnabled = true + cell.more.isHidden = false + cell.more.setTitle("…", for: .normal) } var buttonWidth = max(cell.primary.intrinsicContentSize.width, cell.secondary.intrinsicContentSize.width) @@ -260,9 +237,15 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty // MARK: - tap Action - func tapRemove(with notification: NKNotifications) { - - NextcloudKit.shared.setNotification(serverUrl: nil, idNotification: notification.idNotification, method: "DELETE", account: session.account) { _, _, error in + func tapRemove(with notification: NKNotifications, sender: Any?) { + NextcloudKit.shared.setNotification(serverUrl: nil, idNotification: notification.idNotification, method: "DELETE", account: session.account) { task in + Task { + let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: self.session.account, + path: "\(notification.idNotification)", + name: "setNotification") + await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task) + } + } completion: { _, _, error in if error == .success { if let index = self.notifications .firstIndex(where: { $0.idNotification == notification.idNotification }) { @@ -277,70 +260,87 @@ class NCNotification: UITableViewController, NCNotificationCellDelegate, NCEmpty } } - func tapAction(with notification: NKNotifications, label: String) { - if notification.app == NCGlobal.shared.spreedName, - let roomToken = notification.objectId.split(separator: "/").first, - let talkUrl = URL(string: "nextcloudtalk://open-conversation?server=\(session.urlBase)&user=\(session.userId)&withRoomToken=\(roomToken)"), - UIApplication.shared.canOpenURL(talkUrl) { - UIApplication.shared.open(talkUrl) - } else if let actions = notification.actions, - let jsonActions = JSON(actions).array, - let action = jsonActions.first(where: { $0["label"].string == label }) { - let serverUrl = action["link"].stringValue - let method = action["type"].stringValue - - if method == "WEB", let url = action["link"].url { - UIApplication.shared.open(url, options: [:], completionHandler: nil) - return + func tapAction(with notification: NKNotifications, label: String, sender: Any?) { + guard let actions = notification.actions, + let jsonActions = JSON(actions).array, + let action = jsonActions.first(where: { $0["label"].string == label }) + else { return } + + let serverUrl = action["link"].stringValue + let method = action["type"].stringValue + + if method == "WEB", var url = action["link"].url { + if notification.app == NCGlobal.shared.spreedName, + let roomToken = notification.objectId.split(separator: "/").first, + let talkUrl = URL(string: "nextcloudtalk://open-conversation?server=\(session.urlBase)&user=\(session.userId)&withRoomToken=\(roomToken)"), + UIApplication.shared.canOpenURL(talkUrl) { + + url = talkUrl } - NextcloudKit.shared.setNotification(serverUrl: serverUrl, idNotification: 0, method: method, account: session.account) { _, _, error in - if error == .success { - if let index = self.notifications.firstIndex(where: { $0.idNotification == notification.idNotification }) { - self.notifications.remove(at: index) - } - self.tableView.reloadData() - if self.navigationController?.presentingViewController != nil, notification.app == NCGlobal.shared.twoFactorNotificatioName { - self.dismiss(animated: true) - } - } else if error != .success { - NCContentPresenter().showError(error: error) - } else { - print("[Error] The user has been changed during networking process.") - } + UIApplication.shared.open(url) + return + } + NextcloudKit.shared.setNotification(serverUrl: serverUrl, idNotification: 0, method: method, account: session.account) { task in + Task { + let identifier = await NCNetworking.shared.networkingTasks.createIdentifier(account: self.session.account, + name: "setNotification") + await NCNetworking.shared.networkingTasks.track(identifier: identifier, task: task) + } + } completion: { _, _, error in + if error == .success { + if let index = self.notifications.firstIndex(where: { $0.idNotification == notification.idNotification }) { + self.notifications.remove(at: index) + } + self.tableView.reloadData() + if self.navigationController?.presentingViewController != nil, notification.app == NCGlobal.shared.twoFactorNotificatioName { + self.dismiss(animated: true) + } + } else if error != .success { + NCContentPresenter().showError(error: error) + } else { + print("[Error] The user has been changed during networking process.") } - } // else: Action not found + } } - func tapMore(with notification: NKNotifications) { - toggleMenu(notification: notification) + func tapMore(with notification: NKNotifications, sender: Any?) { + toggleMenu(notification: notification, sender: sender) } // MARK: - Load notification networking - @objc func getNetwokingNotification() { - - self.tableView.reloadData() - NextcloudKit.shared.getNotifications(account: session.account) { task in - self.dataSourceTask = task - self.tableView.reloadData() - } completion: { account, notifications, _, error in - if error == .success, let notifications = notifications { - self.notifications.removeAll() - let sortedNotifications = notifications.sorted { $0.date > $1.date } - for notification in sortedNotifications { - if let icon = notification.icon { - self.utility.convertSVGtoPNGWriteToUserData(svgUrlString: icon, width: 25, rewrite: false, account: account) { _, _ in - self.tableView.reloadData() - } - } - self.notifications.append(notification) - } - self.refreshControl?.endRefreshing() - self.tableView.reloadData() - } - } + @MainActor + func getNetwokingNotification() async { + // If is already in-flight, do nothing + if await NCNetworking.shared.networkingTasks.isReading(identifier: "NCNotification") { + return + } + + self.tableView.reloadData() + + let results = await NextcloudKit.shared.getNotificationsAsync(account: session.account) { task in + Task { + await NCNetworking.shared.networkingTasks.track(identifier: "NCNotification", task: task) + } + } + guard results.error == .success, let notifications = results.notifications else { + return + } + + self.notifications.removeAll() + let sortedNotifications = notifications.sorted { $0.date > $1.date } + for notification in sortedNotifications { + if let icon = notification.icon { + self.utility.convertSVGtoPNGWriteToUserData(svgUrlString: icon, width: 25, rewrite: false, account: session.account) { _, _ in + self.tableView.reloadData() + } + } + self.notifications.append(notification) + } + self.refreshControl?.endRefreshing() + self.tableView.reloadData() } } @@ -356,6 +356,7 @@ class NCNotificationCell: UITableViewCell, NCCellProtocol { @IBOutlet weak var remove: UIButton! @IBOutlet weak var primary: UIButton! @IBOutlet weak var secondary: UIButton! + @IBOutlet weak var more: UIButton! @IBOutlet weak var avatarLeadingMargin: NSLayoutConstraint! @IBOutlet weak var primaryWidth: NSLayoutConstraint! @IBOutlet weak var secondaryWidth: NSLayoutConstraint! @@ -380,7 +381,7 @@ class NCNotificationCell: UITableViewCell, NCCellProtocol { @IBAction func touchUpInsideRemove(_ sender: Any) { guard let notification = notification else { return } - delegate?.tapRemove(with: notification) + delegate?.tapRemove(with: notification, sender: sender) } @IBAction func touchUpInsidePrimary(_ sender: Any) { @@ -388,7 +389,7 @@ class NCNotificationCell: UITableViewCell, NCCellProtocol { let button = sender as? UIButton, let label = button.titleLabel?.text else { return } - delegate?.tapAction(with: notification, label: label) + delegate?.tapAction(with: notification, label: label, sender: sender) } @IBAction func touchUpInsideSecondary(_ sender: Any) { @@ -396,13 +397,17 @@ class NCNotificationCell: UITableViewCell, NCCellProtocol { let button = sender as? UIButton, let label = button.titleLabel?.text else { return } - delegate?.tapAction(with: notification, label: label) + delegate?.tapAction(with: notification, label: label, sender: sender) } + @IBAction func touchUpInsideMore(_ sender: Any) { + guard let notification = notification else { return } + delegate?.tapMore(with: notification, sender: sender) + } } protocol NCNotificationCellDelegate: AnyObject { - func tapRemove(with notification: NKNotifications) - func tapAction(with notification: NKNotifications, label: String) - func tapMore(with notification: NKNotifications) + func tapRemove(with notification: NKNotifications, sender: Any?) + func tapAction(with notification: NKNotifications, label: String, sender: Any?) + func tapMore(with notification: NKNotifications, sender: Any?) }