Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

[Bug] VersionTracking does not handle downgrades correctly #1960

Closed
cpraehaus opened this issue Jan 28, 2022 · 4 comments
Closed

[Bug] VersionTracking does not handle downgrades correctly #1960

cpraehaus opened this issue Jan 28, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@cpraehaus
Copy link
Contributor

Description

On some platforms downgrades from higher to lower app versions are possible (e.g. on iOS when switching from TestFlight Beta to official App store). In such scenarios VersionTracking is broken, e.g. VersionTracking.PreviousVersion is incorrect.

Same for VersionTracking.PreviousBuild.

Its also questionable what the correct behavior is VersionTracking.IsFirstLaunchForCurrentVersion in such downgrade scenarios. I think its not clearly defined in the documentation. Currently the semantics are more like IsFirstLaunchEverForCurrentVersion.
One could interpret too that IsFirstLaunchForCurrentVersion returns true upon the first launch with this version. Currently it returns false when the version was installed at some point (in the version history)

Steps to Reproduce

Note: never explicitly uninstall/remove the app on iOS (this will clear local data).

  1. Install App version 1.0.0 from App Store (official app version)
  2. Start App (to let VersionTracking update its state)
    CurrentVersion: "1.0.0"
    New VersionHistory: ["1.0.0"]
    PreviousVersion: null
  3. Switch to TestFlight and install some alpha/beta build, say 1.0.1054
  4. Start App (to let VersionTracking update its state)
    CurrentVersion: "1.0.1054"
    New VersionHistory: ["1.0.0", "1.0.1054"]
    PreviousVersion: "1.0.0"
  5. Stop testing in TestFlight and switch back to official app version 1.0.0
  6. Start App (to let VersionTracking update its state)
    CurrentVersion: "1.0.0"
    VersionHistory: ["1.0.0", "1.0.1054"] (will not be updated since IsFirstLaunchForCurrentVersion == false)
    PreviousVersion: "1.0.0" (incorrect)

Expected Behavior

VersionTracking.PreviousVersion returns "1.0.1054"

Actual Behavior

VersionTracking.PreviousVersion returns "1.0.0"

Basic Information

  • Version with issue: 1.7.1
  • Last known good version: -
  • IDE: -
  • Platform Target Frameworks: applies to all platforms where app downgrades are possible (without clearing local state/config), e.g. on iOS in combination with TestFlight.

Screenshots

None

Reproduction Link

None

@cpraehaus cpraehaus added the bug Something isn't working label Jan 28, 2022
@jamesmontemagno
Copy link
Collaborator

It is impossible for your users to downgrade their app. In TestFlight yes, but not on the app store. This is an interesting edgecase, but it was only meant to track new verisons, so it did track 1.0.0.

@cpraehaus
Copy link
Contributor Author

@jamesmontemagno Well it happens in day to day use when users are switching back from alpha and beta versions to productive. I don't know if other platforms are - or in the future will be - affected by this as well. Note that in the above example the fact that VersionTracking "tracks" 1.0.0 is just by accident (not by design).

I can try to prepare PR to fix this. Does it have chances of being merged?

@jamesmontemagno
Copy link
Collaborator

Yeah.... I see what you mean for testflight stuff... interesting...

Yeah if you PR it and since it is a bug fix we will try to triage it.

@cpraehaus
Copy link
Contributor Author

@jamesmontemagno Thanks! I have prepared the PR and would be happy if you find time to review it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants