Comments (7)
Actually this seems to be quite common:
from capacitor-codepush.
This appears to be an issue when the CodePush TS/JS library is not loaded at the time when the native plugin attempts to register the onDeviceReady
listener. The injected/eval JS hooks in the native CodePush manager code for Android/iOS should probably be refactored to handle this situation.
Since Capacitor does not guarantee the client JS code is loaded until the application imports the CodePush libraries (unlike Cordova which loads all plugin code up front), we will need to provide deferred callback support in the platform reporting managers:
- https://github.com/mapiacompany/capacitor-codepush/blob/main/ios/Plugin/CodePushReportingManager.m#L36
- https://github.com/mapiacompany/capacitor-codepush/blob/main/android/src/main/java/com/microsoft/capacitor/CodePushReportingManager.java#L32
Something like this (I'm not sure of the syntax needed, I think this is wrong but the intent is right.):
if(window.codePush) {
javascript:document.addEventListener(\"deviceready\", function () { window.codePush.reportStatus(%d, %s, %s, %s, %s, %s); });
} else {
window.codePushReportStatus = function () { window.codePush.reportStatus(%d, %s, %s, %s, %s, %s); });
}
Then in codePush.ts
here: https://github.com/mapiacompany/capacitor-codepush/blob/main/src/codePush.ts#L525
export const codePush = new CodePush();
(window as any).codePush = codePush;
if(window.codePushReportStatus) {
window.codePushReportStatus();
window.codePushReportStatus = undefined;
}
```f
from capacitor-codepush.
@leo6104 What do you think?
from capacitor-codepush.
As a workaround. CodePush needs to be loaded immediately on App start. (I've done this in the Angular root app TypeScript file.) But this is not ideal since it increases the initial JS bundle size and app load times. (Bad for PWAs & user experience.)
import { codePush } from 'capacitor-codepush';
(() => codePush)(); // to prevent it from being minified away
from capacitor-codepush.
@lincolnthree sorry for pinging about a different issue, but it seems your input might be valuable in #21
- as it sounds you don't experience this issue on iOS.
Please let us know whether you experience such issue on iOS. It would let us know there whether issue is related to our own setups, or it's not working for everyone.
from capacitor-codepush.
@o-alexandrov It does actually happen on iOS. I've amended my issue report.
from capacitor-codepush.
@o-alexandrov BTW. It's probably better to actually ping me in the issue you'd like me to look at, rather than convolute the discussion of another topic. The topic you're interested in is unrelated other than the platform is may occur on, which I'm not sure is a really strong 'link'. Lots of platform specific bugs occur in hybrid codebases due to the double coding required to support each platform.
from capacitor-codepush.
Related Issues (20)
- CodePush Error Could not get the package start page HOT 3
- app rolls back to the version before update after closed and opened again HOT 35
- Android build error: Could not get unknown property 'androidxAppCompatVersion' HOT 2
- Hello, how to push to your local server instead of AppCenter
- Integrating into a standard javascript app HOT 1
- Plugin Error
- Cordova Codepush is shutting down HOT 6
- Add additional maintainers?
- Can not use `sync` method in script HOT 7
- Cordova support is retired in App Center, will this effect the project? HOT 1
- App Center - Apache Cordova Retirement HOT 2
- Public key was provided but there is no JWT signature within app bundle to verify HOT 17
- Cordova will be retired from App Center starting April 1st 2022 HOT 2
- [NOT A ISSUE] AppCenter CodePush Backend Alternative HOT 8
- Announcing Apache Cordova Retirement HOT 6
- Cannot find module 'capacitor-codepush', webpackMissingModule
- Is this package still maintained? HOT 9
- CommonJS or AMD dependencies can cause optimization bailouts.
- Getting `Cannot perform diff-update` error for subsequent updates HOT 4
- Http plugin failed to call api to appcenter server
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from capacitor-codepush.