Open riderx opened 3 months ago
/bounty 100
/attempt #411
with your implementation plan/claim #411
in the PR body to claim the bountyโน๏ธ If something is not clear ask before working on it, otherwise your chance to rework it is high ๐ฅ To claim you need to provide in your PR a demo video of the change ๐จโ๐ฉโ๐งโ๐ฆ Join the Discord to get help ๐ Check all Bounty rules
Thank you for contributing to Cap-go/capacitor-updater!
Add a bounty โข Share on socials
Attempt | Started (GMT+0) | Solution |
---|---|---|
๐ด @adilkadivala | Aug 2, 2024, 2:54:02 PM | WIP |
I would like to provide further clarification on the issue we just discussed with @riderx . We would like the app to install the update when the app boots, but only when there is an already downloaded bundle waiting.
The current behavior of CapGo for direct update is: Capgo fetches (downloads) the bundle from the server and installs the update in one step. This adds a delay since the round trip time to the servers add up. (avg. time 5s for most cases).
The proposed behavior is: allow Capgo to determine if there is an already downloaded bundle (on device, ready to be installed) and use that bundle to install the update next time the app is killed/restarted instead of always applying it on background/foreground action. This solutions eliminates the round-trip to the server. (avg. time to install reduced to 1-2s)
The update would be applied on app boot, and much faster.
Here are some steps and pointers to help you get started on resolving this issue:
Add a New Setting for Update Kind:
updateKind
in the configuration file (capacitor.config.json
or capacitor.config.ts
).background
, foreground
, and appBoot
.Modify the Plugin to Check for Already Downloaded Bundles:
CapacitorUpdaterPlugin.java
to include logic that checks for already downloaded bundles when the app boots.Update the load
Method:
load
method in CapacitorUpdaterPlugin.java
to check the updateKind
setting.updateKind
is set to appBoot
, add logic to apply the update if a downloaded bundle is available.Implement the Logic to Apply Updates on App Boot:
CapacitorUpdater.java
, add methods to check for downloaded bundles and apply them on app boot.updateKind
is set to appBoot
.Configuration File:
capacitor.config.json
or capacitor.config.ts
to include the new updateKind
setting.
{
"plugins": {
"CapacitorUpdater": {
"updateKind": "appBoot" // or "background" or "foreground"
}
}
}
CapacitorUpdaterPlugin.java:
load
method to check for the updateKind
setting.
@Override
public void load() {
super.load();
// Existing code...
String updateKind = this.getConfig().getString("updateKind", "background"); if ("appBoot".equals(updateKind)) { checkAndUpdateOnBoot(); } }
private void checkAndUpdateOnBoot() { // Logic to check for downloaded bundles and apply the update BundleInfo downloadedBundle = this.implementation.getDownloadedBundle(); if (downloadedBundle != null) { this.implementation.applyUpdate(downloadedBundle); } }
CapacitorUpdater.java:
public BundleInfo getDownloadedBundle() {
// Logic to check for already downloaded bundles
// Return the bundle info if found, otherwise return null
}
public void applyUpdate(BundleInfo bundle) { // Logic to apply the update using the provided bundle info }
Security:
Stability:
Potential Bugs:
Existing Methods:
CapacitorUpdaterPlugin.java
and CapacitorUpdater.java
for downloading and applying updates to avoid code repetition.API Documentation:
api.md
) to include the new updateKind
setting and its possible values.wanna work on this issue #411, let assign it me..
/attempt #411
@adilkadivala Have you started working on this?
@raphjutras i have left due to some reason ,, you can start. good luck...
@raphjutras i have left due to some reason ,, you can start. good luck...
Then can you cancel your attempt so that others can take the bounty? Thank-you
I have canceled ,
here it is red...
The proposed behavior is: allow Capgo to determine if there is an already downloaded bundle (on device, ready to be installed) and use that bundle to install the update next time the app is killed/restarted instead of always applying it on background/foreground action. This solutions eliminates the round-trip to the server. (avg. time to install reduced to 1-2s)
I think android does that already (?). I am not sure, but I think so from what I have observed
Martin has explained this issue to me. I will be attempting to implement it today
here the reference of codepush: https://github.com/microsoft/cordova-plugin-code-push#installmode
Thank you to both of you @riderx and @WcaleNieWolny I will keep following this issue closely ๐ We will test the feature as soon as it is available.
Hello, I just created a PR with an IOS implementation. I will work on android right away
It should be available in a setting like updateKind. The goal here is to change the moment where update is applied, not when downloaded