marinofaggiana 4 年之前
父節點
當前提交
0ca2bcaa43
共有 1 個文件被更改,包括 13 次插入0 次删除
  1. 13 0
      iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift

+ 13 - 0
iOSClient/Viewer/NCViewerPDF/NCViewerPDF.swift

@@ -45,6 +45,7 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
           
           
         let filePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
         let filePath = CCUtility.getDirectoryProviderStorageOcId(metadata.ocId, fileNameView: metadata.fileNameView)!
                 
                 
+        NotificationCenter.default.addObserver(self, selector: #selector(favoriteFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_favoriteFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(deleteFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_deleteFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(deleteFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_deleteFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(renameFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_renameFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(renameFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_renameFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(moveFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_moveFile), object: nil)
         NotificationCenter.default.addObserver(self, selector: #selector(moveFile(_:)), name: NSNotification.Name(rawValue: k_notificationCenter_moveFile), object: nil)
@@ -138,6 +139,18 @@ class NCViewerPDF: UIViewController, NCViewerPDFSearchDelegate {
     
     
     //MARK: - NotificationCenter
     //MARK: - NotificationCenter
    
    
+    @objc func favoriteFile(_ notification: NSNotification) {
+        if self.view?.window == nil { return }
+        
+        if let userInfo = notification.userInfo as NSDictionary? {
+            if let metadata = userInfo["metadata"] as? tableMetadata {
+                if metadata.ocId == self.metadata.ocId {
+                    self.metadata = metadata
+                }
+            }
+        }
+    }
+    
     @objc func moveFile(_ notification: NSNotification) {
     @objc func moveFile(_ notification: NSNotification) {
         
         
         if let userInfo = notification.userInfo as NSDictionary? {
         if let userInfo = notification.userInfo as NSDictionary? {