ArtSabintsev / Siren

Notify users when a new version of your app is available and prompt them to upgrade.
http://sabintsev.com/
MIT License
4.24k stars 407 forks source link

When rule is set to .critical, previous skipped version setting should be ignored #402

Closed aburgel closed 1 year ago

aburgel commented 2 years ago

We use Siren to force users to upgrade when we release breaking changes on our backend. We ran into an issue recently related to this and the StoredSkippedVersion setting.

Our process is this:

  1. Ship a new version (say 1.5.0)
  2. Wait a few days
  3. Update an endpoint that defines a minimum required version (in this example, we set it to '1.5.0')

When our app starts up, we hit this endpoint, and if current version < minimum required version, we set siren to use Rules.critical.

The problem arises in step 2. We wait a few days so we can let users upgrade automatically, but it's possible that during this time they're are presented with the Siren option to skip the upgrade (since at this point, we're using Rules.default). Because the user may have skipped, when we set Rules.critical, the upgrade won't get enforced.

I think when Rules.critical is in use (or more specifically AlertType.force) StoredSkippedVersion should be ignored.

ArtSabintsev commented 2 years ago

Man oh man - are you the same Alex from Swaag? It's been a long time.

I need to think through this problem and I will get back to you later tonight

ArtSabintsev commented 2 years ago

Yup, just tested this out in the sample app by running the following functions in AppDelegate

  1. defaultExample()
  2. hyperCriticalExample()

When I ran 1, clicked Skip, closed the process. Relaunched the app with 2, it didn't pop the modal.

This is totally a bug that's been in the code for 7.5 years that I've never come across personally.

Feel free to open a PR at your leisure. I'll be out of pocket for about a week, but will check back when I'm back if you do end up opening a PR.

aburgel commented 1 year ago

@ArtSabintsev Yep, that's me. Can't believe you remember that far back 😄 It's nice to see all the iOS projects you have. This one has been especially useful. I just opened up a small PR with a fix for this issue.

ArtSabintsev commented 1 year ago

Thank you! Closing this one in favor of that one.