Vasilis

addition of getinbox2 again

/*
Copyright 2010-2016 Warply Inc. All rights reserved.
Redistribution and use in source and binary forms, without modification,
Redistribution and use in source and binary forms, without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
......@@ -137,8 +137,8 @@ typedef enum {
*/
/*!
@abstract Launching the Warply service.
@discussion This class method initialises the shared instance of WLAppService,
passes the launch options (if any) to managers in order to handle them and
@discussion This class method initialises the shared instance of WLAppService,
passes the launch options (if any) to managers in order to handle them and
launches the communication with Warply service using the provided unique app identification.
@param appUUID A string with the unique app identification.
@param launchOptions A dictionary with the application launch options. May be
......@@ -264,7 +264,7 @@ WL_VERSION_INTERFACE()
*/
/*!
@abstract Send an event.
@discussion This method sends an event. This event is stored into a local DB
@discussion This method sends an event. This event is stored into a local DB
and is sent over to Warply service when a threshold of stored events is exceeded or immediately if the priority parameter is YES
@param event A WLEvent object.
@param priority A BOOL value indicating if the event should be sent immediately or not.
......@@ -284,10 +284,8 @@ WL_VERSION_INTERFACE()
*/
- (BOOL)getInboxWithSuccessBlock:(void (^)(NSArray *list))success failureBlock:(void (^)(NSError *error))failure;
- (BOOL)getInbox2WithSuccessBlock:(void (^)(NSArray *list))success failureBlock:(void (^)(NSError *error))failure;
- (void)getProductsWithSuccessBlock:(NSString*)filter :(void(^)(NSMutableArray *params))success failureBlock:(void(^)(NSError *error))failure;
- (void)sendContactWithSuccessBlock:(NSString *)name andEmail:(NSString *)email andMsisdn:msisdn andMessage:message :(void(^)(NSMutableArray *params)) success failureBlock:(void(^)(NSError *error))failure;
......@@ -363,6 +361,7 @@ WL_VERSION_INTERFACE()
- (void) validateCouponWithSuccessBlock:(NSString*) coupon :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
- (void)loginCosmoteWithSuccessBlock:(NSString*)guid andAppUuid:(NSString*)appUuid andTicket:(NSString*)ticket :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
/*!
@abstract Get the full page add accordint to the display_type of a campaign.
@attributeblock successBlock This block is called when getInbox is sucessful and allOffers is empty or nil and returns an array with the available WLInboxItem items. Otherwise, the allOffers array is filtered.
......@@ -425,7 +424,7 @@ WL_VERSION_INTERFACE()
@return Returns YES if the app is registered with Warply and thus the success or failure block will definitely be called and NO otherwise. In the latter case, the call is queued and will be called as soon as / if the app registers with Warply.
@discussion This method gets the context for the specified path. The success block has a parameter of type
id as the type of the data returned value may differ in each case depending on the specified
path. The caller will probably want to use the return parameter and a timer to update the UI or do any other operation after a certain amount of time that the app remains unregistered and thus, cannot make the call.
path. The caller will probably want to use the return parameter and a timer to update the UI or do any other operation after a certain amount of time that the app remains unregistered and thus, cannot make the call.
*/
- (BOOL)getContextWithPath:(NSString *)path
successBlock:(void (^)(id contextResponse))successBlock
......@@ -441,7 +440,7 @@ WL_VERSION_INTERFACE()
@discussion This method post the context for the specified path. Make sure that
the path, you are trying to access, has write and not only read permissions. If
it has only read permsissions the post will fail with WLResultCodesReadOnly error
code. The caller will probably want to use the return parameter and a timer to update the UI or do any other operation after a certain amount of time that the app remains unregistered and thus, cannot make the call.
code. The caller will probably want to use the return parameter and a timer to update the UI or do any other operation after a certain amount of time that the app remains unregistered and thus, cannot make the call.
*/
- (BOOL)sendContext:(NSData*)context
successBlock:(void (^)(NSDictionary *contextResponse))successBlock
......@@ -449,11 +448,11 @@ WL_VERSION_INTERFACE()
/*!
@abstract Send all localy stored events to Warply service.
@discussion This method flags and sends all the locally stored events to Warply
service. This happend independent if number of locally stored event threshold
has be reached or not. The events are deleted from local DB only when the call is
sucesful. Otherwise, the events remain stored until either the threshold of stored
events is excited and they automatically send to Warply service or this method is
@discussion This method flags and sends all the locally stored events to Warply
service. This happend independent if number of locally stored event threshold
has be reached or not. The events are deleted from local DB only when the call is
sucesful. Otherwise, the events remain stored until either the threshold of stored
events is excited and they automatically send to Warply service or this method is
called again.
@attributeblock completionBlock This block is called when sendAllEvents is sucessful.
@attributeblock failureBlock This block is called when sendAllEvents fails and returns an error object with failure code and description.
......
This diff is collapsed. Click to expand it.
......@@ -16,7 +16,6 @@
- (void) setToStage;
- (void) setLang:(NSString*) lang;
- (UIViewController *) openCoupons:(UIView*) parentView;
- (UIViewController *) openGifts;
- (void) applicationDidEnterBackground:(UIApplication *)application;
- (void) applicationWillEnterForeground:(UIApplication *)application;
- (void) applicationDidBecomeActive:(UIApplication *)application;
......@@ -60,6 +59,7 @@
- (NSDictionary*)getCouponSetsWithActive:(NSNumber*)active andVisible:(NSNumber*)visible andUuids:(NSArray*)uuids;
- (NSDictionary*)redeemCouponWithCoupon:(NSString*)coupon;
- (NSDictionary*)validateCouponWithCoupon:(NSString*)coupon;
- (NSDictionary*)loginCosmoteWithGuid:(NSString*)guid andAppUuid:(NSString*)appUuid andTicket:(NSString*)ticket;
@end
#endif /* MyApi_h */
......
......@@ -47,19 +47,11 @@ NSString *LANG;
}
- (UIViewController *) openCoupons:(UIView*) parentView{
UIViewController *couponsViewController = [CouponsViewInterface couponsViewController:parentView];
return couponsViewController;
}
- (UIViewController *) openGifts{
UIViewController *giftsViewController = [GiftsViewInterface giftsViewController];
// controller = [[UINavigationController alloc]initWithRootViewController:profileViewController];
// [window makeKeyAndVisible];
return giftsViewController;
}
//- (UIViewController *) openCoupons {
//// NSString* const frameworkBundleID = @"framework.warp.ly.WarplySDKFrameworkIOS";
//// NSBundle* bundle = [NSBundle bundleWithIdentifier:frameworkBundleID];
......@@ -1132,4 +1124,31 @@ NSString *LANG;
}
return resp;
}
- (NSDictionary*)loginCosmoteWithGuid:(NSString*)guid andAppUuid:(NSString*)appUuid andTicket:(NSString*)ticket {
__block NSDictionary *resp = [NSDictionary alloc];
__block BOOL isRunLoopNested = NO;
__block BOOL isOperationCompleted = NO;
[[Warply sharedService] loginCosmoteWithSuccessBlock:guid andAppUuid:appUuid andTicket:ticket :^(NSDictionary *response) {
resp = response;
isOperationCompleted = YES;
if (isRunLoopNested) {
CFRunLoopStop(CFRunLoopGetCurrent()); // CFRunLoopRun() returns
}
} failureBlock:^(NSError *error) {
NSLog(@"%@", error);
resp = nil;
isOperationCompleted = YES;
if (isRunLoopNested) {
CFRunLoopStop(CFRunLoopGetCurrent()); // CFRunLoopRun() returns
}
}];
if ( ! isOperationCompleted) {
isRunLoopNested = YES;
NSLog(@"Waiting...");
CFRunLoopRun(); // Magic!
isRunLoopNested = NO;
}
return resp;
}
@end
......