disable trial stuff on debug builds
This commit is contained in:
parent
42eed3019f
commit
e483893a24
@ -478,61 +478,64 @@ public class OnlineActivity extends CommonActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void checkTrial(boolean notify) {
|
public void checkTrial(boolean notify) {
|
||||||
boolean isTrial = getPackageManager().checkSignatures(
|
if (!BuildConfig.DEBUG) {
|
||||||
getPackageName(), "org.fox.ttrss.key") != PackageManager.SIGNATURE_MATCH;
|
|
||||||
|
|
||||||
if (isTrial) {
|
boolean isTrial = getPackageManager().checkSignatures(
|
||||||
long firstStart = m_prefs.getLong("date_firstlaunch_trial", -1);
|
getPackageName(), "org.fox.ttrss.key") != PackageManager.SIGNATURE_MATCH;
|
||||||
|
|
||||||
if (firstStart == -1) {
|
if (isTrial) {
|
||||||
firstStart = System.currentTimeMillis();
|
long firstStart = m_prefs.getLong("date_firstlaunch_trial", -1);
|
||||||
|
|
||||||
SharedPreferences.Editor editor = m_prefs.edit();
|
if (firstStart == -1) {
|
||||||
editor.putLong("date_firstlaunch_trial", firstStart);
|
firstStart = System.currentTimeMillis();
|
||||||
editor.commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!notify && System.currentTimeMillis() > firstStart + (TRIAL_DAYS * 24 * 60 * 60 * 1000)) {
|
SharedPreferences.Editor editor = m_prefs.edit();
|
||||||
|
editor.putLong("date_firstlaunch_trial", firstStart);
|
||||||
|
editor.commit();
|
||||||
|
}
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(this)
|
if (!notify && System.currentTimeMillis() > firstStart + (TRIAL_DAYS * 24 * 60 * 60 * 1000)) {
|
||||||
.setTitle(R.string.trial_expired)
|
|
||||||
.setMessage(R.string.trial_expired_message)
|
|
||||||
.setCancelable(false)
|
|
||||||
.setPositiveButton(getString(R.string.trial_purchase),
|
|
||||||
new OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog,
|
|
||||||
int which) {
|
|
||||||
|
|
||||||
openUnlockUrl();
|
AlertDialog.Builder builder = new AlertDialog.Builder(this)
|
||||||
finish();
|
.setTitle(R.string.trial_expired)
|
||||||
|
.setMessage(R.string.trial_expired_message)
|
||||||
|
.setCancelable(false)
|
||||||
|
.setPositiveButton(getString(R.string.trial_purchase),
|
||||||
|
new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog,
|
||||||
|
int which) {
|
||||||
|
|
||||||
}
|
openUnlockUrl();
|
||||||
})
|
finish();
|
||||||
.setNegativeButton(getString(R.string.cancel),
|
|
||||||
new OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog,
|
|
||||||
int which) {
|
|
||||||
|
|
||||||
finish();
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton(getString(R.string.cancel),
|
||||||
|
new OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(DialogInterface dialog,
|
||||||
|
int which) {
|
||||||
|
|
||||||
}
|
finish();
|
||||||
});
|
|
||||||
|
|
||||||
AlertDialog dialog = builder.create();
|
}
|
||||||
dialog.show();
|
});
|
||||||
|
|
||||||
} else {
|
AlertDialog dialog = builder.create();
|
||||||
int daysLeft = Math.round((firstStart + (TRIAL_DAYS * 24 * 60 * 60 * 1000) - System.currentTimeMillis()) / (24 * 60 * 60 * 1000));
|
dialog.show();
|
||||||
|
|
||||||
if (notify) {
|
} else {
|
||||||
toast(getResources().getQuantityString(R.plurals.trial_mode_prompt, daysLeft, daysLeft));
|
int daysLeft = Math.round((firstStart + (TRIAL_DAYS * 24 * 60 * 60 * 1000) - System.currentTimeMillis()) / (24 * 60 * 60 * 1000));
|
||||||
}
|
|
||||||
}
|
if (notify) {
|
||||||
} else if (notify) {
|
toast(getResources().getQuantityString(R.plurals.trial_mode_prompt, daysLeft, daysLeft));
|
||||||
//toast(R.string.trial_thanks);
|
}
|
||||||
}
|
}
|
||||||
|
} else if (notify) {
|
||||||
|
//toast(R.string.trial_thanks);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void openUnlockUrl() {
|
private void openUnlockUrl() {
|
||||||
|
Loading…
Reference in New Issue
Block a user