marinofaggiana 5 yıl önce
ebeveyn
işleme
6dc025afed

+ 2 - 0
iOSClient/Main/CCMain.h

@@ -91,5 +91,7 @@
 - (void)openImportDocumentPicker;
 - (void)createFolder;
 
+- (void)setTableViewHeader;
+
 @end
 

+ 3 - 15
iOSClient/Main/CCMain.m

@@ -137,13 +137,10 @@
     
     // Load Rich Workspace
     self.viewRichWorkspace = [[[NSBundle mainBundle] loadNibNamed:@"NCRichWorkspace" owner:self options:nil] firstObject];
-    
-    /*
-    UITapGestureRecognizer *webViewTapped = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(webViewTapAction:)];
+    UITapGestureRecognizer *webViewTapped = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(viewRichWorkspaceTapAction:)];
     webViewTapped.numberOfTapsRequired = 1;
     webViewTapped.delegate = self;
     [self.viewRichWorkspace addGestureRecognizer:webViewTapped];
-    */
     
     // Pull-to-Refresh
     [self createRefreshControl];
@@ -1954,15 +1951,10 @@
 }
 
 #pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Web view (NC 18) =====
+#pragma mark ===== Rich WorkspaceTap Action =====
 #pragma --------------------------------------------------------------------------------------------
 
-- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
-{
-    return YES;
-}
-
-- (void)webViewTapAction:(UITapGestureRecognizer *)tapGesture
+- (void)viewRichWorkspaceTapAction:(UITapGestureRecognizer *)tapGesture
 {
     tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@ AND fileNameView LIKE[c] %@", appDelegate.activeAccount, self.serverUrl, @"readme.md"]];
     if (metadata && [[NCUtility sharedInstance] isDirectEditing:metadata]) {
@@ -3890,10 +3882,6 @@
     }
     
     tableDirectory *directory = [[NCManageDatabase sharedInstance] getTableDirectoryWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND serverUrl == %@", appDelegate.activeAccount, self.serverUrl]];
-    if ([richWorkspace isEqualToString:directory.richWorkspace]) {
-        return;
-    }
-
     [self.viewRichWorkspace setFrame:CGRectMake(0, 0, self.tableView.frame.size.width, CCUtility.getRichWorkspaceHeight)];
     
     if (directory.richWorkspace != nil && directory.richWorkspace.length > 0) {

+ 15 - 20
iOSClient/Main/NCRichWorkspace.swift

@@ -45,7 +45,11 @@ import Foundation
         imageDrag.image = CCGraphics.changeThemingColorImage(UIImage(named: "dragHorizontal"), width: 20, height: 10, color: NCBrandColor.sharedInstance.brandText)
     }
     
-    override func  touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
+    override func gestureRecognizerShouldBegin(_ gestureRecognizer: UIGestureRecognizer) -> Bool {
+        return false
+    }
+    
+    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
         let touch = touches.first
         startPosition = touch?.location(in: self)
         originalHeight = self.frame.height
@@ -55,25 +59,16 @@ import Foundation
         let touch = touches.first
         let endPosition = touch?.location(in: self)
         let difference = endPosition!.y - startPosition!.y
-        
-        /*
-        let differenceSectionWebViewHeight = appDelegate.activeMain.constraintHeightRichWorkspace.constant + difference
-        
-        if differenceSectionWebViewHeight <= minHeight {
-            appDelegate.activeMain.constraintHeightRichWorkspace.constant = minHeight
-        }
-        else if differenceSectionWebViewHeight >= maxHeight {
-            appDelegate.activeMain.constraintHeightRichWorkspace.constant = maxHeight
+        if let viewRichWorkspace = appDelegate.activeMain.tableView.tableHeaderView {
+            let differenceHeight = viewRichWorkspace.frame.height + difference
+            if differenceHeight <= minHeight {
+                CCUtility.setRichWorkspaceHeight(Int(minHeight))
+            } else if differenceHeight >= maxHeight {
+                CCUtility.setRichWorkspaceHeight(Int(maxHeight))
+            } else {
+                CCUtility.setRichWorkspaceHeight(Int(differenceHeight))
+            }
+            appDelegate.activeMain.setTableViewHeader()
         }
-        else {
-            appDelegate.activeMain.constraintHeightRichWorkspace.constant = differenceSectionWebViewHeight
-        }
-        
-        // save position
-        let currentviewSectionWebViewHeight = Int(appDelegate.activeMain.constraintHeightRichWorkspace.constant)
-        CCUtility.setRichWorkspaceHeight(currentviewSectionWebViewHeight)
-        */
     }
-
-    
 }