microsoft/cordova-plugin-code-push

Cordova's deviceready event doesn't fire on plugin reinstall

esjs opened this issue · 2 comments

esjs commented

Description

I'm experiencing issue across all projects that use cordova-plugin-code-push installed. The deviceready event doesn't fire when I install plugins for the second time.

Reproduction

  1. create new Cordova project using
    cordova create hello com.example.hello HelloWorld
  2. add ios platform (from project root of course)
    cordova platform add ios
  3. install code-push
    cordova plugin add cordova-plugin-code-push
  4. run project on emulator (iPhone 11 Pro Max in my case, not sure that it's important)
    cordova run ios
  5. Cordova should display green badge that "Device is ready"
  6. from project root run following to remove previously installed stuff
    rm -rf node_modules plugins platforms
  7. Now restore previous state using
    cordova prepare
  8. Run application same emulator as before
    cordova run ios

Expected result:
Cordova should show "Device is ready" as before

Actual result:
Cordova is displaying "Connecting to device" message

Additional Information

  • cordova-plugin-code-push version: 1.12.2
  • List of installed plugins:
    "dependencies": {
    "code-push": "^3.0.1",
    "cordova-ios": "^5.1.1",
    "cordova-plugin-code-push": "^1.12.2",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-device": "^2.0.3",
    "cordova-plugin-dialogs": "^2.0.2",
    "cordova-plugin-file": "^4.3.3",
    "cordova-plugin-file-transfer": "^1.6.3",
    "cordova-plugin-zip": "^3.1.0"
    },
    "cordova": {
    "platforms": [
    "ios"
    ],
    "plugins": {
    "cordova-plugin-whitelist": {},
    "cordova-plugin-code-push": {},
    "cordova-plugin-file": {},
    "cordova-plugin-file-transfer": {},
    "cordova-plugin-zip": {}
    }
    },
    "devDependencies": {
    "cordova-plugin-whitelist": "1"
    }
  • Cordova version:
    9.0.0 (cordova-lib@9.0.1)
  • iOS/Android/Windows version:
    iOS 13.3
  • Does this reproduce on a debug build or release build?
    Didn't check
  • Does this reproduce on a simulator, or only on a physical device?
    Simulator IPhone 11 Pro Max - 13.3
ermik commented

You have to install your JavaScript dependencies, which are located in node_modules if you delete that folder using npm install. You would also need to rebuild your JS code before running run or prepare commands. This plugins can't affect deviceReady event, because it wouldn't be invoked until deviceReady event.

@alexandergoncharov please close.

Thank @ermik, @esjs!
I'm going to close this issue for now. Please feel free to reopen it if you have any questions.