瀏覽代碼

clear code

marinofaggiana 4 年之前
父節點
當前提交
9945489ee7

+ 1 - 1
Share/ShareViewController.m

@@ -412,7 +412,7 @@
     else if (UTTypeConformsTo(fileUTI, kUTTypeImage)) {
         image = [UIImage imageWithContentsOfFile:[NSTemporaryDirectory() stringByAppendingString:fileName]];
         if (image) {
-            image = [image resizeImageWithSize:CGSizeMake(100, 100) isAspectRation:false];
+            image = [image resizeImageWithSize:CGSizeMake(100, 100) isAspectRation:true];
         } else {
             image = [UIImage imageNamed:@"file_photo"];
         }

+ 6 - 17
iOSClient/AppDelegate.h

@@ -47,11 +47,11 @@
 
 @interface AppDelegate : UIResponder <UIApplicationDelegate, UNUserNotificationCenterDelegate>
 
+@property (nonatomic, strong) UIWindow *window;
+@property (nonatomic, copy) void (^backgroundSessionCompletionHandler)(void);
+
 // Timer Process
-@property (nonatomic, strong) NSTimer *timerErrorNetworking;
 
-@property (nonatomic, strong) UIWindow *window;
-@property (nonatomic, strong) NCDocumentPickerViewController *documentPickerViewController;
 
 // Parameter account
 @property (nonatomic, strong) NSString *account;
@@ -60,14 +60,6 @@
 @property (nonatomic, strong) NSString *userID;
 @property (nonatomic, strong) NSString *password;
 
-// Networking 
-@property (nonatomic, copy) void (^backgroundSessionCompletionHandler)(void);
-
-// UploadFromOtherUpp
-@property (nonatomic, strong) NSString *fileNameUpload;
-
-@property (nonatomic, retain) TOPasscodeViewController *passcodeViewController;
-
 @property (nonatomic, retain) NSString *activeServerUrl;
 @property (nonatomic, retain) UIViewController *activeViewController;
 
@@ -92,17 +84,14 @@
 @property (nonatomic, strong) NSMutableDictionary *listOfflineVC;
 @property (nonatomic, strong) NSMutableDictionary *listProgressMetadata;
 
+@property (nonatomic, strong) NSTimer *timerErrorNetworking;
+@property (nonatomic, strong) NCDocumentPickerViewController *documentPickerViewController;
 @property (nonatomic) UIUserInterfaceStyle preferredUserInterfaceStyle API_AVAILABLE(ios(12.0));
-
-// Shares
 @property (nonatomic, strong) NSArray *shares;
 @property BOOL disableSharesView;
-
-// UserDefaults
 @property (nonatomic, strong) NSUserDefaults *ncUserDefaults;
-
-// Network Auto Upload
 @property (nonatomic, strong) NCNetworkingAutoUpload *networkingAutoUpload;
+@property (nonatomic, retain) TOPasscodeViewController *passcodeViewController;
 
 // Login
 - (void)startTimerErrorNetworking;

+ 12 - 5
iOSClient/AppDelegate.m

@@ -27,6 +27,7 @@
 #import "NSNotificationCenter+MainThread.h"
 #import "NCPushNotification.h"
 #import <QuartzCore/QuartzCore.h>
+#import "CCUploadFromOtherUpp.h"
 
 @import Firebase;
 
@@ -636,17 +637,23 @@
     NSLog(@"[LOG] the path is: %@", url.path);
         
     NSArray *splitedUrl = [url.path componentsSeparatedByString:@"/"];
-    self.fileNameUpload = [NSString stringWithFormat:@"%@",[splitedUrl objectAtIndex:([splitedUrl count]-1)]];
+    NSString *fileNameUpload = [NSString stringWithFormat:@"%@",[splitedUrl objectAtIndex:([splitedUrl count]-1)]];
     
     if (self.account && [[NSFileManager defaultManager] fileExistsAtPath:url.path]) {
         
-        [[NSFileManager defaultManager] removeItemAtPath:[NSTemporaryDirectory() stringByAppendingString:self.fileNameUpload] error:nil];
-        [[NSFileManager defaultManager] moveItemAtPath:url.path toPath:[NSTemporaryDirectory() stringByAppendingString:self.fileNameUpload] error:&error];
+        [[NSFileManager defaultManager] removeItemAtPath:[NSTemporaryDirectory() stringByAppendingString:fileNameUpload] error:nil];
+        [[NSFileManager defaultManager] moveItemAtPath:url.path toPath:[NSTemporaryDirectory() stringByAppendingString:fileNameUpload] error:&error];
         
         if (error == nil) {
             dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
-                UIViewController *uploadNavigationViewController = [[UIStoryboard storyboardWithName:@"CCUploadFromOtherUpp" bundle:nil] instantiateViewControllerWithIdentifier:@"CCUploadNavigationViewController"];
-                [self.window.rootViewController presentViewController:uploadNavigationViewController animated:YES completion:nil];
+                
+                UINavigationController *navigationController = [[UIStoryboard storyboardWithName:@"CCUploadFromOtherUpp" bundle:nil] instantiateInitialViewController];
+                
+                CCUploadFromOtherUpp *uploadFromOtherUpp = (CCUploadFromOtherUpp *)[navigationController topViewController];
+                
+                uploadFromOtherUpp.fileNameUpload = fileNameUpload;
+                
+                [self.window.rootViewController presentViewController:uploadFromOtherUpp animated:YES completion:nil];
             });
         }
     }

+ 2 - 0
iOSClient/UploadFromOtherUpp/CCUploadFromOtherUpp.h

@@ -24,8 +24,10 @@
 #import <UIKit/UIKit.h>
 
 @interface CCUploadFromOtherUpp : UITableViewController <UITableViewDelegate, UITableViewDataSource>
+
 @property (weak, nonatomic) IBOutlet UILabel *fileSizeLabel;
 @property (weak, nonatomic) IBOutlet UITextField *fileNameTextfield;
 @property (weak, nonatomic) IBOutlet UILabel *destinationLabel;
+@property (nonatomic, strong) NSString *fileNameUpload;
 
 @end

+ 3 - 3
iOSClient/UploadFromOtherUpp/CCUploadFromOtherUpp.m

@@ -88,9 +88,9 @@
         case 0:
             if (row == 0) {
                                 
-                NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[NSTemporaryDirectory() stringByAppendingString:appDelegate.fileNameUpload] error:nil];
+                NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[NSTemporaryDirectory() stringByAppendingString:self.fileNameUpload] error:nil];
                 NSString *fileSize = [CCUtility transformedSize:[[fileAttributes objectForKey:NSFileSize] longValue]];
-                self.fileNameTextfield.text = appDelegate.fileNameUpload;
+                self.fileNameTextfield.text = self.fileNameUpload;
                 self.fileSizeLabel.text = fileSize;
             }
             break;
@@ -182,7 +182,7 @@
     metadataForUpload.status = NCBrandGlobal.shared.metadataStatusWaitUpload;
     
     // Prepare file and directory
-    [CCUtility copyFileAtPath:[NSTemporaryDirectory() stringByAppendingString:appDelegate.fileNameUpload] toPath:[CCUtility getDirectoryProviderStorageOcId:metadataForUpload.ocId fileNameView:fileName]];
+    [CCUtility copyFileAtPath:[NSTemporaryDirectory() stringByAppendingString:self.fileNameUpload] toPath:[CCUtility getDirectoryProviderStorageOcId:metadataForUpload.ocId fileNameView:fileName]];
     
     // Add Medtadata for upload
     [[NCManageDatabase shared] addMetadata:metadataForUpload];

+ 16 - 6
iOSClient/UploadFromOtherUpp/CCUploadFromOtherUpp.storyboard

@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="2nu-YR-W0N">
     <device id="retina4_7" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
+        <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
@@ -14,7 +15,7 @@
                     <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="none" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" id="5dt-Am-942">
                         <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
+                        <color key="backgroundColor" systemColor="groupTableViewBackgroundColor"/>
                         <sections>
                             <tableViewSection id="dXl-sd-Urw">
                                 <cells>
@@ -39,7 +40,7 @@
                                                         <constraint firstAttribute="height" constant="21" id="HDa-pw-0XU"/>
                                                     </constraints>
                                                     <fontDescription key="fontDescription" type="system" pointSize="12"/>
-                                                    <color key="textColor" systemColor="secondaryLabelColor" red="0.23529411759999999" green="0.23529411759999999" blue="0.26274509800000001" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
+                                                    <color key="textColor" systemColor="secondaryLabelColor"/>
                                                     <nil key="highlightedColor"/>
                                                 </label>
                                             </subviews>
@@ -120,7 +121,7 @@
                                                             <nil key="highlightedColor"/>
                                                         </label>
                                                     </subviews>
-                                                    <color key="backgroundColor" cocoaTouchSystemColor="tableCellGroupedBackgroundColor"/>
+                                                    <color key="backgroundColor" systemColor="tableCellGroupedBackgroundColor"/>
                                                     <constraints>
                                                         <constraint firstItem="lAw-g4-lYL" firstAttribute="centerY" secondItem="xRI-9K-ta8" secondAttribute="centerY" id="6NL-vp-9Tn"/>
                                                         <constraint firstItem="uss-79-34j" firstAttribute="leading" secondItem="lAw-g4-lYL" secondAttribute="trailing" constant="8" id="Rot-ha-PAl"/>
@@ -174,7 +175,7 @@
         <!--Navigation Controller-->
         <scene sceneID="X9k-hu-nkv">
             <objects>
-                <navigationController storyboardIdentifier="CCUploadNavigationViewController" automaticallyAdjustsScrollViewInsets="NO" useStoryboardIdentifierAsRestorationIdentifier="YES" id="2nu-YR-W0N" sceneMemberID="viewController">
+                <navigationController automaticallyAdjustsScrollViewInsets="NO" id="2nu-YR-W0N" sceneMemberID="viewController">
                     <toolbarItems/>
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="7WU-Q2-JEB">
                         <rect key="frame" x="0.0" y="0.0" width="375" height="44"/>
@@ -193,5 +194,14 @@
     <resources>
         <image name="cloudUpload" width="425" height="425"/>
         <image name="folder" width="300" height="300"/>
+        <systemColor name="groupTableViewBackgroundColor">
+            <color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
+        </systemColor>
+        <systemColor name="secondaryLabelColor">
+            <color red="0.23529411764705882" green="0.23529411764705882" blue="0.2627450980392157" alpha="0.59999999999999998" colorSpace="custom" customColorSpace="sRGB"/>
+        </systemColor>
+        <systemColor name="tableCellGroupedBackgroundColor">
+            <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+        </systemColor>
     </resources>
 </document>