Marino Faggiana 8 жил өмнө
parent
commit
30a4365531

+ 6 - 5
iOSClient/MenuAccount+ControlCenter/CCControlCenter.h

@@ -32,14 +32,15 @@
 @property (nonatomic) BOOL isPopGesture;
 @property (nonatomic) BOOL isOpen;
 
-@property (strong, nonatomic) UILabel *noRecord;
-@property (strong, nonatomic) UIPageViewController *pageViewController;
-@property (strong, nonatomic) NSArray *pageType;
-@property (strong, nonatomic) NSString *currentPageType;
-@property (strong, nonatomic) NSMutableArray *controlCenterPagesContent;
 
 - (void)setControlCenterHidden:(BOOL)hidden;
 - (void)enableSingleFingerTap:(SEL)selector target:(id)target;
 - (void)disableSingleFingerTap;
 
+@property (strong, nonatomic) UILabel *labelMessageNoRecord;
+@property (strong, nonatomic) UIPageViewController *pageViewController;
+@property (strong, nonatomic) NSArray *pageType;
+@property (strong, nonatomic) NSMutableArray *controlCenterPagesContent;
+
+- (NSString *)getActivePage;
 @end

+ 23 - 17
iOSClient/MenuAccount+ControlCenter/CCControlCenter.m

@@ -83,29 +83,31 @@
     
     // 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;
     
-    UIViewController *startingViewController = [self viewControllerAtIndex:0];
-    NSArray *viewControllers = @[startingViewController];
+    UIViewController *startingViewController;
+    NSArray *viewControllers;
     
+    startingViewController= [self viewControllerAtIndex:0];
+    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];
-    _noRecord.textColor = COLOR_CONTROL_CENTER;
-    _noRecord.font = [UIFont systemFontOfSize:SIZE_FONT_NORECORD];
-    _noRecord.textAlignment = NSTextAlignmentCenter;
+    _labelMessageNoRecord =[[UILabel alloc]init];
+    _labelMessageNoRecord.backgroundColor=[UIColor clearColor];
+    _labelMessageNoRecord.textColor = COLOR_CONTROL_CENTER;
+    _labelMessageNoRecord.font = [UIFont systemFontOfSize:SIZE_FONT_NORECORD];
+    _labelMessageNoRecord.textAlignment = NSTextAlignmentCenter;
 
-    [_mainView addSubview:_noRecord];
+    [_mainView addSubview:_labelMessageNoRecord];
     
     
     _imageDrag = [[UIImageView alloc] init];
@@ -225,7 +227,7 @@
         
             _mainView.frame = CGRectMake(0, 0, navigationBarW, currentPoint.y);
             _pageViewController.view.frame = CGRectMake(0, currentPoint.y - heightScreen + navigationBarH, navigationBarW, heightTableView);
-            _noRecord.frame = CGRectMake(0, currentPoint.y - centerMaxH, navigationBarW, SIZE_FONT_NORECORD+10);
+            _labelMessageNoRecord.frame = CGRectMake(0, currentPoint.y - centerMaxH, navigationBarW, SIZE_FONT_NORECORD+10);
             _imageDrag.frame = CGRectMake(0, currentPoint.y - BORDER_TOUCH_UPDOWN, navigationBarW, BORDER_TOUCH_UPDOWN);
             _endLine.frame = CGRectMake(0, currentPoint.y - BORDER_TOUCH_UPDOWN, navigationBarW, 1);
         
@@ -295,7 +297,7 @@
     
     _mainView.frame = CGRectMake(0, 0, size.width, [self getMaxH]);
     _pageViewController.view.frame = CGRectMake(0, navigationBarH, _mainView.frame.size.width, _mainView.frame.size.height - self.navigationBar.frame.size.height - BORDER_TOUCH_UPDOWN - TOOLBAR_ADD_BORDER);
-    _noRecord.frame = CGRectMake(0, _mainView.frame.size.height / 2, _mainView.frame.size.width, SIZE_FONT_NORECORD+10);
+    _labelMessageNoRecord.frame = CGRectMake(0, _mainView.frame.size.height / 2, _mainView.frame.size.width, SIZE_FONT_NORECORD+10);
     _imageDrag.frame = CGRectMake(0, _mainView.frame.size.height - BORDER_TOUCH_UPDOWN, _mainView.frame.size.width, BORDER_TOUCH_UPDOWN);
     _endLine.frame = CGRectMake(0, _mainView.frame.size.height - BORDER_TOUCH_UPDOWN, _mainView.frame.size.width, 1);
     
@@ -325,6 +327,7 @@
             _isOpen = YES;
 
             [app.controlCenterTransfer reloadDatasource];
+            [app.controlCenterActivity reloadDatasource];
         }
         
     } else {
@@ -448,11 +451,7 @@
 
     // Change Image
     
-    CCControlCenterTransfer *vc = [self.pageViewController.viewControllers lastObject];
-    
-    _currentPageType = vc.pageType;
-    
-    if ([_currentPageType isEqualToString:k_pageControlCenterActivity]) {
+    if ([[self getActivePage] isEqualToString:k_pageControlCenterActivity]) {
         
         self.title = NSLocalizedString(@"_activity_", nil);
         
@@ -462,7 +461,7 @@
         
     }
     
-    if ([_currentPageType isEqualToString:k_pageControlCenterTransfer]) {
+    if ([[self getActivePage] isEqualToString:k_pageControlCenterTransfer]) {
         
         self.title = NSLocalizedString(@"_transfers_", nil);
         
@@ -472,4 +471,11 @@
     }
 }
 
+- (NSString *)getActivePage
+{
+    CCControlCenterTransfer *vc = [self.pageViewController.viewControllers lastObject];
+    
+    return vc.pageType;
+}
+
 @end

+ 2 - 0
iOSClient/MenuAccount+ControlCenter/CCControlCenterActivity.h

@@ -13,4 +13,6 @@
 @property NSUInteger pageIndex;
 @property (nonatomic, strong) NSString *pageType;
 
+- (void)reloadDatasource;
+
 @end

+ 15 - 11
iOSClient/MenuAccount+ControlCenter/CCControlCenterActivity.m

@@ -41,6 +41,8 @@
     [super viewDidLoad];
     
     _sectionDataSource = [NSArray new];
+    
+    [self reloadDatasource];
 }
 
 // Apparirà
@@ -48,13 +50,15 @@
 {
     [super viewWillAppear:animated];
     
-    [self reloadDatasource];
+    app.controlCenter.labelMessageNoRecord.hidden = YES;
 }
 
 // E' arrivato
 - (void)viewDidAppear:(BOOL)animated
 {
     [super viewDidAppear:animated];
+    
+    [self reloadDatasource];
 }
 
 - (void)didReceiveMemoryWarning {
@@ -78,20 +82,21 @@
         
         //_sectionDataSource = [CCSectionActivity creataDataSourseSectionActivity:records activeAccount:app.activeAccount];
         
-        if ([_sectionDataSource count] == 0) {
+        if ([[app.controlCenter getActivePage] isEqualToString:k_pageControlCenterActivity]) {
             
-            app.controlCenter.noRecord.text = NSLocalizedString(@"_no_activity_",nil);
-            app.controlCenter.noRecord.hidden = NO;
+            if ([_sectionDataSource count] == 0) {
+                
+                app.controlCenter.labelMessageNoRecord.text = NSLocalizedString(@"_no_activity_",nil);
+                app.controlCenter.labelMessageNoRecord.hidden = NO;
             
-        } else {
+            } else {
             
-            app.controlCenter.noRecord.hidden = YES;
+                app.controlCenter.labelMessageNoRecord.hidden = YES;
+            }
         }
     }
     
-    [self.collectionView reloadData];
-    
-    [app updateApplicationIconBadgeNumber];
+    [self.collectionView reloadData];    
 }
 
 #pragma --------------------------------------------------------------------------------------------
@@ -158,8 +163,7 @@
             heightView = 60;
         
         headerView.frame = CGRectMake(headerView.frame.origin.x, headerView.frame.origin.y,  headerView.frame.size.width, heightView);
-        
-        headerView.backgroundColor = [UIColor greenColor];
+        //headerView.backgroundColor = [UIColor greenColor];
         
         return headerView;
     }

+ 9 - 5
iOSClient/MenuAccount+ControlCenter/CCControlCenterTransfer.m

@@ -62,6 +62,7 @@
 {
     [super viewWillAppear:animated];
     
+    app.controlCenter.labelMessageNoRecord.hidden = YES;
 }
 
 // E' arrivato
@@ -244,14 +245,17 @@
         
         _sectionDataSource  = [CCSectionMetadata creataDataSourseSectionMetadata:recordsTableMetadata listProgressMetadata:app.listProgressMetadata groupByField:@"session" replaceDateToExifDate:NO activeAccount:app.activeAccount];
         
-        if ([_sectionDataSource.allRecordsDataSource count] == 0) {
+        if ([[app.controlCenter getActivePage] isEqualToString:k_pageControlCenterTransfer]) {
             
-            app.controlCenter.noRecord.text = NSLocalizedString(@"_no_transfer_",nil);
-            app.controlCenter.noRecord.hidden = NO;
+            if ([_sectionDataSource.allRecordsDataSource count] == 0) {
+                
+                app.controlCenter.labelMessageNoRecord.text = NSLocalizedString(@"_no_transfer_",nil);
+                app.controlCenter.labelMessageNoRecord.hidden = NO;
             
-        } else {
+            } else {
             
-            app.controlCenter.noRecord.hidden = YES;
+                app.controlCenter.labelMessageNoRecord.hidden = YES;
+            }
         }
     }