Showing
1 changed file
with
160 additions
and
43 deletions
| ... | @@ -292,13 +292,46 @@ static const char* jailbreak_apps[] = | ... | @@ -292,13 +292,46 @@ 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"] objectForKey:@"title"]]; | 296 | +// [alert setTitle:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"title"]]; |
| 297 | - [alert setMessage:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"body"]]; | 297 | +// [alert setMessage:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"body"]]; |
| 298 | - [alert addButtonWithTitle:NSLocalizedString(@"Close", @"Warply")]; | 298 | +// [alert addButtonWithTitle:NSLocalizedString(@"Close", @"Warply")]; |
| 299 | - [alert addButtonWithTitle:NSLocalizedString(@"View", @"Warply")]; | 299 | +// [alert addButtonWithTitle:NSLocalizedString(@"View", @"Warply")]; |
| 300 | - [alert setDelegate:self]; | 300 | +// [alert setDelegate:self]; |
| 301 | - [alert show]; | 301 | +// [alert show]; |
| 302 | + | ||
| 303 | + // ============== | ||
| 304 | + NSDictionary *apsInfo = [userInfo objectForKey:@"aps"]; | ||
| 305 | + NSDictionary *alertInfo = [apsInfo objectForKey:@"alert"]; | ||
| 306 | + NSString *title = [alertInfo objectForKey:@"title"]; | ||
| 307 | + NSString *body = [alertInfo objectForKey:@"body"]; | ||
| 308 | + | ||
| 309 | + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title | ||
| 310 | + message:body | ||
| 311 | + preferredStyle:UIAlertControllerStyleAlert]; | ||
| 312 | + | ||
| 313 | + UIAlertAction *closeAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Close", @"Warply") | ||
| 314 | + style:UIAlertActionStyleCancel | ||
| 315 | + handler:^(UIAlertAction *action) { | ||
| 316 | + // Handle close action if needed | ||
| 317 | + }]; | ||
| 318 | + | ||
| 319 | + UIAlertAction *viewAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"View", @"Warply") | ||
| 320 | + style:UIAlertActionStyleDefault | ||
| 321 | + handler:^(UIAlertAction *action) { | ||
| 322 | + // Handle view action if needed | ||
| 323 | + }]; | ||
| 324 | + | ||
| 325 | + [alertController addAction:closeAction]; | ||
| 326 | + [alertController addAction:viewAction]; | ||
| 327 | + | ||
| 328 | + // Get the application's root view controller | ||
| 329 | + UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController; | ||
| 330 | + | ||
| 331 | + // Present the alert in the root view controller | ||
| 332 | + [rootViewController presentViewController:alertController animated:YES completion:nil]; | ||
| 333 | + // ============== | ||
| 334 | + | ||
| 302 | 335 | ||
| 303 | // UIAlertController * alert = [UIAlertController alertControllerWithTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] message:@"" preferredStyle:UIAlertControllerStyleAlert]; | 336 | // UIAlertController * alert = [UIAlertController alertControllerWithTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] message:@"" preferredStyle:UIAlertControllerStyleAlert]; |
| 304 | 337 | ||
| ... | @@ -387,38 +420,72 @@ static const char* jailbreak_apps[] = | ... | @@ -387,38 +420,72 @@ static const char* jailbreak_apps[] = |
| 387 | switch (state) { | 420 | switch (state) { |
| 388 | case WLApplicationStateActive: | 421 | case WLApplicationStateActive: |
| 389 | { | 422 | { |
| 390 | - // UIAlertController * alert = [UIAlertController alertControllerWithTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] message:@"" preferredStyle:UIAlertControllerStyleAlert]; | 423 | +// UIAlertController * alert = [UIAlertController alertControllerWithTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] message:@"" preferredStyle:UIAlertControllerStyleAlert]; |
| 424 | +// | ||
| 425 | +// UIAlertAction* yesButton = [UIAlertAction | ||
| 426 | +// actionWithTitle:NSLocalizedString(@"Close", @"Warply") | ||
| 427 | +// style:UIAlertActionStyleDefault | ||
| 428 | +// handler:^(UIAlertAction * action) { | ||
| 429 | +// //Handle your yes please button action here | ||
| 430 | +// }]; | ||
| 431 | +// | ||
| 432 | +// UIAlertAction* noButton = [UIAlertAction | ||
| 433 | +// actionWithTitle:NSLocalizedString(@"View", @"Warply") | ||
| 434 | +// style:UIAlertActionStyleDefault | ||
| 435 | +// handler:^(UIAlertAction * action) { | ||
| 436 | +// //Handle no, thanks button | ||
| 437 | +// }]; | ||
| 438 | +// | ||
| 439 | +// [alert addAction:yesButton]; | ||
| 440 | +// [alert addAction:noButton]; | ||
| 441 | +// | ||
| 442 | +// UIWindow *alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; | ||
| 443 | +// alertWindow.rootViewController = [[UIViewController alloc] init]; | ||
| 444 | +// alertWindow.windowLevel = UIWindowLevelAlert + 1; | ||
| 445 | +// [alertWindow makeKeyAndVisible]; | ||
| 446 | +// [alertWindow.rootViewController presentViewController:alert animated:YES completion:nil]; | ||
| 391 | 447 | ||
| 392 | - // UIAlertAction* yesButton = [UIAlertAction | 448 | + // ============== |
| 393 | - // actionWithTitle:NSLocalizedString(@"Close", @"Warply") | 449 | +// UIAlertView *alert = [[UIAlertView alloc] init]; |
| 394 | - // style:UIAlertActionStyleDefault | 450 | +// [alert setTitle:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"title"]]; |
| 395 | - // handler:^(UIAlertAction * action) { | 451 | +// [alert setMessage:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"body"]]; |
| 396 | - // //Handle your yes please button action here | 452 | +// [alert addButtonWithTitle:NSLocalizedString(@"Close", @"Warply")]; |
| 397 | - // }]; | 453 | +// [alert addButtonWithTitle:NSLocalizedString(@"View", @"Warply")]; |
| 454 | +// [alert setDelegate:self]; | ||
| 455 | +// [alert show]; | ||
| 456 | + | ||
| 457 | + // ============== | ||
| 458 | + NSDictionary *apsInfo = [userInfo objectForKey:@"aps"]; | ||
| 459 | + NSDictionary *alertInfo = [apsInfo objectForKey:@"alert"]; | ||
| 460 | + NSString *title = [alertInfo objectForKey:@"title"]; | ||
| 461 | + NSString *body = [alertInfo objectForKey:@"body"]; | ||
| 462 | + | ||
| 463 | + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title | ||
| 464 | + message:body | ||
| 465 | + preferredStyle:UIAlertControllerStyleAlert]; | ||
| 466 | + | ||
| 467 | + UIAlertAction *closeAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Close", @"Warply") | ||
| 468 | + style:UIAlertActionStyleCancel | ||
| 469 | + handler:^(UIAlertAction *action) { | ||
| 470 | + // Handle close action if needed | ||
| 471 | + }]; | ||
| 398 | 472 | ||
| 399 | - // UIAlertAction* noButton = [UIAlertAction | 473 | + UIAlertAction *viewAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"View", @"Warply") |
| 400 | - // actionWithTitle:NSLocalizedString(@"View", @"Warply") | 474 | + style:UIAlertActionStyleDefault |
| 401 | - // style:UIAlertActionStyleDefault | 475 | + handler:^(UIAlertAction *action) { |
| 402 | - // handler:^(UIAlertAction * action) { | 476 | + // Handle view action if needed |
| 403 | - // //Handle no, thanks button | 477 | + }]; |
| 404 | - // }]; | ||
| 405 | 478 | ||
| 406 | - // [alert addAction:yesButton]; | 479 | + [alertController addAction:closeAction]; |
| 407 | - // [alert addAction:noButton]; | 480 | + [alertController addAction:viewAction]; |
| 408 | 481 | ||
| 409 | - // UIWindow *alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; | 482 | + // Get the application's root view controller |
| 410 | - // alertWindow.rootViewController = [[UIViewController alloc] init]; | 483 | + UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController; |
| 411 | - // alertWindow.windowLevel = UIWindowLevelAlert + 1; | 484 | + |
| 412 | - // [alertWindow makeKeyAndVisible]; | 485 | + // Present the alert in the root view controller |
| 413 | - // [alertWindow.rootViewController presentViewController:alert animated:YES completion:nil]; | 486 | + [rootViewController presentViewController:alertController animated:YES completion:nil]; |
| 487 | + // ============== | ||
| 414 | 488 | ||
| 415 | - UIAlertView *alert = [[UIAlertView alloc] init]; | ||
| 416 | - [alert setTitle:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"title"]]; | ||
| 417 | - [alert setMessage:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"body"]]; | ||
| 418 | - [alert addButtonWithTitle:NSLocalizedString(@"Close", @"Warply")]; | ||
| 419 | - [alert addButtonWithTitle:NSLocalizedString(@"View", @"Warply")]; | ||
| 420 | - [alert setDelegate:self]; | ||
| 421 | - [alert show]; | ||
| 422 | 489 | ||
| 423 | self.pendingItem = inboxItem; | 490 | self.pendingItem = inboxItem; |
| 424 | break; | 491 | break; |
| ... | @@ -508,13 +575,45 @@ static const char* jailbreak_apps[] = | ... | @@ -508,13 +575,45 @@ static const char* jailbreak_apps[] = |
| 508 | // [alertWindow makeKeyAndVisible]; | 575 | // [alertWindow makeKeyAndVisible]; |
| 509 | // [alertWindow.rootViewController presentViewController:alert animated:YES completion:nil]; | 576 | // [alertWindow.rootViewController presentViewController:alert animated:YES completion:nil]; |
| 510 | 577 | ||
| 511 | - UIAlertView *alert = [[UIAlertView alloc] init]; | 578 | +// UIAlertView *alert = [[UIAlertView alloc] init]; |
| 512 | - [alert setTitle:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"title"]]; | 579 | +// [alert setTitle:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"title"]]; |
| 513 | - [alert setMessage:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"body"]]; | 580 | +// [alert setMessage:[[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] objectForKey:@"body"]]; |
| 514 | - [alert addButtonWithTitle:NSLocalizedString(@"Close", @"Warply")]; | 581 | +// [alert addButtonWithTitle:NSLocalizedString(@"Close", @"Warply")]; |
| 515 | - [alert addButtonWithTitle:NSLocalizedString(@"View", @"Warply")]; | 582 | +// [alert addButtonWithTitle:NSLocalizedString(@"View", @"Warply")]; |
| 516 | - [alert setDelegate:self]; | 583 | +// [alert setDelegate:self]; |
| 517 | - [alert show]; | 584 | +// [alert show]; |
| 585 | + | ||
| 586 | + // ============== | ||
| 587 | + NSDictionary *apsInfo = [userInfo objectForKey:@"aps"]; | ||
| 588 | + NSDictionary *alertInfo = [apsInfo objectForKey:@"alert"]; | ||
| 589 | + NSString *title = [alertInfo objectForKey:@"title"]; | ||
| 590 | + NSString *body = [alertInfo objectForKey:@"body"]; | ||
| 591 | + | ||
| 592 | + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title | ||
| 593 | + message:body | ||
| 594 | + preferredStyle:UIAlertControllerStyleAlert]; | ||
| 595 | + | ||
| 596 | + UIAlertAction *closeAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"Close", @"Warply") | ||
| 597 | + style:UIAlertActionStyleCancel | ||
| 598 | + handler:^(UIAlertAction *action) { | ||
| 599 | + // Handle close action if needed | ||
| 600 | + }]; | ||
| 601 | + | ||
| 602 | + UIAlertAction *viewAction = [UIAlertAction actionWithTitle:NSLocalizedString(@"View", @"Warply") | ||
| 603 | + style:UIAlertActionStyleDefault | ||
| 604 | + handler:^(UIAlertAction *action) { | ||
| 605 | + // Handle view action if needed | ||
| 606 | + }]; | ||
| 607 | + | ||
| 608 | + [alertController addAction:closeAction]; | ||
| 609 | + [alertController addAction:viewAction]; | ||
| 610 | + | ||
| 611 | + // Get the application's root view controller | ||
| 612 | + UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController; | ||
| 613 | + | ||
| 614 | + // Present the alert in the root view controller | ||
| 615 | + [rootViewController presentViewController:alertController animated:YES completion:nil]; | ||
| 616 | + // ============== | ||
| 518 | 617 | ||
| 519 | self.pendingItem = inboxItem; | 618 | self.pendingItem = inboxItem; |
| 520 | break; | 619 | break; |
| ... | @@ -909,8 +1008,26 @@ static const char* jailbreak_apps[] = | ... | @@ -909,8 +1008,26 @@ static const char* jailbreak_apps[] = |
| 909 | UIViewController *existingModalController = [[UIApplication sharedApplication].delegate.window.rootViewController topModalViewController]; | 1008 | UIViewController *existingModalController = [[UIApplication sharedApplication].delegate.window.rootViewController topModalViewController]; |
| 910 | 1009 | ||
| 911 | if (existingModalController == nil) { | 1010 | if (existingModalController == 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]; | 1011 | +// 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]; |
| 913 | - [alert show]; | 1012 | +// [alert show]; |
| 1013 | + | ||
| 1014 | + // ================ | ||
| 1015 | + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"WL_Warning" | ||
| 1016 | + message:@"You have to set the mainWindow.rootViewController in order for offer views to be presented properly." | ||
| 1017 | + preferredStyle:UIAlertControllerStyleAlert]; | ||
| 1018 | + | ||
| 1019 | + UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" | ||
| 1020 | + style:UIAlertActionStyleDefault | ||
| 1021 | + handler:nil]; | ||
| 1022 | + | ||
| 1023 | + [alertController addAction:okAction]; | ||
| 1024 | + | ||
| 1025 | + // Get the application's root view controller | ||
| 1026 | + UIViewController *rootViewController = [UIApplication sharedApplication].delegate.window.rootViewController; | ||
| 1027 | + | ||
| 1028 | + // Present the alert in the root view controller | ||
| 1029 | + [rootViewController presentViewController:alertController animated:YES completion:nil]; | ||
| 1030 | + // ================ | ||
| 914 | 1031 | ||
| 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]; | 1032 | // 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]; |
| 916 | 1033 | ... | ... |
-
Please register or login to post a comment