marinofaggiana před 5 roky
rodič
revize
c71e1da74d

+ 1 - 0
iOSClient/Main/CCMain.m

@@ -1941,6 +1941,7 @@
     UINavigationController *navigationController = [[UIStoryboard storyboardWithName:@"NCViewerRichWorkspace" bundle:nil] instantiateInitialViewController];
     NCViewerRichWorkspace *viewerRichWorkspace = (NCViewerRichWorkspace *)[navigationController topViewController];
     viewerRichWorkspace.richWorkspace = directory.richWorkspace;
+    viewerRichWorkspace.serverUrl = self.serverUrl;
     viewerRichWorkspace.titleCloseItem = NSLocalizedString(@"_back_", nil);
     
     navigationController.modalPresentationStyle = UIModalPresentationFullScreen;

+ 0 - 28
iOSClient/RichWorkspace/NCRichWorkspace.swift

@@ -100,31 +100,3 @@ import SwiftRichString
         textView.sizeToFit()
     }
 }
-
-extension UIColor {
-    public convenience init?(hex: String) {
-        let r, g, b, a: CGFloat
-
-        if hex.hasPrefix("#") {
-            let start = hex.index(hex.startIndex, offsetBy: 1)
-            let hexColor = String(hex[start...])
-
-            if hexColor.count == 8 {
-                let scanner = Scanner(string: hexColor)
-                var hexNumber: UInt64 = 0
-
-                if scanner.scanHexInt64(&hexNumber) {
-                    r = CGFloat((hexNumber & 0xff000000) >> 24) / 255
-                    g = CGFloat((hexNumber & 0x00ff0000) >> 16) / 255
-                    b = CGFloat((hexNumber & 0x0000ff00) >> 8) / 255
-                    a = CGFloat(hexNumber & 0x000000ff) / 255
-
-                    self.init(red: r, green: g, blue: b, alpha: a)
-                    return
-                }
-            }
-        }
-
-        return nil
-    }
-}

+ 9 - 1
iOSClient/Viewer/NCViewerRichWorkspace.swift

@@ -30,6 +30,7 @@ import Foundation
     
     private let appDelegate = UIApplication.shared.delegate as! AppDelegate
     @objc public var richWorkspace: String = ""
+    @objc public var serverUrl: String = ""
     @objc public var titleCloseItem: String = ""
    
     override func viewDidLoad() {
@@ -37,7 +38,8 @@ import Foundation
         
         let closeItem = UIBarButtonItem(title: titleCloseItem, style: .plain, target: self, action: #selector(closeItemTapped(_:)))
         self.navigationItem.leftBarButtonItem = closeItem
-        
+        editItem.image = UIImage(named: "actionSheetModify")
+
         viewRichWorkspace.setRichWorkspaceText(richWorkspace)
         
         NotificationCenter.default.addObserver(self, selector: #selector(self.changeTheming), name: NSNotification.Name(rawValue: "changeTheming"), object: nil)
@@ -54,5 +56,11 @@ import Foundation
     
     @IBAction func editItemAction(_ sender: Any) {
         
+        if let metadata = NCManageDatabase.sharedInstance.getMetadata(predicate: NSPredicate(format: "account == %@ AND serverUrl == %@ AND fileNameView LIKE[c] %@", appDelegate.activeAccount, serverUrl, k_fileNameRichWorkspace.lowercased())) {
+            
+            dismiss(animated: false) {
+                self.appDelegate.activeMain.shouldPerformSegue(metadata, selector: "")
+            }
+        }
     }
 }