diff --git a/source/net/filebot/Main.java b/source/net/filebot/Main.java index 3f7b7714..bea62340 100644 --- a/source/net/filebot/Main.java +++ b/source/net/filebot/Main.java @@ -246,10 +246,10 @@ public class Main { int renameCount = HistorySpooler.getInstance().getPersistentHistoryTotalSize(); if (renameCount > 2000 && Math.random() < chance) { - if (!isAppStore()) { + if (isAppStore()) { + showAppStoreReviewReminder(); + } else { showDonationReminder(); - } else if (isMacApp() && isAppStore()) { - showMacAppStoreReviewReminder(); } } @@ -379,7 +379,7 @@ public class Main { } } - private static void showMacAppStoreReviewReminder() { + private static void showAppStoreReviewReminder() { PreferencesEntry donation = Settings.forPackage(Main.class).entry("review").defaultValue("0"); int donationRev = Integer.parseInt(donation.getValue()); if (donationRev > 0) { @@ -390,13 +390,13 @@ public class Main { int currentRev = getApplicationRevisionNumber(); donation.setValue(String.valueOf(currentRev)); - String message = String.format(Locale.ROOT, "

Thank you for using FileBot!


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

You've renamed %,d files.


", HistorySpooler.getInstance().getPersistentHistoryTotalSize()); + String message = String.format(Locale.ROOT, "

Thank you for using FileBot!


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

You've renamed %,d files.


", getAppStoreName(), HistorySpooler.getInstance().getPersistentHistoryTotalSize()); String[] actions = new String[] { "Review! I like FileBot. :)", "Never! Don't bother me again." }; JOptionPane pane = new JOptionPane(message, INFORMATION_MESSAGE, YES_NO_OPTION, ResourceManager.getIcon("window.icon.large"), actions, actions[0]); pane.createDialog(null, "Please rate FileBot").setVisible(true); if (pane.getValue() == actions[0]) { try { - Desktop.getDesktop().browse(URI.create("macappstore://itunes.apple.com/app/id905384638")); // this will naturally only work on Mac ;) + Desktop.getDesktop().browse(getAppStoreURI()); // this will naturally only work on Mac or Ubuntu ;) } catch (Exception e) { Logger.getLogger(Main.class.getName()).log(Level.SEVERE, "Failed to browse URI", e); } diff --git a/source/net/filebot/Settings.java b/source/net/filebot/Settings.java index 9a609dad..2a26a599 100644 --- a/source/net/filebot/Settings.java +++ b/source/net/filebot/Settings.java @@ -4,6 +4,7 @@ import static net.filebot.util.StringUtilities.*; import java.awt.GraphicsEnvironment; import java.io.File; +import java.net.URI; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; @@ -82,6 +83,10 @@ public final class Settings { return isApplicationDeployment("mas", "usc"); } + public static boolean isUbuntuApp() { + return isApplicationDeployment("usc"); + } + public static boolean isMacApp() { return isApplicationDeployment("mas", "app"); } @@ -169,6 +174,24 @@ public final class Settings { return new File(System.getProperty("user.home")); } + public static String getAppStoreName() { + if (isMacApp()) + return "Mac App Store"; + if (isUbuntuApp()) + return "Ubuntu Software Center"; + + return null; + } + + public static URI getAppStoreURI() { + if (isMacApp()) + return URI.create("macappstore://itunes.apple.com/app/id905384638"); + if (isUbuntuApp()) + return URI.create("apt://filebot"); + + return null; + } + public static Settings forPackage(Class type) { return new Settings(Preferences.userNodeForPackage(type)); }