No trial if all in-app purchased

This commit is contained in:
M66B 2016-01-01 14:52:09 +01:00
parent 31304505d5
commit cd0659d51b
2 changed files with 9 additions and 3 deletions

View File

@ -97,8 +97,14 @@ public class ActivityMain extends AppCompatActivity implements SharedPreferences
long now = new Date().getTime(); long now = new Date().getTime();
long trial = IAB.getTrialEnd(this); long trial = IAB.getTrialEnd(this);
if (now < trial) { if (now < trial) {
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); 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(); Toast.makeText(this, getString(R.string.title_pro_trial_until, df.format(trial)), Toast.LENGTH_LONG).show();
}
} else { } else {
SharedPreferences.Editor editor = prefs.edit(); SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean("show_user", true); editor.putBoolean("show_user", true);

View File

@ -49,11 +49,11 @@ public class ActivityPro extends AppCompatActivity {
// adb shell pm clear com.android.vending // adb shell pm clear com.android.vending
public static final String SKU_SELECT = "select"; public static final String SKU_SELECT = "select";
//public static final String SKU_NOTIFY = "notify"; //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_THEME = "theme";
public static final String SKU_SPEED = "speed"; public static final String SKU_SPEED = "speed";
public static final String SKU_BACKUP = "backup"; public static final String SKU_BACKUP = "backup";
public static final String SKU_DONATION = "donation"; public static final String SKU_DONATION = "donation";
public static final String SKU_NOTIFY = "android.test.purchased";
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {