From ccd883052536957b155374a111ee0d5a023da669 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 11 Mar 2017 04:37:52 +0800 Subject: [PATCH] Make sure not to annoy users have purchased FileBot --- build.xml | 2 +- installer/appbundle/MacOS/purchase.sh | 20 -------------------- source/net/filebot/HistorySpooler.java | 4 +++- source/net/filebot/ui/SupportDialog.java | 3 ++- 4 files changed, 6 insertions(+), 23 deletions(-) delete mode 100755 installer/appbundle/MacOS/purchase.sh diff --git a/build.xml b/build.xml index 2256c90f..c70af96b 100644 --- a/build.xml +++ b/build.xml @@ -309,7 +309,7 @@ - + diff --git a/installer/appbundle/MacOS/purchase.sh b/installer/appbundle/MacOS/purchase.sh deleted file mode 100755 index 3b3c9627..00000000 --- a/installer/appbundle/MacOS/purchase.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -function validate { - /usr/bin/codesign --verbose --deep --verify /Applications/FileBot.app -} - -function purchase { - /usr/bin/open https://app.filebot.net/purchase/FileBot.app -} - -function help { - /usr/bin/open https://app.filebot.net/mac/brew.html -} - -function start { - /usr/local/bin/filebot -} - - -validate && (start || help) || purchase diff --git a/source/net/filebot/HistorySpooler.java b/source/net/filebot/HistorySpooler.java index 2d4c9d0c..2da960cb 100644 --- a/source/net/filebot/HistorySpooler.java +++ b/source/net/filebot/HistorySpooler.java @@ -33,6 +33,7 @@ public final class HistorySpooler { private final File persistentHistoryFile = ApplicationFolder.AppData.resolve("history.xml"); + private int sessionHistoryTotalSize = 0; private int persistentHistoryTotalSize = -1; private boolean persistentHistoryEnabled = true; @@ -101,6 +102,7 @@ public final class HistorySpooler { if (sequence.size() > 0) { sessionHistory.add(sequence); // append to session history + sessionHistoryTotalSize += sequence.size(); } } @@ -113,7 +115,7 @@ public final class HistorySpooler { } public synchronized int getSessionHistoryTotalSize() { - return sessionHistory.totalSize(); + return sessionHistoryTotalSize; } public synchronized int getPersistentHistoryTotalSize() { diff --git a/source/net/filebot/ui/SupportDialog.java b/source/net/filebot/ui/SupportDialog.java index bfb7b997..9c6d4751 100644 --- a/source/net/filebot/ui/SupportDialog.java +++ b/source/net/filebot/ui/SupportDialog.java @@ -8,6 +8,7 @@ import static net.filebot.util.StringUtilities.*; import static net.filebot.util.ui.SwingUI.*; import java.util.List; +import java.util.function.Predicate; import java.util.logging.Level; import java.util.stream.Stream; @@ -49,7 +50,7 @@ public enum SupportDialog { @Override public boolean feelingLucky(int sessionRenameCount, int totalRenameCount, int currentRevision, int lastSupportRevision, int supportRevisionCount) { // annoy users that chose not to purchase FileBot - if (sessionRenameCount > 0 && "Windows 10".equals(System.getProperty("os.name"))) { + if (sessionRenameCount > 0 && Stream.of("Mac OS X", "Windows 10").anyMatch(Predicate.isEqual(System.getProperty("os.name")))) { return true; }