Closed TobiGr closed 6 years ago
It's not that bad. It's a pity this slows down the API even more, we cannot parallelize this, as it depends on data fetched previously.
But I'm still trying to figure out what a "version code" is.
Each version has a version name and a version code. It is hard to compare version names (e.g. 2017-08-08-gplay
, 2017-08-08-fdroid
, 1.0-alpha
, 1.0-beta
, 1.0
) because an application can have the same base, but different flavours (alpha, beta, stable, tv etc.).
The version code is just a number which is increased with every release (sometimes even for every build). This makes it way easier to compare different version and releases. Especially when you support different platforms.
This Android Dev site says:
A positive integer used as an internal version number. This number is used only to determine whether one version is more recent than another, with higher numbers indicating more recent versions. This is not the version number shown to users; that number is set by the versionName setting, below. The Android system uses the versionCode value to protect against downgrades by preventing users from installing an APK with a lower versionCode than the version currently installed on their device.
It's not that bad. It's a pity this slows down the API even more, we cannot parallelize this, as it depends on data fetched previously.
We could use some dirty hacks for this to prevent the second request:
a) Compare F-Droid and GitHub version name. If they are equal, the version code is equal too. => No need to fetch the Gradle build file.
b) Get the latest Gradle Build file from master with all the other files. Generally, the development happens in the dev
branch and only changes are pushed to master
for a new release. Therefore it is save to use this Gradle file as the one required. In addition, we can compare the version name from the file with the version name from the release page. If they are not equal, we need to make another request.
No need to over-engineer this. We cache the values, so don't worry about some slow first request.
Version codes as you call them are usually referenced as version numbers, I guess that's why I was confused.
Anyway, good to merge IMO.
JFYI, it's deployed now.
Thanks.
I just fixed some selectors because GitHub changed them. Maybe we should use some kind of monitoring which alerts us when some value is -1
.
Add GitHub version code by scrapping the git hash of the latest release and parsing the matching
build.gradle
file.TeamNewPipe/NewPipe#1520