Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-9661

Plugins should be notified after deviceready event has been fired

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Invalid
    • 5.1.1
    • None
    • AllPlugins
    • None

    Description

      I use the Intercom plugin.

      It is a plugin that shows a little button at the bottom (that we'll call "widget") that permits to show a native chat panel when the user wants to give a feedback for our app.

      On startup I run something akin to:

      function deviceReady() {
          hideSplashScreen();
          if ( isUserConnected() ) {
              intercom.registerIdentifiedUser(userIntercomData);
              startApp();
          } 
          else {
              intercom.reset();
              showLoginForm();
          }
      }
      

      The widget is only shawn after calling intercom.registerIdentifiedUser();
      The widget disappear when we call intercom.reset();
      The intercom plugin memoizes the fact that an user is registered over time.

      This means that if I kill the app with a registered user, and restart it, Intercom will by default restore that regitered user on next startup.

      Unfortunatly, this means that the widget will be shawn at the very beginning of the app initialization, even before the webview is initialized. In my case, it means that the Intercom button will be shawn for a little amount of time above the splash screen, which is a bit weird.

      This would make sense for the Intercom team to not show the widget until the webview is initialized, particularly waiting for deviceready event to fire.

      After discussing with the Intercom team, it seems they can't implement this because there's no possible way to wait for the deviceready event to fire from the native plugin code.

      So I think it could be nice to be able, from the native plugin code, to wait for the deviceready event to be handled, so that native code can be started afterwards.

      The original plugin issue: https://github.com/intercom/intercom-cordova/issues/18

      Attachments

        Activity

          People

            Unassigned Unassigned
            sebastienlorber Sebastien Lorber
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: