From cd0659d51b93c064024dce48b0564d995a945feb Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 1 Jan 2016 14:52:09 +0100 Subject: [PATCH] No trial if all in-app purchased --- .../main/java/eu/faircode/netguard/ActivityMain.java | 10 ++++++++-- .../main/java/eu/faircode/netguard/ActivityPro.java | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/faircode/netguard/ActivityMain.java b/app/src/main/java/eu/faircode/netguard/ActivityMain.java index 2618c091..c63dbee1 100644 --- a/app/src/main/java/eu/faircode/netguard/ActivityMain.java +++ b/app/src/main/java/eu/faircode/netguard/ActivityMain.java @@ -97,8 +97,14 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences long now = new Date().getTime(); long trial = IAB.getTrialEnd(this); if (now < trial) { - DateFormat df = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); - Toast.makeText(this, getString(R.string.title_pro_trial_until, df.format(trial)), Toast.LENGTH_LONG).show(); + if (!IAB.isPurchased(ActivityPro.SKU_SELECT, false, this) || + !IAB.isPurchased(ActivityPro.SKU_NOTIFY, false, this) || + !IAB.isPurchased(ActivityPro.SKU_THEME, false, this) || + !IAB.isPurchased(ActivityPro.SKU_SPEED, false, this) || + !IAB.isPurchased(ActivityPro.SKU_BACKUP, false, this)) { + DateFormat df = SimpleDateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); + Toast.makeText(this, getString(R.string.title_pro_trial_until, df.format(trial)), Toast.LENGTH_LONG).show(); + } } else { SharedPreferences.Editor editor = prefs.edit(); editor.putBoolean("show_user", true); diff --git a/app/src/main/java/eu/faircode/netguard/ActivityPro.java b/app/src/main/java/eu/faircode/netguard/ActivityPro.java index 09ce440b..b60c0085 100644 --- a/app/src/main/java/eu/faircode/netguard/ActivityPro.java +++ b/app/src/main/java/eu/faircode/netguard/ActivityPro.java @@ -49,11 +49,11 @@ public class ActivityPro extends AppCompatActivity { // adb shell pm clear com.android.vending public static final String SKU_SELECT = "select"; //public static final String SKU_NOTIFY = "notify"; + public static final String SKU_NOTIFY = "android.test.purchased"; public static final String SKU_THEME = "theme"; public static final String SKU_SPEED = "speed"; public static final String SKU_BACKUP = "backup"; public static final String SKU_DONATION = "donation"; - public static final String SKU_NOTIFY = "android.test.purchased"; @Override protected void onCreate(Bundle savedInstanceState) {