Library
ISOSynchronization.h
1 //
2 // ISOSynchronization.h
3 // iSignatureOffice
4 //
5 // Created by Florian Student on 9/24/12.
6 // Copyright (c) 2012 Florian Student. All rights reserved.
7 //
8 
9 #import <Foundation/Foundation.h>
10 
11 typedef void (^callBackBlock)(void);
12 typedef void (^callBackBlockWithURL)(NSURL*);
13 typedef void (^callBackBlockWithString)(NSString*);
14 typedef void (^callBackBlockWithDictionary)(NSDictionary*);
15 
16 #define kErrorCodeNoConnectionToInternet (-1009)
17 #define kErrorCodeLoginDetailsNotSet (90)
18 #define kLoginDataIncorrect (102)
19 #define kErrorNotAllowed (106)
20 #define kErrorDbError (107)
21 #define kErrorInvalidAdHocCode (108)
22 
23 #define kISOCSyncEnded @"ISOCSyncEnded"
24 #define kISOCSyncStarted @"kISOCSyncStarted"
25 
26 #define kProgressBarUpdate @"ProgressBarUpdate"
27 
28 
29 //further error codes from TYR service:
30 //100 = service signature not valid, session expired
31 //101 = braga server exception, severe
32 //102 = login data incorrect
33 //103 = max login tries reached, account locked, try again in 5 minutes
34 //104 = document locked, try again later
35 //105 = document upload failed
36 //public static final int ERROR_NOT_ALLOWED = 106;
37 //public static final int ERROR_DB_ERROR = 107;
38 //public static final int ERROR_INVALID_ADHOC_CODE = 108;
39 
40 @class ISODocument;
41 
42 @interface ISOSynchronization : NSObject
43 
44 
45 + (ISOSynchronization*)sharedSynchronization;
46 
47 - (void)autoLoginOnSuccess:(callBackBlock)onSuccess onFailure:(callBackBlockWithDictionary)onFailure;
48 - (void)loginWithUsername:(NSString*)username andPassword:(NSString*)password onSuccess:(callBackBlock)onSuccess onFailure:(callBackBlockWithDictionary)onFailure;
49 
50 - (NSDictionary*)getSystemMessage;
51 
52 - (void)synchronize;
53 - (void)synchronize:(NSArray*)documentIDs; //For documentIDs == nil, sync everything. Otherwise request filtered list from server, only given document IDs (Array of Integers). Documents not in the list will be deleted at the end of the sync.
54 - (BOOL)loggedIn;
55 - (void)logout;
57 - (void)saveContext;
58 - (NSArray *)allInstancesOf:(NSString*)entityName withPredicate:(NSPredicate*)predicate;
59 - (void)downloadDocument:(ISODocument*)document onSuccess:(callBackBlockWithURL)onSuccess onFailure:(callBackBlockWithDictionary)onFailure;
60 - (void)uploadDocumentAtURL:(NSURL*)url onSuccess:(callBackBlockWithString)onSuccess onFailure:(callBackBlockWithDictionary)onFailure;
61 //- (ISOSigningRequest*)cloneSigningRequest:(ISOSigningRequest*)original;
62 //- (void)deleteSigningRequest:(ISOSigningRequest*)request;
63 - (void)clearAllData;
64 
65 - (ISODocument*)cloneDocument:(ISODocument*)original;
66 - (void)deleteDocument:(ISODocument*)document;
67 - (void)cancelSync;
68 
69 //ISOCapture:
70 - (ISODocument*)getDocumentForAdHocKey:(NSString*)adHocKey fromUrl:(NSURL*) url onSuccess:(callBackBlock)onSuccess onFailure:(callBackBlockWithDictionary)onFailure;
71 - (void)saveDocumentForAdHocKey:(callBackBlock)onSuccess onFailure:(callBackBlockWithDictionary)onFailure;
72 - (void)isoCaptureSendShowSignatureField:(NSNumber*)signatureFieldId forDocument:(ISODocument*)document;
73 - (void)isoCaptureSendCancelSigningForDocument:(ISODocument*)document;
74 
75 @end
void uploadAndSignModifiedDocuments()
Definition: ISOSynchronization.m:1813
BOOL loggedIn()
Definition: ISOSynchronization.m:697
void cancelSync()
Definition: ISOSynchronization.m:671
void clearAllData()
Definition: ISOSynchronization.m:2683
Definition: ISODocument.h:16
Definition: ISOSynchronization.h:42
void saveContext()
Definition: ISOSynchronization.m:2503
NSDictionary * getSystemMessage()
Definition: ISOSynchronization.m:1589