|
@@ -471,16 +471,6 @@
|
|
|
[actionSheet addButtonWithTitle: metadata.fileNamePrint image: iconHeader backgroundColor: [NCBrandColor sharedInstance].tabBar height: 50.0 type: AHKActionSheetButtonTypeDisabled handler: nil
|
|
|
];
|
|
|
|
|
|
- // ONLY Root Favorites : Remove file/folder Favorites
|
|
|
- if (_serverUrl == nil) {
|
|
|
-
|
|
|
- [actionSheet addButtonWithTitle:NSLocalizedString(@"_remove_favorites_", nil) image:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"actionSheetOffline"] color:[NCBrandColor sharedInstance].brand] backgroundColor:[UIColor whiteColor] height: 50.0 type:AHKActionSheetButtonTypeDefault handler:^(AHKActionSheet *as) {
|
|
|
-
|
|
|
- [self.tableView setEditing:NO animated:YES];
|
|
|
- [[CCActions sharedInstance] settingFavorite:metadata favorite:NO delegate:self];
|
|
|
- }];
|
|
|
- }
|
|
|
-
|
|
|
// Share
|
|
|
if (_metadata.cryptated == NO) {
|
|
|
|
|
@@ -509,43 +499,44 @@
|
|
|
#pragma mark ===== Swipe Tablet -> menu =====
|
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
|
|
|
|
-- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
-{
|
|
|
- return UITableViewCellEditingStyleDelete;
|
|
|
-}
|
|
|
-
|
|
|
-- (NSString *)tableView:(UITableView *)tableView titleForSwipeAccessoryButtonForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
|
- return NSLocalizedString(@"_more_", nil);
|
|
|
-}
|
|
|
-
|
|
|
-- (void)tableView:(UITableView *)tableView swipeAccessoryButtonPushedForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
-{
|
|
|
- [self requestMoreMetadata:[_dataSource objectAtIndex:indexPath.row] indexPath:indexPath];
|
|
|
-}
|
|
|
-
|
|
|
-- (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
+- (BOOL)swipeTableCell:(MGSwipeTableCell *)cell canSwipe:(MGSwipeDirection)direction
|
|
|
{
|
|
|
- return NSLocalizedString(@"_delete_", nil);
|
|
|
+ return YES;
|
|
|
}
|
|
|
|
|
|
-- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
|
|
|
+- (BOOL)swipeTableCell:(MGSwipeTableCell *)cell tappedButtonAtIndex:(NSInteger)index direction:(MGSwipeDirection)direction fromExpansion:(BOOL)fromExpansion
|
|
|
{
|
|
|
- if (editingStyle == UITableViewCellEditingStyleDelete) {
|
|
|
-
|
|
|
- [self requestDeleteMetadata:[_dataSource objectAtIndex:indexPath.row] indexPath:indexPath];
|
|
|
+ NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
|
|
|
+
|
|
|
+ if (direction == MGSwipeDirectionRightToLeft) {
|
|
|
+
|
|
|
+ // Delete
|
|
|
+ if (index == 0)
|
|
|
+ [self requestDeleteMetadata:[_dataSource objectAtIndex:indexPath.row] indexPath:indexPath];
|
|
|
+
|
|
|
+ // More
|
|
|
+ if (index == 1)
|
|
|
+ [self requestMoreMetadata:[_dataSource objectAtIndex:indexPath.row] indexPath:indexPath];
|
|
|
+ }
|
|
|
+
|
|
|
+ if (direction == MGSwipeDirectionLeftToRight) {
|
|
|
+
|
|
|
+ tableMetadata *metadata = [_dataSource objectAtIndex:indexPath.row];
|
|
|
+ [[CCActions sharedInstance] settingFavorite:metadata favorite:NO delegate:self];
|
|
|
}
|
|
|
+
|
|
|
+ return YES;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
|
#pragma mark ==== Table ====
|
|
|
#pragma --------------------------------------------------------------------------------------------
|
|
|
|
|
|
- (tableMetadata *)setSelfMetadataFromIndexPath:(NSIndexPath *)indexPath
|
|
|
{
|
|
|
- NSManagedObject *record = [_dataSource objectAtIndex:indexPath.row];
|
|
|
+ tableMetadata *metadata = [_dataSource objectAtIndex:indexPath.row];
|
|
|
|
|
|
- tableMetadata *metadata = [[NCManageDatabase sharedInstance] getMetadataWithPredicate:[NSPredicate predicateWithFormat:@"fileID = %@", [record valueForKey:@"fileID"]]];
|
|
|
-
|
|
|
return metadata;
|
|
|
}
|
|
|
|
|
@@ -601,6 +592,10 @@
|
|
|
CCFavoritesCell *cell = (CCFavoritesCell *)[tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
|
|
|
tableMetadata *metadata;
|
|
|
|
|
|
+ // variable base
|
|
|
+ cell.delegate = self;
|
|
|
+ cell.indexPath = indexPath;
|
|
|
+
|
|
|
// separator
|
|
|
cell.separatorInset = UIEdgeInsetsMake(0.f, 60.f, 0.f, 0.f);
|
|
|
|
|
@@ -677,14 +672,26 @@
|
|
|
cell.local.image = nil;
|
|
|
|
|
|
cell.labelInfoFile.text = [NSString stringWithFormat:@"%@ %@", date, length];
|
|
|
- //cell.labelInfoFile.text = [NSString stringWithFormat:@"%@ • %@", date, length];
|
|
|
- //cell.labelInfoFile.text = [NSString stringWithFormat:@"%@ ◦ %@", date, length];
|
|
|
}
|
|
|
|
|
|
cell.accessoryType = UITableViewCellAccessoryNone;
|
|
|
|
|
|
}
|
|
|
|
|
|
+ // ======== MGSwipe ========
|
|
|
+
|
|
|
+ //configure left buttons : ONLY Root Favorites : Remove file/folder Favorites
|
|
|
+
|
|
|
+ if (_serverUrl == nil) {
|
|
|
+ cell.leftButtons = @[[MGSwipeButton buttonWithTitle:[NSString stringWithFormat:@" %@ ", NSLocalizedString(@"_unfavorite_", nil)] icon:[UIImage imageNamed:@"swipeUnfavorite"] backgroundColor:[UIColor colorWithRed:242.0/255.0 green:220.0/255.0 blue:132.0/255.0 alpha:1.000]]];
|
|
|
+ cell.leftExpansion.buttonIndex = 0;
|
|
|
+ cell.leftExpansion.fillOnTrigger = NO;
|
|
|
+ }
|
|
|
+
|
|
|
+ //configure right buttons
|
|
|
+ cell.rightButtons = @[[MGSwipeButton buttonWithTitle:[NSString stringWithFormat:@" %@ ", NSLocalizedString(@"_delete_", nil)] icon:[UIImage imageNamed:@"swipeDelete"] backgroundColor:[UIColor redColor]], [MGSwipeButton buttonWithTitle:[NSString stringWithFormat:@" %@ ", NSLocalizedString(@"_more_", nil)] icon:[UIImage imageNamed:@"swipeMore"] backgroundColor:[UIColor lightGrayColor]]];
|
|
|
+ cell.rightSwipeSettings.transition = MGSwipeTransitionBorder;
|
|
|
+
|
|
|
return cell;
|
|
|
}
|
|
|
|