Browse Source

clear code

Marino Faggiana 7 years ago
parent
commit
2bea1b1c62
2 changed files with 11 additions and 8 deletions
  1. 2 0
      iOSClient/Photos/CCPhotos.h
  2. 9 8
      iOSClient/Photos/CCPhotos.m

+ 2 - 0
iOSClient/Photos/CCPhotos.h

@@ -42,6 +42,8 @@
 
 @property (nonatomic, weak) CCDetail *detailViewController;
 @property BOOL isSearchMode;
+@property BOOL isEditMode;
+
 
 - (void)downloadFileSuccessFailure:(NSString *)fileName fileID:(NSString *)fileID serverUrl:(NSString *)serverUrl selector:(NSString *)selector selectorPost:(NSString *)selectorPost errorMessage:(NSString *)errorMessage errorCode:(NSInteger)errorCode;
 

+ 9 - 8
iOSClient/Photos/CCPhotos.m

@@ -33,7 +33,6 @@
 
     tableMetadata *_metadata;
 
-    BOOL _cellEditing;
     NSMutableArray *_queueMetadatas;
     NSMutableArray *_selectedMetadatas;
     NSUInteger _numSelectedMetadatas;
@@ -120,7 +119,7 @@
     // Plus Button
     [appDelegate plusButtonVisibile:true];
 
-    if(!_isSearchMode)
+    if(!_isSearchMode && !_isEditMode)
         [self reloadDatasourceFromSearch:NO];
 }
 
@@ -137,7 +136,9 @@
         [appDelegate changeTheming:self];
     
     _scrollBar.handleTintColor = [NCBrandColor sharedInstance].brand;
-    [self.collectionView reloadData];
+    
+    if(!_isSearchMode && !_isEditMode)
+        [self.collectionView reloadData];
 }
 
 - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
@@ -622,7 +623,7 @@
 - (void)searchPhotoVideo
 {
     // test
-    if (appDelegate.activeAccount.length == 0 || _isSearchMode)
+    if (appDelegate.activeAccount.length == 0 || _isSearchMode || _isEditMode)
         return;
     
     // WAITING FOR d:creationdate
@@ -693,14 +694,14 @@
 - (void)editingModeYES
 {
     [self.collectionView setAllowsMultipleSelection:true];
-    _cellEditing = true;
+    _isEditMode = true;
     [self setUINavigationBarSelected];
 }
 
 - (void)editingModeNO
 {
     [self.collectionView setAllowsMultipleSelection:false];
-    _cellEditing = false;
+    _isEditMode = false;
     [_selectedMetadatas removeAllObjects];
     [self setUINavigationBarDefault];
 }
@@ -832,7 +833,7 @@
         NSString *fileID = [metadatasForKey objectAtIndex:indexPath.row];
         _metadata = [_sectionDataSource.allRecordsDataSource objectForKey:fileID];
         
-        if (_cellEditing) {
+        if (_isEditMode) {
         
             [self cellSelect:YES indexPath:indexPath metadata:_metadata];
         
@@ -847,7 +848,7 @@
 - (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath
 {
     // test
-    if (_cellEditing == NO)
+    if (_isEditMode == NO)
         return;
    
     NSArray *metadatasForKey = [_sectionDataSource.sectionArrayRow objectForKey:[_sectionDataSource.sections objectAtIndex:indexPath.section]];