Added announcement properties

pull/212/head
M66B 2 years ago
parent c7a8855cd7
commit a026a6221e

@ -160,6 +160,7 @@ android {
buildConfigField "boolean", "TEST_RELEASE", "false"
buildConfigField "boolean", "BETA_RELEASE", "true"
buildConfigField "boolean", "PLAY_STORE_RELEASE", "false"
buildConfigField "boolean", "FDROID_RELEASE", "false"
buildConfigField "boolean", "AMAZON_RELEASE", "false"
buildConfigField "String", "PRO_FEATURES_URI", "\"https://email.faircode.eu/donate/\""
buildConfigField "String", "CHANGELOG", "\"https://github.com/M66B/FairEmail/releases/\""
@ -180,6 +181,7 @@ android {
buildConfigField "boolean", "TEST_RELEASE", "false"
buildConfigField "boolean", "BETA_RELEASE", "true"
buildConfigField "boolean", "PLAY_STORE_RELEASE", "false"
buildConfigField "boolean", "FDROID_RELEASE", "true"
buildConfigField "boolean", "AMAZON_RELEASE", "false"
buildConfigField "String", "PRO_FEATURES_URI", "\"https://email.faircode.eu/donate/\""
buildConfigField "String", "CHANGELOG", "\"https://github.com/M66B/FairEmail/releases/\""
@ -201,6 +203,7 @@ android {
buildConfigField "boolean", "TEST_RELEASE", "false"
buildConfigField "boolean", "BETA_RELEASE", "true"
buildConfigField "boolean", "PLAY_STORE_RELEASE", "true"
buildConfigField "boolean", "FDROID_RELEASE", "false"
buildConfigField "boolean", "AMAZON_RELEASE", "false"
buildConfigField "String", "PRO_FEATURES_URI", "\"https://email.faircode.eu/#pro\""
buildConfigField "String", "CHANGELOG", "\"\""
@ -222,6 +225,7 @@ android {
buildConfigField "boolean", "TEST_RELEASE", "false"
buildConfigField "boolean", "BETA_RELEASE", "true"
buildConfigField "boolean", "PLAY_STORE_RELEASE", "false"
buildConfigField "boolean", "FDROID_RELEASE", "false"
buildConfigField "boolean", "AMAZON_RELEASE", "true"
buildConfigField "String", "PRO_FEATURES_URI", "\"https://email.faircode.eu/#pro\""
buildConfigField "String", "CHANGELOG", "\"\""

@ -1816,8 +1816,12 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
Announcement announcement = new Announcement();
announcement.id = jannouncement.getInt("ID");
announcement.test = jannouncement.optBoolean("Test");
announcement.play = jannouncement.optBoolean("Play", false);
announcement.fdroid = jannouncement.optBoolean("FDroid", true);
announcement.title = title;
announcement.text = HtmlHelper.fromHtml(text, context);
announcement.minVersion = jannouncement.optInt("minVersion", 0);
announcement.maxVersion = jannouncement.optInt("maxVersion", BuildConfig.VERSION_CODE);
if (jannouncement.has("Link"))
announcement.link = Uri.parse(jannouncement.getString("Link"));
announcement.expires = DTF.parse(jannouncement.getString("Expires")
@ -2459,14 +2463,24 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
private class Announcement {
int id;
boolean test;
boolean play;
boolean fdroid;
String title;
Spanned text;
int minVersion;
int maxVersion;
Uri link;
Date expires;
boolean isExpired() {
if (this.test && !BuildConfig.DEBUG)
return true;
if (this.play && !BuildConfig.PLAY_STORE_RELEASE)
return true;
if (this.fdroid && !BuildConfig.FDROID_RELEASE)
return true;
if (this.minVersion > BuildConfig.VERSION_CODE || BuildConfig.VERSION_CODE > this.maxVersion)
return true;
if (expires == null)
return true;
return (expires.getTime() < new Date().getTime());

Loading…
Cancel
Save