浏览代码

Add option for hide Offline

Marino Faggiana 8 年之前
父节点
当前提交
f347e6eca5
共有 4 个文件被更改,包括 12 次插入51 次删除
  1. 0 3
      iOSClient/AppDelegate.m
  2. 0 3
      iOSClient/FileSystem/CCCoreData.h
  3. 0 31
      iOSClient/FileSystem/CCCoreData.m
  4. 12 14
      iOSClient/Offline/CCOfflineContainer.m

+ 0 - 3
iOSClient/AppDelegate.m

@@ -1393,9 +1393,6 @@
         
         [CCCoreData clearAllDateReadDirectory];
         [CCCoreData flushTableMetadataAccount:nil];
-        
-        [CCCoreData localTableCopyFavoriteToOffline];
-        [CCCoreData directoryTableCopySynchronizedToOffline];
     }
 }
 

+ 0 - 3
iOSClient/FileSystem/CCCoreData.h

@@ -227,9 +227,6 @@
 
 // ===== Routine for migrate =====
 
-+ (void)localTableCopyFavoriteToOffline;
-+ (void)directoryTableCopySynchronizedToOffline;
-
 // ===== Utility Database =====
 
 + (void)moveCoreDataToGroup;

+ 0 - 31
iOSClient/FileSystem/CCCoreData.m

@@ -2040,37 +2040,6 @@
 #pragma mark ===== Routine for migrate =====
 #pragma --------------------------------------------------------------------------------------------
 
-+ (void)localTableCopyFavoriteToOffline
-{
-    [MagicalRecord saveWithBlockAndWait:^(NSManagedObjectContext *localContext) {
-        
-        NSArray *records = [TableLocalFile MR_findAllInContext:localContext];
-        
-        for (TableLocalFile *record in records) {
-            
-            if ([record.favorite isEqualToNumber:[NSNumber numberWithInt:1]]) {
-                record.favorite = [NSNumber numberWithInteger:0];
-                record.offline = [NSNumber numberWithInteger:1];
-            }
-        }
-    }];
-}
-
-+ (void)directoryTableCopySynchronizedToOffline
-{
-    [MagicalRecord saveWithBlockAndWait:^(NSManagedObjectContext *localContext) {
-        
-        NSArray *records = [TableDirectory MR_findAllInContext:localContext];
-        
-        for (TableDirectory *record in records) {
-            
-            if ([record.synchronized isEqualToNumber:[NSNumber numberWithInt:1]]) {
-                record.synchronized = [NSNumber numberWithInteger:0];
-                record.offline = [NSNumber numberWithInteger:1];
-            }
-        }
-    }];
-}
 
 #pragma --------------------------------------------------------------------------------------------
 #pragma mark ===== Utility Database =====

+ 12 - 14
iOSClient/Offline/CCOfflineContainer.m

@@ -67,7 +67,13 @@
     [super viewDidLoad];
     
     // Create data model
+
+#ifdef NO_OFFLINE
+    _pageType = @[k_pageOfflineFavorites, k_pageOfflineLocal];
+#else
     _pageType = @[k_pageOfflineFavorites, k_pageOfflineOffline, k_pageOfflineLocal];
+#endif
+    
     _currentPageType = k_pageOfflineFavorites;
     self.title = NSLocalizedString(@"_favorites_", nil);
     
@@ -173,15 +179,11 @@
 - (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray<UIViewController *> *)previousViewControllers transitionCompleted:(BOOL)completed
 {
     CCOfflinePageContent *vc = [self.pageViewController.viewControllers lastObject];
-    
-    NSString *serverUrl = vc.serverUrl;
     _currentPageType = vc.pageType;
 
     if ([_currentPageType isEqualToString:k_pageOfflineFavorites]) {
-        if (serverUrl)
-            self.title = NSLocalizedString(@"_favorites_", nil);
-        else
-            self.title = NSLocalizedString(@"_favorites_", nil);
+        
+        self.title = NSLocalizedString(@"_favorites_", nil);
         
         UITabBarItem *item = [self.tabBarController.tabBar.items objectAtIndex: k_tabBarApplicationIndexOffline];
         item.selectedImage = [UIImage imageNamed:image_tabBarFavorite];
@@ -189,10 +191,8 @@
     }
 
     if ([_currentPageType isEqualToString:k_pageOfflineOffline]) {
-        if (serverUrl)
-            self.title = NSLocalizedString(@"_offline_", nil);
-        else
-            self.title = NSLocalizedString(@"_offline_", nil);
+        
+        self.title = NSLocalizedString(@"_offline_", nil);
         
         UITabBarItem *item = [self.tabBarController.tabBar.items objectAtIndex: k_tabBarApplicationIndexOffline];
         item.selectedImage = [UIImage imageNamed:image_tabBarOffline];
@@ -200,10 +200,8 @@
     }
     
     if ([_currentPageType isEqualToString:k_pageOfflineLocal]) {
-        if ([serverUrl isEqualToString:[CCUtility getDirectoryLocal]])
-            self.title = NSLocalizedString(@"_local_storage_", nil);
-        else
-            self.title = NSLocalizedString(@"_local_storage_", nil);
+        
+        self.title = NSLocalizedString(@"_local_storage_", nil);
         
         UITabBarItem *item = [self.tabBarController.tabBar.items objectAtIndex: k_tabBarApplicationIndexOffline];
         item.selectedImage = [UIImage imageNamed:image_tabBarLocal];