don't try to upgrade fdroid builds

Add BuildConfig boolean that's true when a gradle property is passed in
from the fdroid metadata/build file. Test when putting together upgrade
state and omit app info when it's true, same as if from Play store.
This commit is contained in:
Eric House 2017-05-24 20:16:07 -07:00
parent d58c601bf3
commit 935932f440
2 changed files with 6 additions and 3 deletions

View file

@ -3,12 +3,13 @@ def VERSION_CODE_BASE = 114
def VERSION_NAME = '4.4.118'
def VARIANTS = [ "xw4", "xw4d" ]
def BUILDS = [ "Debug", "Release" ]
boolean forFDroid = hasProperty('forFDroid')
// Get the git revision we're using. Since fdroid modifies files as
// part of its build process -dirty will always be added, confusing
// users. So add that for the non-fdroid case.
def GITREV = "git describe --tags"
if (! hasProperty('forFDroid')) {
if (! forFDroid) {
GITREV += " --dirty"
}
GITREV = GITREV.execute().text.trim()
@ -47,6 +48,8 @@ android {
variant.buildConfigField "String", "GCM_SENDER_ID", "\"$senderID\""
variant.buildConfigField "short", "CLIENT_VERS_RELAY", "$INITIAL_CLIENT_VERS"
variant.buildConfigField "boolean", "FOR_FDROID", "$forFDroid"
}
flavorDimensions "variant"//, "abi"

View file

@ -124,8 +124,8 @@ public class UpdateCheckReceiver extends BroadcastReceiver {
}
// App update
if ( Utils.isGooglePlayApp( context ) ) {
// Do nothing
if ( BuildConfig.FOR_FDROID || Utils.isGooglePlayApp( context ) ) {
// Do nothing; can't or mustn't upgrade app
} else {
String installer = pm.getInstallerPackageName( packageName );