Cap-go / capacitor-updater

Capacitor plugin for Instant updates: Ship updates, fixes, changes, and features within minutes
https://capgo.app
Mozilla Public License 2.0
528 stars 106 forks source link

feat: maintain path after update has installed #193

Open alexcroox opened 1 year ago

alexcroox commented 1 year ago

Feature Request

Description

With MS App Center's Codepush, once an update was installed, the current page/route would remain. This means when the user returns back to bring the app into focus, they won't realise anything happened.

Currently Capgo goes to the root (/) which for me is a login screen and I'd rather the user could continue where they left off.

Platform(s)

ios/android

Alternatives

If this isn't possible I could save current path before calling CapacitorUpdater.set(), then redirect to the path after install

riderx commented 1 year ago

that a very good one, i have look but i don't know how to do it for now :)

alexcroox commented 1 year ago

I wonder how Codepush does it? Do they maybe grab window.location.pathname before the install, and send the webview there after install?

riderx commented 1 year ago

I don't know also yesterday looking into that i was wondering how to handle if you removed the path the user was in

alexcroox commented 1 year ago

Yeah it’s a good point. Definitely a config option you’d want to leave up to the developer so they can think to handle that in the future if they enable it

alexcroox commented 1 year ago

Adding note from our previous discussion on Discord. Perhaps we could allow the plugin to persist some state (a JS object) when setting the new version, which is then retrievable via new function or .current()?

e.g

CapacitorUpdater.set({ id: data.id, state: { exampleRedirectMeToPathAfterInstallKey: '/platform/dashboard' })

The challenge will be deciding where to retrieve this state, and how to delete it so old state isn't accessed in future updates if state isn't set next time (could it be versioned?)