Coder Social home page Coder Social logo

Better version detection about obtainium HOT 16 OPEN

JohnBetaro avatar JohnBetaro commented on June 24, 2024
Better version detection

from obtainium.

Comments (16)

JohnBetaro avatar JohnBetaro commented on June 24, 2024 2

Are you confident this is true for all APKPure, Aptoide, and Uptodown apps? It is for the ones I checked, just making sure.

No, I just assumed that by checking many apps, I see no reason why wouldn't they use the real version name, since they are only hosting them.

At least we can try and see :)

from obtainium.

ImranR98 avatar ImranR98 commented on June 24, 2024 2

https://github.com/ImranR98/Obtainium/releases/tag/v0.14.22-beta

I'll update the comment above with this info so I can link to to explain version detection it in the future.

from obtainium.

ImranR98 avatar ImranR98 commented on June 24, 2024 1

can't it just extract the string from the system and compare it to the one indicated on the site?

That's where the problem is - the string that comes from the system is the real version string, while the string that comes from GitHub is just the Git tag for that release (for other sources it is similar - a string extracted from somewhere that uniquely identifies a release but isn't necessarily the exact version string for that release). Most developers use version strings as Git tags which is great, but some don't. Some do, but add extra info to the Git tag.

For example, you could have any of these cases among others:

  1. App version 0.14.21 but source says v0.14.21-beta (Obtainium)
  2. App version 2.12.8-2+free but source says 2.12.8-2 (Cheogram)
  3. App version 102.2.1-Release (12.5.6) (really, that whole thing is the OS-reported "version") but source says nothing - no version string is provided by this HTML source so a URL hash is used instead as the release identifier (Tor)
  4. App version 1 but source says v10 (Quotable as described in this comment)

So there is no guarantee that the OS-provided "real" version will be in any way comparable to the source-provided "version" which really just needs to uniquely identify a release in order to enable update notifications - it doesn't need to be a real version string.

In most cases, where the strings seem to both conform to some standard format, like x.y.z or x.y, we can make the comparison - and this is when version detection is able to work. In some cases Obtainium can strip off extra parts from the source string if it would result in a standard version (like how v and -beta are removed from Obtainium's v0.14.21-beta), then it can make the comparison. We never try to strip parts off the "real" version, so in the case of Cheogram above, the versions could not be resolved to a standard format.

This is how the various "standard" versions are generated: https://github.com/ImranR98/Obtainium/blob/main/lib/providers/apps_provider.dart#L64
It's always possible to expand this to add more support but we'd need to be careful (see #136 where there was a lot of trial and error figuring this out). For example if an app reports 1.2 but the source says 1.2-4, should we strip off the number 4 and say the two are the same so no update? Right now, that wouldn't happen since we are only allowed to remove specific words and prefixes.

So in general if Obtainium can't resolve the differences between the two strings to a standard format, it disables version detection and hopes the user never has to update the app externally (in which case they would probably never notice the difference).

That's important to clarify - version detection is only relevant in 2 situations:

  1. If an app's version changes outside of Obtainium (for example if it gets updated by Google Play)
  2. If an attempt to silently update the app in the background fails

In those cases, version detection will allow Obtainium to detect that the app's real OS version has changed and update it's internal records accordingly, without generating a false update notification.

Note: For some sources, the source-provided string is guaranteed to be identical to the APK's real version string. For those sources, we skip all this version detection logic and just do a simple comparison. By default, all sources use the version detection logic, and "naive" version detection is enabled on a per-source basis (this means there may be some sources which don't use it right now, but could).

I'm not sure why you mentioned #941 though, I don't think version detection makes any difference there.

from obtainium.

ImranR98 avatar ImranR98 commented on June 24, 2024 1

Also I think I get how this relates to #941 now. Wouldn't fix the issue but would make sure the update would be retried later.

from obtainium.

JohnBetaro avatar JohnBetaro commented on June 24, 2024 1

I don't know how do you extract the version from F-Droid, but native version detection can be also used there because they don't change anything, although I don't use F-Droid but this will be helpful for a lot of people.

Examples:
Unitto

Addy.io

I hope you won't close the issue until we check all the sources and try to solve the problems once and for all.

You are the best, thank you.

from obtainium.

ImranR98 avatar ImranR98 commented on June 24, 2024

Feel free to re-open if needed.

from obtainium.

JohnBetaro avatar JohnBetaro commented on June 24, 2024

I acknowledge the GitHub version detection problems that's why I change the version name for some apps that I compile with GitHub Actions, an example would be my fork of Signal, also KeePassDX when he adds "beta" attached directly to the number.

But this rule of removing some suffixes and prefixes can be skipped entirely and just compare the strings from the system and the sites as they are, because they keep the version name as it is in the app, not like apps from GitHub.

Examples:

APKPure Aptoide Uptodown
Screenshot 2023-09-30 140041~2 Screenshot 2023-09-30 140217~2 Screenshot 2023-09-30 135915~2

I hope you'll make some changes that will make Obtainium compare them direcly without any changes and keep your method only for specific sites like GitHub.

from obtainium.

JohnBetaro avatar JohnBetaro commented on June 24, 2024

I hope you'll see this since I can't reopen the issue, but I will open a new one if I did not get a response.

from obtainium.

ImranR98 avatar ImranR98 commented on June 24, 2024

Are you confident this is true for all APKPure, Aptoide, and Uptodown apps? It is for the ones I checked, just making sure.

from obtainium.

JohnBetaro avatar JohnBetaro commented on June 24, 2024

Thank you so much, that was insanely fast.

I don't want to open another issue because my next suggestion is related to this one.

If you can just add a toggle for "use tag as version" in the version detection section and make Obtainium use the tag as provided by GitHub and GitLab without any changes and compare it directly to the version name provided by the system.

Situations where this option will be useful:
KeePassDX (GitHub)

Addy.io (GitLab)

And I can think of many scenarios where this option will be very useful and the old method will not detect the version very well.

from obtainium.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.