浏览代码

new interface offline procedure

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

+ 0 - 3
iOSClient/AppDelegate.h

@@ -144,9 +144,6 @@
 // ico Image Cache
 @property (nonatomic, strong) NSMutableDictionary *icoImagesCache;
 
-// Offline - LocalStorage
-@property BOOL isLocalStorage;
-
 // check isDeviceJailbroken
 @property BOOL isDeviceJailbroken;
 

+ 2 - 2
iOSClient/AppDelegate.m

@@ -164,11 +164,11 @@
     // ico Image Cache
     self.icoImagesCache = [[NSMutableDictionary alloc] init];
     
-    //
+    // Page Control
     UIPageControl *pageControl = [UIPageControl appearance];
     pageControl.pageIndicatorTintColor = COLOR_SEPARATOR_TABLE;
     pageControl.currentPageIndicatorTintColor = COLOR_NEXTCLOUD;
-    pageControl.backgroundColor = [UIColor clearColor];
+    pageControl.backgroundColor = COLOR_NAVBAR_IOS7; //[UIColor clearColor];
     
     // remove tmp & cache
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

+ 5 - 5
iOSClient/CCGlobal.h

@@ -275,11 +275,6 @@ extern NSString *const BKPasscodeKeychainServiceName;
 #define actionUploadTemplate            @"uploadTemplate"
 #define actionUploadOnlyPlist           @"uploadOnlyPlist"
 
-// Tipi di sorgente directory
-#define sorceDirectoryAccount           0
-#define sorceDirectoryLocal             1
-#define sorceDirectoryOffline           2
-
 // Metadata : FileType
 #define metadataTypeFile_audio          @"audio"
 #define metadataTypeFile_compress       @"compress"
@@ -309,6 +304,11 @@ extern NSString *const BKPasscodeKeychainServiceName;
 #define keyFileNameMask                 @"fileNameMask"
 #define keyFileNameMaskAutomaticPhotos  @"fileNameMaskAutomaticPhotos"
 
+// type of source directory 
+#define sorceDirectoryOffline           0
+#define sorceDirectoryLocal             1
+#define sorceDirectoryAccount           2
+
 #define pageOfflineOffline              @"Offline"
 #define pageOfflineLocal                @"Local"
 

+ 3 - 3
iOSClient/FileSystem/CCCoreData.m

@@ -1757,11 +1757,11 @@
             
             NSString *upDir = [CCUtility deletingLastPathComponentFromServerUrl:father];
             NSString *directoryID = [self getDirectoryIDFromServerUrl:upDir activeAccount:activeAccount];
-            NSString *fileNamePrint = [father lastPathComponent];
+            NSString *fileName = [father lastPathComponent];
             
-            if (upDir && directoryID && fileNamePrint) {
+            if (upDir && directoryID && fileName) {
             
-                NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(directoryID == %@) AND (account == %@) AND (directory == 1) AND (fileNamePrint == %@)", directoryID, activeAccount, fileNamePrint];
+                NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(directoryID == %@) AND (account == %@) AND (directory == 1) AND (fileNameData == %@)", directoryID, activeAccount, fileName];
                 CCMetadata *metadata = [self getMetadataWithPreficate:predicate context:nil];
             
                 if (metadata)

+ 9 - 0
iOSClient/Intro/CCIntro.m

@@ -278,6 +278,7 @@
     intro.tapToNext = YES;
     intro.pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
     intro.pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
+    intro.pageControl.backgroundColor = [UIColor clearColor];
     [intro.skipButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
     
     [intro setDelegate:self];
@@ -414,6 +415,7 @@
         intro.tapToNext = YES;
         intro.pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
         intro.pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
+        intro.pageControl.backgroundColor = [UIColor clearColor];
         [intro.skipButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
         
         [intro setDelegate:self];
@@ -517,6 +519,7 @@
         intro.tapToNext = YES;
         intro.pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
         intro.pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
+        intro.pageControl.backgroundColor = [UIColor clearColor];
         [intro.skipButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
         
         [intro setDelegate:self];
@@ -620,6 +623,7 @@
         intro.tapToNext = YES;
         intro.pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
         intro.pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
+        intro.pageControl.backgroundColor = [UIColor clearColor];
         [intro.skipButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
         
         [intro setDelegate:self];
@@ -807,6 +811,7 @@
         intro.tapToNext = YES;
         intro.pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
         intro.pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
+        intro.pageControl.backgroundColor = [UIColor clearColor];
         [intro.skipButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
         
         [intro setDelegate:self];
@@ -868,6 +873,7 @@
         intro.tapToNext = YES;
         intro.pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
         intro.pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
+        intro.pageControl.backgroundColor = [UIColor clearColor];
         [intro.skipButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
         
         [intro setDelegate:self];
@@ -934,6 +940,7 @@
         intro.tapToNext = YES;
         intro.pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
         intro.pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
+        intro.pageControl.backgroundColor = [UIColor clearColor];
         [intro.skipButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
         
         [intro setDelegate:self];
@@ -1051,6 +1058,7 @@
         intro.tapToNext = YES;
         intro.pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
         intro.pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
+        intro.pageControl.backgroundColor = [UIColor clearColor];
         [intro.skipButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
         
         [intro setDelegate:self];
@@ -1137,6 +1145,7 @@
         intro.tapToNext = YES;
         intro.pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
         intro.pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
+        intro.pageControl.backgroundColor = [UIColor clearColor];
         [intro.skipButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
             
         [intro setDelegate:self];

+ 4 - 2
iOSClient/Main/CCDetail.m

@@ -426,8 +426,10 @@
     // PhotoBrowser
     self.photoBrowser.displayActionButton = YES;
     
-    if (self.sourceDirectory == sorceDirectoryAccount) self.photoBrowser.displayDeleteButton = YES;
-    else self.photoBrowser.displayDeleteButton = NO;
+    if (self.sourceDirectory == sorceDirectoryAccount)
+        self.photoBrowser.displayDeleteButton = YES;
+    else
+        self.photoBrowser.displayDeleteButton = NO;
     
     self.photoBrowser.displayNavArrows = YES;
     self.photoBrowser.displaySelectionButtons = NO;

+ 2 - 3
iOSClient/Main/CCMain.m

@@ -1817,10 +1817,9 @@
     // read plist
     [self downloadPlist:metadataNet.directoryID serverUrl:metadataNet.serverUrl];
     
+    // File is changed ??
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
-        // File is changed ??
-        BOOL offline = [CCCoreData isOfflineDirectoryServerUrl:_localServerUrl activeAccount:app.activeAccount];
-        [[CCOfflineFileFolder sharedOfflineFileFolder] verifyChangeMedatas:metadatas serverUrl:metadataNet.serverUrl directoryID:metadataNet.directoryID account:app.activeAccount offline:offline];
+        [[CCOfflineFileFolder sharedOfflineFileFolder] verifyChangeMedatas:metadatas serverUrl:metadataNet.serverUrl directoryID:metadataNet.directoryID account:app.activeAccount offline:NO];
     });
 
     // this is the same directory

+ 1 - 4
iOSClient/Offline/CCOfflinePageContent.h

@@ -34,11 +34,8 @@
 @property (nonatomic, weak) IBOutlet UITableView *tableView;
 
 @property (nonatomic, strong) CCMetadata *metadata;
-
-@property (nonatomic, strong) NSString *fileIDPhoto;
-@property (nonatomic, strong) NSString *directoryIDPhoto;
-
 @property (nonatomic, strong) NSString *localServerUrl;
+@property (nonatomic, strong) NSString *titleViewControl;
 
 @property (nonatomic, weak) CCDetail *detailViewController;
 @property (nonatomic, strong) UIDocumentInteractionController *docController;

+ 19 - 11
iOSClient/Offline/CCOfflinePageContent.m

@@ -36,7 +36,7 @@
     self.tableView.tableFooterView = [UIView new];
     self.tableView.separatorColor = COLOR_SEPARATOR_TABLE;
     
-    // Type
+    // calculate _localServerUrl
     if ([self.pageType isEqualToString:pageOfflineOffline] && !_localServerUrl) {
         _localServerUrl = nil;
     }
@@ -46,7 +46,7 @@
     }
     
     // Title
-    self.title = [_localServerUrl lastPathComponent];
+    self.title = _titleViewControl;
 }
 
 // Apparirà
@@ -74,7 +74,11 @@
 
 - (BOOL)emptyDataSetShouldDisplay:(UIScrollView *)scrollView
 {
-    return YES;
+    // only for root
+    if (!_localServerUrl || [_localServerUrl isEqualToString:[CCUtility getDirectoryLocal]])
+        return YES;
+    else
+        return NO;
 }
 
 - (CGFloat)spaceHeightForEmptyDataSet:(UIScrollView *)scrollView
@@ -210,8 +214,10 @@
         metadata = [dataSource objectAtIndex:indexPath.row];
         cell.fileImageView.image = [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@.ico", app.directoryUser, metadata.fileID]];
         
-        if (_metadata.cryptated) cell.offlineImageView.image = [UIImage imageNamed:image_offlinecrypto];
-        else cell.offlineImageView.image = [UIImage imageNamed:image_offline];
+        if (metadata.cryptated)
+            cell.offlineImageView.image = [UIImage imageNamed:image_offlinecrypto];
+        else
+            cell.offlineImageView.image = [UIImage imageNamed:image_offline];
     }
     
     // i am in local
@@ -301,8 +307,7 @@
     if ([_pageType isEqualToString:pageOfflineOffline]) {
         
         NSManagedObject *record = [dataSource objectAtIndex:indexPath.row];
-        _fileIDPhoto = [record valueForKey:@"fileID"];
-        _metadata = [CCCoreData getMetadataWithPreficate:[NSPredicate predicateWithFormat:@"(fileID == %@) AND (account == %@)", self.fileIDPhoto, app.activeAccount] context:nil];
+        _metadata = [CCCoreData getMetadataWithPreficate:[NSPredicate predicateWithFormat:@"(fileID == %@) AND (account == %@)", [record valueForKey:@"fileID"], app.activeAccount] context:nil];
     }
     
     if ([_pageType isEqualToString:pageOfflineLocal]) {
@@ -311,7 +316,6 @@
         NSString *cameraFolderPath = [CCCoreData getCameraUploadFolderPathActiveAccount:app.activeAccount activeUrl:app.activeUrl typeCloud:app.typeCloud];
         
         _metadata = [CCUtility insertFileSystemInMetadata:[dataSource objectAtIndex:indexPath.row] directory:_localServerUrl activeAccount:app.activeAccount cameraFolderName:cameraFolderName cameraFolderPath:cameraFolderPath];
-        _fileIDPhoto = _metadata.fileID;
     }
     
     // if is in download [do not touch]
@@ -344,8 +348,9 @@
         serverUrl = _localServerUrl;
     }
         
-    vc.localServerUrl = [CCUtility stringAppendServerUrl:serverUrl addServerUrl:_metadata.fileName];
+    vc.localServerUrl = [CCUtility stringAppendServerUrl:serverUrl addServerUrl:_metadata.fileNameData];
     vc.pageType = _pageType;
+    vc.titleViewControl = _metadata.fileNamePrint;
     
     [self.navigationController pushViewController:vc animated:YES];
 }
@@ -386,8 +391,11 @@
     
     self.detailViewController.metadataDetail = _metadata;
     
-    if (app.isLocalStorage) self.detailViewController.sourceDirectory = sorceDirectoryLocal;
-    else self.detailViewController.sourceDirectory = sorceDirectoryOffline;
+    if ([self.pageType isEqualToString:pageOfflineOffline])
+        self.detailViewController.sourceDirectory = sorceDirectoryOffline;
+    
+    if ([self.pageType isEqualToString:pageOfflineLocal])
+        self.detailViewController.sourceDirectory = sorceDirectoryLocal;
     
     self.detailViewController.dateFilterQuery = nil;
     self.detailViewController.isCameraUpload = NO;

+ 3 - 10
iOSClient/Settings/CCSettings.m

@@ -243,20 +243,12 @@
     row.action.formSelector = @selector(copyDirGroupToLocal:);
     [section addFormRow:row];
 
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"quickActionOffline" rowType:XLFormRowDescriptorTypeButton title:@"Quick Action Offline"];
-    [row.cellConfig setObject:[UIColor redColor] forKey:@"textLabel.textColor"];
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-    [row.cellConfig setObject:[UIImage imageNamed:image_settingsAdmin] forKey:@"imageView.image"];
-    row.action.formSelector = @selector(quickActionOffline:);
-    [section addFormRow:row];
-    
     row = [XLFormRowDescriptor formRowDescriptorWithTag:@"quickActionPhotos" rowType:XLFormRowDescriptorTypeButton title:@"Quick Action Photos"];
     [row.cellConfig setObject:[UIColor redColor] forKey:@"textLabel.textColor"];
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
     [row.cellConfig setObject:[UIImage imageNamed:image_settingsAdmin] forKey:@"imageView.image"];
     row.action.formSelector = @selector(quickActionPhotos:);
     [section addFormRow:row];
-
 #endif
 
     // Section : quit
@@ -409,8 +401,9 @@
 
         XLFormRowDescriptor *rowAzzeraCache = [self.form formRowWithTag:@"azzeracache"];
 
-        NSString *size = [CCUtility transformedSize:[[self getUserDirectorySize] longValue]];
-        rowAzzeraCache.title = [NSString stringWithFormat:NSLocalizedString(@"_clear_cache_", nil), size];
+        //NSString *size = [CCUtility transformedSize:[[self getUserDirectorySize] longValue]];
+        //rowAzzeraCache.title = [NSString stringWithFormat:NSLocalizedString(@"_clear_cache_", nil), size];
+        rowAzzeraCache.title = NSLocalizedString(@"_clear_cache_no_size_", nil);
         
         [self.tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
 

+ 1 - 0
iOSClient/en.lproj/Localizable.strings

@@ -91,6 +91,7 @@
 "_app_in_use_"              = "Application in use";
 "_contact_by_email_"        = "Contact us by email";
 "_clear_cache_"             = "Clear Cache (%@ used)";
+"_clear_cache_no_size_"     = "Clear Cache";
 "_exit_"                    = "Exit _brand_";
 "_funct_not_enabled_"       = "Functionality not enabled";
 "_passcode_activate_"       = "Password Lock activated";