Apache Cordova
  1. Apache Cordova
  2. CB-497

online and offline events are not being fired in 1.6.0

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.6.0
    • Fix Version/s: 1.6.1
    • Component/s: iOS
    • Labels:
      None
    • Environment:

      IOS4,5 xcode4+

      Description

      • after updating to 1.6 i notice that JS calls with Cordova capital C are not working example: Cordova.exec(..)
        replacing C with c solved the problem
      • Some Cordova classes like CDVConnection.m had some JS firing with Cordova variable with "C" exp: line103" Cordova.fireDocumentEvent('online');"];

      A review is needed to make sure no Cordova variables are needed/called

        Activity

        Emile khattar created issue -
        Shazron Abdullah made changes -
        Field Original Value New Value
        Summary Cordova vs cordova js variable/object name online and offline events are not being fired in 1.6.0
        Shazron Abdullah made changes -
        Component/s iOS [ 12316400 ]
        Component/s CordovaJS [ 12317202 ]
        Shazron Abdullah made changes -
        Assignee Filip Maj [ filmaj ] Shazron Abdullah [ shazron ]
        Shazron Abdullah made changes -
        Priority Major [ 3 ] Blocker [ 1 ]
        Hide
        Filip Maj added a comment -

        After reviewing the native platforms, here are the areas I see that need updating:

        Android, BlackBerry and Windows Phone have no such issues.

        Show
        Filip Maj added a comment - After reviewing the native platforms, here are the areas I see that need updating: In CDVViewController.m In CDVConnection.m (as per above) Android, BlackBerry and Windows Phone have no such issues.
        Filip Maj made changes -
        Priority Blocker [ 1 ] Major [ 3 ]
        Hide
        Shazron Abdullah added a comment -

        separate issue for CVViewController.m CB-501 (and this is a blocker, really)

        Show
        Shazron Abdullah added a comment - separate issue for CVViewController.m CB-501 (and this is a blocker, really)
        Show
        Shazron Abdullah added a comment - Fix commit: http://git-wip-us.apache.org/repos/asf?p=incubator-cordova-ios.git;a=commit;h=0db555b2b2e6ed184d0494d2b28f251059c72a18
        Shazron Abdullah made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 1.6.1 [ 12320757 ]
        Resolution Fixed [ 1 ]
        Hide
        Filip Maj added a comment -

        Sorry man, you know how you load up the issue in your browser and then in the mean time while I'm writing up a comment someone else changes the ticket behind the scenes?

        Yeah, that.

        Show
        Filip Maj added a comment - Sorry man, you know how you load up the issue in your browser and then in the mean time while I'm writing up a comment someone else changes the ticket behind the scenes? Yeah, that.
        Hide
        Emile khattar added a comment -

        It is friday 13

        Show
        Emile khattar added a comment - It is friday 13
        Show
        Shazron Abdullah added a comment - Further fix here: http://git-wip-us.apache.org/repos/asf?p=incubator-cordova-ios.git;a=commit;h=590d087f2e379c84fd11f02442ba54e3b263959e
        Hide
        Shaun Bent added a comment -

        I have run into the issue where pause/resume where not firing - which appears to be fixed in the commit just posted.

        Is it possible to use the commit now without waiting until the next version of Cordova/Phonegap is released? I.E. just copy the CDVViewController.m into my project somewhere?

        Any help on this would be great as this stopping me from launching my app.

        Show
        Shaun Bent added a comment - I have run into the issue where pause/resume where not firing - which appears to be fixed in the commit just posted. Is it possible to use the commit now without waiting until the next version of Cordova/Phonegap is released? I.E. just copy the CDVViewController.m into my project somewhere? Any help on this would be great as this stopping me from launching my app.
        Hide
        Shazron Abdullah added a comment -

        @Shaun it depends on what version, you are using which I assume is 1.6.0? 1.6.1 should be out later today or early tomorrow. All you need to change if you are on 1.6.1 is here, for CDVViewController.m:
        http://git-wip-us.apache.org/repos/asf?p=incubator-cordova-ios.git;a=blobdiff;f=CordovaLib/Classes/CDVViewController.m;h=fa2c00698915f9e908857d7c1fa385ed8a9d3c1f;hp=a61cae5b283f33fc94ba2b2ee0e9094a4d53d1ef;hb=590d087f2e379c84fd11f02442ba54e3b263959e;hpb=791818a96aa981f5876887562759db78b83f37c6

        Show
        Shazron Abdullah added a comment - @Shaun it depends on what version, you are using which I assume is 1.6.0? 1.6.1 should be out later today or early tomorrow. All you need to change if you are on 1.6.1 is here, for CDVViewController.m: http://git-wip-us.apache.org/repos/asf?p=incubator-cordova-ios.git;a=blobdiff;f=CordovaLib/Classes/CDVViewController.m;h=fa2c00698915f9e908857d7c1fa385ed8a9d3c1f;hp=a61cae5b283f33fc94ba2b2ee0e9094a4d53d1ef;hb=590d087f2e379c84fd11f02442ba54e3b263959e;hpb=791818a96aa981f5876887562759db78b83f37c6
        Hide
        Shaun Bent added a comment -

        I am currently using 1.6.0 as I can not seem to find a link to 1.6.1 anywhere - I am getting a little confused between this site, github and phonegap.com, etc.

        If 1.6.1 is out later today or tomorrow will I be able to download it from Phonegap.com?

        Thanks for your help

        Show
        Shaun Bent added a comment - I am currently using 1.6.0 as I can not seem to find a link to 1.6.1 anywhere - I am getting a little confused between this site, github and phonegap.com, etc. If 1.6.1 is out later today or tomorrow will I be able to download it from Phonegap.com? Thanks for your help
        Hide
        Shazron Abdullah added a comment -

        There is no binary yet on phonegap.com, but it will be there when it's ready (it's in progress as we speak). If you want the source for iOS, you can grab it here: https://github.com/apache/incubator-cordova-ios/tags

        phonegap.com - where Adobe releases binary+src versions of Apache Cordova
        Apache jira - where Apache Cordova issues are tracked, and where contributors and devs can send bugs
        github - where Apache Cordova source is mirrored, and where contributors can send code patches

        Eventually Apache will also release Cordova source on Apache infrastructure itself, this is in progress.

        Show
        Shazron Abdullah added a comment - There is no binary yet on phonegap.com, but it will be there when it's ready (it's in progress as we speak). If you want the source for iOS, you can grab it here: https://github.com/apache/incubator-cordova-ios/tags phonegap.com - where Adobe releases binary+src versions of Apache Cordova Apache jira - where Apache Cordova issues are tracked, and where contributors and devs can send bugs github - where Apache Cordova source is mirrored, and where contributors can send code patches Eventually Apache will also release Cordova source on Apache infrastructure itself, this is in progress.
        Hide
        Shaun Bent added a comment -

        Thats perfect - just what I am after - thank you very much for you help!

        Shaun

        Show
        Shaun Bent added a comment - Thats perfect - just what I am after - thank you very much for you help! Shaun
        Hide
        Shaun Bent added a comment -

        Might just be me but now I have applied 1.6.1 to my project my apps now freeze when they resume. I initially thought this might just be my app so I created a new Cordova project that simply alerts messages when the 'deviceready' event is called and the 'resume' event is called. However, whenever I resume an app they just freeze!

        Not sure if this is as a result of the fixes to pause/resume in 1.6.1

        Show
        Shaun Bent added a comment - Might just be me but now I have applied 1.6.1 to my project my apps now freeze when they resume. I initially thought this might just be my app so I created a new Cordova project that simply alerts messages when the 'deviceready' event is called and the 'resume' event is called. However, whenever I resume an app they just freeze! Not sure if this is as a result of the fixes to pause/resume in 1.6.1
        Hide
        Shazron Abdullah added a comment -

        No it's nothing to do with the new fixes, it's iOS. You cannot show any interactive elements immediately during pause/resume, they will hang your app (similarly when launched from a protocol handler). Wrap any content in your resume handler with a setTimeout with a timeout value of zero, it should work.

        eg

        
        document.addEventListener("resume", onResume, false);
        
        function onResume()
        {
          setTimeout(function() {
               // do your thing here!
            }, 0);
        }
        

        It's an iOS Quirk that is documented in the docs I believe - it's been added for the Pause event, but not Resume event - I'll fix the docs.

        Show
        Shazron Abdullah added a comment - No it's nothing to do with the new fixes, it's iOS. You cannot show any interactive elements immediately during pause/resume, they will hang your app (similarly when launched from a protocol handler). Wrap any content in your resume handler with a setTimeout with a timeout value of zero, it should work. eg document.addEventListener( "resume" , onResume, false ); function onResume() { setTimeout(function() { // do your thing here! }, 0); } It's an iOS Quirk that is documented in the docs I believe - it's been added for the Pause event, but not Resume event - I'll fix the docs.

          People

          • Assignee:
            Shazron Abdullah
            Reporter:
            Emile khattar
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development