Browse Source

Move Notification to Files

Signed-off-by: Marino Faggiana <marino@marinofaggiana.com>
Marino Faggiana 1 year ago
parent
commit
2fa77f75a6

+ 20 - 5
iOSClient/Main/Collection Common/NCSelectableNavigationView.swift

@@ -42,7 +42,8 @@ protocol NCSelectableNavigationView: AnyObject {
     var selectOcId: [String] { get set }
     var titleCurrentFolder: String { get }
     var navigationItem: UINavigationItem { get }
-
+    var navigationController: UINavigationController? { get }
+    var layoutKey: String { get }
     var selectActions: [NCMenuAction] { get }
 
     func reloadDataSource(forced: Bool)
@@ -60,12 +61,20 @@ extension NCSelectableNavigationView {
 
     func setNavigationHeader() {
         if isEditMode {
-            navigationItem.rightBarButtonItem = UIBarButtonItem(image: UIImage(named: "navigationMore"), style: .plain, action: tapSelectMenu)
-            navigationItem.leftBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: .plain, action: tapSelect)
+            let more = UIBarButtonItem(image: UIImage(systemName: "ellipsis"), style: .plain, action: tapSelectMenu)
+            let cancel = UIBarButtonItem(title: NSLocalizedString("_cancel_", comment: ""), style: .plain, action: tapSelect)
+            navigationItem.rightBarButtonItems = [more]
+            navigationItem.leftBarButtonItems = [cancel]
             navigationItem.title = NSLocalizedString("_selected_", comment: "") + " : \(selectOcId.count)" + " / \(selectableDataSource.count)"
         } else {
-            navigationItem.rightBarButtonItem = UIBarButtonItem(title: NSLocalizedString("_select_", comment: ""), style: UIBarButtonItem.Style.plain, action: tapSelect)
-            navigationItem.leftBarButtonItem = nil
+            let select = UIBarButtonItem(title: NSLocalizedString("_select_", comment: ""), style: UIBarButtonItem.Style.plain, action: tapSelect)
+            let notification = UIBarButtonItem(image: UIImage(systemName: "bell"), style: .plain, action: tapNotification)
+            if layoutKey == NCGlobal.shared.layoutViewFiles {
+                navigationItem.rightBarButtonItems = [select, notification]
+            } else {
+                navigationItem.rightBarButtonItems = [select]
+            }
+            navigationItem.leftBarButtonItems = []
             navigationItem.title = titleCurrentFolder
         }
     }
@@ -82,6 +91,12 @@ extension NCSelectableNavigationView {
         navigationItem.title = NSLocalizedString("_selected_", comment: "") + " : \(selectOcId.count)" + " / \(selectableDataSource.count)"
         collectionView.reloadData()
     }
+
+    func tapNotification() {
+        if let viewController = UIStoryboard(name: "NCNotification", bundle: nil).instantiateInitialViewController() as? NCNotification {
+            navigationController?.pushViewController(viewController, animated: true)
+        }
+    }
 }
 
 extension NCSelectableNavigationView where Self: UIViewController {

+ 0 - 8
iOSClient/More/NCMore.swift

@@ -113,14 +113,6 @@ class NCMore: UIViewController, UITableViewDelegate, UITableViewDataSource {
         item.order = 20
         functionMenu.append(item)
 
-        // ITEM : Notification
-        item = NKExternalSite()
-        item.name = "_notifications_"
-        item.icon = "bell"
-        item.url = "segueNotification"
-        item.order = 30
-        functionMenu.append(item)
-
         // ITEM : Activity
         item = NKExternalSite()
         item.name = "_activity_"

+ 1 - 0
iOSClient/Trash/NCTrash.swift

@@ -46,6 +46,7 @@ class NCTrash: UIViewController, NCSelectableNavigationView, NCTrashListCellDele
     var layoutForView: NCDBLayoutForView?
     var listLayout: NCListLayout!
     var gridLayout: NCGridLayout!
+    var layoutKey = NCGlobal.shared.layoutViewTrash
 
     private let refreshControl = UIRefreshControl()