Skip to content

Commit

Permalink
Merge pull request #2198 from dimagi/functionalReleaseVersion
Browse files Browse the repository at this point in the history
Shows custom App Version Tag in About CommCare
  • Loading branch information
shubham1g5 committed Mar 24, 2020
2 parents 10916bd + 31ab2a0 commit c5d7f49
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/src/org/commcare/AppUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.text.TextUtils;

import org.commcare.android.database.app.models.UserKeyRecord;
import org.commcare.android.database.global.models.ApplicationRecord;
Expand Down Expand Up @@ -164,6 +165,12 @@ public static String getCurrentVersionString() {
if (p != null) {
profileVersion = String.valueOf(p.getVersion());
}

String appVersionTag = HiddenPreferences.getAppVersionTag();
if (!TextUtils.isEmpty(appVersionTag)) {
profileVersion += " (" + appVersionTag + ")";
}

String buildDate = BuildConfig.BUILD_DATE;
String buildNumber = BuildConfig.BUILD_NUMBER;

Expand Down
7 changes: 7 additions & 0 deletions app/src/org/commcare/preferences/HiddenPreferences.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.commcare.preferences;

import android.content.SharedPreferences;

import androidx.preference.PreferenceManager;

import androidx.annotation.Nullable;
Expand Down Expand Up @@ -58,6 +59,7 @@ public class HiddenPreferences {
private final static String GPS_WIDGET_GOOD_ACCURACY = "cc-gps-widget-good-accuracy";
private final static String GPS_WIDGET_ACCEPTABLE_ACCURACY = "cc-gps-widget-acceptable-accuracy";
private final static String GPS_WIDGET_TIMEOUT_SECS = "cc-gps-widget-timeout-secs";
private static final String APP_VERSION_TAG = "cc-app-version-tag";
private final static String LOG_ENTITY_DETAIL = "cc-log-entity-detail-enabled";
public static final String DUMP_FOLDER_PATH = "dump-folder-path";
private final static String RESIZING_METHOD = "cc-resize-images";
Expand Down Expand Up @@ -308,6 +310,11 @@ public static void setLatestAppVersion(int appVersion) {
.putInt(LATEST_APP_VERSION, appVersion).apply();
}

public static String getAppVersionTag() {
return CommCareApplication.instance().getCurrentApp().getAppPreferences()
.getString(APP_VERSION_TAG, "");
}

public static int getLatestAppVersion() {
return CommCareApplication.instance().getCurrentApp().getAppPreferences()
.getInt(LATEST_APP_VERSION, -1);
Expand Down

0 comments on commit c5d7f49

Please sign in to comment.