diff options
author | Andrew Dolgov <[email protected]> | 2014-11-13 11:56:45 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2014-11-13 11:56:45 +0300 |
commit | e483893a249660378b16dcb51d0d4e383b1bb379 (patch) | |
tree | 7a1fdc68223df2fe9682e05ec8775fbd1d6f16c5 /org.fox.ttrss/src/main/java | |
parent | 42eed3019fb798ede6828613cb3db5c59b8e46bf (diff) |
disable trial stuff on debug builds
Diffstat (limited to 'org.fox.ttrss/src/main/java')
-rw-r--r-- | org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java | 107 |
1 files changed, 55 insertions, 52 deletions
diff --git a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java index 4c848fc9..15bbf51f 100644 --- a/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java +++ b/org.fox.ttrss/src/main/java/org/fox/ttrss/OnlineActivity.java @@ -478,61 +478,64 @@ public class OnlineActivity extends CommonActivity { } public void checkTrial(boolean notify) { - boolean isTrial = getPackageManager().checkSignatures( - getPackageName(), "org.fox.ttrss.key") != PackageManager.SIGNATURE_MATCH; + if (!BuildConfig.DEBUG) { - if (isTrial) { - long firstStart = m_prefs.getLong("date_firstlaunch_trial", -1); - - if (firstStart == -1) { - firstStart = System.currentTimeMillis(); - - SharedPreferences.Editor editor = m_prefs.edit(); - editor.putLong("date_firstlaunch_trial", firstStart); - editor.commit(); - } - - if (!notify && System.currentTimeMillis() > firstStart + (TRIAL_DAYS * 24 * 60 * 60 * 1000)) { - - AlertDialog.Builder builder = new AlertDialog.Builder(this) - .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(); + boolean isTrial = getPackageManager().checkSignatures( + getPackageName(), "org.fox.ttrss.key") != PackageManager.SIGNATURE_MATCH; - } - }) - .setNegativeButton(getString(R.string.cancel), - new OnClickListener() { - @Override - public void onClick(DialogInterface dialog, - int which) { - - finish(); + if (isTrial) { + long firstStart = m_prefs.getLong("date_firstlaunch_trial", -1); - } - }); - - AlertDialog dialog = builder.create(); - dialog.show(); - - } else { - int daysLeft = Math.round((firstStart + (TRIAL_DAYS * 24 * 60 * 60 * 1000) - System.currentTimeMillis()) / (24 * 60 * 60 * 1000)); - - if (notify) { - toast(getResources().getQuantityString(R.plurals.trial_mode_prompt, daysLeft, daysLeft)); - } - } - } else if (notify) { - //toast(R.string.trial_thanks); - } + if (firstStart == -1) { + firstStart = System.currentTimeMillis(); + + SharedPreferences.Editor editor = m_prefs.edit(); + editor.putLong("date_firstlaunch_trial", firstStart); + editor.commit(); + } + + if (!notify && System.currentTimeMillis() > firstStart + (TRIAL_DAYS * 24 * 60 * 60 * 1000)) { + + AlertDialog.Builder builder = new AlertDialog.Builder(this) + .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(); + + } + }); + + AlertDialog dialog = builder.create(); + dialog.show(); + + } else { + int daysLeft = Math.round((firstStart + (TRIAL_DAYS * 24 * 60 * 60 * 1000) - System.currentTimeMillis()) / (24 * 60 * 60 * 1000)); + + if (notify) { + toast(getResources().getQuantityString(R.plurals.trial_mode_prompt, daysLeft, daysLeft)); + } + } + } else if (notify) { + //toast(R.string.trial_thanks); + } + } } private void openUnlockUrl() { |