From cb550af610652bd9ed307c2f7a756f5adfa9d97e Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Thu, 14 Jun 2018 22:26:39 +0700 Subject: [PATCH] Remove donation support dialog --- source/net/filebot/Main.java | 5 ++- source/net/filebot/ui/SupportDialog.java | 49 ++---------------------- 2 files changed, 8 insertions(+), 46 deletions(-) diff --git a/source/net/filebot/Main.java b/source/net/filebot/Main.java index a4b1d68a..25efa3b4 100644 --- a/source/net/filebot/Main.java +++ b/source/net/filebot/Main.java @@ -238,7 +238,10 @@ public class Main { // make sure any long running operations are done now and not later on the shutdown hook thread HistorySpooler.getInstance().commit(); - SupportDialog.maybeShow(); + + if (isAppStore()) { + SupportDialog.AppStoreReview.maybeShow(); + } // restore preferences on start if empty (TODO: remove after a few releases) Settings.store(ApplicationFolder.AppData.resolve("preferences.backup.xml")); diff --git a/source/net/filebot/ui/SupportDialog.java b/source/net/filebot/ui/SupportDialog.java index 3f72ee10..ac882908 100644 --- a/source/net/filebot/ui/SupportDialog.java +++ b/source/net/filebot/ui/SupportDialog.java @@ -21,45 +21,6 @@ import net.filebot.util.PreferencesMap.PreferencesEntry; public enum SupportDialog { - Purchase { - - @Override - String getMessage(int renameCount) { - return String.format("

Thank you for using FileBot!


It has taken thousands of hours to develop this application. If it works well for you,
please purchase a license. It'll help make FileBot even better!

You've renamed %,d files.


", renameCount > 0 ? renameCount : 0); - } - - @Override - String[] getActions(boolean first) { - return new String[] { "Purchase! :)", "Nope! Maybe another time." }; - } - - @Override - Icon getIcon() { - return ResourceManager.getIcon("window.icon.large"); - } - - @Override - String getTitle() { - return "Purchase FileBot"; - } - - @Override - public boolean feelingLucky(int sessionRenameCount, int totalRenameCount, int currentRevision, int lastSupportRevision, int supportRevisionCount) { - try { - LICENSE.check(); - return false; - } catch (Throwable e) { - return true; - } - } - - @Override - String getURI() { - return getPurchaseURL(); - } - - }, - AppStoreReview { @Override @@ -151,7 +112,7 @@ public enum SupportDialog { abstract String getURI(); - public static void maybeShow() { + public void maybeShow() { try { PreferencesEntry persistentSupportRevision = Settings.forPackage(SupportDialog.class).entry("support.revision"); List supportRevision = matchIntegers(persistentSupportRevision.getValue()); @@ -163,16 +124,14 @@ public enum SupportDialog { int totalRenameCount = HistorySpooler.getInstance().getPersistentHistoryTotalSize(); // show donation / review reminders to power users - SupportDialog dialog = isAppStore() ? AppStoreReview : Purchase; - - if (dialog.feelingLucky(sessionRenameCount, totalRenameCount, currentRevision, lastSupportRevision, supportRevision.size())) { - if (dialog.show(totalRenameCount, supportRevision.isEmpty())) { + if (feelingLucky(sessionRenameCount, totalRenameCount, currentRevision, lastSupportRevision, supportRevision.size())) { + if (show(totalRenameCount, supportRevision.isEmpty())) { supportRevision = Stream.concat(supportRevision.stream(), Stream.of(currentRevision)).sorted().distinct().collect(toList()); persistentSupportRevision.setValue(supportRevision.toString()); } } } catch (Exception e) { - log.log(Level.WARNING, e, e::toString); + debug.log(Level.WARNING, e, e::toString); } }