1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2025-03-01 09:25:55 +00:00

Build config fields for Play store releases

This commit is contained in:
M66B 2018-12-19 15:07:36 +01:00
parent 3d343237dc
commit b662ed28db
4 changed files with 10 additions and 2 deletions

View file

@ -40,11 +40,17 @@ android {
minifyEnabled = true
useProguard = true
proguardFiles.add(file('proguard-rules.pro'))
buildConfigField "boolean", "PLAY_STORE_RELEASE", "false"
buildConfigField "String", "HOSTS_FILE_URI", "\"http://www.netguard.me/hosts\""
buildConfigField "String", "GITHUB_LATEST_API", "\"https://api.github.com/repos/M66B/NetGuard/releases/latest\""
}
debug {
minifyEnabled = true
useProguard = true
proguardFiles.add(file('proguard-rules.pro'))
buildConfigField "boolean", "PLAY_STORE_RELEASE", "false"
buildConfigField "String", "HOSTS_FILE_URI", "\"http://www.netguard.me/hosts\""
buildConfigField "String", "GITHUB_LATEST_API", "\"https://api.github.com/repos/M66B/NetGuard/releases/latest\""
}
}
}

View file

@ -725,7 +725,7 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
getPreferenceScreen().findPreference(name).setTitle(getString(R.string.setting_stats_samples, prefs.getString(name, "90")));
else if ("hosts_url".equals(name))
getPreferenceScreen().findPreference(name).setSummary(prefs.getString(name, "http://www.netguard.me/hosts"));
getPreferenceScreen().findPreference(name).setSummary(prefs.getString(name, BuildConfig.HOSTS_FILE_URI));
else if ("loglevel".equals(name))
ServiceSinkhole.reload("changed " + name, this, false);

View file

@ -657,7 +657,7 @@ public class ServiceSinkhole extends VpnService implements SharedPreferences.OnS
StringBuilder json = new StringBuilder();
HttpsURLConnection urlConnection = null;
try {
URL url = new URL("https://api.github.com/repos/M66B/NetGuard/releases/latest");
URL url = new URL(BuildConfig.GITHUB_LATEST_API);
urlConnection = (HttpsURLConnection) url.openConnection();
BufferedReader br = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));

View file

@ -418,6 +418,8 @@ public class Util {
}
public static boolean isPlayStoreInstall(Context context) {
if (BuildConfig.PLAY_STORE_RELEASE)
return true;
try {
return "com.android.vending".equals(context.getPackageManager().getInstallerPackageName(context.getPackageName()));
} catch (Throwable ex) {