Skip to content

Commit

Permalink
Only enable the Updater code on github releases to close mozilla#933
Browse files Browse the repository at this point in the history
  • Loading branch information
crankycoder committed Oct 27, 2014
1 parent f6d4836 commit 8f9d27a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 6 deletions.
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@ unittest:
debug:
./gradlew assembleDebug

release: release_check
./gradlew assembleRelease
sh rename_release.sh
github: release_check
./gradlew assembleGithub
sh rename_release.sh github

playstore: release_check
./gradlew assemblePlaystore
sh rename_release.sh playstore

clean:
rm -rf android/libs/*.jar
Expand Down
13 changes: 13 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ android {

buildConfigField "boolean", "LABEL_MAP_TILES", "false"

buildConfigField "boolean", "GITHUB", "false"
buildConfigField "boolean", "PLAYSTORE", "false"

// Crash report settings
buildConfigField "String", "ACRA_URI", getAcraURI()
buildConfigField "String", "ACRA_USER", getAcraUser()
Expand Down Expand Up @@ -92,6 +95,16 @@ android {
signingConfig signingConfigs.release
}

github.initWith(buildTypes.release)
github {
buildConfigField "boolean", "GITHUB", "true"
}

playstore.initWith(buildTypes.release)
playstore {
buildConfigField "boolean", "PLAYSTORE", "true"
}

unittest.initWith(buildTypes.debug)
unittest {
buildConfigField "boolean", "ROBOLECTRIC", "true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,10 @@ public void onDrawerOpened(View drawerView) {
getApp().setMainActivity(this);

IHttpUtil httpUtil = new HttpUtil();
Updater upd = new Updater(httpUtil);
upd.checkForUpdates(this, BuildConfig.MOZILLA_API_KEY);
if (BuildConfig.GITHUB) {
Updater upd = new Updater(httpUtil);
upd.checkForUpdates(this, BuildConfig.MOZILLA_API_KEY);
}

mMetricsView = new MetricsView(findViewById(R.id.left_drawer));
}
Expand Down
2 changes: 1 addition & 1 deletion rename_release.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# bad hack to rename the final apk
mkdir -p outputs
cmd="cp android/build/outputs/apk/MozStumbler-release.apk outputs/MozStumbler-v`cat VERSION`.apk"
cmd="cp android/build/outputs/apk/MozStumbler-$1.apk outputs/MozStumbler-v`cat VERSION`.apk"
`${cmd}`

0 comments on commit 8f9d27a

Please sign in to comment.