Vasilis

addition of getinbox2 again

1 /* 1 /*
2 Copyright 2010-2016 Warply Inc. All rights reserved. 2 Copyright 2010-2016 Warply Inc. All rights reserved.
3 3
4 - Redistribution and use in source and binary forms, without modification, 4 + Redistribution and use in source and binary forms, without modification,
5 are permitted provided that the following conditions are met: 5 are permitted provided that the following conditions are met:
6 6
7 1. Redistributions of source code must retain the above copyright notice, this 7 1. Redistributions of source code must retain the above copyright notice, this
...@@ -137,8 +137,8 @@ typedef enum { ...@@ -137,8 +137,8 @@ typedef enum {
137 */ 137 */
138 /*! 138 /*!
139 @abstract Launching the Warply service. 139 @abstract Launching the Warply service.
140 - @discussion This class method initialises the shared instance of WLAppService, 140 + @discussion This class method initialises the shared instance of WLAppService,
141 - passes the launch options (if any) to managers in order to handle them and 141 + passes the launch options (if any) to managers in order to handle them and
142 launches the communication with Warply service using the provided unique app identification. 142 launches the communication with Warply service using the provided unique app identification.
143 @param appUUID A string with the unique app identification. 143 @param appUUID A string with the unique app identification.
144 @param launchOptions A dictionary with the application launch options. May be 144 @param launchOptions A dictionary with the application launch options. May be
...@@ -264,7 +264,7 @@ WL_VERSION_INTERFACE() ...@@ -264,7 +264,7 @@ WL_VERSION_INTERFACE()
264 */ 264 */
265 /*! 265 /*!
266 @abstract Send an event. 266 @abstract Send an event.
267 - @discussion This method sends an event. This event is stored into a local DB 267 + @discussion This method sends an event. This event is stored into a local DB
268 and is sent over to Warply service when a threshold of stored events is exceeded or immediately if the priority parameter is YES 268 and is sent over to Warply service when a threshold of stored events is exceeded or immediately if the priority parameter is YES
269 @param event A WLEvent object. 269 @param event A WLEvent object.
270 @param priority A BOOL value indicating if the event should be sent immediately or not. 270 @param priority A BOOL value indicating if the event should be sent immediately or not.
...@@ -284,10 +284,8 @@ WL_VERSION_INTERFACE() ...@@ -284,10 +284,8 @@ WL_VERSION_INTERFACE()
284 */ 284 */
285 - (BOOL)getInboxWithSuccessBlock:(void (^)(NSArray *list))success failureBlock:(void (^)(NSError *error))failure; 285 - (BOOL)getInboxWithSuccessBlock:(void (^)(NSArray *list))success failureBlock:(void (^)(NSError *error))failure;
286 286
287 -
288 - (BOOL)getInbox2WithSuccessBlock:(void (^)(NSArray *list))success failureBlock:(void (^)(NSError *error))failure; 287 - (BOOL)getInbox2WithSuccessBlock:(void (^)(NSArray *list))success failureBlock:(void (^)(NSError *error))failure;
289 288
290 -
291 - (void)getProductsWithSuccessBlock:(NSString*)filter :(void(^)(NSMutableArray *params))success failureBlock:(void(^)(NSError *error))failure; 289 - (void)getProductsWithSuccessBlock:(NSString*)filter :(void(^)(NSMutableArray *params))success failureBlock:(void(^)(NSError *error))failure;
292 290
293 - (void)sendContactWithSuccessBlock:(NSString *)name andEmail:(NSString *)email andMsisdn:msisdn andMessage:message :(void(^)(NSMutableArray *params)) success failureBlock:(void(^)(NSError *error))failure; 291 - (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() ...@@ -363,6 +361,7 @@ WL_VERSION_INTERFACE()
363 361
364 - (void) validateCouponWithSuccessBlock:(NSString*) coupon :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; 362 - (void) validateCouponWithSuccessBlock:(NSString*) coupon :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
365 363
364 +- (void)loginCosmoteWithSuccessBlock:(NSString*)guid andAppUuid:(NSString*)appUuid andTicket:(NSString*)ticket :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure;
366 /*! 365 /*!
367 @abstract Get the full page add accordint to the display_type of a campaign. 366 @abstract Get the full page add accordint to the display_type of a campaign.
368 @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. 367 @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() ...@@ -425,7 +424,7 @@ WL_VERSION_INTERFACE()
425 @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. 424 @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.
426 @discussion This method gets the context for the specified path. The success block has a parameter of type 425 @discussion This method gets the context for the specified path. The success block has a parameter of type
427 id as the type of the data returned value may differ in each case depending on the specified 426 id as the type of the data returned value may differ in each case depending on the specified
428 - 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. 427 + 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.
429 */ 428 */
430 - (BOOL)getContextWithPath:(NSString *)path 429 - (BOOL)getContextWithPath:(NSString *)path
431 successBlock:(void (^)(id contextResponse))successBlock 430 successBlock:(void (^)(id contextResponse))successBlock
...@@ -441,7 +440,7 @@ WL_VERSION_INTERFACE() ...@@ -441,7 +440,7 @@ WL_VERSION_INTERFACE()
441 @discussion This method post the context for the specified path. Make sure that 440 @discussion This method post the context for the specified path. Make sure that
442 the path, you are trying to access, has write and not only read permissions. If 441 the path, you are trying to access, has write and not only read permissions. If
443 it has only read permsissions the post will fail with WLResultCodesReadOnly error 442 it has only read permsissions the post will fail with WLResultCodesReadOnly error
444 - 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. 443 + 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.
445 */ 444 */
446 - (BOOL)sendContext:(NSData*)context 445 - (BOOL)sendContext:(NSData*)context
447 successBlock:(void (^)(NSDictionary *contextResponse))successBlock 446 successBlock:(void (^)(NSDictionary *contextResponse))successBlock
...@@ -449,11 +448,11 @@ WL_VERSION_INTERFACE() ...@@ -449,11 +448,11 @@ WL_VERSION_INTERFACE()
449 448
450 /*! 449 /*!
451 @abstract Send all localy stored events to Warply service. 450 @abstract Send all localy stored events to Warply service.
452 - @discussion This method flags and sends all the locally stored events to Warply 451 + @discussion This method flags and sends all the locally stored events to Warply
453 - service. This happend independent if number of locally stored event threshold 452 + service. This happend independent if number of locally stored event threshold
454 - has be reached or not. The events are deleted from local DB only when the call is 453 + has be reached or not. The events are deleted from local DB only when the call is
455 - sucesful. Otherwise, the events remain stored until either the threshold of stored 454 + sucesful. Otherwise, the events remain stored until either the threshold of stored
456 - events is excited and they automatically send to Warply service or this method is 455 + events is excited and they automatically send to Warply service or this method is
457 called again. 456 called again.
458 @attributeblock completionBlock This block is called when sendAllEvents is sucessful. 457 @attributeblock completionBlock This block is called when sendAllEvents is sucessful.
459 @attributeblock failureBlock This block is called when sendAllEvents fails and returns an error object with failure code and description. 458 @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 @@ ...@@ -16,7 +16,6 @@
16 - (void) setToStage; 16 - (void) setToStage;
17 - (void) setLang:(NSString*) lang; 17 - (void) setLang:(NSString*) lang;
18 - (UIViewController *) openCoupons:(UIView*) parentView; 18 - (UIViewController *) openCoupons:(UIView*) parentView;
19 -- (UIViewController *) openGifts;
20 - (void) applicationDidEnterBackground:(UIApplication *)application; 19 - (void) applicationDidEnterBackground:(UIApplication *)application;
21 - (void) applicationWillEnterForeground:(UIApplication *)application; 20 - (void) applicationWillEnterForeground:(UIApplication *)application;
22 - (void) applicationDidBecomeActive:(UIApplication *)application; 21 - (void) applicationDidBecomeActive:(UIApplication *)application;
...@@ -60,6 +59,7 @@ ...@@ -60,6 +59,7 @@
60 - (NSDictionary*)getCouponSetsWithActive:(NSNumber*)active andVisible:(NSNumber*)visible andUuids:(NSArray*)uuids; 59 - (NSDictionary*)getCouponSetsWithActive:(NSNumber*)active andVisible:(NSNumber*)visible andUuids:(NSArray*)uuids;
61 - (NSDictionary*)redeemCouponWithCoupon:(NSString*)coupon; 60 - (NSDictionary*)redeemCouponWithCoupon:(NSString*)coupon;
62 - (NSDictionary*)validateCouponWithCoupon:(NSString*)coupon; 61 - (NSDictionary*)validateCouponWithCoupon:(NSString*)coupon;
62 +- (NSDictionary*)loginCosmoteWithGuid:(NSString*)guid andAppUuid:(NSString*)appUuid andTicket:(NSString*)ticket;
63 63
64 @end 64 @end
65 #endif /* MyApi_h */ 65 #endif /* MyApi_h */
......
...@@ -47,19 +47,11 @@ NSString *LANG; ...@@ -47,19 +47,11 @@ NSString *LANG;
47 } 47 }
48 48
49 - (UIViewController *) openCoupons:(UIView*) parentView{ 49 - (UIViewController *) openCoupons:(UIView*) parentView{
50 +
50 UIViewController *couponsViewController = [CouponsViewInterface couponsViewController:parentView]; 51 UIViewController *couponsViewController = [CouponsViewInterface couponsViewController:parentView];
51 return couponsViewController; 52 return couponsViewController;
52 } 53 }
53 54
54 -- (UIViewController *) openGifts{
55 -
56 - UIViewController *giftsViewController = [GiftsViewInterface giftsViewController];
57 -// controller = [[UINavigationController alloc]initWithRootViewController:profileViewController];
58 -
59 -// [window makeKeyAndVisible];
60 - return giftsViewController;
61 -}
62 -
63 //- (UIViewController *) openCoupons { 55 //- (UIViewController *) openCoupons {
64 //// NSString* const frameworkBundleID = @"framework.warp.ly.WarplySDKFrameworkIOS"; 56 //// NSString* const frameworkBundleID = @"framework.warp.ly.WarplySDKFrameworkIOS";
65 //// NSBundle* bundle = [NSBundle bundleWithIdentifier:frameworkBundleID]; 57 //// NSBundle* bundle = [NSBundle bundleWithIdentifier:frameworkBundleID];
...@@ -1132,4 +1124,31 @@ NSString *LANG; ...@@ -1132,4 +1124,31 @@ NSString *LANG;
1132 } 1124 }
1133 return resp; 1125 return resp;
1134 } 1126 }
1127 +
1128 +- (NSDictionary*)loginCosmoteWithGuid:(NSString*)guid andAppUuid:(NSString*)appUuid andTicket:(NSString*)ticket {
1129 + __block NSDictionary *resp = [NSDictionary alloc];
1130 + __block BOOL isRunLoopNested = NO;
1131 + __block BOOL isOperationCompleted = NO;
1132 + [[Warply sharedService] loginCosmoteWithSuccessBlock:guid andAppUuid:appUuid andTicket:ticket :^(NSDictionary *response) {
1133 + resp = response;
1134 + isOperationCompleted = YES;
1135 + if (isRunLoopNested) {
1136 + CFRunLoopStop(CFRunLoopGetCurrent()); // CFRunLoopRun() returns
1137 + }
1138 + } failureBlock:^(NSError *error) {
1139 + NSLog(@"%@", error);
1140 + resp = nil;
1141 + isOperationCompleted = YES;
1142 + if (isRunLoopNested) {
1143 + CFRunLoopStop(CFRunLoopGetCurrent()); // CFRunLoopRun() returns
1144 + }
1145 + }];
1146 + if ( ! isOperationCompleted) {
1147 + isRunLoopNested = YES;
1148 + NSLog(@"Waiting...");
1149 + CFRunLoopRun(); // Magic!
1150 + isRunLoopNested = NO;
1151 + }
1152 + return resp;
1153 +}
1135 @end 1154 @end
......