marinofaggiana 5 ani în urmă
părinte
comite
cf53bc7591

+ 4 - 0
Nextcloud.xcodeproj/project.pbxproj

@@ -388,6 +388,7 @@
 		F77B0F8C1D118A16002130FE /* CCCellMainTransfer.xib in Resources */ = {isa = PBXBuildFile; fileRef = F70211F91BAC56E9003FC03E /* CCCellMainTransfer.xib */; };
 		F77D49A91DC238E500CDC568 /* loading.gif in Resources */ = {isa = PBXBuildFile; fileRef = F77D49A71DC238E500CDC568 /* loading.gif */; };
 		F77EB6281EC08036003F814F /* CCExifGeo.m in Sources */ = {isa = PBXBuildFile; fileRef = F7A54C351C6267B500E2C8BF /* CCExifGeo.m */; };
+		F77F5D2D23D5F28100D2B7EB /* NCMainRefreshControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = F77F5D2C23D5F28100D2B7EB /* NCMainRefreshControl.swift */; };
 		F78071091EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m in Sources */ = {isa = PBXBuildFile; fileRef = F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */; };
 		F780710A1EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m in Sources */ = {isa = PBXBuildFile; fileRef = F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */; };
 		F781996922636BFA00EBDF6A /* HCFeatures.m in Sources */ = {isa = PBXBuildFile; fileRef = F781996822636BFA00EBDF6A /* HCFeatures.m */; };
@@ -1108,6 +1109,7 @@
 		F777F0301C29717F00CE81CB /* PHAsset+Utility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "PHAsset+Utility.h"; sourceTree = "<group>"; };
 		F777F0311C29717F00CE81CB /* PHAsset+Utility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "PHAsset+Utility.m"; sourceTree = "<group>"; };
 		F77D49A71DC238E500CDC568 /* loading.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = loading.gif; sourceTree = "<group>"; };
+		F77F5D2C23D5F28100D2B7EB /* NCMainRefreshControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCMainRefreshControl.swift; sourceTree = "<group>"; };
 		F78071071EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSNotificationCenter+MainThread.h"; sourceTree = "<group>"; };
 		F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSNotificationCenter+MainThread.m"; sourceTree = "<group>"; };
 		F781996722636BFA00EBDF6A /* HCFeatures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HCFeatures.h; sourceTree = "<group>"; };
@@ -1603,6 +1605,7 @@
 				F7226EDB1EE4089300EBECB1 /* Main.storyboard */,
 				F7D6650620FF341600BFBA9E /* NCMainCommon.swift */,
 				F7682FDF23C36B0500983A04 /* NCMainTabBar.swift */,
+				F77F5D2C23D5F28100D2B7EB /* NCMainRefreshControl.swift */,
 				F77444F7222816D5000D5EB0 /* NCPhotosPickerViewController.swift */,
 			);
 			path = Main;
@@ -3681,6 +3684,7 @@
 				F70022D41EC4C9100080073F /* NSDate+ISO8601.m in Sources */,
 				F762CB151EACB66200B38484 /* XLFormRowNavigationAccessoryView.m in Sources */,
 				F762CB0A1EACB66200B38484 /* XLFormDescriptor.m in Sources */,
+				F77F5D2D23D5F28100D2B7EB /* NCMainRefreshControl.swift in Sources */,
 				F7D4238C1F0596C6009C9782 /* UIXToolbarView.m in Sources */,
 				F7020FCE2233D7F700B7297D /* NCCreateFormUploadVoiceNote.swift in Sources */,
 				F7F4B1D823C74B3E00D82A6E /* NCRichWorkspace.swift in Sources */,

+ 5 - 5
iOSClient/Main/CCMain.m

@@ -49,7 +49,7 @@
     NSUInteger _failedAttempts;
     NSDate *_lockUntilDate;
 
-    UIRefreshControl *refreshControl;
+    NCMainRefreshControl *refreshControl;
 
     CCHud *_hud;
     
@@ -289,7 +289,7 @@
         }
         
         [self setTableViewHeader];
-        [self.tableView reloadData];
+        self.searchController.searchBar.frame = CGRectMake(0, 0, self.tableView.frame.size.width, self.searchController.searchBar.frame.size.height);
     }];
 }
 
@@ -542,7 +542,7 @@
 
 - (void)createRefreshControl
 {
-    refreshControl = [UIRefreshControl new];
+    refreshControl = [NCMainRefreshControl new];
     
     self.tableView.refreshControl = refreshControl;
     
@@ -3867,12 +3867,12 @@
     if (capabilities.versionMajor < k_nextcloud_version_18_0 || self.richWorkspace.length == 0 || self.searchController.isActive) {
         
         [self.viewRichWorkspace setRichWorkspaceText:@"" gradient:false];
-        [self.tableView.tableHeaderView setFrame:CGRectMake(0, 0, self.view.frame.size.width, heightSearchBar)];
+        [self.tableView.tableHeaderView setFrame:CGRectMake(0, 0, self.tableView.frame.size.width, heightSearchBar)];
         
     } else {
         
         [self.viewRichWorkspace setRichWorkspaceText:self.richWorkspace gradient:true];
-        [self.viewRichWorkspace setFrame:CGRectMake(0, 0, self.view.frame.size.width, heightRichWorkspace + heightSearchBar)];
+        [self.viewRichWorkspace setFrame:CGRectMake(0, 0, self.tableView.frame.size.width, heightRichWorkspace + heightSearchBar)];
     }
     
     [self.tableView reloadData];

+ 58 - 0
iOSClient/Main/NCMainRefreshControl.swift

@@ -0,0 +1,58 @@
+//
+//  NCMainRefreshControl.swift
+//  Nextcloud
+//
+//  Created by Marino Faggiana on 20/01/2020.
+//  Copyright (c) 2017 Marino Faggiana. All rights reserved.
+//
+//  Author Marino Faggiana <marino.faggiana@nextcloud.com>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+
+import Foundation
+
+class NCMainRefreshControl: UIRefreshControl {
+    
+    override func layoutSubviews() {
+        super.layoutSubviews()
+        let originalFrame = frame
+        frame = originalFrame
+    }
+    
+    override var isHidden: Bool {
+        get {
+            return super.isHidden
+        }
+        set(hiding) {
+            if hiding {
+                guard frame.origin.y >= 0 else { return }
+                super.isHidden = hiding
+            } else {
+                guard frame.origin.y < 0 else { return }
+                super.isHidden = hiding
+            }
+        }
+    }
+
+    override var frame: CGRect {
+        didSet {
+            if frame.origin.y < 0 {
+                isHidden = false
+            } else {
+                isHidden = true
+            }
+        }
+    }
+}