/
RHDataModel.h
81 lines (57 loc) · 2.41 KB
/
RHDataModel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//
// MapDataModel.h
// Rhus Iphone
//
// Created by Deep Winter on 2/1/12.
//
#import <Foundation/Foundation.h>
#import "RHDataModel.h"
#import <Couchbase/CouchbaseMobile.h>
#import <CouchCocoa/CouchCocoa.h>
typedef void ( ^CompletedBlock )();
@interface RHDataModel : NSObject {
CouchPersistentReplication* _pull;
CouchPersistentReplication* _push;
CompletedBlock syncCompletedBlock;
BOOL syncStarted;
NSTimer * syncTimeoutTimer;
NSString * project;
}
@property (nonatomic, strong) CouchDatabase *database;
@property (nonatomic, strong) CouchLiveQuery* query;
@property (nonatomic, strong) NSTimer * syncTimeoutTimer;
@property (nonatomic, strong) NSString * project;
- (id) initWithBlock: ( void ( ^ )() ) didStartBlock ;
- (void)showAlert: (NSString*)message error: (NSError*)error fatal: (BOOL)fatal;
- (NSArray *) _getUserDocuments;
- (void) initializeQuery;
- (NSArray *) _getUserDocuments;
-(void) test;
- (void)updateSyncURL;
- (void)updateSyncURLWithCompletedBlock: ( CompletedBlock ) setCompletedBlock;
- (void)forgetSync;
- (NSArray *) getView: (NSString *) viewName;
+ (void) initializeServer;
+ (RHDataModel *) instance;
+ (NSArray *) getUserDocuments;
+ (NSArray *) getUserDocumentsWithOffset: (NSInteger) offset andLimit: (NSInteger) limit;
+ (NSDictionary *) getDocumentById: (NSString *) documentId;
+ (NSDictionary *) getDocumentAtIndex: (NSUInteger) index;
+ (NSDictionary *) getNextDocument: (NSString *) documentId;
+ (NSDictionary *) getPrevDocument: (NSString *) documentId;
+ (NSDictionary *) getDetailDocument: (NSString *) documentId;
+ (NSArray *) getDocuments;
+ (NSArray *) getAllDocuments;
+ (NSArray *) getDocumentsInProject: (NSString *) project;
+ (NSArray *) getDocumentsInProject: (NSString *) project since: (NSString*) date;
+ (NSArray *) getProjects;
+ (void) addProject:(NSString *) projectName;
//+ (UIImage *) getThumbnailForId: (NSString *) documentId;
//+ (UIImage *) getImageForId: (NSString *) documentId;
+ (void) addDocument: (NSDictionary *) document;
+ (void) addDocument: (NSDictionary *) document withAttachments: (NSDictionary *) attachments;
+ (NSArray *) getDetailDocumentsWithStartKey: (NSString *) startKey andLimit: (NSInteger) limit;
+ (NSArray *) getGalleryDocumentsWithStartKey: (NSString *) startKey andLimit: (NSInteger) limit;
+ (NSArray *) getDeviceUserGalleryDocumentsWithStartKey: (NSString *) startKey andLimit: (NSInteger) limit;
- (id) init;
@end