Showing
5 changed files
with
116 additions
and
0 deletions
... | @@ -103,6 +103,8 @@ | ... | @@ -103,6 +103,8 @@ |
103 | - (void)didReceiveNotification:(NSDictionary *)payload; | 103 | - (void)didReceiveNotification:(NSDictionary *)payload; |
104 | - (BOOL)checkforLoyaltySDKNotification:(NSDictionary *)payload; | 104 | - (BOOL)checkforLoyaltySDKNotification:(NSDictionary *)payload; |
105 | // TEST CODE FOR PUSH | 105 | // TEST CODE FOR PUSH |
106 | +// - (BOOL)checkforLoyaltySDKNotification:(NSDictionary *)payload whileAppWasInState:(UIApplicationState)appState; | ||
107 | +// TEST CODE FOR PUSH | ||
106 | // - (BOOL)checkforLoyaltySDKNotification:(NSDictionary *)payload :(void(^)(NSNumber *successResponse))success failureBlock:(void(^)(NSNumber *failureResponse))failure; | 108 | // - (BOOL)checkforLoyaltySDKNotification:(NSDictionary *)payload :(void(^)(NSNumber *successResponse))success failureBlock:(void(^)(NSNumber *failureResponse))failure; |
107 | - (void)sendDeviceInfoIfNecessary:(NSString *)newDeviceToken; | 109 | - (void)sendDeviceInfoIfNecessary:(NSString *)newDeviceToken; |
108 | - (void)editProfileAsync:(NSString*)firstname andLastname:(NSString*)lastname andEmail:(NSString *)email andSalutation:(NSString *)salutation andMsisdn:(NSString *)msisdn andNickname:(NSString *)nickname andGender:(NSString *)gender andBirthday:(NSString *)birthday andNameDay:(NSString *)nameday andTaxID:(NSString *)taxid andProfileMetadata:(NSDictionary *)profileMetadata optin:(NSNumber *)optin newsLetter:(NSNumber *)newsletter andSMS:(NSNumber *)sms andSegmentation:(NSNumber *)segmentation andSMSSegmentation:(NSNumber *)smsSegmentation :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | 110 | - (void)editProfileAsync:(NSString*)firstname andLastname:(NSString*)lastname andEmail:(NSString *)email andSalutation:(NSString *)salutation andMsisdn:(NSString *)msisdn andNickname:(NSString *)nickname andGender:(NSString *)gender andBirthday:(NSString *)birthday andNameDay:(NSString *)nameday andTaxID:(NSString *)taxid andProfileMetadata:(NSDictionary *)profileMetadata optin:(NSNumber *)optin newsLetter:(NSNumber *)newsletter andSMS:(NSNumber *)sms andSegmentation:(NSNumber *)segmentation andSMSSegmentation:(NSNumber *)smsSegmentation :(void(^)(NSDictionary *response))success failureBlock:(void(^)(NSError *error))failure; | ... | ... |
... | @@ -1621,6 +1621,12 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; | ... | @@ -1621,6 +1621,12 @@ NSString *VERIFY_URL = @"/partners/cosmote/verify"; |
1621 | } | 1621 | } |
1622 | 1622 | ||
1623 | // TEST CODE FOR PUSH | 1623 | // TEST CODE FOR PUSH |
1624 | +// - (BOOL)checkforLoyaltySDKNotification:(NSDictionary *)payload whileAppWasInState:(UIApplicationState)appState { | ||
1625 | + | ||
1626 | +// return [[Warply sharedService].pushManager checkforLoyaltySDKNotificationPM:payload whileAppWasInState:appState]; | ||
1627 | +// } | ||
1628 | + | ||
1629 | +// TEST CODE FOR PUSH | ||
1624 | // - (BOOL)checkforLoyaltySDKNotification:(NSDictionary *)payload :(void(^)(NSNumber *successResponse))success failureBlock:(void(^)(NSNumber *failureResponse))failure { | 1630 | // - (BOOL)checkforLoyaltySDKNotification:(NSDictionary *)payload :(void(^)(NSNumber *successResponse))success failureBlock:(void(^)(NSNumber *failureResponse))failure { |
1625 | 1631 | ||
1626 | // return [[Warply sharedService].pushManager checkforLoyaltySDKNotificationPM:payload :^(NSNumber *successResponse) { | 1632 | // return [[Warply sharedService].pushManager checkforLoyaltySDKNotificationPM:payload :^(NSNumber *successResponse) { | ... | ... |
... | @@ -163,6 +163,8 @@ typedef enum WLApplicationState : unsigned int{ | ... | @@ -163,6 +163,8 @@ typedef enum WLApplicationState : unsigned int{ |
163 | 163 | ||
164 | - (BOOL)checkforLoyaltySDKNotificationPM:(NSDictionary *)userInfo; | 164 | - (BOOL)checkforLoyaltySDKNotificationPM:(NSDictionary *)userInfo; |
165 | // TEST CODE FOR PUSH | 165 | // TEST CODE FOR PUSH |
166 | +// - (BOOL)checkforLoyaltySDKNotificationPM:(NSDictionary *)userInfo whileAppWasInState:(UIApplicationState)appState; | ||
167 | +// TEST CODE FOR PUSH | ||
166 | // - (BOOL)checkforLoyaltySDKNotificationPM:(NSDictionary *)userInfo :(void(^)(NSNumber *successResponse))success failureBlock:(void(^)(NSNumber *failureResponse))failure; | 168 | // - (BOOL)checkforLoyaltySDKNotificationPM:(NSDictionary *)userInfo :(void(^)(NSNumber *successResponse))success failureBlock:(void(^)(NSNumber *failureResponse))failure; |
167 | 169 | ||
168 | /*! | 170 | /*! | ... | ... |
... | @@ -387,6 +387,104 @@ static const char* jailbreak_apps[] = | ... | @@ -387,6 +387,104 @@ static const char* jailbreak_apps[] = |
387 | } | 387 | } |
388 | 388 | ||
389 | // TEST CODE FOR PUSH | 389 | // TEST CODE FOR PUSH |
390 | +// - (BOOL)checkforLoyaltySDKNotificationPM:(NSDictionary *)userInfo whileAppWasInState:(UIApplicationState)appState | ||
391 | +// { | ||
392 | +// // TODO: Check if this guard should be commented | ||
393 | +// if ([userInfo valueForKey:@"_a"] == nil) { | ||
394 | +// // The push was sent from another push service | ||
395 | +// return NO; | ||
396 | +// } | ||
397 | + | ||
398 | +// // TODO: Check if states are correct, especially from didFinishLaunchingWithOptions | ||
399 | +// WLApplicationState state; | ||
400 | +// if (appState == UIApplicationStateActive) | ||
401 | +// state = WLApplicationStateActive; | ||
402 | +// else if (appState == UIApplicationStateInactive) | ||
403 | +// state = WLApplicationStateClosed; | ||
404 | +// else | ||
405 | +// state = WLApplicationStateBackground; | ||
406 | + | ||
407 | +// // if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) | ||
408 | +// // state = WLApplicationStateActive; | ||
409 | +// // else if ([UIApplication sharedApplication].applicationState == UIApplicationStateInactive) | ||
410 | +// // state = WLApplicationStateClosed; | ||
411 | +// // else | ||
412 | +// // state = WLApplicationStateBackground; | ||
413 | + | ||
414 | + | ||
415 | +// NSData *jsonData = [NSJSONSerialization dataWithJSONObject:userInfo options:NSJSONWritingPrettyPrinted error:nil]; | ||
416 | +// NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; | ||
417 | +// WLLOG(@"Did receive push: %@", jsonString); | ||
418 | +// WLInboxItem *inboxItem = [[WLInboxItem alloc] initWithAttributes:userInfo] ; | ||
419 | +// // [WLAnalyticsManager logUserReceivedPush:inboxItem]; | ||
420 | + | ||
421 | +// if (state != WLApplicationStateActive) { | ||
422 | +// [WLAnalyticsManager logUserEngagedPush:inboxItem]; | ||
423 | +// } | ||
424 | + | ||
425 | +// if (inboxItem.action != 0) { | ||
426 | +// [self.customPushHanlder didReceiveRemoteNotification:userInfo whileAppWasInState:state]; | ||
427 | +// return YES; | ||
428 | +// } | ||
429 | +// switch (state) { | ||
430 | +// case WLApplicationStateActive: | ||
431 | +// { | ||
432 | +// NSLog(@"=== WLApplicationStateActive: %u", state); | ||
433 | +// NSLog(@"=== userInfo: %@", userInfo); | ||
434 | +// NSLog(@"=== userInfo aps: %@", [userInfo objectForKey:@"aps"]); | ||
435 | +// NSLog(@"=== userInfo aps alert: %@", [[userInfo objectForKey:@"aps"] objectForKey:@"alert"]); | ||
436 | + | ||
437 | +// UIAlertController * alert = [UIAlertController alertControllerWithTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] message:@"" preferredStyle:UIAlertControllerStyleAlert]; | ||
438 | + | ||
439 | +// UIAlertAction* yesButton = [UIAlertAction | ||
440 | +// actionWithTitle:NSLocalizedString(@"Close", @"Warply") | ||
441 | +// style:UIAlertActionStyleDefault | ||
442 | +// handler:^(UIAlertAction * action) { | ||
443 | +// //Handle your yes please button action here | ||
444 | +// }]; | ||
445 | + | ||
446 | +// UIAlertAction* noButton = [UIAlertAction | ||
447 | +// actionWithTitle:NSLocalizedString(@"View", @"Warply") | ||
448 | +// style:UIAlertActionStyleDefault | ||
449 | +// handler:^(UIAlertAction * action) { | ||
450 | +// //Handle no, thanks button | ||
451 | +// }]; | ||
452 | + | ||
453 | +// [alert addAction:yesButton]; | ||
454 | +// [alert addAction:noButton]; | ||
455 | + | ||
456 | +// UIWindow *alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; | ||
457 | +// alertWindow.rootViewController = [[UIViewController alloc] init]; | ||
458 | +// alertWindow.windowLevel = UIWindowLevelAlert + 1; | ||
459 | +// [alertWindow makeKeyAndVisible]; | ||
460 | +// [alertWindow.rootViewController presentViewController:alert animated:YES completion:nil]; | ||
461 | + | ||
462 | +// // UIAlertView *alert = [[UIAlertView alloc] init]; | ||
463 | +// // [alert setTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"]]; | ||
464 | +// // [alert addButtonWithTitle:NSLocalizedString(@"Close", @"Warply")]; | ||
465 | +// // [alert addButtonWithTitle:NSLocalizedString(@"View", @"Warply")]; | ||
466 | +// // [alert setDelegate:self]; | ||
467 | +// // [alert show]; | ||
468 | + | ||
469 | +// self.pendingItem = inboxItem; | ||
470 | +// break; | ||
471 | +// } | ||
472 | +// case WLApplicationStateBackground: | ||
473 | +// { | ||
474 | +// WLLOG(@"=== WLApplicationStateBackground: %u", state); | ||
475 | + | ||
476 | +// [self showItem:inboxItem]; | ||
477 | +// break; | ||
478 | +// } | ||
479 | +// case WLApplicationStateClosed: | ||
480 | +// WLLOG(@"=== WLApplicationStateClosed: %u", state); | ||
481 | +// self.pendingItem = inboxItem; | ||
482 | +// break; | ||
483 | +// } | ||
484 | +// return YES; | ||
485 | +// } | ||
486 | + | ||
487 | +// TEST CODE FOR PUSH | ||
390 | // - (BOOL)checkforLoyaltySDKNotificationPM:(NSDictionary *)userInfo :(void(^)(NSNumber *successResponse))success failureBlock:(void(^)(NSNumber *failureResponse))failure | 488 | // - (BOOL)checkforLoyaltySDKNotificationPM:(NSDictionary *)userInfo :(void(^)(NSNumber *successResponse))success failureBlock:(void(^)(NSNumber *failureResponse))failure |
391 | // { | 489 | // { |
392 | // // TODO: Check if this guard should be commented | 490 | // // TODO: Check if this guard should be commented | ... | ... |
... | @@ -5769,6 +5769,14 @@ public class swiftApi { | ... | @@ -5769,6 +5769,14 @@ public class swiftApi { |
5769 | 5769 | ||
5770 | 5770 | ||
5771 | // TEST CODE FOR PUSH | 5771 | // TEST CODE FOR PUSH |
5772 | + // public func checkForLoyaltySDKNotification(_ payload: [String : Any], _ appState: UIApplication.State) -> Bool { | ||
5773 | + | ||
5774 | + // let instanceOfMyApi = MyApi() | ||
5775 | + // return instanceOfMyApi.checkforLoyaltySDKNotification(payload, whileAppWasIn: appState) | ||
5776 | + // } | ||
5777 | + | ||
5778 | + | ||
5779 | +// TEST CODE FOR PUSH | ||
5772 | // public func checkForLoyaltySDKNotification(_ payload: [String : Any]) -> Bool { | 5780 | // public func checkForLoyaltySDKNotification(_ payload: [String : Any]) -> Bool { |
5773 | 5781 | ||
5774 | // let instanceOfMyApi = MyApi() | 5782 | // let instanceOfMyApi = MyApi() | ... | ... |
-
Please register or login to post a comment