From b6a0ad5d17462e2e56398869ed8ee9ac03ba7774 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 16 Sep 2016 23:34:39 +0800 Subject: [PATCH] Update SupportDialog behaviour --- source/net/filebot/ui/SupportDialog.java | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/source/net/filebot/ui/SupportDialog.java b/source/net/filebot/ui/SupportDialog.java index a9be7111..1280cc3c 100644 --- a/source/net/filebot/ui/SupportDialog.java +++ b/source/net/filebot/ui/SupportDialog.java @@ -18,7 +18,7 @@ public enum SupportDialog { @Override String getMessage(int renameCount) { - return String.format("

Thank you for using FileBot!


It has taken many nights to develop this application. If you enjoy using it,
please consider a donation to me and my work. It will help to
make FileBot even better!

You've renamed %,d files.


", renameCount); + return String.format("

Thank you for using FileBot!


It has taken thousands of hours to develop this application. If you enjoy using it,
please consider making a donation. It'll help make FileBot even better!

You've renamed %,d files.


", renameCount); } @Override @@ -50,7 +50,7 @@ public enum SupportDialog { @Override String getMessage(int renameCount) { - return String.format("

Thank you for using FileBot!


It has taken many nights to develop this application. If you enjoy using it,
please consider writing a nice review on the %s.

You've renamed %,d files.


", getAppStoreName(), renameCount); + return String.format("

Thank you for using FileBot!


It has taken thousands of hours to develop this application. If you enjoy using it,
please consider writing a nice review on the %s.

You've renamed %,d files.


", getAppStoreName(), renameCount); } @Override @@ -78,16 +78,16 @@ public enum SupportDialog { }; - public void show(int renameCount) { + public void show(int totalRenameCount) { PreferencesEntry support = Settings.forPackage(SupportDialog.class).entry("support.revision").defaultValue("0"); int supportRev = Integer.parseInt(support.getValue()); int currentRev = getApplicationRevisionNumber(); - if (supportRev >= currentRev) { + if (supportRev > 0) { return; } - String message = getMessage(renameCount); + String message = getMessage(totalRenameCount); String[] actions = getActions(supportRev <= 0); JOptionPane pane = new JOptionPane(message, INFORMATION_MESSAGE, YES_NO_OPTION, getIcon(), actions, actions[0]); pane.createDialog(null, getTitle()).setVisible(true); @@ -112,17 +112,21 @@ public enum SupportDialog { abstract String getURI(); public static void maybeShow() { - int renameCount = HistorySpooler.getInstance().getPersistentHistoryTotalSize(); + int sessionRenameCount = HistorySpooler.getInstance().getSessionHistory().totalSize(); + int totalRenameCount = HistorySpooler.getInstance().getPersistentHistoryTotalSize(); + int renameLimit = 1000; + boolean lucky = Math.random() >= 0.777; // show donation / review reminders to power users - if ((renameCount >= renameLimit && Math.random() >= 0.777) || (HistorySpooler.getInstance().getSessionHistory().totalSize() >= renameLimit)) { + if ((totalRenameCount >= renameLimit && lucky) || sessionRenameCount >= renameLimit) { if (isAppStore()) { - AppStoreReview.show(renameCount); + AppStoreReview.show(totalRenameCount); } else { - Donation.show(renameCount); + Donation.show(totalRenameCount); } } + } }