Browse Source

Synchronized folder is now Offline

Marino Faggiana 8 years ago
parent
commit
b83077d5fb
30 changed files with 488 additions and 194 deletions
  1. 6 20
      Nextcloud.xcodeproj/project.pbxproj
  2. 8 8
      iOSClient/AppDelegate.m
  3. 2 2
      iOSClient/CCGlobal.h
  4. 0 3
      iOSClient/CCImages.h
  5. 4 4
      iOSClient/FileSystem/CCCoreData.h
  6. 10 10
      iOSClient/FileSystem/CCCoreData.m
  7. 0 23
      iOSClient/Images.xcassets/synchronized.imageset/Contents.json
  8. BIN
      iOSClient/Images.xcassets/synchronized.imageset/synchronized.png
  9. BIN
      iOSClient/Images.xcassets/synchronized.imageset/synchronized@2x.png
  10. BIN
      iOSClient/Images.xcassets/synchronized.imageset/synchronized@3x.png
  11. 0 23
      iOSClient/Images.xcassets/synchronizedcrypto.imageset/Contents.json
  12. BIN
      iOSClient/Images.xcassets/synchronizedcrypto.imageset/synchronizedcrypto.png
  13. BIN
      iOSClient/Images.xcassets/synchronizedcrypto.imageset/synchronizedcrypto@2x.png
  14. BIN
      iOSClient/Images.xcassets/synchronizedcrypto.imageset/synchronizedcrypto@3x.png
  15. 1 1
      iOSClient/Main/CCMain.h
  16. 35 38
      iOSClient/Main/CCMain.m
  17. 0 23
      iOSClient/Nextcloud.xcassets/SynchronizedNextcloud.imageset/Contents.json
  18. BIN
      iOSClient/Nextcloud.xcassets/SynchronizedNextcloud.imageset/SynchronizedNextcloud@1x.png
  19. BIN
      iOSClient/Nextcloud.xcassets/SynchronizedNextcloud.imageset/SynchronizedNextcloud@2x.png
  20. BIN
      iOSClient/Nextcloud.xcassets/SynchronizedNextcloud.imageset/SynchronizedNextcloud@3x.png
  21. 5 5
      iOSClient/Offline/CCOffline.m
  22. 43 0
      iOSClient/Offline/CCOfflineFolder.h
  23. 370 0
      iOSClient/Offline/CCOfflineFolder.m
  24. 0 7
      iOSClient/Settings/CCManageHelp.m
  25. 0 11
      iOSClient/Settings/CCSettings.m
  26. 0 2
      iOSClient/Utility/CCUtility.h
  27. 0 11
      iOSClient/Utility/CCUtility.m
  28. 1 1
      iOSClient/en.lproj/Intro.strings
  29. 3 2
      iOSClient/en.lproj/Localizable.strings
  30. BIN
      iOSClient/en_GB.lproj/Localizable.strings

+ 6 - 20
Nextcloud.xcodeproj/project.pbxproj

@@ -82,7 +82,6 @@
 		F71E68021DC1F79D003BA52B /* libownCloudiOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F71E67FC1DC1F76F003BA52B /* libownCloudiOS.a */; };
 		F7229B3B1DF7187F00E8C4E7 /* InfoNextcloud.plist in Resources */ = {isa = PBXBuildFile; fileRef = F7229B371DF7187F00E8C4E7 /* InfoNextcloud.plist */; };
 		F725437C1E12A44A009BF4C2 /* CCSection.m in Sources */ = {isa = PBXBuildFile; fileRef = F78F6FAF1CC8CCB700F4EA25 /* CCSection.m */; };
-		F72764651DB8FE2A002334CD /* CCSynchronization.m in Sources */ = {isa = PBXBuildFile; fileRef = F72764631DB8FE2A002334CD /* CCSynchronization.m */; };
 		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 */; };
@@ -312,7 +311,6 @@
 		F77B0E711D118A16002130FE /* LMMediaItem.m in Sources */ = {isa = PBXBuildFile; fileRef = F70F0F351C889339008DAB36 /* LMMediaItem.m */; };
 		F77B0E731D118A16002130FE /* PPImageScrollingTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F70F05231C889184008DAB36 /* PPImageScrollingTableViewCell.m */; };
 		F77B0E741D118A16002130FE /* CCBancomat.m in Sources */ = {isa = PBXBuildFile; fileRef = F72137221BAFF0920012B613 /* CCBancomat.m */; };
-		F77B0E751D118A16002130FE /* CCManageSynchronizations.m in Sources */ = {isa = PBXBuildFile; fileRef = F776B0CC1BEA22F00081EFBA /* CCManageSynchronizations.m */; };
 		F77B0E761D118A16002130FE /* ReaderViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F70F0ED61C889317008DAB36 /* ReaderViewController.m */; };
 		F77B0E771D118A16002130FE /* TableShare+CoreDataProperties.m in Sources */ = {isa = PBXBuildFile; fileRef = F7EC9CCC1C4FA803008122B5 /* TableShare+CoreDataProperties.m */; };
 		F77B0E781D118A16002130FE /* ReaderThumbFetch.m in Sources */ = {isa = PBXBuildFile; fileRef = F70F0ECA1C889317008DAB36 /* ReaderThumbFetch.m */; };
@@ -556,6 +554,7 @@
 		F7D6A0931D82DBFA0045AD1A /* CCControlCenterCell.m in Sources */ = {isa = PBXBuildFile; fileRef = F7D6A08C1D82DBFA0045AD1A /* CCControlCenterCell.m */; };
 		F7D6A0951D82DBFA0045AD1A /* CCControlCenterCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = F7D6A08D1D82DBFA0045AD1A /* CCControlCenterCell.xib */; };
 		F7D6A0971D82DBFA0045AD1A /* CCMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = F7D6A08F1D82DBFA0045AD1A /* CCMenu.m */; };
+		F7DAE66E1E2E109F004EFA30 /* CCOfflineFolder.m in Sources */ = {isa = PBXBuildFile; fileRef = F7DAE66D1E2E109F004EFA30 /* CCOfflineFolder.m */; };
 		F7DCA1C81D32BD4100E48D39 /* Share Ext Nextcloud.entitlements in Resources */ = {isa = PBXBuildFile; fileRef = F7DCA1B81D32BD4100E48D39 /* Share Ext Nextcloud.entitlements */; };
 		F7ECBA6D1E239DCD003E6328 /* CCCreateCloud.swift in Sources */ = {isa = PBXBuildFile; fileRef = F7ECBA6C1E239DCD003E6328 /* CCCreateCloud.swift */; };
 		F7EF0CAF1D9E95F400A9D15E /* CCSharedDBSession.m in Sources */ = {isa = PBXBuildFile; fileRef = F7EF0CAD1D9E95F400A9D15E /* CCSharedDBSession.m */; };
@@ -1103,8 +1102,6 @@
 		F722CEEB1A40361A00C40606 /* Raleway-Regular.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Raleway-Regular.ttf"; sourceTree = "<group>"; };
 		F722CEEC1A40361A00C40606 /* Raleway-SemiBold.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Raleway-SemiBold.ttf"; sourceTree = "<group>"; };
 		F722CEED1A40361A00C40606 /* Raleway-Thin.ttf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Raleway-Thin.ttf"; sourceTree = "<group>"; };
-		F72764621DB8FE2A002334CD /* CCSynchronization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCSynchronization.h; sourceTree = "<group>"; };
-		F72764631DB8FE2A002334CD /* CCSynchronization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCSynchronization.m; sourceTree = "<group>"; };
 		F7296A601C8880C9001A7809 /* CCCellShareExt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCCellShareExt.h; sourceTree = "<group>"; };
 		F7296A611C8880C9001A7809 /* CCCellShareExt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCCellShareExt.m; sourceTree = "<group>"; };
 		F7296A621C8880C9001A7809 /* CCCellShareExt.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CCCellShareExt.xib; sourceTree = "<group>"; };
@@ -1366,8 +1363,6 @@
 		F771CD5B1E07F6620066F76D /* TableAutomaticUpload+CoreDataClass.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "TableAutomaticUpload+CoreDataClass.m"; sourceTree = "<group>"; };
 		F771CD5C1E07F6620066F76D /* TableAutomaticUpload+CoreDataProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TableAutomaticUpload+CoreDataProperties.h"; sourceTree = "<group>"; };
 		F771CD5D1E07F6620066F76D /* TableAutomaticUpload+CoreDataProperties.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "TableAutomaticUpload+CoreDataProperties.m"; sourceTree = "<group>"; };
-		F776B0CB1BEA22F00081EFBA /* CCManageSynchronizations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCManageSynchronizations.h; sourceTree = "<group>"; };
-		F776B0CC1BEA22F00081EFBA /* CCManageSynchronizations.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCManageSynchronizations.m; sourceTree = "<group>"; };
 		F777F0301C29717F00CE81CB /* PHAsset+Utility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "PHAsset+Utility.h"; sourceTree = "<group>"; };
 		F777F0311C29717F00CE81CB /* PHAsset+Utility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "PHAsset+Utility.m"; sourceTree = "<group>"; };
 		F77D49A71DC238E500CDC568 /* loading@2x.gif */ = {isa = PBXFileReference; lastKnownFileType = image.gif; path = "loading@2x.gif"; sourceTree = "<group>"; };
@@ -1492,6 +1487,8 @@
 		F7D96F0D1D99498600A587A5 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/InfoPlist.strings; sourceTree = "<group>"; };
 		F7D96F0E1D99498700A587A5 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Intro.strings; sourceTree = "<group>"; };
 		F7D96F0F1D99498700A587A5 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Error.strings; sourceTree = "<group>"; };
+		F7DAE66C1E2E109F004EFA30 /* CCOfflineFolder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCOfflineFolder.h; sourceTree = "<group>"; };
+		F7DAE66D1E2E109F004EFA30 /* CCOfflineFolder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CCOfflineFolder.m; sourceTree = "<group>"; };
 		F7DCA1B81D32BD4100E48D39 /* Share Ext Nextcloud.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = "Share Ext Nextcloud.entitlements"; path = "Share Ext/Share Ext Nextcloud.entitlements"; sourceTree = SOURCE_ROOT; };
 		F7E456D41C89D54A00BD63F0 /* Share Ext-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "Share Ext-Bridging-Header.h"; sourceTree = "<group>"; };
 		F7EC9CCB1C4FA803008122B5 /* TableShare+CoreDataProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "TableShare+CoreDataProperties.h"; sourceTree = "<group>"; };
@@ -2378,15 +2375,6 @@
 			path = Raleway;
 			sourceTree = "<group>";
 		};
-		F72764611DB8FE2A002334CD /* Synchronization */ = {
-			isa = PBXGroup;
-			children = (
-				F72764621DB8FE2A002334CD /* CCSynchronization.h */,
-				F72764631DB8FE2A002334CD /* CCSynchronization.m */,
-			);
-			path = Synchronization;
-			sourceTree = "<group>";
-		};
 		F728CE741BF6322C00E69702 /* Share */ = {
 			isa = PBXGroup;
 			children = (
@@ -2899,8 +2887,6 @@
 				F7AB79F01BB1A3AD00A82F32 /* CCManageOptimizations.m */,
 				F797F4061CF1ECFE00D0B84B /* CCManagePhotos.h */,
 				F797F4071CF1ECFE00D0B84B /* CCManagePhotos.m */,
-				F776B0CB1BEA22F00081EFBA /* CCManageSynchronizations.h */,
-				F776B0CC1BEA22F00081EFBA /* CCManageSynchronizations.m */,
 				F7ACE4301BAC0268006C0017 /* CCSettings.h */,
 				F7ACE4311BAC0268006C0017 /* CCSettings.m */,
 			);
@@ -2987,6 +2973,8 @@
 				F7C00D441E2D0D0F0032160B /* CCCellOffline.xib */,
 				F7C00D451E2D0D0F0032160B /* CCOffline.h */,
 				F7C00D461E2D0D0F0032160B /* CCOffline.m */,
+				F7DAE66C1E2E109F004EFA30 /* CCOfflineFolder.h */,
+				F7DAE66D1E2E109F004EFA30 /* CCOfflineFolder.m */,
 			);
 			path = Offline;
 			sourceTree = "<group>";
@@ -3189,7 +3177,6 @@
 				F7FE125B1BAC03FB0041924B /* Security */,
 				F7ACE4281BAC0268006C0017 /* Settings */,
 				F728CE741BF6322C00E69702 /* Share */,
-				F72764611DB8FE2A002334CD /* Synchronization */,
 				F721371B1BAFF0920012B613 /* Templates */,
 				F7CE287E1D1ACFA70025783C /* UINavigationController+CCProgress */,
 				F70784811A2C8A0D00AC9FFF /* UploadFromOtherUpp */,
@@ -3917,7 +3904,6 @@
 				F77B0E051D118A16002130FE /* ReaderDocument.m in Sources */,
 				F7F06ECD1DBFACC600099AE9 /* CTAssetThumbnailStacks.m in Sources */,
 				F7659A581DC0B760004860C4 /* NSIndexPath+PSTCollectionViewAdditions.m in Sources */,
-				F72764651DB8FE2A002334CD /* CCSynchronization.m in Sources */,
 				F7659A681DC0B760004860C4 /* PSTCollectionViewUpdateItem.m in Sources */,
 				F7C00D471E2D0D0F0032160B /* CCCellOffline.m in Sources */,
 				F77B0E071D118A16002130FE /* ioapi.c in Sources */,
@@ -4014,6 +4000,7 @@
 				F73CCE0B1DC13776007E38D8 /* NSPredicate+XLFormAdditions.m in Sources */,
 				F77B0E5C1D118A16002130FE /* AHKActionSheetViewController.m in Sources */,
 				F73CCE131DC13776007E38D8 /* XLFormRightImageButton.m in Sources */,
+				F7DAE66E1E2E109F004EFA30 /* CCOfflineFolder.m in Sources */,
 				F77B0E5D1D118A16002130FE /* UIImage+Blurring.m in Sources */,
 				F7BE6E2F1D2D5C3B00106933 /* CCQuickActions.m in Sources */,
 				F77B0E5E1D118A16002130FE /* unzip.c in Sources */,
@@ -4040,7 +4027,6 @@
 				F77B0E731D118A16002130FE /* PPImageScrollingTableViewCell.m in Sources */,
 				F7659A2E1DC0B72F004860C4 /* EARestrictedScrollView.m in Sources */,
 				F77B0E741D118A16002130FE /* CCBancomat.m in Sources */,
-				F77B0E751D118A16002130FE /* CCManageSynchronizations.m in Sources */,
 				F77B0E761D118A16002130FE /* ReaderViewController.m in Sources */,
 				F77B0E771D118A16002130FE /* TableShare+CoreDataProperties.m in Sources */,
 				F77B0E781D118A16002130FE /* ReaderThumbFetch.m in Sources */,

+ 8 - 8
iOSClient/AppDelegate.m

@@ -34,7 +34,7 @@
 #import "CCManageAsset.h"
 #import "CCGraphics.h"
 #import "CCPhotosCameraUpload.h"
-#import "CCSynchronization.h"
+#import "CCOfflineFolder.h"
 #import "CCMain.h"
 #import "CCDetail.h"
 
@@ -370,11 +370,11 @@
     // 1 sec.
     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1.0 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
         
-        NSLog(@"[LOG] Synchronize Offline");
-        [[NSNotificationCenter defaultCenter] postNotificationName:@"synchronizedOffline" object:nil];
+        NSLog(@"[LOG] read file Offline");
+        [[NSNotificationCenter defaultCenter] postNotificationName:@"readFileOffline" object:nil];
         
-        NSLog(@"[LOG] Synchronize Folders");
-        [[CCSynchronization sharedSynchronization] synchronizationFolders];
+        NSLog(@"[LOG]  read folder offline");
+        [[CCOfflineFolder sharedOfflineFolder] readFolderOffline];
         
     });
     
@@ -397,14 +397,14 @@
 {
 // BACKGROND & FOREGROUND
     
-    /* Active/Disactive Graphics Animation Synchronization Folders */
-    NSArray *records = [CCCoreData getSynchronizedDirectoryActiveAccount:app.activeAccount];
+    /* Active/Disactive Graphics Animation Offline Folders */
+    NSArray *records = [CCCoreData getOfflineDirectoryActiveAccount:app.activeAccount];
     NSMutableArray *directory = [[NSMutableArray alloc] init];
     for (TableDirectory *record in records)
         [directory addObject:record.serverUrl];
     
     if ([directory count] > 0)
-        [[CCSynchronization sharedSynchronization] synchronizationAnimationDirectory:directory callViewController:YES];
+        [[CCOfflineFolder sharedOfflineFolder] offlineFolderAnimationDirectory:directory callViewController:YES];
 
 // ONLY BACKGROUND
     

+ 2 - 2
iOSClient/CCGlobal.h

@@ -217,7 +217,7 @@ extern NSString *const BKPasscodeKeychainServiceName;
 #define selectorDeleteCrypto            @"deleteCrypto"
 #define selectorDeletePlist             @"deletePlist"
 #define selectorDownloadThumbnail       @"downloadThumbnail"
-#define selectorDownloadSynchronized    @"downloadSynchronized"
+#define selectorDownloadOffline         @"downloadOffline"
 #define selectorEncryptFile             @"encryptFile"
 #define selectorGetUserAndGroup         @"getUserAndGroup"
 #define selectorLoadFileView            @"loadFileView"
@@ -242,7 +242,7 @@ extern NSString *const BKPasscodeKeychainServiceName;
 #define selectorRename                  @"rename"
 #define selectorSave                    @"save"
 #define selectorShare                   @"share"
-#define selectorSynchronizedFolder      @"synchronizedFolder"
+#define selectorOfflineFolder           @"offlineFolder"
 #define selectorUnshare                 @"unshare"
 #define selectorUpdateShare             @"updateShare"
 #define selectorUploadAutomatic         @"uploadAutomatic"

+ 0 - 3
iOSClient/CCImages.h

@@ -36,7 +36,6 @@
 #define image_actionSheetCrypto                 @"actionSheetCrypto"
 #define image_actionSheetLock                   @"actionSheetLock"
 #define image_actionSheetShare                  @"shareNextcloud"
-#define image_actionSheetSynchronized           @"SynchronizedNextcloud"
 #define image_actionSheetReload                 @"reloadNextcloud"
 #define image_actionSheetOpenIn                 @"openInNextcloud"
 #define image_actionSheetOffline                @"actionSheetOfflineNextcloud"
@@ -266,8 +265,6 @@
 #define image_statusuploadcrypto                @"statusuploadcrypto"
 #define image_stoptask                          @"stoptask"
 #define image_stoptaskcrypto                    @"stoptaskcrypto"
-#define image_synchronized                      @"synchronized"
-#define image_synchronizedcrypto                @"synchronizedcrypto"
 
 #ifdef CC
 #define image_tabBarFile                        @"tabBarCryptoCloud"

+ 4 - 4
iOSClient/FileSystem/CCCoreData.h

@@ -144,10 +144,10 @@
 
 + (BOOL)isDirectoryOutOfDate:(int)numAddDay directoryID:(NSString *)directoryID activeAccount:(NSString *)activeAccount;
 
-+ (void)removeSynchronizedDirectoryID:(NSString *)directoryID activeAccount:(NSString *)activeAccount;
-+ (NSArray *)getSynchronizedDirectoryActiveAccount:(NSString *)activeAccount;
-+ (void)setSynchronizedDirectory:(NSString *)serverUrl synchronized:(BOOL)synchronized activeAccount:(NSString *)activeAccount;
-+ (BOOL)isSynchronizedDirectory:(NSString *)serverUrl activeAccount:(NSString *)activeAccount;
++ (void)removeOfflineDirectoryID:(NSString *)directoryID activeAccount:(NSString *)activeAccount;
++ (NSArray *)getOfflineDirectoryActiveAccount:(NSString *)activeAccount;
++ (void)setOfflineDirectory:(NSString *)serverUrl offline:(BOOL)offline activeAccount:(NSString *)activeAccount;
++ (BOOL)isOfflineDirectory:(NSString *)serverUrl activeAccount:(NSString *)activeAccount;
 
 + (BOOL)setDirectoryLock:(NSString *)serverUrl activeAccount:(NSString *)activeAccount;
 + (BOOL)setDirectoryUnLock:(NSString *)serverUrl activeAccount:(NSString *)activeAccount;

+ 10 - 10
iOSClient/FileSystem/CCCoreData.m

@@ -1094,28 +1094,28 @@
 }
 
 #pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Synchronized Directory =====
+#pragma mark ===== Offline Directory =====
 #pragma --------------------------------------------------------------------------------------------
 
-+ (void)removeSynchronizedDirectoryID:(NSString *)directoryID activeAccount:(NSString *)activeAccount
++ (void)removeOfflineDirectoryID:(NSString *)directoryID activeAccount:(NSString *)activeAccount
 {
     [MagicalRecord saveWithBlockAndWait:^(NSManagedObjectContext *localContext) {
 
-        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(directoryID == %@) AND (account == %@) AND (synchronized == 1)", directoryID, activeAccount];
+        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(directoryID == %@) AND (account == %@) AND (offline == 1)", directoryID, activeAccount];
         TableDirectory *record = [TableDirectory MR_findFirstWithPredicate:predicate inContext:localContext];
     
         if (record)
-            record.synchronized = [NSNumber numberWithBool:FALSE];
+            record.offline = [NSNumber numberWithBool:FALSE];
     }];
 }
 
-+ (NSArray *)getSynchronizedDirectoryActiveAccount:(NSString *)activeAccount
++ (NSArray *)getOfflineDirectoryActiveAccount:(NSString *)activeAccount
 {
-    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(account == %@) AND (synchronized == 1)", activeAccount];
+    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(account == %@) AND (offline == 1)", activeAccount];
     return [TableDirectory MR_findAllWithPredicate:predicate];
 }
 
-+ (void)setSynchronizedDirectory:(NSString *)serverUrl synchronized:(BOOL)synchronized activeAccount:(NSString *)activeAccount
++ (void)setOfflineDirectory:(NSString *)serverUrl offline:(BOOL)offline activeAccount:(NSString *)activeAccount
 {
     [MagicalRecord saveWithBlockAndWait:^(NSManagedObjectContext *localContext) {
 
@@ -1123,13 +1123,13 @@
         TableDirectory *record = [TableDirectory MR_findFirstWithPredicate:predicate inContext:localContext];
     
         if (record)
-            record.synchronized = [NSNumber numberWithBool:synchronized];
+            record.offline = [NSNumber numberWithBool:offline];
     }];
 }
 
-+ (BOOL)isSynchronizedDirectory:(NSString *)serverUrl activeAccount:(NSString *)activeAccount
++ (BOOL)isOfflineDirectory:(NSString *)serverUrl activeAccount:(NSString *)activeAccount
 {
-    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(directoryID == %@) AND (synchronized == 1) AND (account == %@)", [self getDirectoryIDFromServerUrl:serverUrl activeAccount:activeAccount], activeAccount];
+    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(directoryID == %@) AND (offline == 1) AND (account == %@)", [self getDirectoryIDFromServerUrl:serverUrl activeAccount:activeAccount], activeAccount];
     TableDirectory *record = [TableDirectory MR_findFirstWithPredicate:predicate];
     
     if (record) return YES;

+ 0 - 23
iOSClient/Images.xcassets/synchronized.imageset/Contents.json

@@ -1,23 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "scale" : "1x",
-      "filename" : "synchronized.png"
-    },
-    {
-      "idiom" : "universal",
-      "filename" : "synchronized@2x.png",
-      "scale" : "2x"
-    },
-    {
-      "idiom" : "universal",
-      "scale" : "3x",
-      "filename" : "synchronized@3x.png"
-    }
-  ],
-  "info" : {
-    "version" : 1,
-    "author" : "xcode"
-  }
-}

BIN
iOSClient/Images.xcassets/synchronized.imageset/synchronized.png


BIN
iOSClient/Images.xcassets/synchronized.imageset/synchronized@2x.png


BIN
iOSClient/Images.xcassets/synchronized.imageset/synchronized@3x.png


+ 0 - 23
iOSClient/Images.xcassets/synchronizedcrypto.imageset/Contents.json

@@ -1,23 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "scale" : "1x",
-      "filename" : "synchronizedcrypto.png"
-    },
-    {
-      "idiom" : "universal",
-      "filename" : "synchronizedcrypto@2x.png",
-      "scale" : "2x"
-    },
-    {
-      "idiom" : "universal",
-      "scale" : "3x",
-      "filename" : "synchronizedcrypto@3x.png"
-    }
-  ],
-  "info" : {
-    "version" : 1,
-    "author" : "xcode"
-  }
-}

BIN
iOSClient/Images.xcassets/synchronizedcrypto.imageset/synchronizedcrypto.png


BIN
iOSClient/Images.xcassets/synchronizedcrypto.imageset/synchronizedcrypto@2x.png


BIN
iOSClient/Images.xcassets/synchronizedcrypto.imageset/synchronizedcrypto@3x.png


+ 1 - 1
iOSClient/Main/CCMain.h

@@ -95,7 +95,7 @@
 - (void)requestSharedByServer;
 - (void)requestServerInformation;
 
-- (void)synchronizedFolderGraphicsServerUrl:(NSString *)serverUrl animation:(BOOL)animation;
+- (void)offlineFolderGraphicsServerUrl:(NSString *)serverUrl animation:(BOOL)animation;
 
 - (void)clearDateReadDataSource:(NSNotification *)notification;
 

+ 35 - 38
iOSClient/Main/CCMain.m

@@ -25,7 +25,7 @@
 
 #import "AppDelegate.h"
 #import "CCPhotosCameraUpload.h"
-#import "CCSynchronization.h"
+#import "CCOfflineFolder.h"
 
 #import "Nextcloud-Swift.h"
 
@@ -35,7 +35,7 @@
 #define alertCreateFolder 1
 #define alertCreateFolderCrypto 2
 #define alertRename 3
-#define alertSynchronization 4
+#define alertOfflineFolder 4
 
 @interface CCMain ()
 {
@@ -353,9 +353,9 @@
             [self renameFile:_metadata fileName:[alertView textFieldAtIndex:0].text];
         }
     }
-    if (alertView.tag == alertSynchronization && buttonIndex == 1) {
+    if (alertView.tag == alertOfflineFolder && buttonIndex == 1) {
      
-        [[CCSynchronization sharedSynchronization] synchronizationFolder:[CCUtility stringAppendServerUrl:_localServerUrl addServerUrl:_metadata.fileNameData]];
+        [[CCOfflineFolder sharedOfflineFolder] addRemoveOfflineFolder:[CCUtility stringAppendServerUrl:_localServerUrl addServerUrl:_metadata.fileNameData]];
         [self performSelector:@selector(getDataSourceWithReloadTableView) withObject:nil afterDelay:0.5];
     }
 }
@@ -381,7 +381,7 @@
      4> return YES or NO Based on the length
      */
     
-    if (alertView.tag == alertSynchronization) return YES;
+    if (alertView.tag == alertOfflineFolder) return YES;
     else return ([[[alertView textFieldAtIndex:0] text] length]>0)?YES:NO;
 }
 
@@ -1155,8 +1155,8 @@
         [self getDataSourceWithReloadTableView:metadata.directoryID fileID:metadata.fileID selector:selector];
     }
     
-    // Synchronize
-    if ([selector isEqualToString:selectorDownloadSynchronized]) {
+    // Offline Directory
+    if ([selector isEqualToString:selectorDownloadOffline]) {
         
         [self getDataSourceWithReloadTableView:metadata.directoryID fileID:metadata.fileID selector:selector];
     }
@@ -1744,10 +1744,10 @@
     // read plist
     [self downloadPlist:metadataNet.directoryID serverUrl:metadataNet.serverUrl];
     
-    // Synchronization directory
+    // Offline Folder
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
         
-        [[CCSynchronization sharedSynchronization] verifyChangeMedatas:metadatas serverUrl:metadataNet.serverUrl directoryID:metadataNet.directoryID account:app.activeAccount synchronization:NO];
+        [[CCOfflineFolder sharedOfflineFolder] verifyChangeMedatas:metadatas serverUrl:metadataNet.serverUrl directoryID:metadataNet.directoryID account:app.activeAccount offline:NO];
     });
 
     // this is the same directory
@@ -4036,8 +4036,8 @@
 {
     _metadata = [self getMetadataFromSectionDataSource:indexPath];
     
-    NSString *titoloCriptaDecripta, *titoloOffline, *titoloLock, *titoloSynchronized;
-    BOOL synchronized = NO;
+    NSString *titoloCriptaDecripta, *titoloOffline, *titoloLock, *titleOfflineFolder;
+    BOOL offlineFolder = NO;
     
     if (_metadata.cryptated) titoloCriptaDecripta = [NSString stringWithFormat:NSLocalizedString(@"_decrypt_", nil)];
     else titoloCriptaDecripta = [NSString stringWithFormat:NSLocalizedString(@"_encrypt_", nil)];
@@ -4045,13 +4045,13 @@
     if ([CCCoreData isOffline:_metadata.fileID activeAccount:app.activeAccount]) titoloOffline = [NSString stringWithFormat:NSLocalizedString(@"_remove_offline_", nil)];
     else titoloOffline = [NSString stringWithFormat:NSLocalizedString(@"_add_offline_", nil)];
     
-    NSString *synchronizedServerUrl = [CCUtility stringAppendServerUrl:_localServerUrl addServerUrl:_metadata.fileNameData];
-    if (_metadata.directory && [CCCoreData isSynchronizedDirectory:synchronizedServerUrl activeAccount:app.activeAccount]) {
+    NSString *offlineServerUrl = [CCUtility stringAppendServerUrl:_localServerUrl addServerUrl:_metadata.fileNameData];
+    if (_metadata.directory && [CCCoreData isOfflineDirectory:offlineServerUrl activeAccount:app.activeAccount]) {
         
-        titoloSynchronized = [NSString stringWithFormat:NSLocalizedString(@"_remove_synchronized_folder_", nil)];
-        synchronized = YES;
+        titleOfflineFolder = [NSString stringWithFormat:NSLocalizedString(@"_remove_offline_", nil)];
+        offlineFolder = YES;
         
-    } else titoloSynchronized = [NSString stringWithFormat:NSLocalizedString(@"_synchronized_folder_", nil)];
+    } else titleOfflineFolder = [NSString stringWithFormat:NSLocalizedString(@"_add_offline_", nil)];
     
     if (_metadata.directory) {
         // calcolo lockServerUrl
@@ -4200,8 +4200,8 @@
         
         if (!lockDirectory) {
         
-            [actionSheet addButtonWithTitle:titoloSynchronized
-                                      image:[UIImage imageNamed:image_actionSheetSynchronized]
+            [actionSheet addButtonWithTitle:titleOfflineFolder
+                                      image:[UIImage imageNamed:image_actionSheetOffline]
                             backgroundColor:[UIColor whiteColor]
                                      height: 50.0
                                        type:AHKActionSheetButtonTypeDefault
@@ -4210,15 +4210,15 @@
                                         // close swipe
                                         [self setEditing:NO animated:YES];
                                         
-                                        if (synchronized == NO) {
+                                        if (offlineFolder == NO) {
                                             
-                                            UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"",nil) message:NSLocalizedString(@"_synchronized_confirm_",nil) delegate:self cancelButtonTitle:NSLocalizedString(@"_cancel_",nil) otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
-                                            alertView.tag = alertSynchronization;
+                                            UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"",nil) message:NSLocalizedString(@"_offline_folder_confirm_",nil) delegate:self cancelButtonTitle:NSLocalizedString(@"_cancel_",nil) otherButtonTitles:NSLocalizedString(@"_ok_", nil), nil];
+                                            alertView.tag = alertOfflineFolder;
                                             [alertView show];
                                             
                                         } else {
                                             
-                                            [[CCSynchronization sharedSynchronization] synchronizationFolder:[CCUtility stringAppendServerUrl:_localServerUrl addServerUrl:_metadata.fileNameData]];
+                                            [[CCOfflineFolder sharedOfflineFolder] addRemoveOfflineFolder:[CCUtility stringAppendServerUrl:_localServerUrl addServerUrl:_metadata.fileNameData]];
                                             [self performSelector:@selector(getDataSourceWithReloadTableView) withObject:nil afterDelay:0.5];
                                         }
                                     }];
@@ -4538,7 +4538,7 @@
     // Reload -> Self se non siamo nella dir appropriata cercala e se è in memoria reindirizza il reload
     if ([directoryID isEqualToString:_localDirectoryID] == NO || _localServerUrl == nil) {
         
-        if ([selector isEqualToString:selectorDownloadSynchronized]) {
+        if ([selector isEqualToString:selectorDownloadOffline]) {
             [app.controlCenter reloadDatasource];
         } else {
             CCMain *main = [app.listMainVC objectForKey:[CCCoreData getServerUrlFromDirectoryID:directoryID activeAccount:app.activeAccount]];
@@ -4916,13 +4916,18 @@
         lunghezzaFile = @" ";
         
         // ----------------------------------------------------------------------------------------------------------
-        // Synchronize
+        // Offline Folder
         // ----------------------------------------------------------------------------------------------------------
         
-        NSString *synchronizedServerUrl = [CCUtility stringAppendServerUrl:_localServerUrl addServerUrl:metadata.fileNameData];
-        if ([CCCoreData isSynchronizedDirectory:synchronizedServerUrl activeAccount:app.activeAccount]) {
+        NSString *offlineServerUrl = [CCUtility stringAppendServerUrl:_localServerUrl addServerUrl:metadata.fileNameData];
+        if ([CCCoreData isOfflineDirectory:offlineServerUrl activeAccount:app.activeAccount]) {
             
-            if ([[CCSynchronization sharedSynchronization] synchronizationAnimationDirectory:[[NSArray alloc] initWithObjects:synchronizedServerUrl, nil] callViewController:NO]) {
+            // Image Offline
+            if (metadata.cryptated) cell.offlineImageView.image = [UIImage imageNamed:image_offlinecrypto];
+            else cell.offlineImageView.image = [UIImage imageNamed:image_offline];
+            
+            // Animation synchronized gif
+            if ([[CCOfflineFolder sharedOfflineFolder] offlineFolderAnimationDirectory:[[NSArray alloc] initWithObjects:offlineServerUrl, nil] callViewController:NO]) {
                 
                 NSURL *myURL;
                 
@@ -4930,11 +4935,6 @@
                 else myURL = [[NSBundle mainBundle] URLForResource: @"synchronized" withExtension:@"gif"];
                 
                 cell.synchronizedImageView.image = [UIImage animatedImageWithAnimatedGIFURL:myURL];
-                
-            } else {
-                
-                if (metadata.cryptated) cell.synchronizedImageView.image = [UIImage imageNamed:image_synchronizedcrypto];
-                else cell.synchronizedImageView.image = [UIImage imageNamed:image_synchronized];
             }
         }
 
@@ -5382,10 +5382,10 @@
 }
 
 #pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Synchronize Cell =====
+#pragma mark ===== Offline Folder Cell =====
 #pragma --------------------------------------------------------------------------------------------
 
-- (void)synchronizedFolderGraphicsServerUrl:(NSString *)serverUrl animation:(BOOL)animation
+- (void)offlineFolderGraphicsServerUrl:(NSString *)serverUrl animation:(BOOL)animation
 {
     BOOL cryptated = NO;
     CCCellMain *cell;
@@ -5423,10 +5423,7 @@
         
     } else {
         
-        if (cryptated)
-            cell.synchronizedImageView.image = [UIImage imageNamed:image_synchronizedcrypto];
-        else
-            cell.synchronizedImageView.image = [UIImage imageNamed:image_synchronized];
+        cell.synchronizedImageView.image = nil;
     }
 }
 

+ 0 - 23
iOSClient/Nextcloud.xcassets/SynchronizedNextcloud.imageset/Contents.json

@@ -1,23 +0,0 @@
-{
-  "images" : [
-    {
-      "idiom" : "universal",
-      "filename" : "SynchronizedNextcloud@1x.png",
-      "scale" : "1x"
-    },
-    {
-      "idiom" : "universal",
-      "filename" : "SynchronizedNextcloud@2x.png",
-      "scale" : "2x"
-    },
-    {
-      "idiom" : "universal",
-      "filename" : "SynchronizedNextcloud@3x.png",
-      "scale" : "3x"
-    }
-  ],
-  "info" : {
-    "version" : 1,
-    "author" : "xcode"
-  }
-}

BIN
iOSClient/Nextcloud.xcassets/SynchronizedNextcloud.imageset/SynchronizedNextcloud@1x.png


BIN
iOSClient/Nextcloud.xcassets/SynchronizedNextcloud.imageset/SynchronizedNextcloud@2x.png


BIN
iOSClient/Nextcloud.xcassets/SynchronizedNextcloud.imageset/SynchronizedNextcloud@3x.png


+ 5 - 5
iOSClient/Offline/CCOffline.m

@@ -24,7 +24,7 @@
 #import "CCOffline.h"
 
 #import "AppDelegate.h"
-#import "CCSynchronization.h"
+#import "CCOfflineFolder.h"
 
 #pragma GCC diagnostic ignored "-Wundeclared-selector"
 
@@ -47,7 +47,7 @@
     if (self = [super initWithCoder:aDecoder])  {
         
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(reloadTable) name:@"reloadTableCCOffline" object:nil];
-        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(synchronizedOffline) name:@"synchronizedCCOffline" object:nil];
+        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readFileOffline) name:@"readFileOffline" object:nil];
         [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(initToHome) name:@"initToHomeOffline" object:nil];
         
         app.activeOffline = self;
@@ -303,7 +303,7 @@
 }
 
 #pragma --------------------------------------------------------------------------------------------
-#pragma mark ===== Synchronized Offline =====
+#pragma mark ===== read file Offline for download =====
 #pragma---------------------------------------------------------------------------------------------
 
 - (void)readFileFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
@@ -315,13 +315,13 @@
 {
     dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
         
-        [[CCSynchronization sharedSynchronization] verifyChangeMedatas:[[NSArray alloc] initWithObjects:metadata, nil] serverUrl:metadataNet.serverUrl directoryID:metadataNet.directoryID account:app.activeAccount synchronization:NO];
+        [[CCOfflineFolder sharedOfflineFolder] verifyChangeMedatas:[[NSArray alloc] initWithObjects:metadata, nil] serverUrl:metadataNet.serverUrl directoryID:metadataNet.directoryID account:app.activeAccount offline:NO];
     });
     
     [self.tableView performSelector:@selector(reloadData) withObject:nil afterDelay:0.1];
 }
 
-- (void)synchronizedOffline
+- (void)readFileOffline
 {
     if (app.activeAccount == nil || [CCUtility getHomeServerUrlActiveUrl:app.activeUrl typeCloud:app.typeCloud] == nil) return;
     

+ 43 - 0
iOSClient/Offline/CCOfflineFolder.h

@@ -0,0 +1,43 @@
+//
+//  CCOfflineFolder.h
+//  Crypto Cloud Technology Nextcloud
+//
+//  Created by Marino Faggiana on 19/10/16.
+//  Copyright (c) 2016 TWS. All rights reserved.
+//
+//  Author Marino Faggiana <m.faggiana@twsweb.it>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+
+#import <Foundation/Foundation.h>
+
+#import "CCMetadata.h"
+#import "CCHud.h"
+#import "CCCellMain.h"
+
+@interface CCOfflineFolder : NSObject
+
+@property (nonatomic, strong) CCHud *hud;
+
++ (CCOfflineFolder *)sharedOfflineFolder;
+
+- (void)readFolderOffline;
+- (void)addRemoveOfflineFolder:(NSString *)serverUrl;
+
+- (void)verifyChangeMedatas:(NSArray *)allRecordMetadatas serverUrl:(NSString *)serverUrl directoryID:(NSString *)directoryID account:(NSString *)account offline:(BOOL)offline;
+
+- (BOOL)offlineFolderAnimationDirectory:(NSArray *)directory callViewController:(BOOL)callViewController;
+
+@end

+ 370 - 0
iOSClient/Offline/CCOfflineFolder.m

@@ -0,0 +1,370 @@
+//
+//  CCOfflineFolder.m
+//  Crypto Cloud Technology Nextcloud
+//
+//  Created by Marino Faggiana on 19/10/16.
+//  Copyright (c) 2016 TWS. All rights reserved.
+//
+//  Author Marino Faggiana <m.faggiana@twsweb.it>
+//
+//  This program is free software: you can redistribute it and/or modify
+//  it under the terms of the GNU General Public License as published by
+//  the Free Software Foundation, either version 3 of the License, or
+//  (at your option) any later version.
+//
+//  This program is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+//  GNU General Public License for more details.
+//
+//  You should have received a copy of the GNU General Public License
+//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+//
+
+#import "CCOfflineFolder.h"
+
+#import "AppDelegate.h"
+#import "CCCoreData.h"
+#import "CCMain.h"
+
+@interface CCOfflineFolder ()
+{
+    // local
+}
+@end
+
+@implementation CCOfflineFolder
+
++ (CCOfflineFolder *)sharedOfflineFolder {
+    static CCOfflineFolder *sharedOfflineFolder;
+    @synchronized(self)
+    {
+        if (!sharedOfflineFolder) {
+            
+            sharedOfflineFolder = [[CCOfflineFolder alloc] init];
+        }
+        return sharedOfflineFolder;
+    }
+}
+
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark ===== Read Folder Offline =====
+#pragma --------------------------------------------------------------------------------------------
+
+- (void)readFolderOffline
+{
+    if ([app.activeAccount length] == 0)
+        return;
+
+    // verify is offline procedure is in progress selectorDownloadOffline
+    if ([[app verifyExistsInQueuesDownloadSelector:selectorDownloadOffline] count] > 0)
+        return;
+    
+    NSArray *directories = [CCCoreData getOfflineDirectoryActiveAccount:app.activeAccount];
+    
+    for (TableDirectory *directory in directories) {
+        
+        CCMetadataNet *metadataNet = [[CCMetadataNet alloc] initWithAccount:app.activeAccount];
+        
+        metadataNet.action = actionReadFolder;
+        metadataNet.date = [NSDate date];
+        metadataNet.directoryID = directory.directoryID;
+        metadataNet.priority = NSOperationQueuePriorityVeryLow;
+        metadataNet.selector = selectorOfflineFolder;
+        metadataNet.serverUrl = directory.serverUrl;
+        
+        [app addNetworkingOperationQueue:app.netQueue delegate:self metadataNet:metadataNet];
+    }
+}
+
+//
+// Add - Remove Folder offline
+//
+- (void)addRemoveOfflineFolder:(NSString *)serverUrl
+{
+    BOOL offline = [CCCoreData isOfflineDirectory:serverUrl activeAccount:app.activeAccount];
+    NSString *directoryID = [CCCoreData getDirectoryIDFromServerUrl:serverUrl activeAccount:app.activeAccount];
+    
+    if (offline) {
+        
+        [CCCoreData setOfflineDirectory:serverUrl offline:NO activeAccount:app.activeAccount];
+        
+    } else {
+        
+        [CCCoreData setOfflineDirectory:serverUrl offline:YES activeAccount:app.activeAccount];
+        
+        CCMetadataNet *metadataNet = [[CCMetadataNet alloc] initWithAccount:app.activeAccount];
+        
+        metadataNet.action = actionReadFolder;
+        metadataNet.directoryID = directoryID;
+        metadataNet.priority = NSOperationQueuePriorityVeryHigh;
+        metadataNet.selector = selectorReadFolder;
+        metadataNet.serverUrl = serverUrl;
+        
+        [app addNetworkingOperationQueue:app.netQueue delegate:self metadataNet:metadataNet];
+    }
+}
+
+#pragma --------------------------------------------------------------------------------------------
+#pragma mark ===== Read Folder offline =====
+#pragma --------------------------------------------------------------------------------------------
+
+- (void)readFolderFailure:(CCMetadataNet *)metadataNet message:(NSString *)message errorCode:(NSInteger)errorCode
+{
+    // verify active user
+    TableAccount *recordAccount = [CCCoreData getActiveAccount];
+    
+    // Folder not present, remove it
+    if (errorCode == 404 && [recordAccount.account isEqualToString:metadataNet.account])
+        [CCCoreData deleteDirectoryAndSubDirectory:metadataNet.serverUrl activeAccount:app.activeAccount];
+}
+
+// MULTI THREAD
+- (void)readFolderSuccess:(CCMetadataNet *)metadataNet permissions:(NSString *)permissions rev:(NSString *)rev metadatas:(NSArray *)metadatas
+{
+    TableAccount *recordAccount = [CCCoreData getActiveAccount];
+    
+    __block NSMutableArray *metadatasForOfflineFolder = [[NSMutableArray alloc] init];
+    
+    if ([recordAccount.account isEqualToString:metadataNet.account] == NO && [metadataNet.selector isEqualToString:selectorOfflineFolder])
+        return;
+    
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
+        
+        NSArray *recordsInSessions = [CCCoreData getTableMetadataWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND (directoryID == %@) AND (session != NULL) AND (session != '')", app.activeAccount, metadataNet.directoryID] context:nil];
+        
+        // ----- Test metadata not present (DELETE) -----
+        
+        NSMutableArray *metadatasNotPresents = [[NSMutableArray alloc] init];
+        NSArray *metadatasInDB = [CCCoreData getTableMetadataWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND (directoryID == %@)", app.activeAccount, metadataNet.directoryID] context:nil];
+        
+        for (CCMetadata *metadataDB in metadatasInDB) {
+            
+            BOOL fileIDFound = NO;
+            
+            for (CCMetadata *metadata in metadatas) {
+                
+                if ([metadataDB.fileID isEqualToString:metadata.fileID]) {
+                    fileIDFound = YES;
+                    break;
+                }
+            }
+            
+            if (!fileIDFound)
+                [metadatasNotPresents addObject:metadataDB];
+        }
+        
+        dispatch_async(dispatch_get_main_queue(), ^{
+            
+            // delete metadata not present
+            for (CCMetadata *metadata in metadatasNotPresents)
+                [CCCoreData deleteFile:metadata serverUrl:metadataNet.serverUrl directoryUser:app.directoryUser typeCloud:app.typeCloud activeAccount:app.activeAccount];
+            
+            [app.activeMain getDataSourceWithReloadTableView:metadataNet.directoryID fileID:nil selector:nil];
+            
+        });
+        
+        // ----- Search metadata for test change metadata (MODIFY) -----
+        
+        for (CCMetadata *metadata in metadatas) {
+            
+            // no dir
+            if (metadata.directory)
+                continue;
+            
+            NSInteger typeFilename = [CCUtility getTypeFileName:metadata.fileName];
+            
+            // reject crypto
+            if (typeFilename == metadataTypeFilenameCrypto) continue;
+            
+            // Verify if the plist is complited
+            if (typeFilename == metadataTypeFilenamePlist) {
+                
+                BOOL isCryptoComplete = NO;
+                NSString *fileNameCrypto = [CCUtility trasformedFileNamePlistInCrypto:metadata.fileName];
+                
+                for (CCMetadata *completeMetadata in metadatas) {
+                    
+                    if (completeMetadata.cryptated == NO) continue;
+                    else  if ([completeMetadata.fileName isEqualToString:fileNameCrypto]) {
+                        isCryptoComplete = YES;
+                        break;
+                    }
+                }
+                if (isCryptoComplete == NO) continue;
+            }
+        
+            // Error password
+            if (metadata.errorPasscode)
+                continue;
+            
+            // Plist not download
+            if (metadata.cryptated && [metadata.title length] == 0)
+                continue;
+            
+            // It's in session
+            BOOL recordInSession = NO;
+            for (TableMetadata *record in recordsInSessions) {
+                if ([record.fileID isEqualToString:metadata.fileID]) {
+                    recordInSession = YES;
+                    break;
+                }
+            }
+            if (recordInSession)
+                continue;
+            
+            // Ohhhh INSERT
+            [metadatasForOfflineFolder addObject:metadata];
+        }
+        
+        if ([metadatasForOfflineFolder count] > 0)
+            [self verifyChangeMedatas:metadatasForOfflineFolder serverUrl:metadataNet.serverUrl directoryID:metadataNet.directoryID account:metadataNet.account offline:YES];
+    });
+}
+
+// MULTI THREAD
+- (void)verifyChangeMedatas:(NSArray *)allRecordMetadatas serverUrl:(NSString *)serverUrl directoryID:(NSString *)directoryID account:(NSString *)account offline:(BOOL)offline
+{
+    NSMutableArray *metadatas = [[NSMutableArray alloc] init];
+    
+    for (CCMetadata *metadata in allRecordMetadatas) {
+        
+        BOOL changeRev = NO;
+        
+        // change account
+        if ([metadata.account isEqualToString:account] == NO)
+            return;
+        
+        // no dir
+        if (metadata.directory)
+            continue;
+        
+        TableLocalFile *record = [TableLocalFile MR_findFirstWithPredicate:[NSPredicate predicateWithFormat:@"(account == %@) AND (fileID == %@)", app.activeAccount, metadata.fileID]];
+        
+        if (offline) {
+            
+            if (![record.rev isEqualToString:metadata.rev ])
+                changeRev = YES;
+            
+        } else {
+            
+            if (record && ![record.rev isEqualToString:metadata.rev ])
+                changeRev = YES;
+        }
+        
+        if (changeRev) {
+            
+            if ([metadata.type isEqualToString:metadataType_file]) {
+                
+                // remove file and ico
+                [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@", app.directoryUser, metadata.fileID] error:nil];
+                [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@.ico", app.directoryUser, metadata.fileID] error:nil];
+            }
+            
+            if ([metadata.type isEqualToString:metadataType_model]) {
+                
+                // remove model
+                [[NSFileManager defaultManager] removeItemAtPath:[NSString stringWithFormat:@"%@/%@", app.directoryUser, metadata.fileName] error:nil];
+            }
+            
+            [metadatas addObject:metadata];
+        }
+    }
+    
+    dispatch_async(dispatch_get_main_queue(), ^{
+        if ([metadatas count])
+            [self offlineMetadatas:metadatas serverUrl:serverUrl directoryID:directoryID offline:offline];
+    });
+}
+
+// MAIN THREAD
+- (void)offlineMetadatas:(NSArray *)metadatas serverUrl:(NSString *)serverUrl directoryID:(NSString *)directoryID offline:(BOOL)offline
+{
+    // HUD
+    if ([metadatas count] > 50 && offline) {
+        if (!_hud) _hud = [[CCHud alloc] initWithView:[[[UIApplication sharedApplication] delegate] window]];
+        [_hud visibleIndeterminateHud];
+    }
+    
+    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.01 * NSEC_PER_SEC), dispatch_get_main_queue(), ^(void) {
+        
+        for (CCMetadata *metadata in metadatas) {
+        
+            NSString *selector, *selectorPost;
+            BOOL downloadData, downloadPlist;
+        
+            // it's a offline ?
+            BOOL isOffline = [CCCoreData isOffline:metadata.fileID activeAccount:app.activeAccount];
+        
+            if (isOffline)
+                selectorPost = selectorAddOffline;
+        
+            if ([metadata.type isEqualToString:metadataType_file]) {
+                downloadData = YES;
+                selector = selectorDownloadOffline;
+            }
+        
+            if ([metadata.type isEqualToString:metadataType_model]) {
+                downloadPlist = YES;
+                selector = selectorLoadPlist;
+            }
+        
+            [CCCoreData addMetadata:metadata activeAccount:app.activeAccount activeUrl:serverUrl typeCloud:app.typeCloud context:nil];
+        
+            CCMetadataNet *metadataNet = [[CCMetadataNet alloc] initWithAccount:app.activeAccount];
+            
+            metadataNet.action = actionDownloadFile;
+            metadataNet.metadata = metadata;
+            metadataNet.downloadData = downloadData;
+            metadataNet.downloadPlist = downloadPlist;
+            metadataNet.selector = selector;
+            metadataNet.selectorPost = selectorPost;
+            metadataNet.serverUrl = serverUrl;
+            metadataNet.session = download_session;
+            metadataNet.taskStatus = taskStatusResume;
+
+            [app addNetworkingOperationQueue:app.netQueueDownload delegate:app.activeMain metadataNet:metadataNet];
+        }
+    
+        [[CCOfflineFolder sharedOfflineFolder] offlineFolderAnimationDirectory:[[NSArray alloc] initWithObjects:serverUrl, nil] callViewController:YES];
+        
+        [app.activeMain getDataSourceWithReloadTableView:directoryID fileID:nil selector:nil];
+        
+        [_hud hideHud];
+    });
+}
+
+// Graphics Animation Offline Folders
+//
+// User return BOOL animation for 1 directory only
+//
+
+- (BOOL)offlineFolderAnimationDirectory:(NSArray *)directory callViewController:(BOOL)callViewController
+{
+    BOOL animation = NO;
+    NSMutableOrderedSet *serversUrlInDownload = [[NSMutableOrderedSet alloc] init];
+    
+    NSMutableArray *metadatasNet = [app verifyExistsInQueuesDownloadSelector:selectorDownloadOffline];
+    
+    for (CCMetadataNet *metadataNet in metadatasNet)
+        [serversUrlInDownload addObject:metadataNet.serverUrl];
+    
+    /* Animation ON/OFF */
+    
+    for (NSString *serverUrl in directory) {
+        
+        animation = [serversUrlInDownload containsObject:serverUrl];
+        
+        if (callViewController) {
+            
+            NSString *serverUrlOffline = [CCUtility deletingLastPathComponentFromServerUrl:serverUrl];
+            CCMain *viewController = [app.listMainVC objectForKey:serverUrlOffline];
+            if (viewController)
+                [viewController offlineFolderGraphicsServerUrl:serverUrl animation:animation];
+        }
+    }
+    
+    return animation;
+}
+
+@end

+ 0 - 7
iOSClient/Settings/CCManageHelp.m

@@ -113,13 +113,6 @@
     [self.intro showIntroCryptoCloud:0.1];
 }
 
-- (void)synchronizations:(XLFormRowDescriptor *)sender
-{
-    [self deselectFormRow:sender];
-    
-    [self.intro showIntroVersion:@"1.90" duration:0.1 review:YES];
-}
-
 - (void)share:(XLFormRowDescriptor *)sender
 {
     [self deselectFormRow:sender];

+ 0 - 11
iOSClient/Settings/CCSettings.m

@@ -159,17 +159,6 @@
     row.action.formSegueIdenfifier = @"CCManageOptimizationsSegue";
     [section addFormRow:row];
 
-    // Section : Synchronizations
-    
-    section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_synchronizations_", nil)];
-    [form addFormSection:section];
-    
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"synchronizations" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_synchronizations_", nil)];
-    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
-    row.action.formSegueIdenfifier = @"CCManageSynchronizationsSegue";
-    [row.cellConfig setObject:[UIImage imageNamed:image_settingsSync] forKey:@"imageView.image"];
-    [section addFormRow:row];
-
     // Section : Acknowledgements
 
     section = [XLFormSectionDescriptor formSection];

+ 0 - 2
iOSClient/Utility/CCUtility.h

@@ -60,7 +60,6 @@
 
 + (void)setOptimizedPhoto:(BOOL)resize;
 + (void)setUploadAndRemovePhoto:(BOOL)remove;
-+ (void)setSynchronizationsOnlyWiFi:(BOOL)onlyWiFi;
 
 + (void)setOrderSettings:(NSString *)order;
 + (void)setAscendingSettings:(BOOL)ascendente;
@@ -98,7 +97,6 @@
 
 + (BOOL)getOptimizedPhoto;
 + (BOOL)getUploadAndRemovePhoto;
-+ (BOOL)getSynchronizationsOnlyWiFi;
 
 + (NSString *)getOrderSettings;
 + (BOOL)getAscendingSettings;

+ 0 - 11
iOSClient/Utility/CCUtility.m

@@ -120,12 +120,6 @@
     [UICKeyChainStore setString:sRemovePhoto forKey:@"uploadremovephoto" service:serviceShareKeyChain];
 }
 
-+ (void)setSynchronizationsOnlyWiFi:(BOOL)onlyWiFi
-{
-    NSString *sSynchronizationsOnlyWiFi = (onlyWiFi) ? @"true" : @"false";
-    [UICKeyChainStore setString:sSynchronizationsOnlyWiFi forKey:@"synchronizationsonlywifi" service:serviceShareKeyChain];
-}
-
 + (void)setOrderSettings:(NSString *)order
 {
     [UICKeyChainStore setString:order forKey:@"order" service:serviceShareKeyChain];
@@ -266,11 +260,6 @@
     return [[UICKeyChainStore stringForKey:@"uploadremovephoto" service:serviceShareKeyChain] boolValue];
 }
 
-+ (BOOL)getSynchronizationsOnlyWiFi
-{
-    return [[UICKeyChainStore stringForKey:@"synchronizationsonlywifi" service:serviceShareKeyChain] boolValue];
-}
-
 + (NSString *)getOrderSettings
 {
     NSString *order = [UICKeyChainStore stringForKey:@"order" service:serviceShareKeyChain];

+ 1 - 1
iOSClient/en.lproj/Intro.strings

@@ -18,7 +18,7 @@
 "_intro_07_" = "_brand_";
 "_intro_08_" = "From now on, you will be able to see all the files stored in your Cloud. You will be able to rename, move, delete them, send them to other compatible programs installed in your iPhone, and much more.";
 "_intro_09_" = "OFFLINE & LOCAL STORAGE";
-"_intro_10_" = "You can tag the most important files as 'Offline', so that they are copied and will always remain synchronized on your iPhone and they can be consulted offline. In the 'Local storage' instead enter files that are no longer synchronized. In the 'Local storage' they will be decompress the compressed files you download from the cloud where you can also access it via iTunes.";
+"_intro_10_" = "You can tag the most important files or folders as 'Offline', so that they are copied and will always remain synchronized on your iPhone and they can be consulted offline. In the 'Local storage' instead enter files that are no longer synchronized. In the 'Local storage' they will be decompress the compressed files you download from the cloud where you can also access it via iTunes.";
 "_intro_11_" = "ENCRYPT / DECRYPT";
 "_intro_12_" = "Any file can be encrypted or decrypted. The name of folders containing your files can be encrypted as well (so as to hide any possible hint at their contents).";
 "_intro_13_" = "ADD";

+ 3 - 2
iOSClient/en.lproj/Localizable.strings

@@ -175,7 +175,7 @@
 "_optimized_photos_how_"    = "If your iPhone is low on space, full-resolution photos are automatically replaced with optimized versions. The full-resolution versions are stored in your Cloud.";
 "_upload_del_photos_how_"   = "Files will be removed from _brand_ memory after they’ve been uploaded to the Cloud. They will remain in the camera roll. Just download the files to see them.";
 
-// Manage Synchronizations
+// Manage Synchronizations [DISMISS]
 
 "_sync_wifi_how_"           = "The files in synchronized folders will be updated only when Wi-Fi is available";
 "_sync_active_"             = "Active synchronizations of folders";
@@ -342,6 +342,7 @@
 "_synchronized_folder_"         = "Keep the folder synchronized";
 "_remove_synchronized_folder_"  = "Remove the synchronization";
 "_synchronized_confirm_"        = "After enabling the synchronization, all files in the folder will be synchronized with the server, continue?";
+"_offline_folder_confirm_"      = "After enabling the offline, all files in the folder will be synchronized with the server, continue?";
 "_same_device_different_passcode_"  = "The file was encrypted on the same device but with different passcode. Keep in mind that if the old passcode is entered, files encrypted with the new passcode will not be readable.";
 "_file_encrypted_another_device_"   = "The file was encrypted on another device [%@], enter the passcode to decrypt its content.";
 "_file_not_found_reload_"       = "File not found, pull down to refresh";
@@ -464,7 +465,7 @@
 
 "_no_transfer_"                     = "No transfer";
 
-// Synchronization
+// Offline
 
 "_create_synchronization_"          = "Create synchronization";
 

BIN
iOSClient/en_GB.lproj/Localizable.strings