[jira] [Commented] (CB-2159) handleOpenURL not called on iOS

2013-01-11 Thread Shazron Abdullah (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-2159?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13551500#comment-13551500
 ] 

Shazron Abdullah commented on CB-2159:
--

The problem here is of timing. 

The sequence of events is:
1. Called: (BOOL)application:(UIApplication*)application 
handleOpenURL:(NSURL*)url
2. Called: (void)webViewDidFinishLoad:(UIWebView*)theWebView

We need to queue up the JavaScript write until later. The easy way is to just 
use a block that is run after a delay for (1), but ideally we want to only run 
the JavaScript after (2)



 handleOpenURL not called on iOS
 ---

 Key: CB-2159
 URL: https://issues.apache.org/jira/browse/CB-2159
 Project: Apache Cordova
  Issue Type: Bug
  Components: iOS
Reporter: Shazron Abdullah
Assignee: Shazron Abdullah
 Fix For: 2.4.0


 Idan Gozlan from the ML:
 Ive noticed that handleOpenURL function not called when app is closed and 
 launched by the custom url.
 the function works alright when the app is in background.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (CB-2159) handleOpenURL not called on iOS

2013-01-11 Thread Shazron Abdullah (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-2159?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13551503#comment-13551503
 ] 

Shazron Abdullah commented on CB-2159:
--

Easy patch would be this in AppDelegate.m, but not ideal since it hard-codes 
500ms delay. Best to queue it up after webViewDidFinishLoad:

{code}
- (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url
{
if (!url) {
return NO;
}

dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 500 * NSEC_PER_MSEC), 
dispatch_get_current_queue(), ^{

// calls into javascript global function 'handleOpenURL'
NSString* jsString = [NSString 
stringWithFormat:@handleOpenURL(\%@\);, url];
[self.viewController.webView 
stringByEvaluatingJavaScriptFromString:jsString];

// all plugins will get the notification, and their handlers will be 
called
[[NSNotificationCenter defaultCenter] postNotification:[NSNotification 
notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
});

return YES;
}
{code}

 handleOpenURL not called on iOS
 ---

 Key: CB-2159
 URL: https://issues.apache.org/jira/browse/CB-2159
 Project: Apache Cordova
  Issue Type: Bug
  Components: iOS
Reporter: Shazron Abdullah
Assignee: Shazron Abdullah
 Fix For: 2.4.0


 Idan Gozlan from the ML:
 Ive noticed that handleOpenURL function not called when app is closed and 
 launched by the custom url.
 the function works alright when the app is in background.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (CB-2159) handleOpenURL not called on iOS

2013-01-11 Thread Shazron Abdullah (JIRA)

[ 
https://issues.apache.org/jira/browse/CB-2159?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13551508#comment-13551508
 ] 

Shazron Abdullah commented on CB-2159:
--

One way is for CDVViewController to handle the notification 
CDVPluginHandleOpenURLNotification itself and queue the writing of the JS up 
for after webViewDidFinishLoad. 

This avoids messy upgrade issues for users, and we can leave existing 
BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url code in 
AppDelegate.m as is.

 handleOpenURL not called on iOS
 ---

 Key: CB-2159
 URL: https://issues.apache.org/jira/browse/CB-2159
 Project: Apache Cordova
  Issue Type: Bug
  Components: iOS
Reporter: Shazron Abdullah
Assignee: Shazron Abdullah
 Fix For: 2.4.0


 Idan Gozlan from the ML:
 Ive noticed that handleOpenURL function not called when app is closed and 
 launched by the custom url.
 the function works alright when the app is in background.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira