Permalink
Browse files

Add working Local NSFileManager-based App Sync Manager with App Regis…

…tration operation
  • Loading branch information...
1 parent b2a478a commit 336357296ec4fe3a0b0be4f27a1571d31f058d27 Tim Isted committed Apr 22, 2011
Showing with 636 additions and 46 deletions.
  1. +40 −14 Examples/ShoppingListMac/ShoppingListMac.xcodeproj/project.pbxproj
  2. +4 −4 Examples/ShoppingListMac/ShoppingListMac/TISLSynchronizationController.m
  3. +3 −2 TICoreDataSync/01 Headers and Constants/TICDSAllClassHeaders.h
  4. +3 −2 TICoreDataSync/01 Headers and Constants/TICDSClassesAndProtocols.h
  5. +14 −1 TICoreDataSync/01 Headers and Constants/TICDSTypesAndEnums.h
  6. +5 −1 TICoreDataSync/01 Headers and Constants/TICDSTypesAndEnums.m
  7. +25 −0 ...2 Primary Classes/File Manager-Based Sync/TICDSFileManagerBasedApplicationRegistrationOperation.h
  8. +170 −0 ...2 Primary Classes/File Manager-Based Sync/TICDSFileManagerBasedApplicationRegistrationOperation.m
  9. +23 −0 ...DataSync/02 Primary Classes/File Manager-Based Sync/TICDSFileManagerBasedApplicationSyncManager.h
  10. +61 −0 ...DataSync/02 Primary Classes/File Manager-Based Sync/TICDSFileManagerBasedApplicationSyncManager.m
  11. +20 −0 TICoreDataSync/02 Primary Classes/Generic Operations/TICDSApplicationRegistrationOperation.h
  12. +168 −2 TICoreDataSync/02 Primary Classes/Generic Operations/TICDSApplicationRegistrationOperation.m
  13. +20 −11 TICoreDataSync/02 Primary Classes/Generic Operations/TICDSOperation.m
  14. +5 −2 TICoreDataSync/02 Primary Classes/TICDSApplicationSyncManager.h
  15. +27 −6 TICoreDataSync/02 Primary Classes/TICDSApplicationSyncManager.m
  16. +8 −0 TICoreDataSync/04 Utilities/TICDSUtilities.h
  17. +25 −1 TICoreDataSync/04 Utilities/TICDSUtilities.m
  18. +5 −0 TICoreDataSync/05 File Structure/ReadMe.txt
  19. +5 −0 TICoreDataSync/05 File Structure/deviceInfo.plist
  20. +5 −0 TICoreDataSync/05 File Structure/documentInfo.plist
@@ -18,13 +18,17 @@
388A3E93135707CA00824C88 /* MyDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = 388A3E92135707CA00824C88 /* MyDocument.m */; };
388A3E96135707CA00824C88 /* MyDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 388A3E94135707CA00824C88 /* MyDocument.xib */; };
388A3E99135707CA00824C88 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 388A3E97135707CA00824C88 /* MainMenu.xib */; };
+ 389D767E1361A577007F19DC /* TICDSFileManagerBasedApplicationRegistrationOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 389D767D1361A577007F19DC /* TICDSFileManagerBasedApplicationRegistrationOperation.m */; };
+ 389D76831361AA8A007F19DC /* deviceInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 389D76801361AA8A007F19DC /* deviceInfo.plist */; };
+ 389D76841361AA8A007F19DC /* documentInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 389D76811361AA8A007F19DC /* documentInfo.plist */; };
+ 389D76851361AA8A007F19DC /* ReadMe.txt in Resources */ = {isa = PBXBuildFile; fileRef = 389D76821361AA8A007F19DC /* ReadMe.txt */; };
+ 389D76881361AB84007F19DC /* TICDSFileManagerBasedApplicationSyncManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 389D76871361AB84007F19DC /* TICDSFileManagerBasedApplicationSyncManager.m */; };
389F86B313608C7900004CA4 /* TICDSOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = 389F86B213608C7900004CA4 /* TICDSOperation.m */; };
389F86BB1360902900004CA4 /* DropboxBoth.png in Resources */ = {isa = PBXBuildFile; fileRef = 389F86B51360902900004CA4 /* DropboxBoth.png */; };
389F86BC1360902900004CA4 /* DropboxText.png in Resources */ = {isa = PBXBuildFile; fileRef = 389F86B61360902900004CA4 /* DropboxText.png */; };
389F86BD1360902900004CA4 /* DropboxLogo.png in Resources */ = {isa = PBXBuildFile; fileRef = 389F86B71360902900004CA4 /* DropboxLogo.png */; };
389F86BE1360902900004CA4 /* TISLSynchronizationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 389F86B91360902900004CA4 /* TISLSynchronizationController.m */; };
389F86BF1360902900004CA4 /* TISLSynchronizationWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 389F86BA1360902900004CA4 /* TISLSynchronizationWindow.xib */; };
- 389F86C31360911B00004CA4 /* TICDSLocalDropboxApplicationSyncManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 389F86C21360911B00004CA4 /* TICDSLocalDropboxApplicationSyncManager.m */; };
389F86C6136092D900004CA4 /* TICDSUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 389F86C5136092D900004CA4 /* TICDSUtilities.m */; };
389F86C81360933F00004CA4 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 389F86C71360933F00004CA4 /* QuartzCore.framework */; };
389F86CA1360934800004CA4 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 389F86C91360934700004CA4 /* SystemConfiguration.framework */; };
@@ -57,6 +61,13 @@
388A3E92135707CA00824C88 /* MyDocument.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyDocument.m; sourceTree = "<group>"; };
388A3E95135707CA00824C88 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MyDocument.xib; sourceTree = "<group>"; };
388A3E98135707CA00824C88 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = "<group>"; };
+ 389D767C1361A577007F19DC /* TICDSFileManagerBasedApplicationRegistrationOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TICDSFileManagerBasedApplicationRegistrationOperation.h; sourceTree = "<group>"; };
+ 389D767D1361A577007F19DC /* TICDSFileManagerBasedApplicationRegistrationOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TICDSFileManagerBasedApplicationRegistrationOperation.m; sourceTree = "<group>"; };
+ 389D76801361AA8A007F19DC /* deviceInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = deviceInfo.plist; sourceTree = "<group>"; };
+ 389D76811361AA8A007F19DC /* documentInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = documentInfo.plist; sourceTree = "<group>"; };
+ 389D76821361AA8A007F19DC /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ReadMe.txt; sourceTree = "<group>"; };
+ 389D76861361AB83007F19DC /* TICDSFileManagerBasedApplicationSyncManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TICDSFileManagerBasedApplicationSyncManager.h; sourceTree = "<group>"; };
+ 389D76871361AB84007F19DC /* TICDSFileManagerBasedApplicationSyncManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TICDSFileManagerBasedApplicationSyncManager.m; sourceTree = "<group>"; };
389F86B113608C7900004CA4 /* TICDSOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TICDSOperation.h; sourceTree = "<group>"; };
389F86B213608C7900004CA4 /* TICDSOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TICDSOperation.m; sourceTree = "<group>"; };
389F86B51360902900004CA4 /* DropboxBoth.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = DropboxBoth.png; sourceTree = "<group>"; };
@@ -65,8 +76,6 @@
389F86B81360902900004CA4 /* TISLSynchronizationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TISLSynchronizationController.h; sourceTree = "<group>"; };
389F86B91360902900004CA4 /* TISLSynchronizationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TISLSynchronizationController.m; sourceTree = "<group>"; };
389F86BA1360902900004CA4 /* TISLSynchronizationWindow.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TISLSynchronizationWindow.xib; sourceTree = "<group>"; };
- 389F86C11360911B00004CA4 /* TICDSLocalDropboxApplicationSyncManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TICDSLocalDropboxApplicationSyncManager.h; sourceTree = "<group>"; };
- 389F86C21360911B00004CA4 /* TICDSLocalDropboxApplicationSyncManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TICDSLocalDropboxApplicationSyncManager.m; sourceTree = "<group>"; };
389F86C4136092D900004CA4 /* TICDSUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TICDSUtilities.h; sourceTree = "<group>"; };
389F86C5136092D900004CA4 /* TICDSUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TICDSUtilities.m; sourceTree = "<group>"; };
389F86C71360933F00004CA4 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
@@ -189,6 +198,27 @@
name = "Supporting Files";
sourceTree = "<group>";
};
+ 389D767B1361A53D007F19DC /* File Manager-Based Sync */ = {
+ isa = PBXGroup;
+ children = (
+ 389D767C1361A577007F19DC /* TICDSFileManagerBasedApplicationRegistrationOperation.h */,
+ 389D767D1361A577007F19DC /* TICDSFileManagerBasedApplicationRegistrationOperation.m */,
+ 389D76861361AB83007F19DC /* TICDSFileManagerBasedApplicationSyncManager.h */,
+ 389D76871361AB84007F19DC /* TICDSFileManagerBasedApplicationSyncManager.m */,
+ );
+ path = "File Manager-Based Sync";
+ sourceTree = "<group>";
+ };
+ 389D767F1361AA64007F19DC /* 05 File Structure */ = {
+ isa = PBXGroup;
+ children = (
+ 389D76801361AA8A007F19DC /* deviceInfo.plist */,
+ 389D76811361AA8A007F19DC /* documentInfo.plist */,
+ 389D76821361AA8A007F19DC /* ReadMe.txt */,
+ );
+ path = "05 File Structure";
+ sourceTree = "<group>";
+ };
389F86B41360900F00004CA4 /* Synchronization */ = {
isa = PBXGroup;
children = (
@@ -202,22 +232,14 @@
name = Synchronization;
sourceTree = "<group>";
};
- 389F86C0136090EA00004CA4 /* Local Dropbox Sync */ = {
- isa = PBXGroup;
- children = (
- 389F86C11360911B00004CA4 /* TICDSLocalDropboxApplicationSyncManager.h */,
- 389F86C21360911B00004CA4 /* TICDSLocalDropboxApplicationSyncManager.m */,
- );
- path = "Local Dropbox Sync";
- sourceTree = "<group>";
- };
38FFACB413604068004758EE /* TICoreDataSync */ = {
isa = PBXGroup;
children = (
38FFACB513604102004758EE /* TICoreDataSync.h */,
38FFACB6136041ED004758EE /* 01 Headers and Constants */,
38FFACBA1360435B004758EE /* 02 Primary Classes */,
382390CB1360874B0068EB37 /* 04 Utilities */,
+ 389D767F1361AA64007F19DC /* 05 File Structure */,
38FFACBE13604B38004758EE /* 06 External Sources */,
);
name = TICoreDataSync;
@@ -238,7 +260,7 @@
38FFACBA1360435B004758EE /* 02 Primary Classes */ = {
isa = PBXGroup;
children = (
- 389F86C0136090EA00004CA4 /* Local Dropbox Sync */,
+ 389D767B1361A53D007F19DC /* File Manager-Based Sync */,
382390CF136089F40068EB37 /* Generic Operations */,
38FFACBB1360439F004758EE /* TICDSApplicationSyncManager.h */,
38FFACBC1360439F004758EE /* TICDSApplicationSyncManager.m */,
@@ -313,6 +335,9 @@
389F86BC1360902900004CA4 /* DropboxText.png in Resources */,
389F86BD1360902900004CA4 /* DropboxLogo.png in Resources */,
389F86BF1360902900004CA4 /* TISLSynchronizationWindow.xib in Resources */,
+ 389D76831361AA8A007F19DC /* deviceInfo.plist in Resources */,
+ 389D76841361AA8A007F19DC /* documentInfo.plist in Resources */,
+ 389D76851361AA8A007F19DC /* ReadMe.txt in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -334,9 +359,10 @@
382390D513608AAF0068EB37 /* TICDSError.m in Sources */,
389F86B313608C7900004CA4 /* TICDSOperation.m in Sources */,
389F86BE1360902900004CA4 /* TISLSynchronizationController.m in Sources */,
- 389F86C31360911B00004CA4 /* TICDSLocalDropboxApplicationSyncManager.m in Sources */,
389F86C6136092D900004CA4 /* TICDSUtilities.m in Sources */,
389F86CD136093D800004CA4 /* TISLAppDelegate.m in Sources */,
+ 389D767E1361A577007F19DC /* TICDSFileManagerBasedApplicationRegistrationOperation.m in Sources */,
+ 389D76881361AB84007F19DC /* TICDSFileManagerBasedApplicationSyncManager.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -41,7 +41,7 @@ @implementation TISLSynchronizationController
+ (void)initialize
{
// Set Logging Verbosity (DEBUG must be #defined to see logs, regardless of verbosity setting)
- //[TICDSLog setVerbosity:TICDSLogVerbosityEveryStep];
+ [TICDSLog setVerbosity:TICDSLogVerbosityEveryStep];
}
- (void)enableSynchronizationIfNecessaryShouldOpenViewIfDisabled:(BOOL)shouldOpenView
@@ -67,11 +67,11 @@ - (void)registerDropboxClient
{
// Fetch the default sync manager (will be created by this call)
// This application uses only one global sync manager for any sync'd documents
- TICDSApplicationSyncManager *syncManager = [TICDSLocalDropboxApplicationSyncManager defaultApplicationSyncManager];
+ TICDSApplicationSyncManager *syncManager = [TICDSFileManagerBasedApplicationSyncManager defaultApplicationSyncManager];
NSURL *dropboxLocation = [NSURL fileURLWithPath:[[NSUserDefaults standardUserDefaults] valueForKey:kTISLUserDropboxLocation]];
- [(TICDSLocalDropboxApplicationSyncManager *)syncManager setLocalDropboxLocation:dropboxLocation];
+ [(TICDSFileManagerBasedApplicationSyncManager *)syncManager setLocalApplicationContainingDirectoryLocation:dropboxLocation];
// Get a unique client ID for this client from user defaults, generating one if it doesn't already exist
NSString *clientUuid = [[NSUserDefaults standardUserDefaults] stringForKey:kTISLSynchronizationClientIdentifier];
@@ -182,7 +182,7 @@ - (void)downloadSelectedDocument
NSString *itemIdentifier = [[[self dropboxListOfAvailableDocumentsArray] objectAtIndex:selectedRow] valueForKey:kTICDSDocumentIdentifier];
- TICDSApplicationSyncManager *syncManager = [TICDSLocalDropboxApplicationSyncManager defaultApplicationSyncManager];
+ TICDSApplicationSyncManager *syncManager = [TICDSFileManagerBasedApplicationSyncManager defaultApplicationSyncManager];
[syncManager requestDownloadOfDocumentStoreWithIdentifier:itemIdentifier toFileLocation:fileLocation];
}
@@ -10,8 +10,9 @@
#pragma mark Primary Classes
#import "TICDSApplicationSyncManager.h"
-#pragma mark Local Dropbox
-#import "TICDSLocalDropboxApplicationSyncManager.h"
+#pragma mark File Manager-Based
+#import "TICDSFileManagerBasedApplicationSyncManager.h"
+#import "TICDSFileManagerBasedApplicationRegistrationOperation.h"
#pragma mark Operations
#import "TICDSOperation.h"
@@ -10,8 +10,9 @@
#pragma mark PRIMARY CLASSES
@class TICDSApplicationSyncManager;
-#pragma mark Local Dropbox
-@class TICDSLocalDropboxApplicationSyncManager;
+#pragma mark File Manager-Based
+@class TICDSFileManagerBasedApplicationSyncManager;
+@class TICDSFileManagerBasedApplicationRegistrationOperation;
#pragma mark Operations
@class TICDSOperation;
@@ -19,6 +19,15 @@ typedef enum _TICDSApplicationSyncManagerState {
TICDSApplicationSyncManagerStateRegistering = -110,
} TICDSApplicationSyncManagerState;
+#pragma mark Existence
+typedef enum _TICDSRemoteFileStructureExistsResponseType {
+
+ TICDSRemoteFileStructureExistsResponseTypeError = 0,
+ TICDSRemoteFileStructureExistsResponseTypeDoesNotExist = -1,
+ TICDSRemoteFileStructureExistsResponseTypeDoesExist = 1,
+
+} TICDSRemoteFileStructureExistsResponseType;
+
#pragma mark Logging
typedef enum _TICDSLogVerbosity {
TICDSLogVerbosityNoLogging = 0,
@@ -62,6 +71,10 @@ extern NSString * const TICDSErrorClassAndMethod;
extern NSString * const TICDSErrorDomain;
extern NSString * const kTICDSClientDeviceDescription;
+extern NSString * const kTICDSClientDeviceUserInfo;
extern NSString * const kTICDSLastSyncDate;
extern NSString * const kTICDSDocumentIdentifier;
-extern NSString * const kTICDSDocumentName;
+extern NSString * const kTICDSDocumentName;
+
+extern NSString * const kTICDSUtilitiesFileStructureClientDeviceUID;
+extern NSString * const kTICDSUtilitiesFileStructureDocumentUID;
@@ -15,6 +15,10 @@
NSString * const TICDSErrorDomain = @"com.timisted.ticoredatasync";
NSString * const kTICDSClientDeviceDescription = @"kTICDSClientDeviceDescription";
+NSString * const kTICDSClientDeviceUserInfo = @"kTICDSClientDeviceUserInfo";
NSString * const kTICDSLastSyncDate = @"kTICDSLastSyncDate";
NSString * const kTICDSDocumentIdentifier = @"kTICDSDocumentIdentifier";
-NSString * const kTICDSDocumentName = @"kTICDSDocumentName";
+NSString * const kTICDSDocumentName = @"kTICDSDocumentName";
+
+NSString * const kTICDSUtilitiesFileStructureClientDeviceUID = @"kTICDSUtilitiesFileStructureClientDeviceUID";
+NSString * const kTICDSUtilitiesFileStructureDocumentUID = @"kTICDSUtilitiesFileStructureDocumentUID";
@@ -0,0 +1,25 @@
+//
+// TICDSFileManagerBasedApplicationRegistrationOperation.h
+// ShoppingListMac
+//
+// Created by Tim Isted on 22/04/2011.
+// Copyright 2011 Tim Isted. All rights reserved.
+//
+
+#import "TICDSApplicationRegistrationOperation.h"
+
+
+@interface TICDSFileManagerBasedApplicationRegistrationOperation : TICDSApplicationRegistrationOperation {
+@private
+ NSURL *_localApplicationDirectoryLocation;
+ NSURL *_localDocumentsDirectoryLocation;
+ NSURL *_localClientDevicesDirectoryLocation;
+ NSURL *_localClientDevicesThisClientDeviceDirectoryLocation;
+}
+
+@property (nonatomic, retain) NSURL *localApplicationDirectoryLocation;
+@property (nonatomic, retain) NSURL *localDocumentsDirectoryLocation;
+@property (nonatomic, retain) NSURL *localClientDevicesDirectoryLocation;
+@property (nonatomic, retain) NSURL *localClientDevicesThisClientDeviceDirectoryLocation;
+
+@end
Oops, something went wrong.

0 comments on commit 3363572

Please sign in to comment.