Manos Chorianopoulos

push notifications fix

...@@ -43,6 +43,9 @@ ...@@ -43,6 +43,9 @@
43 NSString *_alert; 43 NSString *_alert;
44 NSString *_sound; 44 NSString *_sound;
45 45
46 + NSUInteger _mutable_content;
47 + NSString *_category;
48 +
46 // Test code for push 49 // Test code for push
47 // NSString *_category; 50 // NSString *_category;
48 // NSInteger _mutable_content; 51 // NSInteger _mutable_content;
...@@ -63,6 +66,9 @@ ...@@ -63,6 +66,9 @@
63 */ 66 */
64 @property (nonatomic, copy) NSString *sound; 67 @property (nonatomic, copy) NSString *sound;
65 68
69 +@property (nonatomic) NSUInteger mutable_content;
70 +@property (nonatomic, copy) NSString *category;
71 +
66 /*! 72 /*!
67 @methodgroup Initializing a WLAPSItem Object 73 @methodgroup Initializing a WLAPSItem Object
68 */ 74 */
......
...@@ -52,9 +52,15 @@ ...@@ -52,9 +52,15 @@
52 if ([idx isKindOfClass:[NSNull class]] ) 52 if ([idx isKindOfClass:[NSNull class]] )
53 continue; 53 continue;
54 54
55 + if ([key isEqualToString:@"mutable-content"]) {
56 + [self setValue:idx forKey:@"mutable_content"];
57 + } else {
55 [self setValue:idx forKey:key]; 58 [self setValue:idx forKey:key];
56 } 59 }
57 - @catch (NSException *e) { WLLOG(@"%@: UnKnown Key:%@ - Value:%@", [e name], key, idx); } 60 + }
61 + @catch (NSException *e) {
62 + WLLOG(@"%@: WLAPSItem UnKnown Key:%@ - Value:%@", [e name], key, idx);
63 + }
58 @finally { } 64 @finally { }
59 } 65 }
60 } 66 }
......
...@@ -46,6 +46,11 @@ ...@@ -46,6 +46,11 @@
46 NSString *_message; 46 NSString *_message;
47 WLAPSItem *_apsItem; 47 WLAPSItem *_apsItem;
48 NSDictionary *_customData; 48 NSDictionary *_customData;
49 +
50 + NSString *_EXTRA_FIELDS;
51 + NSString *_attachment_url;
52 + NSString *_data;
53 + NSString *_url;
49 } 54 }
50 /*! 55 /*!
51 @property action 56 @property action
...@@ -90,6 +95,11 @@ ...@@ -90,6 +95,11 @@
90 */ 95 */
91 @property (nonatomic, strong) NSDictionary *customData; 96 @property (nonatomic, strong) NSDictionary *customData;
92 97
98 +@property (nonatomic, copy) NSString *EXTRA_FIELDS;
99 +@property (nonatomic, copy) NSString *attachment_url;
100 +@property (nonatomic, copy) NSString *data;
101 +@property (nonatomic, copy) NSString *url;
102 +
93 /*! 103 /*!
94 @methodgroup Initializing a WLBaseItem Object 104 @methodgroup Initializing a WLBaseItem Object
95 */ 105 */
......
...@@ -55,13 +55,15 @@ ...@@ -55,13 +55,15 @@
55 [self setValue:idx forKey:@"action"]; 55 [self setValue:idx forKey:@"action"];
56 else if ([key isEqualToString:@"aps"]) 56 else if ([key isEqualToString:@"aps"])
57 _apsItem = [[WLAPSItem alloc] initWithAttributes:(NSDictionary*)idx]; 57 _apsItem = [[WLAPSItem alloc] initWithAttributes:(NSDictionary*)idx];
58 + else if ([key isEqualToString:@"attachment-url"])
59 + [self setValue:idx forKey:@"attachment_url"];
58 else 60 else
59 [self setValue:idx forKey:key]; 61 [self setValue:idx forKey:key];
60 } 62 }
61 @catch (NSException *e) { 63 @catch (NSException *e) {
62 [_customData setValue:idx forKey:key]; 64 [_customData setValue:idx forKey:key];
63 - WLLOG(@"%@: UnKnown Key:%@ - Value:%@", [e name], key, idx); } 65 + WLLOG(@"%@: WLBaseItem UnKnown Key:%@ - Value:%@", [e name], key, idx); }
64 - @finally { } 66 + @finally {}
65 } 67 }
66 } 68 }
67 69
......
...@@ -292,37 +292,38 @@ static const char* jailbreak_apps[] = ...@@ -292,37 +292,38 @@ static const char* jailbreak_apps[] =
292 switch (state) { 292 switch (state) {
293 case WLApplicationStateActive: 293 case WLApplicationStateActive:
294 { 294 {
295 - // UIAlertView *alert = [[UIAlertView alloc] init]; 295 + UIAlertView *alert = [[UIAlertView alloc] init];
296 - // [alert setTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"]]; 296 + [alert setTitle:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"title"]];
297 - // [alert addButtonWithTitle:NSLocalizedString(@"Close", @"Warply")]; 297 + [alert setMessage:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"body"]];
298 - // [alert addButtonWithTitle:NSLocalizedString(@"View", @"Warply")]; 298 + [alert addButtonWithTitle:NSLocalizedString(@"Close", @"Warply")];
299 - // [alert setDelegate:self]; 299 + [alert addButtonWithTitle:NSLocalizedString(@"View", @"Warply")];
300 - // [alert show]; 300 + [alert setDelegate:self];
301 - 301 + [alert show];
302 - UIAlertController * alert = [UIAlertController alertControllerWithTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] message:@"" preferredStyle:UIAlertControllerStyleAlert]; 302 +
303 - 303 + // UIAlertController * alert = [UIAlertController alertControllerWithTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] message:@"" preferredStyle:UIAlertControllerStyleAlert];
304 - UIAlertAction* yesButton = [UIAlertAction 304 +
305 - actionWithTitle:NSLocalizedString(@"Close", @"Warply") 305 + // UIAlertAction* yesButton = [UIAlertAction
306 - style:UIAlertActionStyleDefault 306 + // actionWithTitle:NSLocalizedString(@"Close", @"Warply")
307 - handler:^(UIAlertAction * action) { 307 + // style:UIAlertActionStyleDefault
308 - //Handle your yes please button action here 308 + // handler:^(UIAlertAction * action) {
309 - }]; 309 + // //Handle your yes please button action here
310 - 310 + // }];
311 - UIAlertAction* noButton = [UIAlertAction 311 +
312 - actionWithTitle:NSLocalizedString(@"View", @"Warply") 312 + // UIAlertAction* noButton = [UIAlertAction
313 - style:UIAlertActionStyleDefault 313 + // actionWithTitle:NSLocalizedString(@"View", @"Warply")
314 - handler:^(UIAlertAction * action) { 314 + // style:UIAlertActionStyleDefault
315 - //Handle no, thanks button 315 + // handler:^(UIAlertAction * action) {
316 - }]; 316 + // //Handle no, thanks button
317 - 317 + // }];
318 - [alert addAction:yesButton]; 318 +
319 - [alert addAction:noButton]; 319 + // [alert addAction:yesButton];
320 - 320 + // [alert addAction:noButton];
321 - UIWindow *alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 321 +
322 - alertWindow.rootViewController = [[UIViewController alloc] init]; 322 + // UIWindow *alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
323 - alertWindow.windowLevel = UIWindowLevelAlert + 1; 323 + // alertWindow.rootViewController = [[UIViewController alloc] init];
324 - [alertWindow makeKeyAndVisible]; 324 + // alertWindow.windowLevel = UIWindowLevelAlert + 1;
325 - [alertWindow.rootViewController presentViewController:alert animated:YES completion:nil]; 325 + // [alertWindow makeKeyAndVisible];
326 + // [alertWindow.rootViewController presentViewController:alert animated:YES completion:nil];
326 327
327 self.pendingItem = inboxItem; 328 self.pendingItem = inboxItem;
328 break; 329 break;
...@@ -386,37 +387,38 @@ static const char* jailbreak_apps[] = ...@@ -386,37 +387,38 @@ static const char* jailbreak_apps[] =
386 switch (state) { 387 switch (state) {
387 case WLApplicationStateActive: 388 case WLApplicationStateActive:
388 { 389 {
389 - UIAlertController * alert = [UIAlertController alertControllerWithTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] message:@"" preferredStyle:UIAlertControllerStyleAlert]; 390 + // UIAlertController * alert = [UIAlertController alertControllerWithTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] message:@"" preferredStyle:UIAlertControllerStyleAlert];
390 - 391 +
391 - UIAlertAction* yesButton = [UIAlertAction 392 + // UIAlertAction* yesButton = [UIAlertAction
392 - actionWithTitle:NSLocalizedString(@"Close", @"Warply") 393 + // actionWithTitle:NSLocalizedString(@"Close", @"Warply")
393 - style:UIAlertActionStyleDefault 394 + // style:UIAlertActionStyleDefault
394 - handler:^(UIAlertAction * action) { 395 + // handler:^(UIAlertAction * action) {
395 - //Handle your yes please button action here 396 + // //Handle your yes please button action here
396 - }]; 397 + // }];
397 - 398 +
398 - UIAlertAction* noButton = [UIAlertAction 399 + // UIAlertAction* noButton = [UIAlertAction
399 - actionWithTitle:NSLocalizedString(@"View", @"Warply") 400 + // actionWithTitle:NSLocalizedString(@"View", @"Warply")
400 - style:UIAlertActionStyleDefault 401 + // style:UIAlertActionStyleDefault
401 - handler:^(UIAlertAction * action) { 402 + // handler:^(UIAlertAction * action) {
402 - //Handle no, thanks button 403 + // //Handle no, thanks button
403 - }]; 404 + // }];
404 - 405 +
405 - [alert addAction:yesButton]; 406 + // [alert addAction:yesButton];
406 - [alert addAction:noButton]; 407 + // [alert addAction:noButton];
407 - 408 +
408 - UIWindow *alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 409 + // UIWindow *alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
409 - alertWindow.rootViewController = [[UIViewController alloc] init]; 410 + // alertWindow.rootViewController = [[UIViewController alloc] init];
410 - alertWindow.windowLevel = UIWindowLevelAlert + 1; 411 + // alertWindow.windowLevel = UIWindowLevelAlert + 1;
411 - [alertWindow makeKeyAndVisible]; 412 + // [alertWindow makeKeyAndVisible];
412 - [alertWindow.rootViewController presentViewController:alert animated:YES completion:nil]; 413 + // [alertWindow.rootViewController presentViewController:alert animated:YES completion:nil];
413 - 414 +
414 - // UIAlertView *alert = [[UIAlertView alloc] init]; 415 + UIAlertView *alert = [[UIAlertView alloc] init];
415 - // [alert setTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"]]; 416 + [alert setTitle:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"title"]];
416 - // [alert addButtonWithTitle:NSLocalizedString(@"Close", @"Warply")]; 417 + [alert setMessage:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"body"]];
417 - // [alert addButtonWithTitle:NSLocalizedString(@"View", @"Warply")]; 418 + [alert addButtonWithTitle:NSLocalizedString(@"Close", @"Warply")];
418 - // [alert setDelegate:self]; 419 + [alert addButtonWithTitle:NSLocalizedString(@"View", @"Warply")];
419 - // [alert show]; 420 + [alert setDelegate:self];
421 + [alert show];
420 422
421 self.pendingItem = inboxItem; 423 self.pendingItem = inboxItem;
422 break; 424 break;
...@@ -481,37 +483,38 @@ static const char* jailbreak_apps[] = ...@@ -481,37 +483,38 @@ static const char* jailbreak_apps[] =
481 switch (state) { 483 switch (state) {
482 case WLApplicationStateActive: 484 case WLApplicationStateActive:
483 { 485 {
484 - UIAlertController * alert = [UIAlertController alertControllerWithTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] message:@"" preferredStyle:UIAlertControllerStyleAlert]; 486 + // UIAlertController * alert = [UIAlertController alertControllerWithTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] message:@"" preferredStyle:UIAlertControllerStyleAlert];
485 - 487 +
486 - UIAlertAction* yesButton = [UIAlertAction 488 + // UIAlertAction* yesButton = [UIAlertAction
487 - actionWithTitle:NSLocalizedString(@"Close", @"Warply") 489 + // actionWithTitle:NSLocalizedString(@"Close", @"Warply")
488 - style:UIAlertActionStyleDefault 490 + // style:UIAlertActionStyleDefault
489 - handler:^(UIAlertAction * action) { 491 + // handler:^(UIAlertAction * action) {
490 - //Handle your yes please button action here 492 + // //Handle your yes please button action here
491 - }]; 493 + // }];
492 - 494 +
493 - UIAlertAction* noButton = [UIAlertAction 495 + // UIAlertAction* noButton = [UIAlertAction
494 - actionWithTitle:NSLocalizedString(@"View", @"Warply") 496 + // actionWithTitle:NSLocalizedString(@"View", @"Warply")
495 - style:UIAlertActionStyleDefault 497 + // style:UIAlertActionStyleDefault
496 - handler:^(UIAlertAction * action) { 498 + // handler:^(UIAlertAction * action) {
497 - //Handle no, thanks button 499 + // //Handle no, thanks button
498 - }]; 500 + // }];
499 - 501 +
500 - [alert addAction:yesButton]; 502 + // [alert addAction:yesButton];
501 - [alert addAction:noButton]; 503 + // [alert addAction:noButton];
502 - 504 +
503 - UIWindow *alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 505 + // UIWindow *alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
504 - alertWindow.rootViewController = [[UIViewController alloc] init]; 506 + // alertWindow.rootViewController = [[UIViewController alloc] init];
505 - alertWindow.windowLevel = UIWindowLevelAlert + 1; 507 + // alertWindow.windowLevel = UIWindowLevelAlert + 1;
506 - [alertWindow makeKeyAndVisible]; 508 + // [alertWindow makeKeyAndVisible];
507 - [alertWindow.rootViewController presentViewController:alert animated:YES completion:nil]; 509 + // [alertWindow.rootViewController presentViewController:alert animated:YES completion:nil];
508 - 510 +
509 - // UIAlertView *alert = [[UIAlertView alloc] init]; 511 + UIAlertView *alert = [[UIAlertView alloc] init];
510 - // [alert setTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"]]; 512 + [alert setTitle:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"title"]];
511 - // [alert addButtonWithTitle:NSLocalizedString(@"Close", @"Warply")]; 513 + [alert setMessage:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"body"]];
512 - // [alert addButtonWithTitle:NSLocalizedString(@"View", @"Warply")]; 514 + [alert addButtonWithTitle:NSLocalizedString(@"Close", @"Warply")];
513 - // [alert setDelegate:self]; 515 + [alert addButtonWithTitle:NSLocalizedString(@"View", @"Warply")];
514 - // [alert show]; 516 + [alert setDelegate:self];
517 + [alert show];
515 518
516 self.pendingItem = inboxItem; 519 self.pendingItem = inboxItem;
517 break; 520 break;
...@@ -906,25 +909,25 @@ static const char* jailbreak_apps[] = ...@@ -906,25 +909,25 @@ static const char* jailbreak_apps[] =
906 UIViewController *existingModalController = [[UIApplication sharedApplication].delegate.window.rootViewController topModalViewController]; 909 UIViewController *existingModalController = [[UIApplication sharedApplication].delegate.window.rootViewController topModalViewController];
907 910
908 if (existingModalController == nil) { 911 if (existingModalController == nil) {
909 - // UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"WL_Warning" message:@"You have to set the mainWindow.rootViewController in order for offer views to be presented properly." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; 912 + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"WL_Warning" message:@"You have to set the mainWindow.rootViewController in order for offer views to be presented properly." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
910 - // [alert show]; 913 + [alert show];
911 914
912 - UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"WL_Warning" message:@"You have to set the mainWindow.rootViewController in order for offer views to be presented properly." preferredStyle:UIAlertControllerStyleAlert]; 915 + // UIAlertController * alert = [UIAlertController alertControllerWithTitle:@"WL_Warning" message:@"You have to set the mainWindow.rootViewController in order for offer views to be presented properly." preferredStyle:UIAlertControllerStyleAlert];
913 916
914 - UIAlertAction* yesButton = [UIAlertAction 917 + // UIAlertAction* yesButton = [UIAlertAction
915 - actionWithTitle:@"OK" 918 + // actionWithTitle:@"OK"
916 - style:UIAlertActionStyleDefault 919 + // style:UIAlertActionStyleDefault
917 - handler:^(UIAlertAction * action) { 920 + // handler:^(UIAlertAction * action) {
918 - //Handle your yes please button action here 921 + // //Handle your yes please button action here
919 - }]; 922 + // }];
920 923
921 - [alert addAction:yesButton]; 924 + // [alert addAction:yesButton];
922 925
923 - UIWindow *alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 926 + // UIWindow *alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
924 - alertWindow.rootViewController = [[UIViewController alloc] init]; 927 + // alertWindow.rootViewController = [[UIViewController alloc] init];
925 - alertWindow.windowLevel = UIWindowLevelAlert + 1; 928 + // alertWindow.windowLevel = UIWindowLevelAlert + 1;
926 - [alertWindow makeKeyAndVisible]; 929 + // [alertWindow makeKeyAndVisible];
927 - [alertWindow.rootViewController presentViewController:alert animated:YES completion:nil]; 930 + // [alertWindow.rootViewController presentViewController:alert animated:YES completion:nil];
928 931
929 return; 932 return;
930 } 933 }
......