diff --git a/Makefile b/Makefile
index dd2daef7..bcdd37c9 100644
--- a/Makefile
+++ b/Makefile
@@ -95,7 +95,7 @@ prepare-dSYM:
clean:
rm -rf $(BUILD_PATH)
- if [ -a $(PWD)/dSYM.zip ]; then rm $(PWD)/dSYM.zip; fi;
+ if [ -a $(PWD)/dSYMs.zip ]; then rm $(PWD)/dSYMs.zip; fi;
if [ -a $(PWD)/Stats.dmg ]; then rm $(PWD)/Stats.dmg; fi;
next-version:
diff --git a/Stats.xcodeproj/project.pbxproj b/Stats.xcodeproj/project.pbxproj
index 3e15e4c5..c9654bb4 100644
--- a/Stats.xcodeproj/project.pbxproj
+++ b/Stats.xcodeproj/project.pbxproj
@@ -1695,7 +1695,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
- MARKETING_VERSION = 2.1.8;
+ MARKETING_VERSION = 2.1.9;
PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.Stats;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -1727,7 +1727,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
- MARKETING_VERSION = 2.1.8;
+ MARKETING_VERSION = 2.1.9;
PRODUCT_BUNDLE_IDENTIFIER = eu.exelban.Stats;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
diff --git a/Stats/AppDelegate.swift b/Stats/AppDelegate.swift
index 541d3086..cea20280 100755
--- a/Stats/AppDelegate.swift
+++ b/Stats/AppDelegate.swift
@@ -100,14 +100,16 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele
return
}
- let notification = NSUserNotification()
- notification.identifier = UUID().uuidString
- notification.title = "Successfully updated"
- notification.subtitle = "Stats was updated to the latest version"
- notification.soundName = NSUserNotificationDefaultSoundName
- notification.hasActionButton = false
-
- NSUserNotificationCenter.default.deliver(notification)
+ if IsNewestVersion(currentVersion: prevVersion, latestVersion: currentVersion) {
+ let notification = NSUserNotification()
+ notification.identifier = UUID().uuidString
+ notification.title = "Successfully updated"
+ notification.subtitle = "Stats was updated to the v\(currentVersion)"
+ notification.soundName = NSUserNotificationDefaultSoundName
+ notification.hasActionButton = false
+
+ NSUserNotificationCenter.default.deliver(notification)
+ }
os_log(.info, log: log, "Detected previous version %s. Current version (%s) set", prevVersion, currentVersion)
}
diff --git a/Stats/Supporting Files/Info.plist b/Stats/Supporting Files/Info.plist
index d64ab5cc..abef6918 100755
--- a/Stats/Supporting Files/Info.plist
+++ b/Stats/Supporting Files/Info.plist
@@ -17,7 +17,7 @@
CFBundleShortVersionString
$(MARKETING_VERSION)
CFBundleVersion
- 11
+ 14
Description
Simple macOS system monitor in your menu bar
LSApplicationCategoryType
diff --git a/StatsKit/extensions.swift b/StatsKit/extensions.swift
index c01ffebd..7916bc64 100644
--- a/StatsKit/extensions.swift
+++ b/StatsKit/extensions.swift
@@ -713,3 +713,28 @@ public func colorFromString(_ colorString: String) -> NSColor {
return NSColor.controlAccentColor
}
}
+
+public func IsNewestVersion(currentVersion: String, latestVersion: String) -> Bool {
+ let currentNumber = currentVersion.replacingOccurrences(of: "v", with: "")
+ let latestNumber = latestVersion.replacingOccurrences(of: "v", with: "")
+
+ let currentArray = currentNumber.condenseWhitespace().split(separator: ".")
+ let latestArray = latestNumber.condenseWhitespace().split(separator: ".")
+
+ let current = Version(major: Int(currentArray[0]) ?? 0, minor: Int(currentArray[1]) ?? 0, patch: Int(currentArray[2]) ?? 0)
+ let latest = Version(major: Int(latestArray[0]) ?? 0, minor: Int(latestArray[1]) ?? 0, patch: Int(latestArray[2]) ?? 0)
+
+ if latest.major > current.major {
+ return true
+ }
+
+ if latest.minor > current.minor && latest.major >= current.major {
+ return true
+ }
+
+ if latest.patch > current.patch && latest.minor >= current.minor && latest.major >= current.major {
+ return true
+ }
+
+ return false
+}
diff --git a/StatsKit/updater.sh b/StatsKit/updater.sh
index 43a917d9..845b2fee 100644
--- a/StatsKit/updater.sh
+++ b/StatsKit/updater.sh
@@ -31,7 +31,7 @@ if [[ "$STEP" == "1" ]]; then
/usr/bin/hdiutil attach "$DMG_PATH" -mountpoint "$MOUNT_PATH" -noverify -nobrowse -noautoopen
cp $MOUNT_PATH/Stats.app/Contents/Resources/Scripts/updater.sh $TMPDIR/updater.sh
- sh $TMPDIR/updater.sh --step 2 --app "$CURRENT_PATH" --dmg "$DMG_PATH" &
+ sh $TMPDIR/updater.sh --step 2 --app "$CURRENT_PATH" --dmg "$DMG_PATH" >/dev/null &
kill -9 $PID
diff --git a/StatsKit/updater.swift b/StatsKit/updater.swift
index b0ba5328..c49cdb65 100644
--- a/StatsKit/updater.swift
+++ b/StatsKit/updater.swift
@@ -60,7 +60,7 @@ public class macAppUpdater {
let downloadURL: String = result![1]
let lastVersion: String = result![0]
- let newVersion: Bool = self.checkIfNewer(currentVersion: self.currentVersion, latestVersion: lastVersion)
+ let newVersion: Bool = IsNewestVersion(currentVersion: self.currentVersion, latestVersion: lastVersion)
completionHandler(version(current: self.currentVersion, latest: lastVersion, newest: newVersion, url: downloadURL), nil)
}
@@ -93,31 +93,6 @@ public class macAppUpdater {
task.resume()
}
- private func checkIfNewer(currentVersion: String, latestVersion: String) -> Bool {
- let currentNumber = currentVersion.replacingOccurrences(of: "v", with: "")
- let latestNumber = latestVersion.replacingOccurrences(of: "v", with: "")
-
- let currentArray = currentNumber.condenseWhitespace().split(separator: ".")
- let latestArray = latestNumber.condenseWhitespace().split(separator: ".")
-
- let current = Version(major: Int(currentArray[0]) ?? 0, minor: Int(currentArray[1]) ?? 0, patch: Int(currentArray[2]) ?? 0)
- let latest = Version(major: Int(latestArray[0]) ?? 0, minor: Int(latestArray[1]) ?? 0, patch: Int(latestArray[2]) ?? 0)
-
- if latest.major > current.major {
- return true
- }
-
- if latest.minor > current.minor && latest.major >= current.major {
- return true
- }
-
- if latest.patch > current.patch && latest.minor >= current.minor && latest.major >= current.major {
- return true
- }
-
- return false
- }
-
public func download(_ url: URL) {
let downloadTask = URLSession.shared.downloadTask(with: url) {
urlOrNil, responseOrNil, errorOrNil in