如何在tabs.openWithOptions中检测URL更改?

时间:2012-07-12 00:35:20

标签: trigger.io

所以我有以下代码:

options = {
    url: "http://mywebsite.com/login/" + authService,
    pattern: "http://*mywebsite.com/complete/" + authService + "*",
  };
  forge.tabs.openWithOptions(options, function(data) {
    // We've logged in. Do something now
  }, function(data) {
    forge.logging.error("Error");
  });

代码在iPhone模拟器上运行良好,但在Android模拟器中不会调用成功回调。它似乎没有注册从Oauth转到重定向网址。在模拟器中,它确实加载了我的重定向URL,但它没有记录它。这是伪造运行中记录的内容:

[   INFO] I/Forge   (  393): Loading initial page in webview.

[   INFO] I/Forge   (  393): Application in focus, resuming webview.

[   INFO] D/Forge   (  393): Returning event: {"event":"internal.connectionStateChange","params":{"wifi":false,"connected":true}}

[   INFO] D/Forge   (  393): Native call "tabbar.hide" with task.params: {}

[   INFO] D/Forge   (  393): Returning: {"status":"success","callid":"2C1DB06C-9438-4AFD-841B-C2E3BBF8AA85"}

[   INFO] D/Forge   (  393): Native call "tabbar.addButton" with task.params: {"text":"Events","icon":"img/logo-forge.png"}

[   INFO] D/Forge   (  393): Native call "tabbar.addButton" with task.params: {"text":"Activity","icon":"img/logo-forge.png"}

[   INFO] D/Forge   (  393): Native call "tabbar.addButton" with task.params: {"text":"Me","icon":"img/logo-forge.png"}

[   INFO] D/Forge   (  393): Returning: {"content":"37F88F37-9A08-4541-8B1D-D7D08C2605D8","status":"success","callid":"37F88F37-9A08-4541-8B1D-D7D08C2605D8"}

[   INFO] D/Forge   (  393): Returning: {"content":"FFA69B04-006E-45CB-8BD7-A3CBB7E8403C","status":"success","callid":"FFA69B04-006E-45CB-8BD7-A3CBB7E8403C"}

[   INFO] D/Forge   (  393): Returning: {"content":"99681BEB-E79B-4309-B230-90B731A3DA61","status":"success","callid":"99681BEB-E79B-4309-B230-90B731A3DA61"}

[   INFO] D/Forge   (  393): Native call "internal.hideLaunchImage" with task.params: {}

[   INFO] D/Forge   (  393): Native call "tabbar.setActive" with task.params: {"id":"37F88F37-9A08-4541-8B1D-D7D08C2605D8"}

[   INFO] D/Forge   (  393): Returning: {"status":"success","callid":"23F0D9E1-5F63-4F6A-BFE0-14D674CDEB65"}

[   INFO] D/Forge   (  393): Native call "tabs.open" with task.params: {"url":"http://mywebsite.com/login/twitter","pattern":"^http://*mywebsite.com/complete/twitter.*$","title":"Sign in with Twitter"}

[   INFO] I/Forge   (  393): Displaying modal view.

[   INFO] I/Forge   (  393): subView load http://mywebsite.com/login/twitter/

[   INFO] I/Forge   (  393): subView load http://api.twitter.com/oauth/authenticate?oauth_token=TOKEN&oauth_callback=http%3A%2F%2Fmywebsite.com%2Fcomplete%2Ftwitter%2F

如果我无法一致地检测到这些网址更改,是否可以在某个时间点获取当前标签的网址?

注意:我在我的后端使用django-social-auth。

0 个答案:

没有答案