[jira] [Commented] (CB-3534) Multiple CDVViewControllers - deviceready not fired and cordova.exec events queued up till backgrounding

2013-10-04 Thread Andrew Grieve (JIRA)

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

Andrew Grieve commented on CB-3534:
---

Just tried this with Cordova 3.1 (downloaded the zip, swapped out the 
cordova.js file as well as the CordovaLib directory with the 3.1 versions), and 
both alerts fire. Confirmed that they didn't fire with the 2.7 versions. Maybe 
this is already fixed?

 Multiple CDVViewControllers - deviceready not fired and cordova.exec events 
 queued up till backgrounding
 

 Key: CB-3534
 URL: https://issues.apache.org/jira/browse/CB-3534
 Project: Apache Cordova
  Issue Type: Bug
  Components: App Hello World, CordovaJS, iOS
Affects Versions: 2.3.0, 2.7.0
 Environment: Reproducible on iPhone/iPad 6.1 Simulator and Device.
Reporter: Mike Kwan
Assignee: Shazron Abdullah
Priority: Critical
 Fix For: 3.2.0

 Attachments: CordovaBug.zip, Screen Shot 2013-05-29 at 13.55.42.png, 
 Screen Shot 2013-05-29 at 14.31.44.png


 Minimal example reproducing the problem is attached and set up as follows:
  # Custom container view controller split into two halves each containing a 
 _CDVViewController_
  # Top half loads and after a delay (3000ms) fires a _NSNotification_
  # In response to the _NSNotification_ the top half loads a green page and 
 the bottom half loads a red page
 Both red pages and green pages have an event listener for *deviceready*:
 {code}
 function onDeviceReady() {
 alert('deviceready from X'); // colour here
 cordova.exec(null, null, 'Echo', 'echo', ['hello']);
 };
 {code}
 {panel:title=Observed 
 Behaviour|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#CE}
  - _deviceready_ is fired only for the red page (bottom)
  - The _cordova.exec_ succeeds for the red page (bottom)
  - _deviceready_ is not fired for the green page (top)
 {panel}
 {panel:title=Expected 
 Behaviour|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#CE}
 _deviceready_ should be fired for both the green and red page simultaneously 
 and the _cordova.exec_ events should go through immediately.
 {panel}
 {panel:title=Extra 
 Details|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#CE}
 This bug reproduces the first time the app is launched (reset the simulator 
 to reproduce). On subsequent launches the app behaves as expected.
 The _deviceready_ can be triggered by certain events for the top page:
  - Pulling down the notification bar
  - Backgrounding
 If _deviceready_ is triggered by pulling down the notification bar, the 
 _cordova.exec_ is still not fired for the green page. The _cordova.exec_ 
 message is queued up and finally does go through when the app is backgrounded.
 {panel}
 This bug is remarkably similar to the following:
 https://issues.apache.org/jira/browse/CB-2094
 Perhaps it is an edge case which was overlooked? This bug reproduces on 2.3.0 
 and 2.7.0 - I have not tried other versions yet.



--
This message was sent by Atlassian JIRA
(v6.1#6144)


[jira] [Commented] (CB-3534) Multiple CDVViewControllers - deviceready not fired and cordova.exec events queued up till backgrounding

2013-10-03 Thread Mike Kwan (JIRA)

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

Mike Kwan commented on CB-3534:
---

Hi Shazron,

Looks like this one didn't make it for 3.1.0 - are there plans to look into it 
for 3.2.0?

Mike

 Multiple CDVViewControllers - deviceready not fired and cordova.exec events 
 queued up till backgrounding
 

 Key: CB-3534
 URL: https://issues.apache.org/jira/browse/CB-3534
 Project: Apache Cordova
  Issue Type: Bug
  Components: App Hello World, CordovaJS, iOS
Affects Versions: 2.3.0, 2.7.0
 Environment: Reproducible on iPhone/iPad 6.1 Simulator and Device.
Reporter: Mike Kwan
Assignee: Shazron Abdullah
Priority: Critical
 Fix For: 3.1.0

 Attachments: CordovaBug.zip, Screen Shot 2013-05-29 at 13.55.42.png, 
 Screen Shot 2013-05-29 at 14.31.44.png


 Minimal example reproducing the problem is attached and set up as follows:
  # Custom container view controller split into two halves each containing a 
 _CDVViewController_
  # Top half loads and after a delay (3000ms) fires a _NSNotification_
  # In response to the _NSNotification_ the top half loads a green page and 
 the bottom half loads a red page
 Both red pages and green pages have an event listener for *deviceready*:
 {code}
 function onDeviceReady() {
 alert('deviceready from X'); // colour here
 cordova.exec(null, null, 'Echo', 'echo', ['hello']);
 };
 {code}
 {panel:title=Observed 
 Behaviour|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#CE}
  - _deviceready_ is fired only for the red page (bottom)
  - The _cordova.exec_ succeeds for the red page (bottom)
  - _deviceready_ is not fired for the green page (top)
 {panel}
 {panel:title=Expected 
 Behaviour|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#CE}
 _deviceready_ should be fired for both the green and red page simultaneously 
 and the _cordova.exec_ events should go through immediately.
 {panel}
 {panel:title=Extra 
 Details|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#CE}
 This bug reproduces the first time the app is launched (reset the simulator 
 to reproduce). On subsequent launches the app behaves as expected.
 The _deviceready_ can be triggered by certain events for the top page:
  - Pulling down the notification bar
  - Backgrounding
 If _deviceready_ is triggered by pulling down the notification bar, the 
 _cordova.exec_ is still not fired for the green page. The _cordova.exec_ 
 message is queued up and finally does go through when the app is backgrounded.
 {panel}
 This bug is remarkably similar to the following:
 https://issues.apache.org/jira/browse/CB-2094
 Perhaps it is an edge case which was overlooked? This bug reproduces on 2.3.0 
 and 2.7.0 - I have not tried other versions yet.



--
This message was sent by Atlassian JIRA
(v6.1#6144)


[jira] [Commented] (CB-3534) Multiple CDVViewControllers - deviceready not fired and cordova.exec events queued up till backgrounding

2013-06-17 Thread Mike Kwan (JIRA)

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

Mike Kwan commented on CB-3534:
---

Marginal improvement which prevents the retain artificially keeping the object 
alive:

{code}
- (void)viewDidLoad
{
[super viewDidLoad];
[self webView].backgroundColor = [UIColor clearColor];
[self webView].opaque = NO;
[self webView].dataDetectorTypes = UIDataDetectorTypeNone;

[self flushCordovaBridge];
}

/*
 * This method works around https://issues.apache.org/jira/browse/CB-3534
 * As soon as a proper fix is released we need to get rid of this.
 */
- (void)flushCordovaBridge
{
__weak BaseViewController *me = self;
[me.commandDelegate evalJs:@cordova.fireDocumentEvent('resign'); 
scheduledOnRunLoop:NO];

double delayInSeconds = 0.1;
dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 
(int64_t)(delayInSeconds * NSEC_PER_SEC));
dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
[me flushCordovaBridge];
});
}
{code}

 Multiple CDVViewControllers - deviceready not fired and cordova.exec events 
 queued up till backgrounding
 

 Key: CB-3534
 URL: https://issues.apache.org/jira/browse/CB-3534
 Project: Apache Cordova
  Issue Type: Bug
  Components: App Hello World, CordovaJS, iOS
Affects Versions: 2.3.0, 2.7.0
 Environment: Reproducible on iPhone/iPad 6.1 Simulator and Device.
Reporter: Mike Kwan
Assignee: Shazron Abdullah
Priority: Critical
 Fix For: 2.9.0

 Attachments: CordovaBug.zip, Screen Shot 2013-05-29 at 13.55.42.png, 
 Screen Shot 2013-05-29 at 14.31.44.png


 Minimal example reproducing the problem is attached and set up as follows:
  # Custom container view controller split into two halves each containing a 
 _CDVViewController_
  # Top half loads and after a delay (3000ms) fires a _NSNotification_
  # In response to the _NSNotification_ the top half loads a green page and 
 the bottom half loads a red page
 Both red pages and green pages have an event listener for *deviceready*:
 {code}
 function onDeviceReady() {
 alert('deviceready from X'); // colour here
 cordova.exec(null, null, 'Echo', 'echo', ['hello']);
 };
 {code}
 {panel:title=Observed 
 Behaviour|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#CE}
  - _deviceready_ is fired only for the red page (bottom)
  - The _cordova.exec_ succeeds for the red page (bottom)
  - _deviceready_ is not fired for the green page (top)
 {panel}
 {panel:title=Expected 
 Behaviour|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#CE}
 _deviceready_ should be fired for both the green and red page simultaneously 
 and the _cordova.exec_ events should go through immediately.
 {panel}
 {panel:title=Extra 
 Details|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#CE}
 This bug reproduces the first time the app is launched (reset the simulator 
 to reproduce). On subsequent launches the app behaves as expected.
 The _deviceready_ can be triggered by certain events for the top page:
  - Pulling down the notification bar
  - Backgrounding
 If _deviceready_ is triggered by pulling down the notification bar, the 
 _cordova.exec_ is still not fired for the green page. The _cordova.exec_ 
 message is queued up and finally does go through when the app is backgrounded.
 {panel}
 This bug is remarkably similar to the following:
 https://issues.apache.org/jira/browse/CB-2094
 Perhaps it is an edge case which was overlooked? This bug reproduces on 2.3.0 
 and 2.7.0 - I have not tried other versions yet.

--
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-3534) Multiple CDVViewControllers - deviceready not fired and cordova.exec events queued up till backgrounding

2013-06-07 Thread Mike Kwan (JIRA)

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

Mike Kwan commented on CB-3534:
---

The issue seems to be that the me.getInfo (leading to exec(..., ..., 'Device', 
'getDeviceInfo', [])) for the top page does not get through to the native side. 
This means the callback from channel.join() never gets invoked. Investigating 
further...

 Multiple CDVViewControllers - deviceready not fired and cordova.exec events 
 queued up till backgrounding
 

 Key: CB-3534
 URL: https://issues.apache.org/jira/browse/CB-3534
 Project: Apache Cordova
  Issue Type: Bug
  Components: App Hello World, CordovaJS, iOS
Affects Versions: 2.3.0, 2.7.0
 Environment: Reproducible on iPhone/iPad 6.1 Simulator and Device.
Reporter: Mike Kwan
Assignee: Shazron Abdullah
Priority: Critical
 Attachments: CordovaBug.zip, Screen Shot 2013-05-29 at 13.55.42.png, 
 Screen Shot 2013-05-29 at 14.31.44.png


 Minimal example reproducing the problem is attached and set up as follows:
  # Custom container view controller split into two halves each containing a 
 _CDVViewController_
  # Top half loads and after a delay (3000ms) fires a _NSNotification_
  # In response to the _NSNotification_ the top half loads a green page and 
 the bottom half loads a red page
 Both red pages and green pages have an event listener for *deviceready*:
 {code}
 function onDeviceReady() {
 alert('deviceready from X'); // colour here
 cordova.exec(null, null, 'Echo', 'echo', ['hello']);
 };
 {code}
 {panel:title=Observed 
 Behaviour|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#CE}
  - _deviceready_ is fired only for the red page (bottom)
  - The _cordova.exec_ succeeds for the red page (bottom)
  - _deviceready_ is not fired for the green page (top)
 {panel}
 {panel:title=Expected 
 Behaviour|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#CE}
 _deviceready_ should be fired for both the green and red page simultaneously 
 and the _cordova.exec_ events should go through immediately.
 {panel}
 {panel:title=Extra 
 Details|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#CE}
 This bug reproduces the first time the app is launched (reset the simulator 
 to reproduce). On subsequent launches the app behaves as expected.
 The _deviceready_ can be triggered by certain events for the top page:
  - Pulling down the notification bar
  - Backgrounding
 If _deviceready_ is triggered by pulling down the notification bar, the 
 _cordova.exec_ is still not fired for the green page. The _cordova.exec_ 
 message is queued up and finally does go through when the app is backgrounded.
 {panel}
 This bug is remarkably similar to the following:
 https://issues.apache.org/jira/browse/CB-2094
 Perhaps it is an edge case which was overlooked? This bug reproduces on 2.3.0 
 and 2.7.0 - I have not tried other versions yet.

--
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-3534) Multiple CDVViewControllers - deviceready not fired and cordova.exec events queued up till backgrounding

2013-06-07 Thread Mike Kwan (JIRA)

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

Mike Kwan commented on CB-3534:
---

I have an embarrassingly terrible workaround for this issue...

{code}
- (void)viewDidLoad
{
[super viewDidLoad];
[self flushCordovaBridge];
}

- (void)flushCordovaBridge
{
[self.commandDelegate evalJs:@cordova.fireDocumentEvent('resign'); 
scheduledOnRunLoop:NO];
[self performSelector:_cmd withObject:nil afterDelay:0.1];
}
{code}

This probably drains the battery and also will also prevent the 
*CDVViewController* being released if it is no longer being used so if you use 
this put some login to only do the *performSelector* if your 
*CDVViewController* still needs to be alive.

 Multiple CDVViewControllers - deviceready not fired and cordova.exec events 
 queued up till backgrounding
 

 Key: CB-3534
 URL: https://issues.apache.org/jira/browse/CB-3534
 Project: Apache Cordova
  Issue Type: Bug
  Components: App Hello World, CordovaJS, iOS
Affects Versions: 2.3.0, 2.7.0
 Environment: Reproducible on iPhone/iPad 6.1 Simulator and Device.
Reporter: Mike Kwan
Assignee: Shazron Abdullah
Priority: Critical
 Attachments: CordovaBug.zip, Screen Shot 2013-05-29 at 13.55.42.png, 
 Screen Shot 2013-05-29 at 14.31.44.png


 Minimal example reproducing the problem is attached and set up as follows:
  # Custom container view controller split into two halves each containing a 
 _CDVViewController_
  # Top half loads and after a delay (3000ms) fires a _NSNotification_
  # In response to the _NSNotification_ the top half loads a green page and 
 the bottom half loads a red page
 Both red pages and green pages have an event listener for *deviceready*:
 {code}
 function onDeviceReady() {
 alert('deviceready from X'); // colour here
 cordova.exec(null, null, 'Echo', 'echo', ['hello']);
 };
 {code}
 {panel:title=Observed 
 Behaviour|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#CE}
  - _deviceready_ is fired only for the red page (bottom)
  - The _cordova.exec_ succeeds for the red page (bottom)
  - _deviceready_ is not fired for the green page (top)
 {panel}
 {panel:title=Expected 
 Behaviour|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#CE}
 _deviceready_ should be fired for both the green and red page simultaneously 
 and the _cordova.exec_ events should go through immediately.
 {panel}
 {panel:title=Extra 
 Details|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1|bgColor=#CE}
 This bug reproduces the first time the app is launched (reset the simulator 
 to reproduce). On subsequent launches the app behaves as expected.
 The _deviceready_ can be triggered by certain events for the top page:
  - Pulling down the notification bar
  - Backgrounding
 If _deviceready_ is triggered by pulling down the notification bar, the 
 _cordova.exec_ is still not fired for the green page. The _cordova.exec_ 
 message is queued up and finally does go through when the app is backgrounded.
 {panel}
 This bug is remarkably similar to the following:
 https://issues.apache.org/jira/browse/CB-2094
 Perhaps it is an edge case which was overlooked? This bug reproduces on 2.3.0 
 and 2.7.0 - I have not tried other versions yet.

--
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