瀏覽代碼

removed CCHud

marinofaggiana 4 年之前
父節點
當前提交
21c23b8964

+ 0 - 25
Nextcloud.xcodeproj/project.pbxproj

@@ -53,7 +53,6 @@
 		F713FF002472764100214AF6 /* UIImage+animatedGIF.m in Sources */ = {isa = PBXBuildFile; fileRef = F713FEFF2472764100214AF6 /* UIImage+animatedGIF.m */; };
 		F71459C21D12E3B700CAFEEC /* ShareViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F7C0F46F1C8880540059EC54 /* ShareViewController.m */; };
 		F71459D21D12E3B700CAFEEC /* CCUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = F7053E3D1C639DF500741EA5 /* CCUtility.m */; };
-		F71459E11D12E3B700CAFEEC /* CCHud.m in Sources */ = {isa = PBXBuildFile; fileRef = F7514EDB1C7B1336008F3338 /* CCHud.m */; };
 		F7145A041D12E3B700CAFEEC /* CCloadItemData.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7296A661C8880ED001A7809 /* CCloadItemData.swift */; };
 		F7145A1A1D12E3B700CAFEEC /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F7F67BB81A24D27800EE80DA /* Images.xcassets */; };
 		F7145A231D12E3B700CAFEEC /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = F7E70DE91A24DE4100E1B66A /* Localizable.strings */; };
@@ -175,7 +174,6 @@
 		F779422025E956C900B7F9EC /* NCRenameFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = F779421F25E956C900B7F9EC /* NCRenameFile.swift */; };
 		F77A697D250A0FBC00FF1708 /* NCCollectionViewCommon+Menu.swift in Sources */ = {isa = PBXBuildFile; fileRef = F77A697C250A0FBC00FF1708 /* NCCollectionViewCommon+Menu.swift */; };
 		F77B0DF51D118A16002130FE /* CCUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = F7053E3D1C639DF500741EA5 /* CCUtility.m */; };
-		F77B0E301D118A16002130FE /* CCHud.m in Sources */ = {isa = PBXBuildFile; fileRef = F7514EDB1C7B1336008F3338 /* CCHud.m */; };
 		F77B0E4F1D118A16002130FE /* CCManageAutoUpload.m in Sources */ = {isa = PBXBuildFile; fileRef = F7ACE42F1BAC0268006C0017 /* CCManageAutoUpload.m */; };
 		F77B0E5F1D118A16002130FE /* NCSettings.m in Sources */ = {isa = PBXBuildFile; fileRef = F7ACE4311BAC0268006C0017 /* NCSettings.m */; };
 		F77B0E981D118A16002130FE /* CCManageAccount.m in Sources */ = {isa = PBXBuildFile; fileRef = F7ACE42D1BAC0268006C0017 /* CCManageAccount.m */; };
@@ -187,7 +185,6 @@
 		F780710A1EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m in Sources */ = {isa = PBXBuildFile; fileRef = F78071081EDAB65800EAFFF6 /* NSNotificationCenter+MainThread.m */; };
 		F7813EB825E9126B002C44A2 /* XLForm in Frameworks */ = {isa = PBXBuildFile; productRef = F7813EB725E9126B002C44A2 /* XLForm */; };
 		F7813EC325E91358002C44A2 /* UICKeyChainStore in Frameworks */ = {isa = PBXBuildFile; productRef = F7813EC225E91358002C44A2 /* UICKeyChainStore */; };
-		F7813ECE25E91460002C44A2 /* MBProgressHUD in Frameworks */ = {isa = PBXBuildFile; productRef = F7813ECD25E91460002C44A2 /* MBProgressHUD */; };
 		F78295311F962EFA00A572F5 /* NCEndToEndEncryption.m in Sources */ = {isa = PBXBuildFile; fileRef = F70CAE391F8CF31A008125FD /* NCEndToEndEncryption.m */; };
 		F782A57B25123694007BBABD /* Realm in Frameworks */ = {isa = PBXBuildFile; productRef = F782A57A25123694007BBABD /* Realm */; };
 		F782A57D25123694007BBABD /* RealmSwift in Frameworks */ = {isa = PBXBuildFile; productRef = F782A57C25123694007BBABD /* RealmSwift */; };
@@ -479,8 +476,6 @@
 		F7501C302212E57400FB1415 /* NCMedia.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = NCMedia.storyboard; sourceTree = "<group>"; };
 		F7501C312212E57400FB1415 /* NCMedia.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NCMedia.swift; sourceTree = "<group>"; };
 		F7509BA925DFC69C005370D1 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
-		F7514EDA1C7B1336008F3338 /* CCHud.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCHud.h; sourceTree = "<group>"; };
-		F7514EDB1C7B1336008F3338 /* CCHud.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCHud.m; sourceTree = "<group>"; };
 		F75153232226920200323DDC /* FastScroll.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FastScroll.framework; path = Carthage/Build/iOS/FastScroll.framework; sourceTree = "<group>"; };
 		F752011C25480387000BF3A7 /* NCViewerVideo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NCViewerVideo.swift; sourceTree = "<group>"; };
 		F753701822723D620041C76C /* gl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = gl; path = gl.lproj/Localizable.strings; sourceTree = "<group>"; };
@@ -740,7 +735,6 @@
 				F78F3FF125E8E83F007936CF /* FSCalendar in Frameworks */,
 				F74C4FBB2328C3C200A23E25 /* OpenSSL.framework in Frameworks */,
 				F7C4D88D2534887E00C142DA /* Parchment in Frameworks */,
-				F7813ECE25E91460002C44A2 /* MBProgressHUD in Frameworks */,
 				F7AF7633246BEDFE00B86E3C /* TOPasscodeViewController.framework in Frameworks */,
 				F78F400725E8EB42007936CF /* Queuer in Frameworks */,
 				F7176DDB256672F10017E83C /* libsqlite3.tbd in Frameworks */,
@@ -1240,8 +1234,6 @@
 		F7BFFA991A24D7BB0044ED85 /* Utility */ = {
 			isa = PBXGroup;
 			children = (
-				F7514EDA1C7B1336008F3338 /* CCHud.h */,
-				F7514EDB1C7B1336008F3338 /* CCHud.m */,
 				F7053E3C1C639DF500741EA5 /* CCUtility.h */,
 				F7053E3D1C639DF500741EA5 /* CCUtility.m */,
 				F733598025C1C188002ABA72 /* NCAskAuthorization.swift */,
@@ -1658,7 +1650,6 @@
 				F78F400625E8EB42007936CF /* Queuer */,
 				F7813EB725E9126B002C44A2 /* XLForm */,
 				F7813EC225E91358002C44A2 /* UICKeyChainStore */,
-				F7813ECD25E91460002C44A2 /* MBProgressHUD */,
 				F764A75C25E919DC00F95C9E /* FirebaseCrashlytics */,
 			);
 			productName = "Crypto Cloud";
@@ -1778,7 +1769,6 @@
 				F78F400525E8EB42007936CF /* XCRemoteSwiftPackageReference "Queuer" */,
 				F7813EB625E9126A002C44A2 /* XCRemoteSwiftPackageReference "XLForm" */,
 				F7813EC125E91358002C44A2 /* XCRemoteSwiftPackageReference "UICKeyChainStore" */,
-				F7813ECC25E91460002C44A2 /* XCRemoteSwiftPackageReference "MBProgressHUD" */,
 				F764A75B25E919DC00F95C9E /* XCRemoteSwiftPackageReference "firebase-ios-sdk" */,
 			);
 			productRefGroup = F7F67B9F1A24D27800EE80DA;
@@ -1958,7 +1948,6 @@
 				F7C9322725E39D4A000A14C2 /* NCGlobal.swift in Sources */,
 				F71459D21D12E3B700CAFEEC /* CCUtility.m in Sources */,
 				F7F8D71C1ED6183000E711F3 /* CCCellShareExt.m in Sources */,
-				F71459E11D12E3B700CAFEEC /* CCHud.m in Sources */,
 				F765609023BF813600765969 /* NCContentPresenter.swift in Sources */,
 				F75A9EE723796C6F0044CFCE /* NCNetworking.swift in Sources */,
 				F7A76DC8256A71CD00119AB3 /* UIImage+Extensions.swift in Sources */,
@@ -2051,7 +2040,6 @@
 				F769454222E9F0EE000A798A /* NCShareLinkMenuView.swift in Sources */,
 				F785EE9D246196DF00B3F945 /* NCNetworkingE2EE.swift in Sources */,
 				F7509BAA25DFC69C005370D1 /* AppDelegate.swift in Sources */,
-				F77B0E301D118A16002130FE /* CCHud.m in Sources */,
 				F76673ED22C901F6007ED366 /* FileProviderDomain.swift in Sources */,
 				F7A321AD1E9E6AD50069AD1B /* CCAdvanced.m in Sources */,
 				F77B0E4F1D118A16002130FE /* CCManageAutoUpload.m in Sources */,
@@ -2826,14 +2814,6 @@
 				minimumVersion = 2.2.1;
 			};
 		};
-		F7813ECC25E91460002C44A2 /* XCRemoteSwiftPackageReference "MBProgressHUD" */ = {
-			isa = XCRemoteSwiftPackageReference;
-			repositoryURL = "https://github.com/jdg/MBProgressHUD";
-			requirement = {
-				kind = upToNextMajorVersion;
-				minimumVersion = 1.2.0;
-			};
-		};
 		F782A57925123694007BBABD /* XCRemoteSwiftPackageReference "realm-cocoa" */ = {
 			isa = XCRemoteSwiftPackageReference;
 			repositoryURL = "https://github.com/realm/realm-cocoa";
@@ -2962,11 +2942,6 @@
 			package = F7813EC125E91358002C44A2 /* XCRemoteSwiftPackageReference "UICKeyChainStore" */;
 			productName = UICKeyChainStore;
 		};
-		F7813ECD25E91460002C44A2 /* MBProgressHUD */ = {
-			isa = XCSwiftPackageProductDependency;
-			package = F7813ECC25E91460002C44A2 /* XCRemoteSwiftPackageReference "MBProgressHUD" */;
-			productName = MBProgressHUD;
-		};
 		F782A57A25123694007BBABD /* Realm */ = {
 			isa = XCSwiftPackageProductDependency;
 			package = F782A57925123694007BBABD /* XCRemoteSwiftPackageReference "realm-cocoa" */;

+ 0 - 9
Nextcloud.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

@@ -127,15 +127,6 @@
           "version": "1.22.1"
         }
       },
-      {
-        "package": "MBProgressHUD",
-        "repositoryURL": "https://github.com/jdg/MBProgressHUD",
-        "state": {
-          "branch": null,
-          "revision": "bca42b801100b2b3a4eda0ba8dd33d858c780b0d",
-          "version": "1.2.0"
-        }
-      },
       {
         "package": "nanopb",
         "repositoryURL": "https://github.com/firebase/nanopb.git",

+ 0 - 1
Share/NCSelectDestination.h

@@ -24,7 +24,6 @@
 #import <UIKit/UIKit.h>
 
 #import "CCUtility.h"
-#import "CCHud.h"
 
 @class tableMetadata;
 

+ 0 - 1
Share/Share-Bridging-Header.h

@@ -2,6 +2,5 @@
 //  Use this file to import your target's public headers that you would like to expose to Swift.
 //
 
-#import "CCHud.h"
 #import "ShareViewController.h"
 #import "NCEndToEndEncryption.h"

+ 0 - 3
Share/ShareViewController.h

@@ -25,7 +25,6 @@
 
 #import "CCCellShareExt.h"
 #import "NCSelectDestination.h"
-#import "CCHud.h"
 
 @interface ShareViewController : UIViewController <UITableViewDelegate, MBProgressHUDDelegate, NCSelectDestinationDelegate, UITextFieldDelegate>
 
@@ -39,8 +38,6 @@
 @property (nonatomic, weak) IBOutlet NSLayoutConstraint *constraintTopTableView;
 @property (nonatomic, weak) IBOutlet UIToolbar *toolBar;
 
-@property (nonatomic, strong) CCHud *hud;
-
 - (void)closeShareViewController;
 - (void)reloadData:(NSArray *)files;
 

+ 3 - 6
Share/ShareViewController.m

@@ -103,9 +103,7 @@
     }
     
     self.filesName = [[NSMutableArray alloc] init];
-    
-    self.hud = [[CCHud alloc] initWithView:self.navigationController.view];
-    
+        
     [self.shareTable registerNib:[UINib nibWithNibName:@"CCCellShareExt" bundle:nil] forCellReuseIdentifier:@"ShareExtCell"];
     
     [self navigationBarToolBar];
@@ -258,7 +256,7 @@
 {
     if ([self.filesName count] > 0) {
     
-        [self.hud visibleHudTitle:NSLocalizedString(@"_uploading_", nil) mode:MBProgressHUDModeDeterminate color:NCBrandColor.shared.brandElement];
+        [[NCUtility shared] startActivityIndicatorWithView:nil bottom:0];
         
         NSString *fileName = [self.filesName objectAtIndex:0];
         NSString *fileNameLocal = [NSTemporaryDirectory() stringByAppendingString:fileName];
@@ -287,11 +285,10 @@
                         
         } progressHandler:^(NSProgress *progress) {
             
-            [self.hud progress:progress.fractionCompleted];
             
         } completionHandler:^(NSString *account, NSString *ocId, NSString *etag, NSDate *date, int64_t size, NSDictionary *allHeaderFields, NSInteger errorCode, NSString *errorDescription) {
             
-            [self.hud hideHud];
+            [[NCUtility shared] stopActivityIndicator];
             [self.filesName removeObject:fileName];
            
             if (errorCode == 0) {

+ 2 - 5
iOSClient/Networking/NCAutoUpload.swift

@@ -33,7 +33,6 @@ class NCAutoUpload: NSObject, CLLocationManagerDelegate {
     
     private let appDelegate = UIApplication.shared.delegate as! AppDelegate
     public var locationManager: CLLocationManager?
-    private var hud: CCHud?
     private var endForAssetToUpload: Bool = false
 
     // MARK: -
@@ -137,12 +136,10 @@ class NCAutoUpload: NSObject, CLLocationManagerDelegate {
     @objc func autoUploadFullPhotos(viewController: UIViewController?, log: String) {
         NCAskAuthorization.shared.askAuthorizationPhotoLibrary(viewController: appDelegate.window?.rootViewController) { (hasPermission) in
             if hasPermission {
-                self.hud = CCHud.init(view: self.appDelegate.window?.rootViewController?.view)
                 NCContentPresenter.shared.messageNotification("_attention_", description: "_create_full_upload_", delay: NCGlobal.shared.dismissAfterSecondLong, type: .info, errorCode: 0, forced: true)
-                self.hud?.visibleHudTitle(NSLocalizedString("_wait_", comment: ""), mode: MBProgressHUDMode.indeterminate, color: NCBrandColor.shared.brand)
-                
+                NCUtility.shared.startActivityIndicator(view: nil)
                 self.uploadAssetsNewAndFull(viewController: viewController, selector: NCGlobal.shared.selectorUploadAutoUploadAll, log: log) { (items) in
-                    self.hud?.hideHud()
+                    NCUtility.shared.stopActivityIndicator()
                 }
             }
         }

+ 0 - 1
iOSClient/Nextcloud-Bridging-Header.h

@@ -7,5 +7,4 @@
 #import "NYMnemonic.h"
 #import "UIImage+animatedGIF.h"
 #import "CCUtility.h"
-#import "CCHud.h"
 #import "NCPushNotification.h"

+ 0 - 3
iOSClient/Settings/CCAdvanced.h

@@ -23,10 +23,7 @@
 
 #import <MessageUI/MFMailComposeViewController.h>
 #import <XLForm/XLForm.h>
-#import "CCHud.h"
 
 @interface CCAdvanced : XLFormViewController <MFMailComposeViewControllerDelegate>
 
-@property (nonatomic, strong) CCHud *hud;
-
 @end

+ 2 - 4
iOSClient/Settings/CCAdvanced.m

@@ -30,7 +30,6 @@
 @interface CCAdvanced ()
 {
     AppDelegate *appDelegate;
-    CCHud *_hud;
 }
 @end
 
@@ -256,7 +255,6 @@
         
     self.title = NSLocalizedString(@"_advanced_", nil);
     appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
-    _hud = [[CCHud alloc] initWithView:[[[UIApplication sharedApplication] delegate] window]];
 
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:NCGlobal.shared.notificationCenterChangeTheming object:nil];
     [self changeTheming];
@@ -357,7 +355,7 @@
     [appDelegate.activeMedia reloadDataSource];
     
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
-       [_hud hideHud];
+        [[NCUtility shared] stopActivityIndicator];
     });
 }
 
@@ -368,7 +366,7 @@
     UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"" message:NSLocalizedString(@"_want_delete_cache_", nil) preferredStyle:UIAlertControllerStyleActionSheet];
     
     [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_yes_", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
-        [_hud visibleHudTitle:NSLocalizedString(@"_wait_", nil) mode:MBProgressHUDModeIndeterminate color:nil];
+        [[NCUtility shared] startActivityIndicatorWithView:nil bottom:0];
         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
             [self clearCache];
         });

+ 0 - 1
iOSClient/Settings/NCSettings.h

@@ -25,7 +25,6 @@
 #import <MessageUI/MessageUI.h>
 #import <XLForm/XLForm.h>
 #import "CCUtility.h"
-#import "CCHud.h"
 
 @interface NCSettings : XLFormViewController
 

+ 0 - 42
iOSClient/Utility/CCHud.h

@@ -1,42 +0,0 @@
-//
-//  CCHud.h
-//  Nextcloud
-//
-//  Created by Marino Faggiana on 22/02/16.
-//  Copyright (c) 2016 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/Foundation.h>
-#import <MBProgressHUD/MBProgressHUD.h>
-
-@interface CCHud : NSObject
-
-@property (nonatomic, strong) MBProgressHUD *hud;
-
-- (id)initWithView:(id)view;
-
-- (void)visibleHudTitle:(NSString *)title mode:(MBProgressHUDMode)mode color:(UIColor *)color;
-- (void)visibleIndeterminateHud;
-
-- (void)hideHud;
-
-- (void)progress:(float)progress;
-
-- (void)AddButtonCancelWithTarget:(id)target selector:(NSString *)selector;
-
-@end

+ 0 - 86
iOSClient/Utility/CCHud.m

@@ -1,86 +0,0 @@
-//
-//  CCHud.m
-//  Nextcloud
-//
-//  Created by Marino Faggiana on 22/02/16.
-//  Copyright (c) 2016 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 "CCHud.h"
-
-@interface CCHud ()
-{
-    UIView * _view;
-}
-@end
-
-@implementation CCHud
-
-- (id)initWithView:(id)view
-{
-    self = [super init];
-    
-    _view = view;
-    return self;
-}
-
-// mode :   MBProgressHUDModeDeterminateHorizontalBar
-//          MBProgressHUDModeDeterminate
-//          MBProgressHUDModeIndeterminate
-
-- (void)visibleHudTitle:(NSString *)title mode:(MBProgressHUDMode)mode color:(UIColor *)color
-{
-    if (self.hud) return;
-    
-    self.hud = [MBProgressHUD showHUDAddedTo:_view animated:NO];
-    
-    if (!self.hud) return;
-    
-    self.hud.removeFromSuperViewOnHide = YES;
-    self.hud.mode = mode ;
-    if (title) self.hud.label.text = title;
-    self.hud.hidden = NO;
-    if (color) self.hud.bezelView.color = color;
-}
-
-- (void)visibleIndeterminateHud
-{
-    [self visibleHudTitle:nil mode:MBProgressHUDModeIndeterminate color:nil];
-}
-
-- (void)hideHud
-{
-    if (self.hud) {
-        [self.hud hideAnimated:YES];
-        [self.hud removeFromSuperview];
-        self.hud = nil;
-    }
-}
-
-- (void)progress:(float)progress
-{
-    if (self.hud) self.hud.progress = progress;
-}
-
-- (void)AddButtonCancelWithTarget:(id)target selector:(NSString *)selector
-{
-    [self.hud.button setTitle:NSLocalizedString(@"_cancel_", nil) forState:UIControlStateNormal];
-    [self.hud.button addTarget:target action:(NSSelectorFromString(selector)) forControlEvents:UIControlEventTouchUpInside];
-}
-
-@end

+ 2 - 2
iOSClient/Utility/NCUtility.swift

@@ -34,8 +34,8 @@ class NCUtility: NSObject {
         return instance
     }()
     
-    let activityIndicator = UIActivityIndicatorView(style: .whiteLarge)
-    var viewActivityIndicator: UIView?
+    private let activityIndicator = UIActivityIndicatorView(style: .whiteLarge)
+    private var viewActivityIndicator: UIView?
     
     func setLayoutForView(key: String, serverUrl: String, layout: String, sort: String, ascending: Bool, groupBy: String, directoryOnTop: Bool, titleButton: String, itemForLine: Int) {