浏览代码

Paging Control Center

Marino Faggiana 8 年之前
父节点
当前提交
acb6cc48d0

+ 14 - 0
Nextcloud.xcodeproj/project.pbxproj

@@ -720,6 +720,8 @@
 		F72AAECB1E5C60C700BB17E1 /* AHKActionSheetViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F72AAEC51E5C60C700BB17E1 /* AHKActionSheetViewController.m */; };
 		F72AAECC1E5C60C700BB17E1 /* UIImage+AHKAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = F72AAEC71E5C60C700BB17E1 /* UIImage+AHKAdditions.m */; };
 		F72AAECD1E5C60C700BB17E1 /* UIWindow+AHKAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = F72AAEC91E5C60C700BB17E1 /* UIWindow+AHKAdditions.m */; };
+		F72AE40B1E67246200B3E477 /* ControlCenter.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F72AE40A1E67246200B3E477 /* ControlCenter.storyboard */; };
+		F72AE40C1E67246200B3E477 /* ControlCenter.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F72AE40A1E67246200B3E477 /* ControlCenter.storyboard */; };
 		F72C63891DC14B0400FA5ED5 /* libMagicalRecord.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F7B61E9B1DC13C20009E938F /* libMagicalRecord.a */; };
 		F732BA061D76CE1500E9878B /* CCNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = F732BA041D76CE1500E9878B /* CCNetworking.m */; };
 		F732BA0B1D76DBA500E9878B /* CCNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = F732BA041D76CE1500E9878B /* CCNetworking.m */; };
@@ -818,6 +820,8 @@
 		F750374D1DBFA91A008FB480 /* ALView+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = F75037441DBFA91A008FB480 /* ALView+PureLayout.m */; };
 		F750374F1DBFA91A008FB480 /* NSArray+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = F75037461DBFA91A008FB480 /* NSArray+PureLayout.m */; };
 		F75037511DBFA91A008FB480 /* NSLayoutConstraint+PureLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = F75037481DBFA91A008FB480 /* NSLayoutConstraint+PureLayout.m */; };
+		F75284931E671DE6003ACF39 /* CCControlCenterPageContent.m in Sources */ = {isa = PBXBuildFile; fileRef = F75284921E671DE6003ACF39 /* CCControlCenterPageContent.m */; };
+		F75284941E671DE6003ACF39 /* CCControlCenterPageContent.m in Sources */ = {isa = PBXBuildFile; fileRef = F75284921E671DE6003ACF39 /* CCControlCenterPageContent.m */; };
 		F7596C781D128FC80092A6B8 /* Nextcloud.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F7596C771D128FC80092A6B8 /* Nextcloud.xcassets */; };
 		F75ADF451DC75FFE008A7347 /* CCLogin.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F75ADF441DC75FFE008A7347 /* CCLogin.storyboard */; };
 		F7659A271DC0B726004860C4 /* EAIntroPage.m in Sources */ = {isa = PBXBuildFile; fileRef = F7659A231DC0B726004860C4 /* EAIntroPage.m */; };
@@ -1735,6 +1739,7 @@
 		F72AAEC71E5C60C700BB17E1 /* UIImage+AHKAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+AHKAdditions.m"; sourceTree = "<group>"; };
 		F72AAEC81E5C60C700BB17E1 /* UIWindow+AHKAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIWindow+AHKAdditions.h"; sourceTree = "<group>"; };
 		F72AAEC91E5C60C700BB17E1 /* UIWindow+AHKAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIWindow+AHKAdditions.m"; sourceTree = "<group>"; };
+		F72AE40A1E67246200B3E477 /* ControlCenter.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = ControlCenter.storyboard; sourceTree = "<group>"; };
 		F73049B81CB567F000C7C320 /* NSString+TruncateToWidth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+TruncateToWidth.h"; sourceTree = "<group>"; };
 		F73049B91CB567F000C7C320 /* NSString+TruncateToWidth.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+TruncateToWidth.m"; sourceTree = "<group>"; };
 		F732BA031D76CE1500E9878B /* CCNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCNetworking.h; sourceTree = "<group>"; };
@@ -1862,6 +1867,8 @@
 		F750374B1DBFA91A008FB480 /* PureLayoutDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PureLayoutDefines.h; sourceTree = "<group>"; };
 		F7514EDA1C7B1336008F3338 /* CCHud.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCHud.h; sourceTree = "<group>"; };
 		F7514EDB1C7B1336008F3338 /* CCHud.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCHud.m; sourceTree = "<group>"; };
+		F75284911E671DE6003ACF39 /* CCControlCenterPageContent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCControlCenterPageContent.h; sourceTree = "<group>"; };
+		F75284921E671DE6003ACF39 /* CCControlCenterPageContent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCControlCenterPageContent.m; sourceTree = "<group>"; };
 		F7540EE21D5B238600C3FFA8 /* aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = aes.h; sourceTree = "<group>"; };
 		F7540EE31D5B238600C3FFA8 /* asn1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asn1.h; sourceTree = "<group>"; };
 		F7540EE41D5B238600C3FFA8 /* asn1_mac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = asn1_mac.h; sourceTree = "<group>"; };
@@ -3663,8 +3670,11 @@
 		F7D6A0881D82DBFA0045AD1A /* MenuAccount+ControlCenter */ = {
 			isa = PBXGroup;
 			children = (
+				F72AE40A1E67246200B3E477 /* ControlCenter.storyboard */,
 				F7D6A0891D82DBFA0045AD1A /* CCControlCenter.h */,
 				F7D6A08A1D82DBFA0045AD1A /* CCControlCenter.m */,
+				F75284911E671DE6003ACF39 /* CCControlCenterPageContent.h */,
+				F75284921E671DE6003ACF39 /* CCControlCenterPageContent.m */,
 				F7D6A08B1D82DBFA0045AD1A /* CCControlCenterTransferCell.h */,
 				F7D6A08C1D82DBFA0045AD1A /* CCControlCenterTransferCell.m */,
 				F7D6A08D1D82DBFA0045AD1A /* CCControlCenterTransferCell.xib */,
@@ -4385,6 +4395,7 @@
 				084215551E646E0200C8F4F3 /* icon-error@2x.png in Resources */,
 				084215561E646E0200C8F4F3 /* LaunchScreenNextcloud.xib in Resources */,
 				084215571E646E0200C8F4F3 /* ZSSoutdent@2x.png in Resources */,
+				F72AE40C1E67246200B3E477 /* ControlCenter.storyboard in Resources */,
 				084215581E646E0200C8F4F3 /* ZSSindent.png in Resources */,
 				084215591E646E0200C8F4F3 /* ZSSpicker.png in Resources */,
 				0842155A1E646E0200C8F4F3 /* PlayButtonOverlayLargeTap@2x.png in Resources */,
@@ -4633,6 +4644,7 @@
 				F77B0F081D118A16002130FE /* ZSSunderline@2x.png in Resources */,
 				F77B0F0A1D118A16002130FE /* Reader-Mark-Y.png in Resources */,
 				F77B0F0C1D118A16002130FE /* Reader-Mark-Y@2x.png in Resources */,
+				F72AE40B1E67246200B3E477 /* ControlCenter.storyboard in Resources */,
 				F77B0F0D1D118A16002130FE /* ZSSundo@2x.png in Resources */,
 				F77B0F0E1D118A16002130FE /* BKPasscodeView.strings in Resources */,
 				F77B0F111D118A16002130FE /* ZSSparagraph.png in Resources */,
@@ -4961,6 +4973,7 @@
 				084214C21E646E0200C8F4F3 /* ReaderThumbFetch.m in Sources */,
 				084214C31E646E0200C8F4F3 /* CCPassaporto.m in Sources */,
 				084214C41E646E0200C8F4F3 /* CTAssetItemViewController.m in Sources */,
+				F75284941E671DE6003ACF39 /* CCControlCenterPageContent.m in Sources */,
 				084214C51E646E0200C8F4F3 /* PSTCollectionView.m in Sources */,
 				084214C61E646E0200C8F4F3 /* CCLogin.m in Sources */,
 				084214C71E646E0200C8F4F3 /* CYRTextStorage.m in Sources */,
@@ -5554,6 +5567,7 @@
 				F77B0E781D118A16002130FE /* ReaderThumbFetch.m in Sources */,
 				F77B0E7B1D118A16002130FE /* CCPassaporto.m in Sources */,
 				F7F06EA51DBFACC600099AE9 /* CTAssetItemViewController.m in Sources */,
+				F75284931E671DE6003ACF39 /* CCControlCenterPageContent.m in Sources */,
 				F7659A5A1DC0B760004860C4 /* PSTCollectionView.m in Sources */,
 				F7BF1B431D51E893000854F6 /* CCLogin.m in Sources */,
 				F77B0E7D1D118A16002130FE /* CYRTextStorage.m in Sources */,

+ 3 - 0
iOSClient/CCGlobal.h

@@ -257,6 +257,9 @@ extern NSString *const BKPasscodeKeychainServiceName;
 #define k_pageOfflineOffline                            @"Offline"
 #define k_pageOfflineLocal                              @"Local"
 
+#define k_pageControlCenterTransfer                     @"Transfer"
+#define k_pageControlCenterActivity                     @"Activity"
+
 // Search
 #define k_minCharsSearch                                2
 

+ 4 - 3
iOSClient/Main/CCMain.m

@@ -26,6 +26,7 @@
 #import "AppDelegate.h"
 #import "CCPhotosCameraUpload.h"
 #import "CCSynchronize.h"
+#import "CCControlCenterTransferCell.h"
 #import <OCCommunicationLib/OCActivity.h>
 #import <OCCommunicationLib/OCNotifications.h>
 #import <OCCommunicationLib/OCNotificationsAction.h>
@@ -4697,14 +4698,14 @@
     if ([serverUrl isEqualToString:_serverUrl] == NO || _serverUrl == nil) {
         
         if ([selector isEqualToString:selectorDownloadSynchronize]) {
-            [app.controlCenter reloadDatasource];
+//            [app.controlCenter reloadDatasource];
         } else {
             CCMain *main = [app.listMainVC objectForKey:serverUrl];
             if (main) {
                 [main reloadDatasource];
             } else {
                 [self tableViewReload];
-                [app.controlCenter reloadDatasource];
+//                [app.controlCenter reloadDatasource];
             }
         }
         
@@ -4714,7 +4715,7 @@
     // Offline folder ?
     _isOfflineServerUrl = [CCCoreData isOfflineDirectoryServerUrl:_serverUrl activeAccount:app.activeAccount];
     
-    [app.controlCenter reloadDatasource];
+ //   [app.controlCenter reloadDatasource];
     
     // Settaggio variabili per le ottimizzazioni
     _directoryGroupBy = [CCUtility getGroupBySettings];

+ 1 - 7
iOSClient/MenuAccount+ControlCenter/CCControlCenter.h

@@ -24,11 +24,10 @@
 #import <UIKit/UIKit.h>
 
 #import "CCGlobal.h"
-#import "CCControlCenterTransferCell.h"
 #import "CCSection.h"
 #import "CCMetadata.h"
 
-@interface CCControlCenter : UINavigationController <UITableViewDataSource, UITableViewDelegate, UIPageViewControllerDataSource, UIPageViewControllerDelegate>
+@interface CCControlCenter : UINavigationController <UIPageViewControllerDataSource, UIPageViewControllerDelegate>
 
 @property (nonatomic) BOOL isPopGesture;
 @property (nonatomic) BOOL isOpen;
@@ -37,12 +36,7 @@
 @property (strong, nonatomic) NSArray *pageType;
 @property (strong, nonatomic) NSString *currentPageType;
 
-- (void)reloadDatasource;
-
 - (void)setControlCenterHidden:(BOOL)hidden;
-
-- (void)progressTask:(NSString *)fileID serverUrl:(NSString *)serverUrl cryptated:(BOOL)cryptated progress:(float)progress;
-
 - (void)enableSingleFingerTap:(SEL)selector target:(id)target;
 - (void)disableSingleFingerTap;
 

+ 60 - 585
iOSClient/MenuAccount+ControlCenter/CCControlCenter.m

@@ -23,10 +23,12 @@
 
 #import "CCControlCenter.h"
 
+#import "CCControlCenterPageContent.h"
 #import "AppDelegate.h"
 #import "CCMain.h"
 #import "CCDetail.h"
 
+
 #define BORDER_TOUCH_UPDOWN 50.0f
 
 #define TOOLBAR_TRANSFER_H 0.0f
@@ -44,9 +46,7 @@
 @interface CCControlCenter ()
 {
     UIVisualEffectView *_mainView;
-    UITableView *_tableView;
     UILabel *_noRecord;
-    //UIToolbar *_toolbarTask;
     UIImageView *_imageDrag;
     UIView *_endLine;
     
@@ -55,8 +55,7 @@
     UIPanGestureRecognizer *panNavigationBar, *panImageDrag;
     UITapGestureRecognizer *_singleFingerTap;
     
-    // Datasource
-    CCSectionDataSource *_sectionDataSource;
+    UIPageControl *pageControl;
 }
 @end
 
@@ -85,7 +84,8 @@
     
     // TEST
     //_mainView.backgroundColor = [UIColor yellowColor];
-        
+    
+    /*
     _tableView = [[UITableView alloc] init];
     [_tableView setFrame:CGRectMake(0, 0, self.navigationBar.frame.size.width, 0)];
     _tableView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
@@ -96,6 +96,24 @@
     _tableView.backgroundColor = [UIColor clearColor];
 
     [_mainView addSubview:_tableView];
+    */
+    
+    // Create data model
+    _pageType = @[k_pageControlCenterTransfer, k_pageControlCenterActivity];
+    _currentPageType = k_pageControlCenterTransfer;
+    
+    // Create page view controller
+    _pageViewController = [[UIStoryboard storyboardWithName: @"ControlCenter" bundle:[NSBundle mainBundle]] instantiateViewControllerWithIdentifier:@"ControlCenterPageViewController"];
+    _pageViewController.dataSource = self;
+    _pageViewController.delegate = self;
+    
+    CCControlCenterPageContent *startingViewController = [self viewControllerAtIndex:0];
+    NSArray *viewControllers = @[startingViewController];
+    [_pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
+    [_pageViewController.view setFrame:CGRectMake(0, 0, self.navigationBar.frame.size.width, 0)];
+    _pageViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+     
+    [_mainView addSubview:_pageViewController.view];
     
     _noRecord =[[UILabel alloc]init];
     _noRecord.backgroundColor=[UIColor clearColor];
@@ -103,23 +121,10 @@
     _noRecord.font = [UIFont systemFontOfSize:SIZE_FONT_NORECORD];
     _noRecord.textAlignment = NSTextAlignmentCenter;
     _noRecord.text = NSLocalizedString(@"_no_transfer_",nil);
+    _noRecord.hidden = YES;
 
     [_mainView addSubview:_noRecord];
     
-    /*
-    _toolbarTask = [[UIToolbar alloc] init];
-    UIBarButtonItem *cancelItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"toolbarTaskCancel"] style:UIBarButtonItemStylePlain target:self action:@selector(cancelAllTask)];
-    UIBarButtonItem *stopItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"toolbarTaskStop"] style:UIBarButtonItemStylePlain target:self action:@selector(stopAllTask)];
-    UIBarButtonItem *reloadItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"toolbarTaskReload"] style:UIBarButtonItemStylePlain target:self action:@selector(reloadAllTask)];
-    UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
-    [_toolbarTask setItems:[[NSArray alloc] initWithObjects:cancelItem, spacer, stopItem, spacer, reloadItem, nil]];
-    [_toolbarTask setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin];
-    [_toolbarTask setBackgroundImage:[UIImage new] forToolbarPosition:UIBarPositionAny barMetrics:UIBarMetricsDefault];
-    [_toolbarTask setShadowImage:[UIImage new] forToolbarPosition:UIBarPositionAny];
-    
-    [_mainView addSubview:_toolbarTask];
-    */
-    
     _imageDrag = [[UIImageView alloc] init];
     [_imageDrag setFrame:CGRectMake(0, 0, self.navigationBar.frame.size.width, 0)];
     _imageDrag.image = [UIImage imageNamed:image_drag];
@@ -148,8 +153,6 @@
     panNavigationBar.maximumNumberOfTouches = panNavigationBar.minimumNumberOfTouches = 1;
     
     [self.navigationBar addGestureRecognizer:panNavigationBar];
-    
-    [self reloadDatasource];
 }
 
 /* iOS Developer Library : A panning gesture is continuous. It begins (UIGestureRecognizerStateBegan) when the minimum number of fingers allowed (minimumNumberOfTouches) has moved enough to be considered a pan. It changes (UIGestureRecognizerStateChanged) when a finger moves while at least the minimum number of fingers are pressed down. It ends (UIGestureRecognizerStateEnded) when all fingers are lifted. */
@@ -238,8 +241,7 @@
         animations:^ {
         
             _mainView.frame = CGRectMake(0, 0, navigationBarW, currentPoint.y);
-            //_tableView.frame = CGRectMake(0, tableViewY, navigationBarW, _mainView.frame.size.height - tableViewY - BORDER_TOUCH_UPDOWN - TOOLBAR_TRANSFER_H - TOOLBAR_ADD_BORDER);
-            _tableView.frame = CGRectMake(0, currentPoint.y - heightScreen + navigationBarH, navigationBarW, heightTableView);
+            _pageViewController.view.frame = CGRectMake(0, currentPoint.y - heightScreen + navigationBarH, navigationBarW, heightTableView);
             _noRecord.frame = CGRectMake(0, currentPoint.y - centerMaxH - TOOLBAR_TRANSFER_H, navigationBarW, SIZE_FONT_NORECORD+10);
             //_toolbarTask.frame = CGRectMake(0, currentPoint.y - BORDER_TOUCH_UPDOWN - TOOLBAR_TRANSFER_H - TOOLBAR_ADD_BORDER/2, _mainView.frame.size.width, TOOLBAR_TRANSFER_H);
             _imageDrag.frame = CGRectMake(0, currentPoint.y - BORDER_TOUCH_UPDOWN, navigationBarW, BORDER_TOUCH_UPDOWN);
@@ -310,7 +312,7 @@
     CGFloat navigationBarH = self.navigationBar.frame.size.height + [UIApplication sharedApplication].statusBarFrame.size.height;
     
     _mainView.frame = CGRectMake(0, 0, size.width, [self getMaxH]);
-    _tableView.frame = CGRectMake(0, navigationBarH, _mainView.frame.size.width, _mainView.frame.size.height - navigationBarH - BORDER_TOUCH_UPDOWN - TOOLBAR_TRANSFER_H - TOOLBAR_ADD_BORDER);
+    _pageViewController.view.frame = CGRectMake(0, navigationBarH, _mainView.frame.size.width, _mainView.frame.size.height - navigationBarH - BORDER_TOUCH_UPDOWN - TOOLBAR_TRANSFER_H - TOOLBAR_ADD_BORDER);
     _noRecord.frame = CGRectMake(0, _mainView.frame.size.height / 2 - TOOLBAR_TRANSFER_H, _mainView.frame.size.width, SIZE_FONT_NORECORD+10);
     //_toolbarTask.frame = CGRectMake(0, _mainView.frame.size.height - BORDER_TOUCH_UPDOWN - TOOLBAR_TRANSFER_H - TOOLBAR_ADD_BORDER/2, _mainView.frame.size.width, TOOLBAR_TRANSFER_H);
     _imageDrag.frame = CGRectMake(0, _mainView.frame.size.height - BORDER_TOUCH_UPDOWN, _mainView.frame.size.width, BORDER_TOUCH_UPDOWN);
@@ -341,7 +343,7 @@
             
             _isOpen = YES;
 
-            [self reloadDatasource];
+            //[self reloadDatasource];
         }
         
     } else {
@@ -366,596 +368,69 @@
 }
 
 #pragma --------------------------------------------------------------------------------------------
-#pragma mark - ===== Progress & Task Button =====
+#pragma mark ===== Page  =====
 #pragma --------------------------------------------------------------------------------------------
 
-- (void)progressTask:(NSString *)fileID serverUrl:(NSString *)serverUrl cryptated:(BOOL)cryptated progress:(float)progress;
+- (CCControlCenterPageContent *)viewControllerAtIndex:(NSUInteger)index
 {
-    // Chech 
-    if (!fileID)
-        return;
-    
-    [app.listProgressMetadata setObject:[NSNumber numberWithFloat:progress] forKey:fileID];
-
-    NSIndexPath *indexPath = [_sectionDataSource.fileIDIndexPath objectForKey:fileID];
-    
-    if (indexPath && indexPath.row == 0) {
-        
-        CCControlCenterTransferCell *cell = (CCControlCenterTransferCell *)[_tableView cellForRowAtIndexPath:indexPath];
-    
-        if (cryptated) cell.progressView.progressTintColor = COLOR_CRYPTOCLOUD;
-        else cell.progressView.progressTintColor = COLOR_TEXT_ANTHRACITE;
-        
-        cell.progressView.hidden = NO;
-        [cell.progressView setProgress:progress];
-        
-    } else {
-     
-        [self reloadDatasource];
+    if (([self.pageType count] == 0) || (index >= [self.pageType count])) {
+        return nil;
     }
-}
-
-- (void)reloadTaskButton:(id)sender withEvent:(UIEvent *)event
-{
-    if (app.activeMain == nil)
-        return;
     
-    UITouch * touch = [[event allTouches] anyObject];
-    CGPoint location = [touch locationInView:_tableView];
-    NSIndexPath * indexPath = [_tableView indexPathForRowAtPoint:location];
+    // Create a new view controller and pass suitable data.
+    CCControlCenterPageContent *pageContentViewController = [[UIStoryboard storyboardWithName: @"ControlCenter" bundle:[NSBundle mainBundle]]  instantiateViewControllerWithIdentifier:@"ControlCenterPageContent"];
     
-    if (indexPath) {
-        
-        NSString *fileID = [[_sectionDataSource.sectionArrayRow objectForKey:[_sectionDataSource.sections objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];
-        CCMetadata *metadata = [_sectionDataSource.allRecordsDataSource objectForKey:fileID];
-        
-        if (metadata)
-            [app.activeMain reloadTaskButton:metadata];
-    }
-}
-
-- (void)reloadAllTask
-{
-    if (app.activeMain == nil)
-        return;
+    pageContentViewController.pageIndex = index;
+    pageContentViewController.pageType = self.pageType[index];
     
-    for (NSString *key in _sectionDataSource.allRecordsDataSource.allKeys) {
-        
-        CCMetadata *metadata = [_sectionDataSource.allRecordsDataSource objectForKey:key];
-        
-        if ([metadata.session containsString:@"download"] && (metadata.sessionTaskIdentifierPlist != k_taskIdentifierDone))
-            continue;
-        
-        if ([metadata.session containsString:@"upload"] && (metadata.sessionTaskIdentifier != k_taskIdentifierStop))
-            continue;
-        
-        [app.activeMain reloadTaskButton:metadata];
-    }
+    return pageContentViewController;
 }
 
-- (void)cancelTaskButton:(id)sender withEvent:(UIEvent *)event
+- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController
 {
-    if (app.activeMain == nil)
-        return;
+    NSUInteger index = ((CCControlCenterPageContent *) viewController).pageIndex;
     
-    UITouch * touch = [[event allTouches] anyObject];
-    CGPoint location = [touch locationInView:_tableView];
-    NSIndexPath * indexPath = [_tableView indexPathForRowAtPoint:location];
-    
-    if (indexPath) {
-        
-        NSString *fileID = [[_sectionDataSource.sectionArrayRow objectForKey:[_sectionDataSource.sections objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];
-        CCMetadata *metadata = [_sectionDataSource.allRecordsDataSource objectForKey:fileID];
-        
-        if (metadata)
-            [app.activeMain cancelTaskButton:metadata reloadTable:YES];
+    if ((index == 0) || (index == NSNotFound)) {
+        return nil;
     }
-}
-
-- (void)cancelAllTask
-{
-    if (app.activeMain == nil)
-        return;
-    
-    BOOL lastAndRefresh = NO;
     
-    for (NSString *key in _sectionDataSource.allRecordsDataSource.allKeys) {
-        
-        if ([key isEqualToString:[_sectionDataSource.allRecordsDataSource.allKeys lastObject]])
-            lastAndRefresh = YES;
-
-        CCMetadata *metadata = [_sectionDataSource.allRecordsDataSource objectForKey:key];
-        
-        if ([metadata.session containsString:@"upload"] && metadata.cryptated && ((metadata.sessionTaskIdentifier == k_taskIdentifierDone && metadata.sessionTaskIdentifierPlist >= 0) || (metadata.sessionTaskIdentifier >= 0 && metadata.sessionTaskIdentifierPlist == k_taskIdentifierDone)))
-            continue;
-        
-        [app.activeMain cancelTaskButton:metadata reloadTable:lastAndRefresh];
-    }
+    index--;
+    return [self viewControllerAtIndex:index];
 }
 
-- (void)stopTaskButton:(id)sender withEvent:(UIEvent *)event
+- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController
 {
-    if (app.activeMain == nil)
-        return;
+    NSUInteger index = ((CCControlCenterPageContent *) viewController).pageIndex;
     
-    UITouch * touch = [[event allTouches] anyObject];
-    CGPoint location = [touch locationInView:_tableView];
-    NSIndexPath * indexPath = [_tableView indexPathForRowAtPoint:location];
-    
-    if (indexPath) {
-        
-        NSString *fileID = [[_sectionDataSource.sectionArrayRow objectForKey:[_sectionDataSource.sections objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];
-        CCMetadata *metadata = [_sectionDataSource.allRecordsDataSource objectForKey:fileID];
-        
-        if (metadata)
-            [app.activeMain stopTaskButton:metadata];
+    if (index == NSNotFound) {
+        return nil;
     }
-}
-
-- (void)stopAllTask
-{
-    if (app.activeMain == nil)
-        return;
     
-    for (NSString *key in _sectionDataSource.allRecordsDataSource.allKeys) {
-        
-        CCMetadata *metadata = [_sectionDataSource.allRecordsDataSource objectForKey:key];
-        
-        if ([metadata.session containsString:@"download"]) {
-                [app.activeMain cancelTaskButton:metadata reloadTable:YES];
-            continue;
-        }
-        
-        if ([metadata.session containsString:@"upload"] && metadata.cryptated && ((metadata.sessionTaskIdentifier == k_taskIdentifierDone && metadata.sessionTaskIdentifierPlist >= 0) || (metadata.sessionTaskIdentifier >= 0 && metadata.sessionTaskIdentifierPlist == k_taskIdentifierDone)))
-            continue;
-        
-        [app.activeMain stopTaskButton:metadata];
-    }    
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark - ==== Datasource ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (void)reloadDatasource
-{
-    // test
-    if (app.activeAccount.length == 0)
-        return;
-    
-    if (_isOpen) {
-    
-        NSArray *recordsTableMetadata = [CCCoreData getTableMetadataWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND ((session CONTAINS 'upload') OR (session CONTAINS 'download' AND (sessionSelector != 'loadPlist')))", app.activeAccount] fieldOrder:@"sessionTaskIdentifier" ascending:YES];
-    
-        _sectionDataSource  = [CCSection creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:app.listProgressMetadata groupByField:@"session" replaceDateToExifDate:NO activeAccount:app.activeAccount];
-    
-        if ([_sectionDataSource.allRecordsDataSource count] == 0) _noRecord.hidden = NO;
-        else _noRecord.hidden = YES;
+    index++;
+    if (index == [self.pageType count]) {
+        return nil;
     }
-    
-    [_tableView reloadData];
-    
-    [app updateApplicationIconBadgeNumber];
-}
-
-#pragma --------------------------------------------------------------------------------------------
-#pragma mark - ==== Table ====
-#pragma --------------------------------------------------------------------------------------------
-
-- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
-{
-    return 50;
-}
-
-- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
-{
-    return [[_sectionDataSource.sectionArrayRow allKeys] count];
+    return [self viewControllerAtIndex:index];
 }
 
-- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+- (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController
 {
-    return [[_sectionDataSource.sectionArrayRow objectForKey:[_sectionDataSource.sections objectAtIndex:section]] count];
+    return [self.pageType count];
 }
 
-- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
+- (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController
 {
-    return 13.0f;
+    return 0;
 }
 
--(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
-{
-    UIVisualEffectView *visualEffectView;
-    
-    NSString *titleSection, *numberTitle;
-    NSInteger typeOfSession = 0;
-    
-    if ([[_sectionDataSource.sections objectAtIndex:section] isKindOfClass:[NSString class]]) titleSection = [_sectionDataSource.sections objectAtIndex:section];
-    if ([[_sectionDataSource.sections objectAtIndex:section] isKindOfClass:[NSDate class]]) titleSection = [CCUtility getTitleSectionDate:[_sectionDataSource.sections objectAtIndex:section]];
-    
-    NSArray *metadatas = [_sectionDataSource.sectionArrayRow objectForKey:[_sectionDataSource.sections objectAtIndex:section]];
-    NSUInteger rowsCount = [metadatas count];
-    
-    visualEffectView = [[UIVisualEffectView alloc] init];
-    visualEffectView.backgroundColor = [UIColor clearColor];
-    
-    // title section
-    if ([titleSection isEqualToString:@"_none_"]) {
-        titleSection = @"";
-    } else if ([titleSection containsString:@"download"] && ![titleSection containsString:@"wwan"]) {
-        typeOfSession = download;
-        titleSection = NSLocalizedString(@"_title_section_download_",nil);
-    } else if ([titleSection containsString:@"download"] && [titleSection containsString:@"wwan"]) {
-        typeOfSession = downloadwwan;
-        titleSection = [NSLocalizedString(@"_title_section_download_",nil) stringByAppendingString:@" Wi-Fi"];
-    } else if ([titleSection containsString:@"upload"] && ![titleSection containsString:@"wwan"]) {
-        typeOfSession = upload;
-        titleSection = NSLocalizedString(@"_title_section_upload_",nil);
-    } else if ([titleSection containsString:@"upload"] && [titleSection containsString:@"wwan"]) {
-        typeOfSession = uploadwwan;
-        titleSection = [NSLocalizedString(@"_title_section_upload_",nil) stringByAppendingString:@" Wi-Fi"];
-    } else {
-        titleSection = NSLocalizedString(titleSection,nil);
-    }
-    
-    // title label on left
-    UILabel *titleLabel=[[UILabel alloc]initWithFrame:CGRectMake(8, 3, 0, 13)];
-    titleLabel.textColor = COLOR_TEXT_ANTHRACITE;
-    titleLabel.font = [UIFont systemFontOfSize:9];
-    titleLabel.textAlignment = NSTextAlignmentLeft;
-    titleLabel.text = titleSection;
-    titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
-    [visualEffectView addSubview:titleLabel];
-    
-    // element (s) on right
-    UILabel *elementLabel=[[UILabel alloc]initWithFrame:CGRectMake(-8, 3, 0, 13)];
-    elementLabel.textColor = COLOR_TEXT_ANTHRACITE;
-    elementLabel.font = [UIFont systemFontOfSize:9];
-    elementLabel.textAlignment = NSTextAlignmentRight;
-    elementLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
-
-    if ((typeOfSession == download && app.queueNunDownload > rowsCount) || (typeOfSession == downloadwwan && app.queueNumDownloadWWan > rowsCount) ||
-        (typeOfSession == upload   && app.queueNumUpload > rowsCount)   || (typeOfSession == uploadwwan && app.queueNumUploadWWan > rowsCount)) {
-        numberTitle = [NSString stringWithFormat:@"%lu+", (unsigned long)rowsCount];
-    } else {
-        numberTitle = [NSString stringWithFormat:@"%lu", (unsigned long)rowsCount];
-    }
-    
-    if (rowsCount > 1)
-        elementLabel.text = [NSString stringWithFormat:@"%@ %@", numberTitle, NSLocalizedString(@"_elements_",nil)];
-    else
-        elementLabel.text = [NSString stringWithFormat:@"%@ %@", numberTitle, NSLocalizedString(@"_element_",nil)];
-    
-    // view
-    [visualEffectView addSubview:elementLabel];
-    
-    return visualEffectView;
-}
-
-- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
-{
-    NSString *titleSection;
-    NSString *element_s;
-    
-    if ([[_sectionDataSource.sections objectAtIndex:section] isKindOfClass:[NSString class]]) titleSection = [_sectionDataSource.sections objectAtIndex:section];
-    
-    // Prepare view for title in footer
-    UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
-    
-    UILabel *titleFooterLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 18)];
-    titleFooterLabel.textColor = COLOR_TEXT_ANTHRACITE;
-    titleFooterLabel.font = [UIFont systemFontOfSize:12];
-    titleFooterLabel.textAlignment = NSTextAlignmentCenter;
-
-    // Footer Download
-    if ([titleSection containsString:@"download"] && ![titleSection containsString:@"wwan"] && titleSection != nil) {
-        
-        // element or elements ?
-        if (app.queueNunDownload > 1) element_s = NSLocalizedString(@"_elements_",nil);
-        else element_s = NSLocalizedString(@"_element_",nil);
-        
-        // Num record to upload
-        NSMutableAttributedString *stringFooter= [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:NSLocalizedString(@"_tite_footer_download_", nil), app.queueNunDownload, element_s]];
-        titleFooterLabel.attributedText = stringFooter;
-        
-        [view addSubview:titleFooterLabel];
-        return view;
-    }
-    
-    // Footer Download WWAN
-    if ([titleSection containsString:@"download"] && [titleSection containsString:@"wwan"] && titleSection != nil) {
-        
-        // element or elements ?
-        if (app.queueNumDownloadWWan > 1) element_s = NSLocalizedString(@"_elements_",nil);
-        else element_s = NSLocalizedString(@"_element_",nil);
-            
-        // Add the symbol WiFi and Num record
-        NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
-        attachment.image = [UIImage imageNamed:image_WiFiSmall];
-        NSAttributedString *attachmentString = [NSAttributedString attributedStringWithAttachment:attachment];
-        NSMutableAttributedString *stringFooter= [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:NSLocalizedString(@"_tite_footer_download_wwan_", nil), app.queueNumDownloadWWan, element_s]];
-        [stringFooter insertAttributedString:attachmentString atIndex:0];
-        titleFooterLabel.attributedText = stringFooter;
-            
-        [view addSubview:titleFooterLabel];
-        return view;
-    }
-
-    // Footer Upload
-    if ([titleSection containsString:@"upload"] && ![titleSection containsString:@"wwan"] && titleSection != nil) {
-        
-        // element or elements ?
-        if (app.queueNumUpload > 1) element_s = NSLocalizedString(@"_elements_",nil);
-        else element_s = NSLocalizedString(@"_element_",nil);
-        
-        // Num record to upload
-        NSMutableAttributedString *stringFooter= [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:NSLocalizedString(@"_tite_footer_upload_", nil), app.queueNumUpload, element_s]];
-        titleFooterLabel.attributedText = stringFooter;
-        
-        [view addSubview:titleFooterLabel];
-        return view;
-    }
-
-    // Footer Upload WWAN
-    if ([titleSection containsString:@"upload"] && [titleSection containsString:@"wwan"] && titleSection != nil) {
-        
-        // element or elements ?
-        if (app.queueNumUploadWWan > 1) element_s = NSLocalizedString(@"_elements_",nil);
-        else element_s = NSLocalizedString(@"_element_",nil);
-        
-        // Add the symbol WiFi and Num record
-        NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
-        attachment.image = [UIImage imageNamed:image_WiFiSmall];
-        NSAttributedString *attachmentString = [NSAttributedString attributedStringWithAttachment:attachment];
-        NSMutableAttributedString *stringFooter= [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:NSLocalizedString(@"_tite_footer_upload_wwan_", nil), app.queueNumUploadWWan,element_s]];
-        [stringFooter insertAttributedString:attachmentString atIndex:0];
-        titleFooterLabel.attributedText = stringFooter;
-            
-        [view addSubview:titleFooterLabel];
-        return view;
-    }
-    
-    return nil;
-}
-
-- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
-{
-    //NSString *titleSection;
-    
-    //if ([[_sectionDataSource.sections objectAtIndex:section] isKindOfClass:[NSString class]])
-    //    titleSection = [_sectionDataSource.sections objectAtIndex:section];
-    
-    //if ([titleSection rangeOfString:@"upload"].location != NSNotFound && [titleSection rangeOfString:@"wwan"].location != NSNotFound && titleSection != nil) return 18.0f;
-    //else return 0.0f;
-    
-    return 18.0f;
-}
-
-- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
-{
-    return [_sectionDataSource.sections indexOfObject:title];
-}
+/*
+ - (void)pageViewController:(UIPageViewController *)pageViewController willTransitionToViewControllers:(NSArray<UIViewController *> *)pendingViewControllers
+ {
+ }
+ */
 
-- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+- (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray<UIViewController *> *)previousViewControllers transitionCompleted:(BOOL)completed
 {
-    NSString *dataFile;
-    NSString *lunghezzaFile;
-    
-    NSString *fileID = [[_sectionDataSource.sectionArrayRow objectForKey:[_sectionDataSource.sections objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];
-    CCMetadata *metadata = [_sectionDataSource.allRecordsDataSource objectForKey:fileID];
-    
-    CCControlCenterTransferCell *cell = (CCControlCenterTransferCell *)[tableView dequeueReusableCellWithIdentifier:@"ControlCenterTransferCell" forIndexPath:indexPath];
-    cell.backgroundColor = [UIColor clearColor];
-    cell.selectionStyle = UITableViewCellSelectionStyleNone;
-        
-    // ----------------------------------------------------------------------------------------------------------
-    // DEFAULT
-    // ----------------------------------------------------------------------------------------------------------
-    
-    cell.fileImageView.image = nil;
-    cell.statusImageView.image = nil;
-    
-    cell.labelTitle.enabled = YES;
-    cell.labelTitle.text = @"";
-    cell.labelInfoFile.enabled = YES;
-    cell.labelInfoFile.text = @"";
-    
-    cell.progressView.progress = 0.0;
-    cell.progressView.hidden = YES;
-    
-    cell.cancelTaskButton.hidden = YES;
-    cell.reloadTaskButton.hidden = YES;
-    cell.stopTaskButton.hidden = YES;
-    
-    // colori e font
-    if (metadata.cryptated) {
-        cell.labelTitle.textColor = COLOR_CRYPTOCLOUD;
-        cell.labelInfoFile.textColor = [UIColor blackColor];
-    } else {
-        cell.labelTitle.textColor = COLOR_TEXT_ANTHRACITE;
-        cell.labelInfoFile.textColor = [UIColor blackColor];
-    }
-    
-    // ----------------------------------------------------------------------------------------------------------
-    // File Name & Folder
-    // ----------------------------------------------------------------------------------------------------------
-    
-    // nome del file
-    cell.labelTitle.text = metadata.fileNamePrint;
-    
-    // è una directory
-    if (metadata.directory) {
-        
-        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
-        cell.labelInfoFile.text = [CCUtility dateDiff:metadata.date];
-        
-        lunghezzaFile = @" ";
-        
-    } else {
-        
-        // è un file
-        
-        dataFile = [CCUtility dateDiff:metadata.date];
-        lunghezzaFile = [CCUtility transformedSize:metadata.size];
-        
-        // Plist ancora da scaricare
-        if (metadata.cryptated && [metadata.title length] == 0) {
-            
-            dataFile = @" ";
-            lunghezzaFile = @" ";
-        }
-        
-        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
-        [dateFormatter setDateStyle:NSDateFormatterShortStyle];
-        [dateFormatter setTimeStyle:NSDateFormatterShortStyle];
-        
-        cell.accessoryType = UITableViewCellAccessoryNone;
-    }
-    
-    // ----------------------------------------------------------------------------------------------------------
-    // File Image View
-    // ----------------------------------------------------------------------------------------------------------
-    
-    // assegnamo l'immagine anteprima se esiste, altrimenti metti quella standars
-    if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@.ico", app.directoryUser, metadata.fileID]]) {
-        
-        cell.fileImageView.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.ico", app.directoryUser, metadata.fileID]];
-        
-    } else {
-        
-        cell.fileImageView.image = [UIImage imageNamed:metadata.iconName];
-    }
-    
-    // ----------------------------------------------------------------------------------------------------------
-    // Image Status cyptated & Lock Passcode
-    // ----------------------------------------------------------------------------------------------------------
-    
-    // File Cyptated
-    if (metadata.cryptated && metadata.directory == NO && [metadata.type isEqualToString: k_metadataType_template] == NO) {
-        
-        cell.statusImageView.image = [UIImage imageNamed:image_lock];
-    }
-    
-    // ----------------------------------------------------------------------------------------------------------
-    // downloadFile
-    // ----------------------------------------------------------------------------------------------------------
-    
-    if ([metadata.session length] > 0 && [metadata.session rangeOfString:@"download"].location != NSNotFound) {
-        
-        if (metadata.cryptated) cell.statusImageView.image = [UIImage imageNamed:image_statusdownloadcrypto];
-        else cell.statusImageView.image = [UIImage imageNamed:image_statusdownload];
-        
-        // Fai comparire il RELOAD e lo STOP solo se non è un Task Plist
-        if (metadata.sessionTaskIdentifierPlist == k_taskIdentifierDone) {
-            
-            if (metadata.cryptated)[cell.cancelTaskButton setBackgroundImage:[UIImage imageNamed:image_stoptaskcrypto] forState:UIControlStateNormal];
-            else [cell.cancelTaskButton setBackgroundImage:[UIImage imageNamed:image_stoptask] forState:UIControlStateNormal];
-            
-            cell.cancelTaskButton.hidden = NO;
-            
-            if (metadata.cryptated)[cell.reloadTaskButton setBackgroundImage:[UIImage imageNamed:image_reloadtaskcrypto] forState:UIControlStateNormal];
-            else [cell.reloadTaskButton setBackgroundImage:[UIImage imageNamed:image_reloadtask] forState:UIControlStateNormal];
-            
-            cell.reloadTaskButton.hidden = NO;
-        }
-        
-        cell.labelInfoFile.text = [NSString stringWithFormat:@"%@", lunghezzaFile];
-        
-        float progress = [[app.listProgressMetadata objectForKey:metadata.fileID] floatValue];
-        if (progress > 0) {
-            
-            if (metadata.cryptated) cell.progressView.progressTintColor = COLOR_CRYPTOCLOUD;
-            else cell.progressView.progressTintColor = COLOR_TEXT_ANTHRACITE;
-            
-            cell.progressView.progress = progress;
-            cell.progressView.hidden = NO;
-        }
-        
-        // ----------------------------------------------------------------------------------------------------------
-        // downloadFile Error
-        // ----------------------------------------------------------------------------------------------------------
-        
-        if (metadata.sessionTaskIdentifier == k_taskIdentifierError || metadata.sessionTaskIdentifierPlist == k_taskIdentifierError) {
-            
-            cell.statusImageView.image = [UIImage imageNamed:image_statuserror];
-            
-            if ([metadata.sessionError length] == 0)
-                cell.labelInfoFile.text = [NSString stringWithFormat:@"%@, %@", NSLocalizedString(@"_error_",nil), NSLocalizedString(@"_file_not_downloaded_",nil)];
-            else
-                cell.labelInfoFile.text = [CCError manageErrorKCF:[metadata.sessionError integerValue] withNumberError:NO];
-        }
-    }
-    
-    // ----------------------------------------------------------------------------------------------------------
-    // uploadFile
-    // ----------------------------------------------------------------------------------------------------------
-    
-    if ([metadata.session length] > 0 && [metadata.session rangeOfString:@"upload"].location != NSNotFound) {
-        
-        if (metadata.cryptated) cell.statusImageView.image = [UIImage imageNamed:image_statusuploadcrypto];
-        else cell.statusImageView.image = [UIImage imageNamed:image_statusupload];
-        
-        if (metadata.cryptated)[cell.cancelTaskButton setBackgroundImage:[UIImage imageNamed:image_removetaskcrypto] forState:UIControlStateNormal];
-        else [cell.cancelTaskButton setBackgroundImage:[UIImage imageNamed:image_removetask] forState:UIControlStateNormal];
-        cell.cancelTaskButton.hidden = NO;
-        
-        if (metadata.sessionTaskIdentifier == k_taskIdentifierStop) {
-            
-            if (metadata.cryptated)[cell.reloadTaskButton setBackgroundImage:[UIImage imageNamed:image_reloadtaskcrypto] forState:UIControlStateNormal];
-            else [cell.reloadTaskButton setBackgroundImage:[UIImage imageNamed:image_reloadtask] forState:UIControlStateNormal];
-            
-            if (metadata.cryptated) cell.statusImageView.image = [UIImage imageNamed:image_statusstopcrypto];
-            else cell.statusImageView.image = [UIImage imageNamed:image_statusstop];
-            
-            cell.reloadTaskButton.hidden = NO;
-            cell.stopTaskButton.hidden = YES;
-            
-        } else {
-            
-            if (metadata.cryptated)[cell.stopTaskButton setBackgroundImage:[UIImage imageNamed:image_stoptaskcrypto] forState:UIControlStateNormal];
-            else [cell.stopTaskButton setBackgroundImage:[UIImage imageNamed:image_stoptask] forState:UIControlStateNormal];
-            
-            cell.stopTaskButton.hidden = NO;
-            cell.reloadTaskButton.hidden = YES;
-        }
-        
-        // se non c'è una preview in bianconero metti l'immagine di default
-        if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@.ico", app.directoryUser, metadata.fileID]] == NO)
-            cell.fileImageView.image = [UIImage imageNamed:image_uploaddisable];
-        
-        cell.labelTitle.enabled = NO;
-        cell.labelInfoFile.text = [NSString stringWithFormat:@"%@", lunghezzaFile];
-        
-        float progress = [[app.listProgressMetadata objectForKey:metadata.fileID] floatValue];
-        if (progress > 0) {
-            
-            if (metadata.cryptated) cell.progressView.progressTintColor = COLOR_CRYPTOCLOUD;
-            else cell.progressView.progressTintColor = COLOR_TEXT_ANTHRACITE;
-            
-            cell.progressView.progress = progress;
-            cell.progressView.hidden = NO;
-        }
-        
-        // ----------------------------------------------------------------------------------------------------------
-        // uploadFileError
-        // ----------------------------------------------------------------------------------------------------------
-        
-        if (metadata.sessionTaskIdentifier == k_taskIdentifierError || metadata.sessionTaskIdentifierPlist == k_taskIdentifierError) {
-            
-            cell.labelTitle.enabled = NO;
-            cell.statusImageView.image = [UIImage imageNamed:image_statuserror];
-            
-            if ([metadata.sessionError length] == 0)
-                cell.labelInfoFile.text = [NSString stringWithFormat:@"%@, %@", NSLocalizedString(@"_error_",nil), NSLocalizedString(@"_file_not_uploaded_",nil)];
-            else
-                cell.labelInfoFile.text = [CCError manageErrorKCF:[metadata.sessionError integerValue] withNumberError:NO];
-        }
-    }
-    
-    [cell.reloadTaskButton addTarget:self action:@selector(reloadTaskButton:withEvent:) forControlEvents:UIControlEventTouchUpInside];
-    [cell.cancelTaskButton addTarget:self action:@selector(cancelTaskButton:withEvent:) forControlEvents:UIControlEventTouchUpInside];
-    [cell.stopTaskButton addTarget:self action:@selector(stopTaskButton:withEvent:) forControlEvents:UIControlEventTouchUpInside];
-    
-    return cell;
 }
 
 

+ 21 - 0
iOSClient/MenuAccount+ControlCenter/CCControlCenterPageContent.h

@@ -0,0 +1,21 @@
+//
+//  CCControlCenterPageContent.h
+//  Nextcloud
+//
+//  Created by Marino Faggiana on 01/03/17.
+//  Copyright © 2017 TWS. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface CCControlCenterPageContent : UIViewController <UITableViewDataSource, UITableViewDelegate>
+
+@property NSUInteger pageIndex;
+@property (nonatomic, strong) NSString *pageType;
+
+@property (nonatomic, weak) IBOutlet UITableView *tableView;
+
+- (void)reloadDatasource;
+- (void)progressTask:(NSString *)fileID serverUrl:(NSString *)serverUrl cryptated:(BOOL)cryptated progress:(float)progress;
+
+@end

+ 663 - 0
iOSClient/MenuAccount+ControlCenter/CCControlCenterPageContent.m

@@ -0,0 +1,663 @@
+//
+//  CCControlCenterPageContent.m
+//  Nextcloud
+//
+//  Created by Marino Faggiana on 01/03/17.
+//  Copyright © 2017 TWS. All rights reserved.
+//
+
+#import "CCControlCenterPageContent.h"
+
+#import "AppDelegate.h"
+#import "CCMain.h"
+#import "CCDetail.h"
+#import "CCSection.h"
+#import "CCMetadata.h"
+#import "CCControlCenterTransferCell.h"
+
+#define download 1
+#define downloadwwan 2
+#define upload 3
+#define uploadwwan 4
+
+@interface CCControlCenterPageContent ()
+{    
+    // Datasource
+    CCSectionDataSource *_sectionDataSource;
+}
+@end
+
+@implementation CCControlCenterPageContent
+
+- (void)viewDidLoad {
+    
+    [super viewDidLoad];
+    
+    // Custom Cell
+    [_tableView registerNib:[UINib nibWithNibName:@"CCControlCenterTransferCell" bundle:nil] forCellReuseIdentifier:@"ControlCenterTransferCell"];
+    
+   
+    _tableView.delegate = self;
+    _tableView.dataSource = self;
+    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
+    _tableView.backgroundColor = [UIColor redColor];
+}
+
+// Apparirà
+- (void)viewWillAppear:(BOOL)animated
+{
+    [super viewWillAppear:animated];
+    
+    
+    [self reloadDatasource];
+}
+
+// E' arrivato
+- (void)viewDidAppear:(BOOL)animated
+{
+    [super viewDidAppear:animated];
+    
+    // update Badge
+    [app updateApplicationIconBadgeNumber];
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+}
+
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark - ===== Progress & Task Button =====
+#pragma --------------------------------------------------------------------------------------------
+
+- (void)progressTask:(NSString *)fileID serverUrl:(NSString *)serverUrl cryptated:(BOOL)cryptated progress:(float)progress;
+{
+    // Chech
+    if (!fileID)
+        return;
+    
+    [app.listProgressMetadata setObject:[NSNumber numberWithFloat:progress] forKey:fileID];
+    
+    NSIndexPath *indexPath = [_sectionDataSource.fileIDIndexPath objectForKey:fileID];
+    
+    if (indexPath && indexPath.row == 0) {
+        
+        CCControlCenterTransferCell *cell = (CCControlCenterTransferCell *)[_tableView cellForRowAtIndexPath:indexPath];
+        
+        if (cryptated) cell.progressView.progressTintColor = COLOR_CRYPTOCLOUD;
+        else cell.progressView.progressTintColor = COLOR_TEXT_ANTHRACITE;
+        
+        cell.progressView.hidden = NO;
+        [cell.progressView setProgress:progress];
+        
+    } else {
+        
+        [self reloadDatasource];
+    }
+}
+
+- (void)reloadTaskButton:(id)sender withEvent:(UIEvent *)event
+{
+    if (app.activeMain == nil)
+        return;
+    
+    UITouch * touch = [[event allTouches] anyObject];
+    CGPoint location = [touch locationInView:_tableView];
+    NSIndexPath * indexPath = [_tableView indexPathForRowAtPoint:location];
+    
+    if (indexPath) {
+        
+        NSString *fileID = [[_sectionDataSource.sectionArrayRow objectForKey:[_sectionDataSource.sections objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];
+        CCMetadata *metadata = [_sectionDataSource.allRecordsDataSource objectForKey:fileID];
+        
+        if (metadata)
+            [app.activeMain reloadTaskButton:metadata];
+    }
+}
+
+- (void)reloadAllTask
+{
+    if (app.activeMain == nil)
+        return;
+    
+    for (NSString *key in _sectionDataSource.allRecordsDataSource.allKeys) {
+        
+        CCMetadata *metadata = [_sectionDataSource.allRecordsDataSource objectForKey:key];
+        
+        if ([metadata.session containsString:@"download"] && (metadata.sessionTaskIdentifierPlist != k_taskIdentifierDone))
+            continue;
+        
+        if ([metadata.session containsString:@"upload"] && (metadata.sessionTaskIdentifier != k_taskIdentifierStop))
+            continue;
+        
+        [app.activeMain reloadTaskButton:metadata];
+    }
+}
+
+- (void)cancelTaskButton:(id)sender withEvent:(UIEvent *)event
+{
+    if (app.activeMain == nil)
+        return;
+    
+    UITouch * touch = [[event allTouches] anyObject];
+    CGPoint location = [touch locationInView:_tableView];
+    NSIndexPath * indexPath = [_tableView indexPathForRowAtPoint:location];
+    
+    if (indexPath) {
+        
+        NSString *fileID = [[_sectionDataSource.sectionArrayRow objectForKey:[_sectionDataSource.sections objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];
+        CCMetadata *metadata = [_sectionDataSource.allRecordsDataSource objectForKey:fileID];
+        
+        if (metadata)
+            [app.activeMain cancelTaskButton:metadata reloadTable:YES];
+    }
+}
+
+- (void)cancelAllTask
+{
+    if (app.activeMain == nil)
+        return;
+    
+    BOOL lastAndRefresh = NO;
+    
+    for (NSString *key in _sectionDataSource.allRecordsDataSource.allKeys) {
+        
+        if ([key isEqualToString:[_sectionDataSource.allRecordsDataSource.allKeys lastObject]])
+            lastAndRefresh = YES;
+        
+        CCMetadata *metadata = [_sectionDataSource.allRecordsDataSource objectForKey:key];
+        
+        if ([metadata.session containsString:@"upload"] && metadata.cryptated && ((metadata.sessionTaskIdentifier == k_taskIdentifierDone && metadata.sessionTaskIdentifierPlist >= 0) || (metadata.sessionTaskIdentifier >= 0 && metadata.sessionTaskIdentifierPlist == k_taskIdentifierDone)))
+            continue;
+        
+        [app.activeMain cancelTaskButton:metadata reloadTable:lastAndRefresh];
+    }
+}
+
+- (void)stopTaskButton:(id)sender withEvent:(UIEvent *)event
+{
+    if (app.activeMain == nil)
+        return;
+    
+    UITouch * touch = [[event allTouches] anyObject];
+    CGPoint location = [touch locationInView:_tableView];
+    NSIndexPath * indexPath = [_tableView indexPathForRowAtPoint:location];
+    
+    if (indexPath) {
+        
+        NSString *fileID = [[_sectionDataSource.sectionArrayRow objectForKey:[_sectionDataSource.sections objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];
+        CCMetadata *metadata = [_sectionDataSource.allRecordsDataSource objectForKey:fileID];
+        
+        if (metadata)
+            [app.activeMain stopTaskButton:metadata];
+    }
+}
+
+- (void)stopAllTask
+{
+    if (app.activeMain == nil)
+        return;
+    
+    for (NSString *key in _sectionDataSource.allRecordsDataSource.allKeys) {
+        
+        CCMetadata *metadata = [_sectionDataSource.allRecordsDataSource objectForKey:key];
+        
+        if ([metadata.session containsString:@"download"]) {
+            [app.activeMain cancelTaskButton:metadata reloadTable:YES];
+            continue;
+        }
+        
+        if ([metadata.session containsString:@"upload"] && metadata.cryptated && ((metadata.sessionTaskIdentifier == k_taskIdentifierDone && metadata.sessionTaskIdentifierPlist >= 0) || (metadata.sessionTaskIdentifier >= 0 && metadata.sessionTaskIdentifierPlist == k_taskIdentifierDone)))
+            continue;
+        
+        [app.activeMain stopTaskButton:metadata];
+    }    
+}
+
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark - ==== Datasource ====
+#pragma --------------------------------------------------------------------------------------------
+
+- (void)reloadDatasource
+{
+    // test
+    if (app.activeAccount.length == 0)
+        return;
+    
+   // if (_isOpen) {
+        
+        NSArray *recordsTableMetadata = [CCCoreData getTableMetadataWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND ((session CONTAINS 'upload') OR (session CONTAINS 'download' AND (sessionSelector != 'loadPlist')))", app.activeAccount] fieldOrder:@"sessionTaskIdentifier" ascending:YES];
+        
+        _sectionDataSource  = [CCSection creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:app.listProgressMetadata groupByField:@"session" replaceDateToExifDate:NO activeAccount:app.activeAccount];
+        
+    //    if ([_sectionDataSource.allRecordsDataSource count] == 0) _noRecord.hidden = NO;
+    //    else _noRecord.hidden = YES;
+    //}
+    
+    [_tableView reloadData];
+    
+    [app updateApplicationIconBadgeNumber];
+}
+
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark - ==== Table ====
+#pragma --------------------------------------------------------------------------------------------
+
+- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    return 50;
+}
+
+- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
+{
+    return [[_sectionDataSource.sectionArrayRow allKeys] count];
+}
+
+- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
+{
+    return [[_sectionDataSource.sectionArrayRow objectForKey:[_sectionDataSource.sections objectAtIndex:section]] count];
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
+{
+    return 13.0f;
+}
+
+-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
+{
+    UIVisualEffectView *visualEffectView;
+    
+    NSString *titleSection, *numberTitle;
+    NSInteger typeOfSession = 0;
+    
+    if ([[_sectionDataSource.sections objectAtIndex:section] isKindOfClass:[NSString class]]) titleSection = [_sectionDataSource.sections objectAtIndex:section];
+    if ([[_sectionDataSource.sections objectAtIndex:section] isKindOfClass:[NSDate class]]) titleSection = [CCUtility getTitleSectionDate:[_sectionDataSource.sections objectAtIndex:section]];
+    
+    NSArray *metadatas = [_sectionDataSource.sectionArrayRow objectForKey:[_sectionDataSource.sections objectAtIndex:section]];
+    NSUInteger rowsCount = [metadatas count];
+    
+    visualEffectView = [[UIVisualEffectView alloc] init];
+    visualEffectView.backgroundColor = [UIColor clearColor];
+    
+    // title section
+    if ([titleSection isEqualToString:@"_none_"]) {
+        titleSection = @"";
+    } else if ([titleSection containsString:@"download"] && ![titleSection containsString:@"wwan"]) {
+        typeOfSession = download;
+        titleSection = NSLocalizedString(@"_title_section_download_",nil);
+    } else if ([titleSection containsString:@"download"] && [titleSection containsString:@"wwan"]) {
+        typeOfSession = downloadwwan;
+        titleSection = [NSLocalizedString(@"_title_section_download_",nil) stringByAppendingString:@" Wi-Fi"];
+    } else if ([titleSection containsString:@"upload"] && ![titleSection containsString:@"wwan"]) {
+        typeOfSession = upload;
+        titleSection = NSLocalizedString(@"_title_section_upload_",nil);
+    } else if ([titleSection containsString:@"upload"] && [titleSection containsString:@"wwan"]) {
+        typeOfSession = uploadwwan;
+        titleSection = [NSLocalizedString(@"_title_section_upload_",nil) stringByAppendingString:@" Wi-Fi"];
+    } else {
+        titleSection = NSLocalizedString(titleSection,nil);
+    }
+    
+    // title label on left
+    UILabel *titleLabel=[[UILabel alloc]initWithFrame:CGRectMake(8, 3, 0, 13)];
+    titleLabel.textColor = COLOR_TEXT_ANTHRACITE;
+    titleLabel.font = [UIFont systemFontOfSize:9];
+    titleLabel.textAlignment = NSTextAlignmentLeft;
+    titleLabel.text = titleSection;
+    titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+    [visualEffectView addSubview:titleLabel];
+    
+    // element (s) on right
+    UILabel *elementLabel=[[UILabel alloc]initWithFrame:CGRectMake(-8, 3, 0, 13)];
+    elementLabel.textColor = COLOR_TEXT_ANTHRACITE;
+    elementLabel.font = [UIFont systemFontOfSize:9];
+    elementLabel.textAlignment = NSTextAlignmentRight;
+    elementLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
+    
+    if ((typeOfSession == download && app.queueNunDownload > rowsCount) || (typeOfSession == downloadwwan && app.queueNumDownloadWWan > rowsCount) ||
+        (typeOfSession == upload   && app.queueNumUpload > rowsCount)   || (typeOfSession == uploadwwan && app.queueNumUploadWWan > rowsCount)) {
+        numberTitle = [NSString stringWithFormat:@"%lu+", (unsigned long)rowsCount];
+    } else {
+        numberTitle = [NSString stringWithFormat:@"%lu", (unsigned long)rowsCount];
+    }
+    
+    if (rowsCount > 1)
+        elementLabel.text = [NSString stringWithFormat:@"%@ %@", numberTitle, NSLocalizedString(@"_elements_",nil)];
+    else
+        elementLabel.text = [NSString stringWithFormat:@"%@ %@", numberTitle, NSLocalizedString(@"_element_",nil)];
+    
+    // view
+    [visualEffectView addSubview:elementLabel];
+    
+    return visualEffectView;
+}
+
+- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section
+{
+    NSString *titleSection;
+    NSString *element_s;
+    
+    if ([[_sectionDataSource.sections objectAtIndex:section] isKindOfClass:[NSString class]]) titleSection = [_sectionDataSource.sections objectAtIndex:section];
+    
+    // Prepare view for title in footer
+    UIView *view = [[UIView alloc] initWithFrame:CGRectZero];
+    
+    UILabel *titleFooterLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, tableView.frame.size.width, 18)];
+    titleFooterLabel.textColor = COLOR_TEXT_ANTHRACITE;
+    titleFooterLabel.font = [UIFont systemFontOfSize:12];
+    titleFooterLabel.textAlignment = NSTextAlignmentCenter;
+    
+    // Footer Download
+    if ([titleSection containsString:@"download"] && ![titleSection containsString:@"wwan"] && titleSection != nil) {
+        
+        // element or elements ?
+        if (app.queueNunDownload > 1) element_s = NSLocalizedString(@"_elements_",nil);
+        else element_s = NSLocalizedString(@"_element_",nil);
+        
+        // Num record to upload
+        NSMutableAttributedString *stringFooter= [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:NSLocalizedString(@"_tite_footer_download_", nil), app.queueNunDownload, element_s]];
+        titleFooterLabel.attributedText = stringFooter;
+        
+        [view addSubview:titleFooterLabel];
+        return view;
+    }
+    
+    // Footer Download WWAN
+    if ([titleSection containsString:@"download"] && [titleSection containsString:@"wwan"] && titleSection != nil) {
+        
+        // element or elements ?
+        if (app.queueNumDownloadWWan > 1) element_s = NSLocalizedString(@"_elements_",nil);
+        else element_s = NSLocalizedString(@"_element_",nil);
+        
+        // Add the symbol WiFi and Num record
+        NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
+        attachment.image = [UIImage imageNamed:image_WiFiSmall];
+        NSAttributedString *attachmentString = [NSAttributedString attributedStringWithAttachment:attachment];
+        NSMutableAttributedString *stringFooter= [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:NSLocalizedString(@"_tite_footer_download_wwan_", nil), app.queueNumDownloadWWan, element_s]];
+        [stringFooter insertAttributedString:attachmentString atIndex:0];
+        titleFooterLabel.attributedText = stringFooter;
+        
+        [view addSubview:titleFooterLabel];
+        return view;
+    }
+    
+    // Footer Upload
+    if ([titleSection containsString:@"upload"] && ![titleSection containsString:@"wwan"] && titleSection != nil) {
+        
+        // element or elements ?
+        if (app.queueNumUpload > 1) element_s = NSLocalizedString(@"_elements_",nil);
+        else element_s = NSLocalizedString(@"_element_",nil);
+        
+        // Num record to upload
+        NSMutableAttributedString *stringFooter= [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:NSLocalizedString(@"_tite_footer_upload_", nil), app.queueNumUpload, element_s]];
+        titleFooterLabel.attributedText = stringFooter;
+        
+        [view addSubview:titleFooterLabel];
+        return view;
+    }
+    
+    // Footer Upload WWAN
+    if ([titleSection containsString:@"upload"] && [titleSection containsString:@"wwan"] && titleSection != nil) {
+        
+        // element or elements ?
+        if (app.queueNumUploadWWan > 1) element_s = NSLocalizedString(@"_elements_",nil);
+        else element_s = NSLocalizedString(@"_element_",nil);
+        
+        // Add the symbol WiFi and Num record
+        NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
+        attachment.image = [UIImage imageNamed:image_WiFiSmall];
+        NSAttributedString *attachmentString = [NSAttributedString attributedStringWithAttachment:attachment];
+        NSMutableAttributedString *stringFooter= [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:NSLocalizedString(@"_tite_footer_upload_wwan_", nil), app.queueNumUploadWWan,element_s]];
+        [stringFooter insertAttributedString:attachmentString atIndex:0];
+        titleFooterLabel.attributedText = stringFooter;
+        
+        [view addSubview:titleFooterLabel];
+        return view;
+    }
+    
+    return nil;
+}
+
+- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
+{
+    //NSString *titleSection;
+    
+    //if ([[_sectionDataSource.sections objectAtIndex:section] isKindOfClass:[NSString class]])
+    //    titleSection = [_sectionDataSource.sections objectAtIndex:section];
+    
+    //if ([titleSection rangeOfString:@"upload"].location != NSNotFound && [titleSection rangeOfString:@"wwan"].location != NSNotFound && titleSection != nil) return 18.0f;
+    //else return 0.0f;
+    
+    return 18.0f;
+}
+
+- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
+{
+    return [_sectionDataSource.sections indexOfObject:title];
+}
+
+- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+    NSString *dataFile;
+    NSString *lunghezzaFile;
+    
+    NSString *fileID = [[_sectionDataSource.sectionArrayRow objectForKey:[_sectionDataSource.sections objectAtIndex:indexPath.section]] objectAtIndex:indexPath.row];
+    CCMetadata *metadata = [_sectionDataSource.allRecordsDataSource objectForKey:fileID];
+    
+    CCControlCenterTransferCell *cell = (CCControlCenterTransferCell *)[tableView dequeueReusableCellWithIdentifier:@"ControlCenterTransferCell" forIndexPath:indexPath];
+    cell.backgroundColor = [UIColor clearColor];
+    cell.selectionStyle = UITableViewCellSelectionStyleNone;
+    
+    // ----------------------------------------------------------------------------------------------------------
+    // DEFAULT
+    // ----------------------------------------------------------------------------------------------------------
+    
+    cell.fileImageView.image = nil;
+    cell.statusImageView.image = nil;
+    
+    cell.labelTitle.enabled = YES;
+    cell.labelTitle.text = @"";
+    cell.labelInfoFile.enabled = YES;
+    cell.labelInfoFile.text = @"";
+    
+    cell.progressView.progress = 0.0;
+    cell.progressView.hidden = YES;
+    
+    cell.cancelTaskButton.hidden = YES;
+    cell.reloadTaskButton.hidden = YES;
+    cell.stopTaskButton.hidden = YES;
+    
+    // colori e font
+    if (metadata.cryptated) {
+        cell.labelTitle.textColor = COLOR_CRYPTOCLOUD;
+        cell.labelInfoFile.textColor = [UIColor blackColor];
+    } else {
+        cell.labelTitle.textColor = COLOR_TEXT_ANTHRACITE;
+        cell.labelInfoFile.textColor = [UIColor blackColor];
+    }
+    
+    // ----------------------------------------------------------------------------------------------------------
+    // File Name & Folder
+    // ----------------------------------------------------------------------------------------------------------
+    
+    // nome del file
+    cell.labelTitle.text = metadata.fileNamePrint;
+    
+    // è una directory
+    if (metadata.directory) {
+        
+        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
+        cell.labelInfoFile.text = [CCUtility dateDiff:metadata.date];
+        
+        lunghezzaFile = @" ";
+        
+    } else {
+        
+        // è un file
+        
+        dataFile = [CCUtility dateDiff:metadata.date];
+        lunghezzaFile = [CCUtility transformedSize:metadata.size];
+        
+        // Plist ancora da scaricare
+        if (metadata.cryptated && [metadata.title length] == 0) {
+            
+            dataFile = @" ";
+            lunghezzaFile = @" ";
+        }
+        
+        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
+        [dateFormatter setDateStyle:NSDateFormatterShortStyle];
+        [dateFormatter setTimeStyle:NSDateFormatterShortStyle];
+        
+        cell.accessoryType = UITableViewCellAccessoryNone;
+    }
+    
+    // ----------------------------------------------------------------------------------------------------------
+    // File Image View
+    // ----------------------------------------------------------------------------------------------------------
+    
+    // assegnamo l'immagine anteprima se esiste, altrimenti metti quella standars
+    if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@.ico", app.directoryUser, metadata.fileID]]) {
+        
+        cell.fileImageView.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.ico", app.directoryUser, metadata.fileID]];
+        
+    } else {
+        
+        cell.fileImageView.image = [UIImage imageNamed:metadata.iconName];
+    }
+    
+    // ----------------------------------------------------------------------------------------------------------
+    // Image Status cyptated & Lock Passcode
+    // ----------------------------------------------------------------------------------------------------------
+    
+    // File Cyptated
+    if (metadata.cryptated && metadata.directory == NO && [metadata.type isEqualToString: k_metadataType_template] == NO) {
+        
+        cell.statusImageView.image = [UIImage imageNamed:image_lock];
+    }
+    
+    // ----------------------------------------------------------------------------------------------------------
+    // downloadFile
+    // ----------------------------------------------------------------------------------------------------------
+    
+    if ([metadata.session length] > 0 && [metadata.session rangeOfString:@"download"].location != NSNotFound) {
+        
+        if (metadata.cryptated) cell.statusImageView.image = [UIImage imageNamed:image_statusdownloadcrypto];
+        else cell.statusImageView.image = [UIImage imageNamed:image_statusdownload];
+        
+        // Fai comparire il RELOAD e lo STOP solo se non è un Task Plist
+        if (metadata.sessionTaskIdentifierPlist == k_taskIdentifierDone) {
+            
+            if (metadata.cryptated)[cell.cancelTaskButton setBackgroundImage:[UIImage imageNamed:image_stoptaskcrypto] forState:UIControlStateNormal];
+            else [cell.cancelTaskButton setBackgroundImage:[UIImage imageNamed:image_stoptask] forState:UIControlStateNormal];
+            
+            cell.cancelTaskButton.hidden = NO;
+            
+            if (metadata.cryptated)[cell.reloadTaskButton setBackgroundImage:[UIImage imageNamed:image_reloadtaskcrypto] forState:UIControlStateNormal];
+            else [cell.reloadTaskButton setBackgroundImage:[UIImage imageNamed:image_reloadtask] forState:UIControlStateNormal];
+            
+            cell.reloadTaskButton.hidden = NO;
+        }
+        
+        cell.labelInfoFile.text = [NSString stringWithFormat:@"%@", lunghezzaFile];
+        
+        float progress = [[app.listProgressMetadata objectForKey:metadata.fileID] floatValue];
+        if (progress > 0) {
+            
+            if (metadata.cryptated) cell.progressView.progressTintColor = COLOR_CRYPTOCLOUD;
+            else cell.progressView.progressTintColor = COLOR_TEXT_ANTHRACITE;
+            
+            cell.progressView.progress = progress;
+            cell.progressView.hidden = NO;
+        }
+        
+        // ----------------------------------------------------------------------------------------------------------
+        // downloadFile Error
+        // ----------------------------------------------------------------------------------------------------------
+        
+        if (metadata.sessionTaskIdentifier == k_taskIdentifierError || metadata.sessionTaskIdentifierPlist == k_taskIdentifierError) {
+            
+            cell.statusImageView.image = [UIImage imageNamed:image_statuserror];
+            
+            if ([metadata.sessionError length] == 0)
+                cell.labelInfoFile.text = [NSString stringWithFormat:@"%@, %@", NSLocalizedString(@"_error_",nil), NSLocalizedString(@"_file_not_downloaded_",nil)];
+            else
+                cell.labelInfoFile.text = [CCError manageErrorKCF:[metadata.sessionError integerValue] withNumberError:NO];
+        }
+    }
+    
+    // ----------------------------------------------------------------------------------------------------------
+    // uploadFile
+    // ----------------------------------------------------------------------------------------------------------
+    
+    if ([metadata.session length] > 0 && [metadata.session rangeOfString:@"upload"].location != NSNotFound) {
+        
+        if (metadata.cryptated) cell.statusImageView.image = [UIImage imageNamed:image_statusuploadcrypto];
+        else cell.statusImageView.image = [UIImage imageNamed:image_statusupload];
+        
+        if (metadata.cryptated)[cell.cancelTaskButton setBackgroundImage:[UIImage imageNamed:image_removetaskcrypto] forState:UIControlStateNormal];
+        else [cell.cancelTaskButton setBackgroundImage:[UIImage imageNamed:image_removetask] forState:UIControlStateNormal];
+        cell.cancelTaskButton.hidden = NO;
+        
+        if (metadata.sessionTaskIdentifier == k_taskIdentifierStop) {
+            
+            if (metadata.cryptated)[cell.reloadTaskButton setBackgroundImage:[UIImage imageNamed:image_reloadtaskcrypto] forState:UIControlStateNormal];
+            else [cell.reloadTaskButton setBackgroundImage:[UIImage imageNamed:image_reloadtask] forState:UIControlStateNormal];
+            
+            if (metadata.cryptated) cell.statusImageView.image = [UIImage imageNamed:image_statusstopcrypto];
+            else cell.statusImageView.image = [UIImage imageNamed:image_statusstop];
+            
+            cell.reloadTaskButton.hidden = NO;
+            cell.stopTaskButton.hidden = YES;
+            
+        } else {
+            
+            if (metadata.cryptated)[cell.stopTaskButton setBackgroundImage:[UIImage imageNamed:image_stoptaskcrypto] forState:UIControlStateNormal];
+            else [cell.stopTaskButton setBackgroundImage:[UIImage imageNamed:image_stoptask] forState:UIControlStateNormal];
+            
+            cell.stopTaskButton.hidden = NO;
+            cell.reloadTaskButton.hidden = YES;
+        }
+        
+        // se non c'è una preview in bianconero metti l'immagine di default
+        if ([[NSFileManager defaultManager] fileExistsAtPath:[NSString stringWithFormat:@"%@/%@.ico", app.directoryUser, metadata.fileID]] == NO)
+            cell.fileImageView.image = [UIImage imageNamed:image_uploaddisable];
+        
+        cell.labelTitle.enabled = NO;
+        cell.labelInfoFile.text = [NSString stringWithFormat:@"%@", lunghezzaFile];
+        
+        float progress = [[app.listProgressMetadata objectForKey:metadata.fileID] floatValue];
+        if (progress > 0) {
+            
+            if (metadata.cryptated) cell.progressView.progressTintColor = COLOR_CRYPTOCLOUD;
+            else cell.progressView.progressTintColor = COLOR_TEXT_ANTHRACITE;
+            
+            cell.progressView.progress = progress;
+            cell.progressView.hidden = NO;
+        }
+        
+        // ----------------------------------------------------------------------------------------------------------
+        // uploadFileError
+        // ----------------------------------------------------------------------------------------------------------
+        
+        if (metadata.sessionTaskIdentifier == k_taskIdentifierError || metadata.sessionTaskIdentifierPlist == k_taskIdentifierError) {
+            
+            cell.labelTitle.enabled = NO;
+            cell.statusImageView.image = [UIImage imageNamed:image_statuserror];
+            
+            if ([metadata.sessionError length] == 0)
+                cell.labelInfoFile.text = [NSString stringWithFormat:@"%@, %@", NSLocalizedString(@"_error_",nil), NSLocalizedString(@"_file_not_uploaded_",nil)];
+            else
+                cell.labelInfoFile.text = [CCError manageErrorKCF:[metadata.sessionError integerValue] withNumberError:NO];
+        }
+    }
+    
+    [cell.reloadTaskButton addTarget:self action:@selector(reloadTaskButton:withEvent:) forControlEvents:UIControlEventTouchUpInside];
+    [cell.cancelTaskButton addTarget:self action:@selector(cancelTaskButton:withEvent:) forControlEvents:UIControlEventTouchUpInside];
+    [cell.stopTaskButton addTarget:self action:@selector(stopTaskButton:withEvent:) forControlEvents:UIControlEventTouchUpInside];
+    
+    return cell;
+}
+
+
+@end
+

+ 53 - 0
iOSClient/MenuAccount+ControlCenter/ControlCenter.storyboard

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
+    <device id="retina4_7" orientation="portrait">
+        <adaptation id="fullscreen"/>
+    </device>
+    <dependencies>
+        <deployment identifier="iOS"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
+        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+    </dependencies>
+    <scenes>
+        <!--Page View Controller-->
+        <scene sceneID="m6z-8w-IJV">
+            <objects>
+                <pageViewController storyboardIdentifier="ControlCenterPageViewController" autoresizesArchivedViewToFullSize="NO" transitionStyle="scroll" navigationOrientation="horizontal" spineLocation="none" id="khw-cy-z0B" sceneMemberID="viewController"/>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="bXc-vg-quF" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="6487" y="1218"/>
+        </scene>
+        <!--Control Center Page Content-->
+        <scene sceneID="Gv7-Uy-0Cg">
+            <objects>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="U19-6b-Mxz" userLabel="First Responder" sceneMemberID="firstResponder"/>
+                <viewController storyboardIdentifier="ControlCenterPageContent" id="XDY-MZ-Gnz" customClass="CCControlCenterPageContent" sceneMemberID="viewController">
+                    <layoutGuides>
+                        <viewControllerLayoutGuide type="top" id="uPE-Nb-KVS"/>
+                        <viewControllerLayoutGuide type="bottom" id="zG1-N8-9Mo"/>
+                    </layoutGuides>
+                    <view key="view" contentMode="scaleToFill" id="xeI-JC-cKn">
+                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="cFo-AN-kZv">
+                                <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                                <autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                                <connections>
+                                    <outlet property="dataSource" destination="XDY-MZ-Gnz" id="ERx-9f-Lzx"/>
+                                    <outlet property="delegate" destination="XDY-MZ-Gnz" id="WCN-ad-5BK"/>
+                                </connections>
+                            </tableView>
+                        </subviews>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+                    </view>
+                    <connections>
+                        <outlet property="tableView" destination="cFo-AN-kZv" id="vLq-gh-way"/>
+                    </connections>
+                </viewController>
+            </objects>
+            <point key="canvasLocation" x="7125.6000000000004" y="1217.5412293853074"/>
+        </scene>
+    </scenes>
+</document>

+ 2 - 2
iOSClient/Networking/CCNetworking.m

@@ -595,7 +595,7 @@
  
 #ifndef EXTENSION
             // Control Center
-            [app.controlCenter progressTask:_currentProgressMetadata.fileID serverUrl:serverUrl cryptated:_currentProgressMetadata.cryptated progress:progress];
+ //           [app.controlCenter progressTask:_currentProgressMetadata.fileID serverUrl:serverUrl cryptated:_currentProgressMetadata.cryptated progress:progress];
         
             // Detail
             if (app.activeDetail)
@@ -1274,7 +1274,7 @@
             
 #ifndef EXTENSION
             // Control Center
-            [app.controlCenter progressTask:_currentProgressMetadata.fileID serverUrl:serverUrl cryptated:_currentProgressMetadata.cryptated progress:progress];
+     //       [app.controlCenter progressTask:_currentProgressMetadata.fileID serverUrl:serverUrl cryptated:_currentProgressMetadata.cryptated progress:progress];
 #endif
             
             if ([self.delegate respondsToSelector:@selector(progressTask:serverUrl:cryptated:progress:)])

+ 0 - 1
iOSClient/Offline/CCOfflineContainer.h

@@ -23,7 +23,6 @@
 
 #import <UIKit/UIKit.h>
 
-#import "CCOfflinePageContent.h"
 
 @interface CCOfflineContainer : UIViewController <UIPageViewControllerDataSource, UIPageViewControllerDelegate>
 

+ 2 - 0
iOSClient/Offline/CCOfflineContainer.m

@@ -22,6 +22,8 @@
 //
 
 #import "CCOfflineContainer.h"
+
+#import "CCOfflinePageContent.h"
 #import "AppDelegate.h"
 #import "CCSynchronize.h"