Build config fields for Play store releases

pull/147/head
M66B 6 years ago
parent a891f3f578
commit 9d7316e608

@ -27,12 +27,16 @@ android {
minifyEnabled = true minifyEnabled = true
useProguard = true useProguard = true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "boolean", "PLAY_STORE_RELEASE", "false"
buildConfigField "String", "GITHUB_LATEST_API", "\"https://api.github.com/repos/M66B/open-source-email/releases/latest\""
} }
debug { debug {
debuggable = true debuggable = true
minifyEnabled = false minifyEnabled = false
useProguard = false useProguard = false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
buildConfigField "boolean", "PLAY_STORE_RELEASE", "false"
buildConfigField "String", "GITHUB_LATEST_API", "\"https://api.github.com/repos/M66B/open-source-email/releases/latest\""
} }
} }

@ -145,7 +145,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
static final String ACTION_DECRYPT = BuildConfig.APPLICATION_ID + ".DECRYPT"; static final String ACTION_DECRYPT = BuildConfig.APPLICATION_ID + ".DECRYPT";
static final String ACTION_SHOW_PRO = BuildConfig.APPLICATION_ID + ".SHOW_PRO"; static final String ACTION_SHOW_PRO = BuildConfig.APPLICATION_ID + ".SHOW_PRO";
static final String UPDATE_LATEST_API = "https://api.github.com/repos/M66B/open-source-email/releases/latest";
static final long UPDATE_INTERVAL = 12 * 3600 * 1000L; // milliseconds static final long UPDATE_INTERVAL = 12 * 3600 * 1000L; // milliseconds
private static final String PGP_BEGIN_MESSAGE = "-----BEGIN PGP MESSAGE-----"; private static final String PGP_BEGIN_MESSAGE = "-----BEGIN PGP MESSAGE-----";
@ -642,7 +641,7 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
StringBuilder json = new StringBuilder(); StringBuilder json = new StringBuilder();
HttpsURLConnection urlConnection = null; HttpsURLConnection urlConnection = null;
try { try {
URL latest = new URL(UPDATE_LATEST_API); URL latest = new URL(BuildConfig.GITHUB_LATEST_API);
urlConnection = (HttpsURLConnection) latest.openConnection(); urlConnection = (HttpsURLConnection) latest.openConnection();
BufferedReader br = new BufferedReader(new InputStreamReader(urlConnection.getInputStream())); BufferedReader br = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));

@ -427,6 +427,8 @@ public class Helper {
} }
static boolean isPlayStoreInstall(Context context) { static boolean isPlayStoreInstall(Context context) {
if (BuildConfig.PLAY_STORE_RELEASE)
return true;
if (false && BuildConfig.DEBUG) if (false && BuildConfig.DEBUG)
return true; return true;
try { try {

Loading…
Cancel
Save