phonegap-build / PushPlugin

This repository is deprecated head to phonegap/phonegap-push-plugin
https://github.com/phonegap/phonegap-plugin-push
MIT License
1.31k stars 996 forks source link

WP8 to WP8.1 Breaks the notification callbacks #360

Open AlexBelchUK opened 9 years ago

AlexBelchUK commented 9 years ago

When using windows phone 8.1 with IE 11 (Following latest phone software update), the call to execScript no longer supported in IE 11 instead we have to call exec and new string[] {command}

This change has now been done to cordova 3.6 release, it also needs doing in the WP8 push plugin code too

PushPlugin.cs change is:

void ExecuteCallback(string callback, string callbackResult) { Deployment.Current.Dispatcher.BeginInvoke(() => { PhoneApplicationFrame frame; PhoneApplicationPage page; CordovaView cView;

if (TryCast(Application.Current.RootVisual, out frame) &&
    TryCast(frame.Content, out page) &&
    TryCast(page.FindName("CordovaView"), out cView))
    {
      cView.Browser.Dispatcher.BeginInvoke(() =>
      {
        try
        {
          // New code is below
          cView.Browser.InvokeScript("eval", new string[] { callback + "(" + callbackResult + ")" });

          // Old code not used
          // cView.Browser.InvokeScript("execScript", callback + "(" + callbackResult + ")");
        }
        catch (Exception ex)
        {
          Debug.WriteLine("ERROR: Exception in InvokeScriptCallback :: " + ex.Message);
        }
      });
   }
 });

}

marcelotq commented 9 years ago

How can I do this in automatic install of PhoneGap Build? Thanks