This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)fetchContactsWithCompletion:(void(^)(NSArray *entities))completion { | |
NSString *resourcePath = @"ContactCollection?$filter=length(company) gt 0 and length(function) gt 0"; | |
[self scheduleRequestForResource:resourcePath withMode:SODataRequestModeRead withEntity:nil withCompletion:^(NSArray *entities, id<SODataRequestExecution> requestExecution, NSError *error) { | |
if (entities) { | |
completion(entities); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)fetchContactsWithCompletion:(void(^)(NSArray *entities))completion { | |
NSString *resourcePath = @"ContactCollection; | |
[self scheduleRequestForResource:resourcePath withMode:SODataRequestModeRead withEntity:nil withCompletion:^(NSArray *entities, id<SODataRequestExecution> requestExecution, NSError *error) { | |
if (entities) { | |
NSMutableArray *completeEntities = [[NSMutableArray alloc] init]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(id<ODataStore>)storeForRequestToResourcePath:(NSString *)resourcePath | |
{ | |
/* | |
First, test if mode is online- or offline-only anyway. | |
*/ | |
if (self.workingMode == WorkingModeOnline) { | |
return self.networkStore; | |
} else if (self.workingMode == WorkingModeOffline) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "ODataStore.h" | |
#import "SODataStore.h" | |
#import "SODataStoreSync.h" | |
#import "SODataStoreAsync.h" | |
#import "Framework-Constants.h" | |
@interface DataController : NSObject | |
@property (nonatomic, assign) WorkingModes workingMode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)createEntity:(id<SODataEntity>) entity withCompletion:(void(^)(BOOL success))completion; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) scheduleRequest:(id<SODataRequestParam>)request completionHandler:(void(^)(NSArray *entities, id<SODataRequestExecution>requestExecution, NSError *error))completion | |
NSString *finishedSubscription = [NSString stringWithFormat:@"%@.%@", kRequestDelegateFinished, request]; | |
[[NSNotificationCenter defaultCenter] addObserverForName:finishedSubscription | |
object:nil | |
queue:[NSOperationQueue mainQueue] | |
usingBlock:^(NSNotification *note) { | |
id<SODataRequestExecution>requestExecution = note.object; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)fetchTravelAgenciesSampleWithCompletion:(void(^)(NSArray *entities))completion { | |
NSString *resourcePath = @"TravelagencyCollection"; | |
SODataRequestParamSingleDefault *myRequest = [[SODataRequestParamSingleDefault alloc] initWithMode:mode resourcePath:resourcePath]; | |
myRequest.payload = entity ? entity : nil; | |
[self scheduleRequest:myRequest completionHandler:^(NSArray *entities, id<SODataRequestExecution> requestExecution, NSError *error) { | |
if (entities) { | |
completion(entities); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { | |
if ([[segue identifier] isEqualToString:@"ReturnInputFromAdd"]) { | |
self.properties = [NSMutableArray array]; | |
prop = [[SODataPropertyDefault alloc] initWithName:@"NAME"]; | |
prop.value = self.nameInput.text; | |
[self.properties addObject:prop]; | |
… | |
prop = [[SODataPropertyDefault alloc] initWithName:@"URL"]; | |
prop.value = self.urlInput.text; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void) requestServerResponse:(id<SODataRequestExecution>)requestExecution | |
{ | |
id<SODataRequestExecution>requestExecution = note.object; | |
id<SODataResponse> response = requestExecution.response; | |
id<SODataResponseSingle> respSingle = (id<SODataResponseSingle>) response; | |
id<SODataPayload> p = respSingle.payload; | |
SODataEntitySetDefault *entities = (id<SODataEntitySet>)p; | |
if ([requestExecution.request.customTag isEqualToString:@"AccountRequest"]) { |