Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install UX #1

Closed
alexcroox opened this issue Oct 25, 2021 · 17 comments
Closed

Install UX #1

alexcroox opened this issue Oct 25, 2021 · 17 comments

Comments

@alexcroox
Copy link

alexcroox commented Oct 25, 2021

Love the effort here, will be watching closely.

One thing I'd like to point out if it's not been considered already is the install method. It would be great to be able to configure how the app is updated;

a) Immediate install/switch/restart when the download of the new update is finished
b) Manual through function so developer can choose the best time when they know the user isn't doing something important.
c) Install/restart/switch when the app re-gains focus (e.g with App.addListener('appStateChange')

If you wait until re-focus then it prevents the user being in the middle of something when you randomly restart the app. (doesn't handle the case of them switching apps temporarily to copy/paste or reference something else during a form filling exercise of course).

Apple won't allow you to show an install update prompt so you have to consider the different background approaches.

Will you be exposing events for download started/finished/failed/update available etc?

@riderx
Copy link
Collaborator

riderx commented Nov 17, 2021

Hey thanks for the feedback, my idea is to make the plugin as dumb as possible and let dev do they one logic .
So probably with the event. I’m still struggling on the update now but when I will have a functional tool I will start on events

@riderx
Copy link
Collaborator

riderx commented Nov 25, 2021

Hey @alexcroox i have update the doc to make example

  import { CapacitorUpdater } from 'capacitor-updater'
  import { SplashScreen } from '@capacitor/splash-screen'
  import { App } from '@capacitor/app'

  // Do the update when user leave app
  App.addListener('appStateChange', async(state) => {
      if (!state.isActive) {
        SplashScreen.show()
        const version = await CapacitorUpdater.download({
        url: 'https://github.com/Forgr-ee/Mimesis/releases/download/0.0.1/dist.zip',
        })
        await CapacitorUpdater.set(version)
        SplashScreen.hide() // in case the set fail, otherwise the new app will have to hide it
      }
  })

So when you hide the app it start the download and set the new version.

In my own app I have chosen to check for new version and download at the start.
Then set new version as active when state.isActive === false to don't disturb the user.

@riderx
Copy link
Collaborator

riderx commented Dec 16, 2021

@alexcroox i was wandering if you have any clue about how the current plugin are doing the revert, I don't find a way to revert from installed version to original version

@alexcroox
Copy link
Author

alexcroox commented Dec 16, 2021

I’m not sure of that specific implementation but wouldn’t it just be a case of copying the current install over to a “previous-version” folder, downloading the new version into a new folder, then telling Capacitor to launch from that new folder. Then when you re-launch call a “setInstallSuccessful” function or similar within x seconds of launch. If it’s not called by JS then you know it must be a broken build and can repeat the above but use the previous version folder as the new startup target to revert back.

@riderx
Copy link
Collaborator

riderx commented Dec 16, 2021

@alexcroox i found the way to get back the original version yesterday night, Thanks !
I will have a look for the auto revert system soon.

@Torone
Copy link

Torone commented Jan 19, 2022

Hi @riderx thanks for this plugin.
I have some questions...

You wrote: "In my own app I have chosen to check for new version and download at the start.
Then set new version as active when state.isActive === false to don't disturb the user."

How can you check for new versions? I'm missing a few parts probably...

What I would like to do is to get the updates when the user open the App only if there is something to update. But I'm struggling to understand how...

Can you please add a few more code example that can cover different scenarios? Thanks again!

@MarkChrisLevy
Copy link

@Torone You have to implement server side on your own, the plugin just "unpacks" and "load" new version. But imho that it is exactly how it should work, cause you will not depend on any specific backend vendor.

@riderx
Copy link
Collaborator

riderx commented Jan 20, 2022

Yes, @Torone, it works like @MarkChrisLevy said.

But many users asked like you, better solution.

So i'm working in simple solution with auto-pull version.
You will have 2 options:

  • Our API will be paid feature, to upload and store the version for you.
  • Implement your own API, it will need to respond { "version": "1.0.0", "url": "https://your_zip_file_in _your_server"}

I plan to make the same pricing of old Expo.dev 29 euro by month.

And of course you can continue to pull version manually like before

@Torone
Copy link

Torone commented Jan 20, 2022

Thanks for your answers. I managed to create my own logic using my API. It is working fine.

@riderx
Copy link
Collaborator

riderx commented Feb 7, 2022

@Torone i have add the auto-update system and auto revert if it fail.

it's free for now !
You can setup your own server URL too

Check the doc : https://doc.capgo.app/Auto-update-2cf9edda70484d7fa57111ab9c435d08

@riderx
Copy link
Collaborator

riderx commented Feb 7, 2022

@alexcroox with the auto-update system do you still need the event ?
I was thinking maybe a method to "pause" the auto update could be enought

@lincolnthree
Copy link
Collaborator

@riderx I think events are still important so the app can make decisions at runtime. Or display progress.

@riderx
Copy link
Collaborator

riderx commented Feb 11, 2022

@lincolnthree in auto update you manage nothing, and in manual you already have promise, who give your result when things are done.
I need a bit more of the context to see where it can be useful.
Also, we can't show to Apple user stuff about auto update, otherwise your app can be kick out :/

@riderx
Copy link
Collaborator

riderx commented Mar 3, 2022

i have added some features hope this make it feature complete for your usecase:
https://github.com/Cap-go/capacitor-updater#listen-to-download-events
To check download events, works for manual and auto update
In auto update, i have added :
https://github.com/Cap-go/capacitor-updater#delayupdate
https://github.com/Cap-go/capacitor-updater#canceldelay
To delay update or cancel the delay.
I have also refactored the code a bit and remove Just module in favour of Alamofire, who is more maintained

@riderx
Copy link
Collaborator

riderx commented Mar 7, 2022

@alexcroox do the latest change full fit your needs?

@alexcroox
Copy link
Author

yes I think a/b/c could probably be covered by the new events and methods thanks

@riderx
Copy link
Collaborator

riderx commented Mar 7, 2022

❤️

riderx pushed a commit that referenced this issue Sep 19, 2022
riderx pushed a commit that referenced this issue Mar 8, 2024
* move to only private key encryption with public key decryption
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants