Skip to content

Commit

Permalink
Merge pull request #61 from iglance/development
Browse files Browse the repository at this point in the history
Minor improvements and bug fixes
  • Loading branch information
D0miH authored Dec 27, 2019
2 parents ffcd4bc + 4830dca commit e00cd98
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 69 deletions.
2 changes: 1 addition & 1 deletion Version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[version]1.4.1[/version]
[version]1.4.2[/version]
4 changes: 2 additions & 2 deletions iGlance/iGlance.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.4.1;
MARKETING_VERSION = 1.4.2;
PRODUCT_BUNDLE_IDENTIFIER = io.iglance.iglance;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -582,7 +582,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.4.1;
MARKETING_VERSION = 1.4.2;
PRODUCT_BUNDLE_IDENTIFIER = io.iglance.iglance;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
26 changes: 20 additions & 6 deletions iGlance/iGlance/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ extension NSColor {

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
public static var VERSION = "1.4.1"
public static var VERSION = "1.4.2"

var myWindowController: MyMainWindow?

Expand All @@ -70,6 +70,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
static var userWantsCPUUtil = false
static var userWantsCPUTemp = false
static var userWantsAutostart = false
static var userWantsCheckForUpdateOnWake = true
static var cpuColor = NSColor.green
static var cpuColor2 = NSColor.red
static var cpuUsageVisualization = VisualizationType.Bar
Expand All @@ -83,7 +84,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
static var userWantsCPUBorder = true
static var userWantsMemBorder = true
static var userWantsBatteryUtil = true
static var userWantsBatteryNotification = true
static var userWantsLowBatteryNotification = true
static var userWantsHighBatteryNotification = true
static var lowerBatteryNotificationValue = 20
static var upperBatteryNotificationValue = 80
static var networkOrder = NetUsageComponent.NetworkOrder.uploadTop
Expand Down Expand Up @@ -191,7 +193,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {

@objc func wakeUpListener(note: NSNotification)
{
checkForUpdate()
if UserSettings.userWantsCheckForUpdateOnWake {
checkForUpdate()
}
}

func matches(for regex: String, in text: String) -> [String] {
Expand Down Expand Up @@ -333,6 +337,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {
if UserDefaults.standard.value(forKey: "userWantsAutostart") != nil {
UserSettings.userWantsAutostart = UserDefaults.standard.value(forKey: "userWantsAutostart") as! Bool
}
if UserDefaults.standard.value(forKey: "userWantsCheckForUpdateOnWake") != nil {
UserSettings.userWantsCheckForUpdateOnWake = UserDefaults.standard.value(forKey: "userWantsCheckForUpdateOnWake") as! Bool
}
if UserDefaults.standard.value(forKey: "updateInterval") != nil {
UserSettings.updateInterval = UserDefaults.standard.value(forKey: "updateInterval") as! Double
}
Expand All @@ -356,8 +363,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
if UserDefaults.standard.value(forKey: "userWantsBatteryUtil") != nil {
UserSettings.userWantsBatteryUtil = UserDefaults.standard.value(forKey: "userWantsBatteryUtil") as! Bool
}
if UserDefaults.standard.value(forKey: "userWantsBatteryNotification") != nil {
UserSettings.userWantsBatteryNotification = UserDefaults.standard.value(forKey: "userWantsBatteryNotification") as! Bool
if UserDefaults.standard.value(forKey: "userWantsLowBatteryNotification") != nil {
UserSettings.userWantsLowBatteryNotification = UserDefaults.standard.value(forKey: "userWantsLowBatteryNotification") as! Bool
}
if UserDefaults.standard.value(forKey: "userWantsHighBatteryNotification") != nil {
UserSettings.userWantsHighBatteryNotification = UserDefaults.standard.value(forKey: "userWantsHighBatteryNotification") as! Bool
}
if UserDefaults.standard.value(forKey: "lowerBatteryNotificationValue") != nil {
UserSettings.lowerBatteryNotificationValue = UserDefaults.standard.value(forKey: "lowerBatteryNotificationValue") as! Int
Expand Down Expand Up @@ -428,7 +438,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
} else {
BatteryComponent.sItemBattery.isVisible = false
}
if AppDelegate.UserSettings.userWantsBatteryNotification {
if AppDelegate.UserSettings.userWantsLowBatteryNotification {
// notify the user if needed
AppDelegate.myBattery.notifyUser()
}
if AppDelegate.UserSettings.userWantsHighBatteryNotification {
// notify the user if needed
AppDelegate.myBattery.notifyUser()
}
Expand Down
Loading

0 comments on commit e00cd98

Please sign in to comment.