Browse Source

add Select All

Marino Faggiana 6 years ago
parent
commit
668749e7b6

+ 1 - 1
Nextcloud.xcodeproj/project.pbxproj

@@ -1917,10 +1917,10 @@
 		F72B60941A24F04E004EF66F /* Localizations */ = {
 			isa = PBXGroup;
 			children = (
+				F7E70DE91A24DE4100E1B66A /* Localizable.strings */,
 				F75797AC1E81356C00187A1B /* CTAssetsPicker.strings */,
 				F732B3351E8045A1002B7D75 /* SwiftWebVC.strings */,
 				F72B60911A24F00B004EF66F /* BKPasscodeView.strings */,
-				F7E70DE91A24DE4100E1B66A /* Localizable.strings */,
 				F7C6D5F61BE371D800AC83AD /* InfoPlist.strings */,
 				F744BE9F1BEBB69F004FFF66 /* Intro.strings */,
 				F7B381BF1C074E3E004693F8 /* Error.strings */,

+ 1 - 0
iOSClient/AppDelegate.h

@@ -93,6 +93,7 @@
 @property (nonatomic, strong) REMenuItem *dateItem;
 
 @property (nonatomic, strong) REMenu *reSelectMenu;
+@property (nonatomic, strong) REMenuItem *selectAllItem;
 @property (nonatomic, strong) REMenuItem *deleteItem;
 @property (nonatomic, strong) REMenuItem *moveItem;
 @property (nonatomic, strong) REMenuItem *encryptItem;

+ 1 - 1
iOSClient/Brand/File_Provider_Extension.plist

@@ -19,7 +19,7 @@
 	<key>CFBundleShortVersionString</key>
 	<string>2.22.0</string>
 	<key>CFBundleVersion</key>
-	<string>12</string>
+	<string>13</string>
 	<key>NSExtension</key>
 	<dict>
 		<key>NSExtensionFileProviderDocumentGroup</key>

+ 1 - 1
iOSClient/Brand/Share.plist

@@ -19,7 +19,7 @@
 	<key>CFBundleShortVersionString</key>
 	<string>2.22.0</string>
 	<key>CFBundleVersion</key>
-	<string>12</string>
+	<string>13</string>
 	<key>NSAppTransportSecurity</key>
 	<dict>
 		<key>NSAllowsArbitraryLoads</key>

+ 1 - 1
iOSClient/Brand/iOSClient.plist

@@ -69,7 +69,7 @@
 		</dict>
 	</array>
 	<key>CFBundleVersion</key>
-	<string>12</string>
+	<string>13</string>
 	<key>FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED</key>
 	<true/>
 	<key>Fabric</key>

+ 23 - 0
iOSClient/Images.xcassets/selectAll.imageset/Contents.json

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

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


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


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


+ 22 - 3
iOSClient/Main/CCMain.m

@@ -3085,13 +3085,19 @@
 
 - (void)createReSelectMenu
 {
+    // ITEM SELECT ALL --------------------------------------------------------------------------------------------------
+    
+    appDelegate.selectAllItem = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_select_all_", nil) subtitle:@"" image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"selectAll"] multiplier:2 color:[NCBrandColor sharedInstance].icon] highlightedImage:nil action:^(REMenuItem *item) {
+        [self didSelectAll];
+    }];
+    
     // ITEM DELETE ------------------------------------------------------------------------------------------------------
     
     appDelegate.deleteItem = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_delete_selected_files_", nil) subtitle:@"" image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"delete"] multiplier:2 color:[NCBrandColor sharedInstance].icon] highlightedImage:nil action:^(REMenuItem *item) {
             [self deleteFile];
     }];
     
-    // ITEM MOVE ------------------------------------------------------------------------------------------------------
+    // ITEM MOVE --------------------------------------------------------------------------------------------------------
     
     appDelegate.moveItem = [[REMenuItem alloc] initWithTitle:NSLocalizedString(@"_move_selected_files_", nil) subtitle:@"" image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"move"] multiplier:2 color:[NCBrandColor sharedInstance].icon] highlightedImage:nil action:^(REMenuItem *item) {
             [self moveOpenWindow:[self.tableView indexPathsForSelectedRows]];
@@ -3111,9 +3117,9 @@
 
     // E2EE
     if (_metadataFolder.e2eEncrypted) {
-        appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.deleteItem,appDelegate.downloadItem, appDelegate.saveItem]];
+        appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.selectAllItem, appDelegate.deleteItem, appDelegate.downloadItem, appDelegate.saveItem]];
     } else {
-        appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.deleteItem,appDelegate.moveItem, appDelegate.downloadItem, appDelegate.saveItem]];
+        appDelegate.reSelectMenu = [[REMenu alloc] initWithItems:@[appDelegate.selectAllItem, appDelegate.deleteItem, appDelegate.moveItem, appDelegate.downloadItem, appDelegate.saveItem]];
     }
     
     appDelegate.reSelectMenu.imageOffset = CGSizeMake(5, -1);
@@ -4882,6 +4888,19 @@
     [self setTitle];
 }
 
+- (void)didSelectAll
+{
+    for (int i = 0; i < self.tableView.numberOfSections; i++) {
+        for (int j = 0; j < [self.tableView numberOfRowsInSection:i]; j++) {
+            NSIndexPath *indexPath = [NSIndexPath indexPathForRow:j inSection:i];
+            tableMetadata *metadata = [self getMetadataFromSectionDataSource:indexPath];
+            [_selectedFileIDsMetadatas setObject:metadata forKey:metadata.fileID];
+            [self.tableView selectRowAtIndexPath:indexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
+        }
+    }
+    [self setTitle];
+}
+
 - (BOOL)indexPathIsValid:(NSIndexPath *)indexPath
 {
     if (!indexPath)

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

@@ -48,6 +48,7 @@
 "_no_"                      = "No";
 "_yes_"                     = "Yes";
 "_select_"                  = "Select";
+"_select_all_"              = "Select all";
 "_upload_"                  = "Upload";
 "_home_"                    = "Files";
 "_file_to_upload_"          = "File to upload";