Marino Faggiana 6 жил өмнө
parent
commit
a4385e1058

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

@@ -2,6 +2,7 @@
   "images" : [
     {
       "idiom" : "universal",
+      "filename" : "folderAutomaticUpload.png",
       "scale" : "1x"
     },
     {
@@ -11,6 +12,7 @@
     },
     {
       "idiom" : "universal",
+      "filename" : "folderAutomaticUpload@3x.png",
       "scale" : "3x"
     }
   ],

BIN
iOSClient/Images.xcassets/folderAutomaticUpload.imageset/folderAutomaticUpload.png


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


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


+ 1 - 1
iOSClient/Main/NCMainCommon.swift

@@ -241,7 +241,7 @@ class NCMainCommon: NSObject {
                     cell.file.image = CCGraphics.changeThemingColorImage(UIImage.init(named: "folderEncrypted"), multiplier: 3, color: NCBrandColor.sharedInstance.brandElement)
                     cell.imageTitleSegue = UIImage.init(named: "lock")
                 } else if metadata.fileName == autoUploadFileName && serverUrl == autoUploadDirectory {
-                    cell.file.image = CCGraphics.changeThemingColorImage(UIImage.init(named: "folderMedia"), multiplier: 3, color: NCBrandColor.sharedInstance.brandElement)
+                    cell.file.image = CCGraphics.changeThemingColorImage(UIImage.init(named: "folderAutomaticUpload"), multiplier: 3, color: NCBrandColor.sharedInstance.brandElement)
                     cell.imageTitleSegue = UIImage.init(named: "media")
                 } else if isShare {
                     cell.file.image = CCGraphics.changeThemingColorImage(UIImage.init(named: "folder_shared_with_me"), multiplier: 3, color: NCBrandColor.sharedInstance.brandElement)

+ 0 - 33
iOSClient/Media/CCMedia.m

@@ -51,7 +51,6 @@
     // Remenu
     REMenu *menu;
     REMenuItem *menuSelectMediaFolder;
-//    REMenuItem *menuSelectAutomaticUploadFolder;
     REMenuItem *menuFilterImage;
     REMenuItem *menuFilterVideo;
     REMenuItem *menuSelectItems;
@@ -252,12 +251,6 @@
         [self selectStartDirectoryPhotosTab];
     }];
     
-    /*
-    menuSelectAutomaticUploadFolder = [[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;
@@ -695,32 +688,6 @@
     [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_", 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;
-    
-    [navigationController setModalPresentationStyle:UIModalPresentationFormSheet];
-    [self presentViewController:navigationController animated:YES completion:nil];
-}
-*/
-
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ==== Search Photo/Video ====
 #pragma --------------------------------------------------------------------------------------------

+ 1 - 1
iOSClient/Move/CCMove.m

@@ -420,7 +420,7 @@
         if (metadata.e2eEncrypted)
             cell.imageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderEncrypted"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
         else if ([metadata.fileName isEqualToString:_autoUploadFileName] && [self.serverUrl isEqualToString:_autoUploadDirectory])
-            cell.imageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderMedia"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
+            cell.imageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderAutomaticUpload"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
         else
             cell.imageView.image = [CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folder"] multiplier:2 color:[NCBrandColor sharedInstance].brandElement];
         

+ 2 - 1
iOSClient/Settings/CCManageAutoUpload.h

@@ -25,7 +25,8 @@
 #import "CCMain.h"
 #import "CCManageLocation.h"
 #import "CCMedia.h"
+#import "CCMove.h"
 
-@interface CCManageAutoUpload : XLFormViewController
+@interface CCManageAutoUpload : XLFormViewController <CCMoveDelegate>
 
 @end

+ 68 - 0
iOSClient/Settings/CCManageAutoUpload.m

@@ -90,6 +90,22 @@
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
     [section addFormRow:row];
 
+    // Auto Upload Directory
+    
+    section = [XLFormSectionDescriptor formSection];
+    [form addFormSection:section];
+    
+    // Lock active YES/NO
+    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"autoUploadDirectory" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_autoupload_select_folder_", nil)];
+    row.hidden = [NSString stringWithFormat:@"$%@==0", @"autoUpload"];
+    [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"folderAutomaticUpload"] multiplier:2 color:[NCBrandColor sharedInstance].icon] forKey:@"imageView.image"];
+    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+    [row.cellConfig setObject:[UIColor blackColor] forKey:@"textLabel.textColor"];
+    [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
+    //[row.cellConfig setObject:@(UITableViewCellAccessoryDisclosureIndicator) forKey:@"accessoryType"];
+    row.action.formSelector = @selector(selectAutomaticUploadFolder);
+    [section addFormRow:row];
+    
     // Auto Upload Photo
     
     section = [XLFormSectionDescriptor formSection];
@@ -443,4 +459,56 @@
     return sectionName;
 }
 
+
+- (void)moveServerUrlTo:(NSString *)serverUrlTo title:(NSString *)title type:(NSString *)type
+{
+   
+     if ([type isEqualToString:@"automaticUploadFolder"]) {
+     
+         if (title == nil) {
+             [appDelegate messageNotification:@"_error_" description:@"_autoupload_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];
+         
+         // Clear data new Auto Upload
+         [[NCManageDatabase sharedInstance] clearDateReadWithServerUrl:serverUrl directoryID: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_", 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;
+     
+     [navigationController setModalPresentationStyle:UIModalPresentationFormSheet];
+     [self presentViewController:navigationController animated:YES completion:nil];
+ }
+
 @end

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

@@ -190,6 +190,8 @@
 // Manage AutoUpload
 
 "_autoupload_"                      = "Auto upload photos/videos";
+"_autoupload_select_folder_"        = "Select the \"Automatic upload\" folder";
+"_autoupload_error_select_folder_"  = "Select a valid folder for the \"Automatic upload\"";
 "_autoupload_background_"           = "Auto upload in the background";
 "_autoupload_photos_"               = "Auto upload photos";
 "_autoupload_videos_"               = "Auto upload videos";
@@ -398,8 +400,6 @@
 // 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";
@@ -506,7 +506,6 @@
 // CreateFormUploadAssets
 
 "_destination_folder_"              = "Destination folder";
-"_use_folder_media_"                = "Use the Media folder as destination";
 "_use_folder_auto_upload_"          = "Use the Auto Upload folder as destination";
 "_rename_filename_"                 = "Rename";
 "_filename_"                        = "Filename";