Make sure not to annoy users have purchased FileBot

This commit is contained in:
Reinhard Pointner 2017-03-11 04:37:52 +08:00
parent e5778ee3cb
commit ccd8830525
4 changed files with 6 additions and 23 deletions

View File

@ -309,7 +309,7 @@
<target name="appbundle" description="Build Mac application bundle" depends="revision"> <target name="appbundle" description="Build Mac application bundle" depends="revision">
<bundleapp outputdirectory="${dir.dist}" executablename="purchase.sh" hidedockicon="true" minimumsystemversion="${mac.version}" jvmrequired="${jvm.version}" name="${application.name}" displayname="${application.name} ${version}" version="${revision}" shortversion="${version}" identifier="${package.identifier}.Command" mainclassname="${main.class}" icon="${dir.installer}/appbundle/filebot.icns" copyright="${tstamp.year} ${package.developer}" applicationcategory="${mac.application.category}" highresolutioncapable="true" supportsautomaticgraphicsswitching="true" debug="true"> <bundleapp outputdirectory="${dir.dist}" executablename="filebot.launcher" hidedockicon="true" minimumsystemversion="${mac.version}" jvmrequired="${jvm.version}" name="${application.name}" displayname="${application.name} ${version}" version="${revision}" shortversion="${version}" identifier="${package.identifier}.Command" mainclassname="${main.class}" icon="${dir.installer}/appbundle/filebot.icns" copyright="${tstamp.year} ${package.developer}" applicationcategory="${mac.application.category}" highresolutioncapable="true" supportsautomaticgraphicsswitching="true" debug="true">
<classpath file="${path.fatjar}" /> <classpath file="${path.fatjar}" />
<librarypath dir="${dir.lib}/native/mac-x86_64" /> <librarypath dir="${dir.lib}/native/mac-x86_64" />
<librarypath dir="${dir.installer}/appbundle/MacOS" /> <librarypath dir="${dir.installer}/appbundle/MacOS" />

View File

@ -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

View File

@ -33,6 +33,7 @@ public final class HistorySpooler {
private final File persistentHistoryFile = ApplicationFolder.AppData.resolve("history.xml"); private final File persistentHistoryFile = ApplicationFolder.AppData.resolve("history.xml");
private int sessionHistoryTotalSize = 0;
private int persistentHistoryTotalSize = -1; private int persistentHistoryTotalSize = -1;
private boolean persistentHistoryEnabled = true; private boolean persistentHistoryEnabled = true;
@ -101,6 +102,7 @@ public final class HistorySpooler {
if (sequence.size() > 0) { if (sequence.size() > 0) {
sessionHistory.add(sequence); // append to session history sessionHistory.add(sequence); // append to session history
sessionHistoryTotalSize += sequence.size();
} }
} }
@ -113,7 +115,7 @@ public final class HistorySpooler {
} }
public synchronized int getSessionHistoryTotalSize() { public synchronized int getSessionHistoryTotalSize() {
return sessionHistory.totalSize(); return sessionHistoryTotalSize;
} }
public synchronized int getPersistentHistoryTotalSize() { public synchronized int getPersistentHistoryTotalSize() {

View File

@ -8,6 +8,7 @@ import static net.filebot.util.StringUtilities.*;
import static net.filebot.util.ui.SwingUI.*; import static net.filebot.util.ui.SwingUI.*;
import java.util.List; import java.util.List;
import java.util.function.Predicate;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.stream.Stream; import java.util.stream.Stream;
@ -49,7 +50,7 @@ public enum SupportDialog {
@Override @Override
public boolean feelingLucky(int sessionRenameCount, int totalRenameCount, int currentRevision, int lastSupportRevision, int supportRevisionCount) { public boolean feelingLucky(int sessionRenameCount, int totalRenameCount, int currentRevision, int lastSupportRevision, int supportRevisionCount) {
// annoy users that chose not to purchase FileBot // 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; return true;
} }