#42 toast not showing on top of InAppBrowser on iOS

#55 Again/Still? Toast won't show in front of InAppBrowser on iOS
This commit is contained in:
EddyVerbruggen 2015-09-29 22:36:48 +02:00
parent 5634e1d84c
commit 03320113b4
3 changed files with 27 additions and 22 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "cordova-plugin-x-toast", "name": "cordova-plugin-x-toast",
"version": "2.2.0", "version": "2.2.1",
"description": "This plugin allows you to show a Toast. A Toast is a little non intrusive buttonless popup which automatically disappears.", "description": "This plugin allows you to show a Toast. A Toast is a little non intrusive buttonless popup which automatically disappears.",
"cordova": { "cordova": {
"id": "cordova-plugin-x-toast", "id": "cordova-plugin-x-toast",

View File

@ -2,7 +2,7 @@
<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
id="cordova-plugin-x-toast" id="cordova-plugin-x-toast"
version="2.2.0"> version="2.2.1">
<name>Toast</name> <name>Toast</name>

View File

@ -114,13 +114,10 @@ static UIView *prevToast = NULL;
toast.exclusiveTouch = YES; toast.exclusiveTouch = YES;
} }
if ([[[UIDevice currentDevice] systemVersion] compare:@"8.0" options:NSNumericSearch] != NSOrderedAscending) { // make sure that if InAppBrowser is active, we're still showing Toasts on top of it
// on iOS8 when InAppBrowser is active, the Toast is below it, UIViewController *vc = [self getTopMostViewController];
[self.superview.superview addSubview:toast]; UIView *v = [vc view];
} else { [v addSubview:toast];
// ..on iOS7 however with this fix on landscape the Toast isn't rotated automatically
[self.superview addSubview:toast];
}
[UIView animateWithDuration:CSToastFadeDuration [UIView animateWithDuration:CSToastFadeDuration
delay:0.0 delay:0.0
@ -135,6 +132,14 @@ static UIView *prevToast = NULL;
} }
- (UIViewController*) getTopMostViewController {
UIViewController *presentingViewController = [[[UIApplication sharedApplication] delegate] window].rootViewController;
while (presentingViewController.presentedViewController != nil) {
presentingViewController = presentingViewController.presentedViewController;
}
return presentingViewController;
}
- (void)hideToast { - (void)hideToast {
if (prevToast){ if (prevToast){
[self hideToast:prevToast]; [self hideToast:prevToast];