Manos Chorianopoulos

fix alertview at push manager

...@@ -256,12 +256,37 @@ static const char* jailbreak_apps[] = ...@@ -256,12 +256,37 @@ static const char* jailbreak_apps[] =
256 switch (state) { 256 switch (state) {
257 case WLApplicationStateActive: 257 case WLApplicationStateActive:
258 { 258 {
259 - UIAlertView *alert = [[UIAlertView alloc] init]; 259 + // UIAlertView *alert = [[UIAlertView alloc] init];
260 - [alert setTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"]]; 260 + // [alert setTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"]];
261 - [alert addButtonWithTitle:NSLocalizedString(@"Close", @"Warply")]; 261 + // [alert addButtonWithTitle:NSLocalizedString(@"Close", @"Warply")];
262 - [alert addButtonWithTitle:NSLocalizedString(@"View", @"Warply")]; 262 + // [alert addButtonWithTitle:NSLocalizedString(@"View", @"Warply")];
263 - [alert setDelegate:self]; 263 + // [alert setDelegate:self];
264 - [alert show]; 264 + // [alert show];
265 +
266 + UIAlertController * alert = [UIAlertController alertControllerWithTitle:[[userInfo objectForKey:@"aps"] objectForKey:@"alert"] message:@"" preferredStyle:UIAlertControllerStyleAlert];
267 +
268 + UIAlertAction* yesButton = [UIAlertAction
269 + actionWithTitle:NSLocalizedString(@"Close", @"Warply")
270 + style:UIAlertActionStyleDefault
271 + handler:^(UIAlertAction * action) {
272 + //Handle your yes please button action here
273 + }];
274 +
275 + UIAlertAction* noButton = [UIAlertAction
276 + actionWithTitle:NSLocalizedString(@"View", @"Warply")
277 + style:UIAlertActionStyleDefault
278 + handler:^(UIAlertAction * action) {
279 + //Handle no, thanks button
280 + }];
281 +
282 + [alert addAction:yesButton];
283 + [alert addAction:noButton];
284 +
285 + UIWindow *alertWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
286 + alertWindow.rootViewController = [[UIViewController alloc] init];
287 + alertWindow.windowLevel = UIWindowLevelAlert + 1;
288 + [alertWindow makeKeyAndVisible];
289 + [alertWindow.rootViewController presentViewController:alert animated:YES completion:nil];
265 290
266 self.pendingItem = inboxItem; 291 self.pendingItem = inboxItem;
267 break; 292 break;
......