Browse Source

remove shortcutOffline

Marino Faggiana 8 năm trước cách đây
mục cha
commit
4bea42db77

+ 1 - 43
iOSClient/AppDelegate.m

@@ -489,18 +489,15 @@
     UIApplicationShortcutIcon *shortcutPhotosIcon = [UIApplicationShortcutIcon iconWithTemplateImageName:image_quickActionPhotos];
     UIApplicationShortcutIcon *shortcutUploadClearIcon = [UIApplicationShortcutIcon iconWithTemplateImageName:image_quickActionUploadClear];
     UIApplicationShortcutIcon *shortcutUploadEncryptedIcon = [UIApplicationShortcutIcon iconWithTemplateImageName:image_quickActionUploadEncrypted];
-    UIApplicationShortcutIcon *shortcutIconTypeOffline = [UIApplicationShortcutIcon iconWithTemplateImageName:image_quickActionUploadOffline];
     
     UIApplicationShortcutItem *shortcutPhotos = [[UIApplicationShortcutItem alloc] initWithType:[NSString stringWithFormat:@"%@.photos", bundleId] localizedTitle:NSLocalizedString(@"_photo_camera_", nil) localizedSubtitle:nil icon:shortcutPhotosIcon userInfo:nil];
 
-    UIApplicationShortcutItem *shortcutOffline = [[UIApplicationShortcutItem alloc] initWithType:[NSString stringWithFormat:@"%@.offline", bundleId] localizedTitle:NSLocalizedString(@"_offline_", nil) localizedSubtitle:nil icon:shortcutIconTypeOffline userInfo:nil];
-    
     UIApplicationShortcutItem *shortcutUploadClear = [[UIApplicationShortcutItem alloc] initWithType:[NSString stringWithFormat:@"%@.uploadClear", bundleId] localizedTitle:NSLocalizedString(@"_upload_file_", nil) localizedSubtitle:nil icon:shortcutUploadClearIcon userInfo:nil];
     
     UIApplicationShortcutItem *shortcutUploadEncrypted = [[UIApplicationShortcutItem alloc] initWithType:[NSString stringWithFormat:@"%@.uploadEncrypted", bundleId] localizedTitle:NSLocalizedString(@"_upload_encrypted_file_", nil) localizedSubtitle:nil icon:shortcutUploadEncryptedIcon userInfo:nil];
     
     // add all items to an array
-    NSArray *items = @[shortcutUploadEncrypted, shortcutUploadClear, shortcutPhotos, shortcutOffline];
+    NSArray *items = @[shortcutUploadEncrypted, shortcutUploadClear, shortcutPhotos];
     
     // add the array to our app
     [UIApplication sharedApplication].shortcutItems = items;
@@ -519,7 +516,6 @@
     
     NSString *bundleId = [NSBundle mainBundle].bundleIdentifier;
     
-    NSString *shortcutOffline = [NSString stringWithFormat:@"%@.offline", bundleId];
     NSString *shortcutPhotos = [NSString stringWithFormat:@"%@.photos", bundleId];
     NSString *shortcutUploadClear = [NSString stringWithFormat:@"%@.uploadClear", bundleId];
     NSString *shortcutUploadEncrypted = [NSString stringWithFormat:@"%@.uploadEncrypted", bundleId];
@@ -632,44 +628,6 @@
         handled = YES;
     }
     
-    else if ([shortcutItem.type isEqualToString:shortcutOffline] && self.activeAccount) {
-        
-        dispatch_async(dispatch_get_main_queue(), ^{
-            
-            UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
-        
-            if (splitViewController.isCollapsed) {
-            
-                UITabBarController *tbc = splitViewController.viewControllers.firstObject;
-                for (UINavigationController *nvc in tbc.viewControllers) {
-                
-                    if ([nvc.topViewController isKindOfClass:[CCDetail class]])
-                        [nvc popToRootViewControllerAnimated:NO];
-                
-                    if ([nvc.topViewController isKindOfClass:[CCOffline class]])
-                        NSLog(@"ERROR");//[(CCOffline *)nvc.topViewController forcedSwitchOffline];
-                }
-            
-                [tbc setSelectedIndex:TabBarApplicationIndexOffline];
-            
-            } else {
-            
-                UINavigationController *nvcDetail = splitViewController.viewControllers.lastObject;
-                [nvcDetail popToRootViewControllerAnimated:NO];
-            
-                UITabBarController *tbc = splitViewController.viewControllers.firstObject;
-        
-                UINavigationController *ncOffline = [tbc.viewControllers objectAtIndex:TabBarApplicationIndexOffline];
-                if ([ncOffline.topViewController isKindOfClass:[CCOffline class]])
-                    NSLog(@"ERROR");//[(CCOffline *)ncOffline.topViewController forcedSwitchOffline];
-            
-                [tbc setSelectedIndex:TabBarApplicationIndexOffline];
-            }
-        });
-        
-        handled = YES;
-    }
-
     return handled;
 }
 

+ 69 - 0
iOSClient/Offline/CCOfflinePageContent.m

@@ -68,6 +68,75 @@
     [super didReceiveMemoryWarning];
 }
 
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark ==== DZNEmptyDataSetSource Methods ====
+#pragma --------------------------------------------------------------------------------------------
+
+- (BOOL)emptyDataSetShouldDisplay:(UIScrollView *)scrollView
+{
+    return YES;
+}
+
+- (CGFloat)spaceHeightForEmptyDataSet:(UIScrollView *)scrollView
+{
+    return 0.0f;
+}
+
+- (CGFloat)verticalOffsetForEmptyDataSet:(UIScrollView *)scrollView
+{
+    return - self.navigationController.navigationBar.frame.size.height;
+}
+
+- (UIColor *)backgroundColorForEmptyDataSet:(UIScrollView *)scrollView
+{
+    return [UIColor whiteColor];
+}
+
+- (UIImage *)imageForEmptyDataSet:(UIScrollView *)scrollView
+{
+    if ([self.pageType isEqualToString:pageOfflineOffline])
+        return [UIImage imageNamed:image_brandOffline];
+    
+    if ([self.pageType isEqualToString:pageOfflineLocal])
+        return [UIImage imageNamed:image_brandLocal];
+    
+    return nil;
+}
+
+- (NSAttributedString *)titleForEmptyDataSet:(UIScrollView *)scrollView
+{
+    NSString *text;
+    
+    if ([self.pageType isEqualToString:pageOfflineOffline])
+        text = NSLocalizedString(@"_no_files_uploaded_", nil);
+    
+    if ([self.pageType isEqualToString:pageOfflineLocal])
+        text = NSLocalizedString(@"_no_files_uploaded_", nil);
+    
+    NSDictionary *attributes = @{NSFontAttributeName:[UIFont boldSystemFontOfSize:20.0f], NSForegroundColorAttributeName:COLOR_BRAND};
+    
+    return [[NSAttributedString alloc] initWithString:text attributes:attributes];
+}
+
+- (NSAttributedString *)descriptionForEmptyDataSet:(UIScrollView *)scrollView
+{
+    NSString *text;
+    
+    if ([self.pageType isEqualToString:pageOfflineOffline])
+        text = NSLocalizedString(@"_tutorial_offline_view_", nil);
+        
+    if ([self.pageType isEqualToString:pageOfflineLocal])
+        text = NSLocalizedString(@"_tutorial_local_view_", nil);
+    
+    NSMutableParagraphStyle *paragraph = [NSMutableParagraphStyle new];
+    paragraph.lineBreakMode = NSLineBreakByWordWrapping;
+    paragraph.alignment = NSTextAlignmentCenter;
+    
+    NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:14.0], NSForegroundColorAttributeName: [UIColor lightGrayColor], NSParagraphStyleAttributeName: paragraph};
+    
+    return [[NSAttributedString alloc] initWithString:text attributes:attributes];
+}
+
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ==== Table ====
 #pragma --------------------------------------------------------------------------------------------

+ 0 - 9
iOSClient/Settings/CCSettings.m

@@ -341,15 +341,6 @@
     exit(0);
 }
 
-- (void)quickActionOffline:(XLFormRowDescriptor *)sender
-{
-    NSString *bundleId = [NSBundle mainBundle].bundleIdentifier;
-    
-    UIApplicationShortcutItem *shortcutOffline = [[UIApplicationShortcutItem alloc] initWithType:[NSString stringWithFormat:@"%@.offline", bundleId] localizedTitle:@"" localizedSubtitle:nil icon:nil userInfo:nil];
-    
-    [app handleShortCutItem:shortcutOffline];
-}
-
 - (void)quickActionPhotos:(XLFormRowDescriptor *)sender
 {
     NSString *bundleId = [NSBundle mainBundle].bundleIdentifier;