CB-6482 InAppBrowser calls incorrect callback on WP8

This commit is contained in:
sgrebnov 2014-04-21 15:28:03 -07:00
parent e282cc9e38
commit ab7494faa0

View File

@ -41,6 +41,8 @@ namespace WPCordovaClassLib.Cordova.Commands
protected bool ShowLocation {get;set;} protected bool ShowLocation {get;set;}
protected bool StartHidden {get;set;} protected bool StartHidden {get;set;}
protected string NavigationCallbackId { get; set; }
public void open(string options) public void open(string options)
{ {
// reset defaults on ShowLocation + StartHidden features // reset defaults on ShowLocation + StartHidden features
@ -52,6 +54,7 @@ namespace WPCordovaClassLib.Cordova.Commands
string urlLoc = args[0]; string urlLoc = args[0];
string target = args[1]; string target = args[1];
string featString = args[2]; string featString = args[2];
this.NavigationCallbackId = args[3];
string[] features = featString.Split(','); string[] features = featString.Split(',');
foreach (string str in features) foreach (string str in features)
@ -367,7 +370,7 @@ namespace WPCordovaClassLib.Cordova.Commands
string message = "{\"type\":\"exit\"}"; string message = "{\"type\":\"exit\"}";
PluginResult result = new PluginResult(PluginResult.Status.OK, message); PluginResult result = new PluginResult(PluginResult.Status.OK, message);
result.KeepCallback = false; result.KeepCallback = false;
this.DispatchCommandResult(result); this.DispatchCommandResult(result, NavigationCallbackId);
}); });
} }
} }
@ -385,7 +388,7 @@ namespace WPCordovaClassLib.Cordova.Commands
string message = "{\"type\":\"loadstop\", \"url\":\"" + e.Uri.OriginalString + "\"}"; string message = "{\"type\":\"loadstop\", \"url\":\"" + e.Uri.OriginalString + "\"}";
PluginResult result = new PluginResult(PluginResult.Status.OK, message); PluginResult result = new PluginResult(PluginResult.Status.OK, message);
result.KeepCallback = true; result.KeepCallback = true;
this.DispatchCommandResult(result); this.DispatchCommandResult(result, NavigationCallbackId);
} }
void browser_NavigationFailed(object sender, System.Windows.Navigation.NavigationFailedEventArgs e) void browser_NavigationFailed(object sender, System.Windows.Navigation.NavigationFailedEventArgs e)
@ -393,7 +396,7 @@ namespace WPCordovaClassLib.Cordova.Commands
string message = "{\"type\":\"error\",\"url\":\"" + e.Uri.OriginalString + "\"}"; string message = "{\"type\":\"error\",\"url\":\"" + e.Uri.OriginalString + "\"}";
PluginResult result = new PluginResult(PluginResult.Status.ERROR, message); PluginResult result = new PluginResult(PluginResult.Status.ERROR, message);
result.KeepCallback = true; result.KeepCallback = true;
this.DispatchCommandResult(result); this.DispatchCommandResult(result, NavigationCallbackId);
} }
void browser_Navigating(object sender, NavigatingEventArgs e) void browser_Navigating(object sender, NavigatingEventArgs e)
@ -401,7 +404,7 @@ namespace WPCordovaClassLib.Cordova.Commands
string message = "{\"type\":\"loadstart\",\"url\":\"" + e.Uri.OriginalString + "\"}"; string message = "{\"type\":\"loadstart\",\"url\":\"" + e.Uri.OriginalString + "\"}";
PluginResult result = new PluginResult(PluginResult.Status.OK, message); PluginResult result = new PluginResult(PluginResult.Status.OK, message);
result.KeepCallback = true; result.KeepCallback = true;
this.DispatchCommandResult(result); this.DispatchCommandResult(result, NavigationCallbackId);
} }
} }