Эх сурвалжийг харах

added OCA.RichDocuments.documentsMain.onClose()

marinofaggiana 4 жил өмнө
parent
commit
d7eb6f3832

+ 9 - 0
iOSClient/Viewer/NCViewerNextcloudText/NCViewerNextcloudText.swift

@@ -91,6 +91,15 @@ class NCViewerNextcloudText: UIViewController, WKNavigationDelegate, WKScriptMes
         appDelegate.activeViewController = self
     }
     
+    override func viewWillDisappear(_ animated: Bool) {
+        super.viewWillDisappear(animated)
+
+        if let navigationController = self.navigationController {
+            if !navigationController.viewControllers.contains(self) {
+            }
+        }
+    }
+    
     @objc func viewUnload() {
         
         navigationController?.popViewController(animated: true)

+ 3 - 3
iOSClient/Viewer/NCViewerRichdocument/NCViewerRichdocument.storyboard

@@ -3,16 +3,16 @@
     <device id="retina6_1" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17126"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
-        <!--Viewer Rich Workspace-->
+        <!--Viewer Richdocument-->
         <scene sceneID="iQa-NL-bSv">
             <objects>
-                <viewController hidesBottomBarWhenPushed="YES" id="4S0-zY-MgR" customClass="NCViewerRichWorkspace" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
+                <viewController hidesBottomBarWhenPushed="YES" id="4S0-zY-MgR" customClass="NCViewerRichdocument" customModule="Nextcloud" customModuleProvider="target" sceneMemberID="viewController">
                     <view key="view" contentMode="scaleToFill" id="Ka1-ZK-iJj">
                         <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>

+ 14 - 0
iOSClient/Viewer/NCViewerRichdocument/NCViewerRichdocument.swift

@@ -89,6 +89,20 @@ class NCViewerRichdocument: UIViewController, WKNavigationDelegate, WKScriptMess
         appDelegate.activeViewController = self
     }
     
+    override func viewWillDisappear(_ animated: Bool) {
+        super.viewWillDisappear(animated)
+
+        if let navigationController = self.navigationController {
+            if !navigationController.viewControllers.contains(self) {
+                
+                let functionJS = "OCA.RichDocuments.documentsMain.onClose()"
+                webView.evaluateJavaScript(functionJS) { (result, error) in
+                    print("close")
+                }
+            }
+        }
+    }
+    
     @objc func viewUnload() {
         
         navigationController?.popViewController(animated: true)