Marino Faggiana vor 6 Jahren
Ursprung
Commit
cf79394d62

+ 1 - 1
Share/ShareViewController.m

@@ -168,7 +168,7 @@
     self.navigationItem.hidesBackButton = YES;
 }
 
-- (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title
+- (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title type:(NSString *)type
 {
     // DENIED e2e
     if ([CCUtility isFolderEncrypted:serverUrlTo account:self.activeAccount]) {

+ 21 - 0
iOSClient/Images.xcassets/folderAutomaticUpload.imageset/Contents.json

@@ -0,0 +1,21 @@
+{
+  "images" : [
+    {
+      "idiom" : "universal",
+      "scale" : "1x"
+    },
+    {
+      "idiom" : "universal",
+      "filename" : "folderAutomaticUpload@2x.png",
+      "scale" : "2x"
+    },
+    {
+      "idiom" : "universal",
+      "scale" : "3x"
+    }
+  ],
+  "info" : {
+    "version" : 1,
+    "author" : "xcode"
+  }
+}

BIN
iOSClient/Images.xcassets/folderAutomaticUpload.imageset/folderAutomaticUpload@2x.png


+ 1 - 21
iOSClient/Main/CCMain.m

@@ -1875,7 +1875,7 @@
 }
 
 // DELEGATE : Move
-- (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title
+- (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title type:(NSString *)type
 {
     [_queueSelector removeAllObjects];
     
@@ -3606,26 +3606,6 @@
                                     }];
         }
         
-        if (!([self.metadata.fileName isEqualToString:_autoUploadFileName] == YES && [serverUrl isEqualToString:_autoUploadDirectory] == YES)) {
-            
-            [actionSheet addButtonWithTitle:NSLocalizedString(@"_folder_automatic_upload_", nil)
-                                      image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderMedia"] multiplier:2 color:[NCBrandColor sharedInstance].icon]
-                            backgroundColor:[NCBrandColor sharedInstance].backgroundView
-                                     height:50.0
-                                       type:AHKActionSheetButtonTypeDefault
-                                    handler:^(AHKActionSheet *as) {
-                                        
-                                        // Settings new folder Automatatic upload
-                                        [[NCManageDatabase sharedInstance] setAccountAutoUploadFileName:self.metadata.fileName];
-                                        [[NCManageDatabase sharedInstance] setAccountAutoUploadDirectory:serverUrl activeUrl:appDelegate.activeUrl];
-                                        
-                                        // Clear data (old) Auto Upload
-                                        [[NCManageDatabase sharedInstance] clearDateReadWithServerUrl:_autoUploadDirectory directoryID:nil];
-                                                                                
-                                        [self readFolder:serverUrl];
-                                    }];
-        }
-
         if (!([self.metadata.fileName isEqualToString:_autoUploadFileName] == YES && [serverUrl isEqualToString:_autoUploadDirectory] == YES)) {
             
             [actionSheet addButtonWithTitle:titoloLock

+ 68 - 10
iOSClient/Media/CCMedia.m

@@ -51,6 +51,7 @@
     // Remenu
     REMenu *menu;
     REMenuItem *menuSelectMediaFolder;
+    REMenuItem *menuSelectAutomaticUploadFolder;
     REMenuItem *menuFilterImage;
     REMenuItem *menuFilterVideo;
     REMenuItem *menuSelectItems;
@@ -247,10 +248,14 @@
         }
     }];
     
-    menuSelectMediaFolder = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_select_media_folder_", nil)subtitle:@"" image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderMedia"] multiplier:2 color:[NCBrandColor sharedInstance].icon] highlightedImage:nil action:^(REMenuItem *item) {
+    menuSelectAutomaticUploadFolder = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_select_media_folder_", nil)subtitle:@"" image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderMedia"] multiplier:2 color:[NCBrandColor sharedInstance].icon] highlightedImage:nil action:^(REMenuItem *item) {
         [self selectStartDirectoryPhotosTab];
     }];
     
+    menuSelectMediaFolder = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_select_automatic_upload_folder_", nil)subtitle:@"" image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderAutomaticUpload"] multiplier:2 color:[NCBrandColor sharedInstance].icon] highlightedImage:nil action:^(REMenuItem *item) {
+        [self selectAutomaticUploadFolder];
+    }];
+    
     if (filterTypeFileImage) {
         menuFilterImage = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_media_viewimage_show_", nil)subtitle:@"" image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"imageno"] multiplier:2 color:[NCBrandColor sharedInstance].icon] highlightedImage:nil action:^(REMenuItem *item) {
             filterTypeFileImage = NO;
@@ -277,7 +282,7 @@
     
     // REMENU --------------------------------------------------------------------------------------------------------------
     
-    menu = [[REMenu alloc] initWithItems:@[menuSelectItems, menuSelectMediaFolder, menuFilterImage, menuFilterVideo]];
+    menu = [[REMenu alloc] initWithItems:@[menuSelectItems, menuSelectMediaFolder, menuSelectAutomaticUploadFolder, menuFilterImage, menuFilterVideo]];
     
     menu.imageOffset = CGSizeMake(5, -1);
     
@@ -620,20 +625,45 @@
 }
 
 #pragma --------------------------------------------------------------------------------------------
-#pragma mark ==== Change Start directory ====
+#pragma mark ==== Change Start directory && Automatic upload directory ====
 #pragma --------------------------------------------------------------------------------------------
 
-- (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title
+- (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title type:(NSString *)type
 {
-    NSString *oldStartDirectoryMediaTabView = [[NCManageDatabase sharedInstance] getAccountStartDirectoryMediaTabView:[CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl]];
+    if ([type isEqualToString:@"mediaFolder"]) {
+        
+        NSString *oldStartDirectoryMediaTabView = [[NCManageDatabase sharedInstance] getAccountStartDirectoryMediaTabView:[CCUtility getHomeServerUrlActiveUrl:appDelegate.activeUrl]];
+        
+        if (![serverUrlTo isEqualToString:oldStartDirectoryMediaTabView]) {
+            
+            // Save Start Directory
+            [[NCManageDatabase sharedInstance] setAccountStartDirectoryMediaTabView:serverUrlTo];
+            
+            // search PhotoVideo with new start directory
+            [self searchPhotoVideo];
+        }
+    }
     
-    if (![serverUrlTo isEqualToString:oldStartDirectoryMediaTabView]) {
+    if ([type isEqualToString:@"automaticUploadFolder"]) {
         
-        // Save Start Directory
-        [[NCManageDatabase sharedInstance] setAccountStartDirectoryMediaTabView:serverUrlTo];
+        if (title == nil) {
+            [appDelegate messageNotification:@"_error_" description:@"_media_error_select_folder_" visible:YES delay:k_dismissAfterSecond type:TWMessageBarMessageTypeError errorCode:0];
+            return;
+        }
+        
+        NSString *serverUrl = [NSURL URLWithString:serverUrlTo].URLByDeletingLastPathComponent.absoluteString;
+        if ([[serverUrl substringFromIndex:[serverUrl length] - 1] isEqualToString:@"/"])
+            serverUrl = [serverUrl substringToIndex:[serverUrl length] - 1];
+
+        // Clear data (old) Auto Upload
+        [[NCManageDatabase sharedInstance] clearDateReadWithServerUrl:[[NCManageDatabase sharedInstance] getAccountAutoUploadDirectory:appDelegate.activeUrl] directoryID:nil];
+        
+        // Settings new folder Automatatic upload
+        [[NCManageDatabase sharedInstance] setAccountAutoUploadFileName:title];
+        [[NCManageDatabase sharedInstance] setAccountAutoUploadDirectory:serverUrl activeUrl:appDelegate.activeUrl];
         
-        // search PhotoVideo with new start directory
-        [self searchPhotoVideo];
+        // Clear data new Auto Upload
+        [[NCManageDatabase sharedInstance] clearDateReadWithServerUrl:serverUrl directoryID:nil];
     }
 }
 
@@ -650,6 +680,34 @@
     viewController.tintColorTitle = [NCBrandColor sharedInstance].brandText;
     viewController.networkingOperationQueue = appDelegate.netQueue;
     viewController.hideCreateFolder = YES;
+    
+    // TYPE
+    viewController.type = @"mediaFolder";
+    
+    // E2EE
+    viewController.includeDirectoryE2EEncryption = NO;
+    
+    [navigationController setModalPresentationStyle:UIModalPresentationFormSheet];
+    [self presentViewController:navigationController animated:YES completion:nil];
+}
+
+- (void)selectAutomaticUploadFolder
+{
+    UINavigationController* navigationController = [[UIStoryboard storyboardWithName:@"CCMove" bundle:nil] instantiateViewControllerWithIdentifier:@"CCMove"];
+    
+    CCMove *viewController = (CCMove *)navigationController.topViewController;
+    
+    viewController.delegate = self;
+    viewController.move.title = NSLocalizedString(@"_select_automatic_upload_folder_", nil);
+    viewController.tintColor = [NCBrandColor sharedInstance].brandText;
+    viewController.barTintColor = [NCBrandColor sharedInstance].brand;
+    viewController.tintColorTitle = [NCBrandColor sharedInstance].brandText;
+    viewController.networkingOperationQueue = appDelegate.netQueue;
+    viewController.hideCreateFolder = NO;
+    
+    // TYPE
+    viewController.type = @"automaticUploadFolder";
+    
     // E2EE
     viewController.includeDirectoryE2EEncryption = NO;
     

+ 2 - 1
iOSClient/Move/CCMove.h

@@ -49,6 +49,7 @@
 
 @property (nonatomic, strong) NSString *serverUrl;
 @property (nonatomic, strong) tableMetadata *passMetadata;
+@property (nonatomic, strong) NSString *type;
 
 //BKPasscodeViewController
 @property (nonatomic) NSUInteger failedAttempts;
@@ -67,7 +68,7 @@
 
 @protocol CCMoveDelegate <NSObject>
 
-@optional - (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title;
+@optional - (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title type:(NSString *)type;
 @optional - (void)dismissMove;
 @optional - (void)selectMetadata:(tableMetadata *)metadata serverUrl:(NSString *)serverUrl;
 

+ 2 - 1
iOSClient/Move/CCMove.m

@@ -190,7 +190,7 @@
     if ([self.delegate respondsToSelector:@selector(dismissMove)])
         [self.delegate dismissMove];
     
-    [self.delegate moveServerUrlTo:_serverUrl title:self.passMetadata.fileNameView];
+    [self.delegate moveServerUrlTo:_serverUrl title:self.passMetadata.fileNameView type:self.type];
         
     [self dismissViewControllerAnimated:YES completion:nil];
 }
@@ -531,6 +531,7 @@
     viewController.hideCreateFolder = self.hideCreateFolder;
     viewController.hideMoveutton = self.hideMoveutton;
     viewController.selectFile = self.selectFile;
+    viewController.type = self.type;
     viewController.networkingOperationQueue = self.networkingOperationQueue;
 
     viewController.passMetadata = metadata;

+ 1 - 1
iOSClient/QuickActions/CCQuickActions.m

@@ -150,7 +150,7 @@
 #pragma mark ===== Move =====
 #pragma --------------------------------------------------------------------------------------------
 
-- (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title
+- (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title type:(NSString *)type
 {    
     [_mainVC uploadFileAsset:_assets serverUrl:serverUrlTo useSubFolder:NO session:k_upload_session];
 }

+ 2 - 0
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -398,6 +398,8 @@
 // Media
 
 "_select_media_folder_"         = "Select the \"Media\" folder";
+"_select_automatic_upload_folder_" = "Select the \"Automatic upload\" folder";
+"_media_error_select_folder_"   = "Select a valid folder for the \"Automatic upload\"";
 "_media_viewimage_show_"        = "Show images";
 "_media_viewimage_hide_"        = "Hide images";
 "_media_viewvideo_show_"        = "Show video";

+ 1 - 1
iOSClient/UploadFromOtherUpp/CCUploadFromOtherUpp.m

@@ -145,7 +145,7 @@
 #pragma mark == IBAction ==
 #pragma --------------------------------------------------------------------------------------------
 
-- (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title
+- (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title type:(NSString *)type
 {
     if (serverUrlTo) {
         serverUrlLocal = serverUrlTo;