Skip to content

Commit

Permalink
Merge pull request #89 from iglance/development
Browse files Browse the repository at this point in the history
Version 2.0.3
  • Loading branch information
D0miH authored Mar 29, 2020
2 parents 96c957e + 5f795f3 commit 5ce3487
Show file tree
Hide file tree
Showing 13 changed files with 90 additions and 39 deletions.
11 changes: 11 additions & 0 deletions Sparkle/updates/appcast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,16 @@
<enclosure url="https://raw.githubusercontent.com/iglance/iGlance/master/Sparkle/updates/iGlance2.0.2-2.0.delta" sparkle:version="2.0.2" sparkle:shortVersionString="2.0.2" sparkle:deltaFrom="2.0" length="147903" type="application/octet-stream" sparkle:edSignature="Vsses70C1z8mLYGXZxARaanVj4ws1bEcD7Vj9YJsCIMFziUhsAaUNyyy+OV3jGeF7ng7f6SZy/2bDzXNUxknDg=="/>
</sparkle:deltas>
</item>
<item>
<title>2.0.3</title>
<pubDate>Sun, 29 Mar 2020 19:27:26 +0200</pubDate>
<sparkle:minimumSystemVersion>10.12</sparkle:minimumSystemVersion>
<enclosure url="https://github.com/iglance/iGlance/releases/download/v2.0.3/iGlance_v2.0.3.zip" sparkle:version="2.0.3" sparkle:shortVersionString="2.0.3" length="10109566" type="application/octet-stream" sparkle:edSignature="TzvJIhwa6XdWPNU+tgxn+RH8Zedb0dO3tM3Eb+xuBeMeXh9Rsb33YiJNHXu24S50GBLZ4Fyq3D0O6NJHNoODBA=="/>
<sparkle:deltas>
<enclosure url="https://raw.githubusercontent.com/iglance/iGlance/master/Sparkle/updates/iGlance2.0.3-2.0.2.delta" sparkle:version="2.0.3" sparkle:shortVersionString="2.0.3" sparkle:deltaFrom="2.0.2" length="149668" type="application/octet-stream" sparkle:edSignature="1QP4iaV1kl8YNsu/KgCW840cgJRqs3ckxWBeT5NEAyX1ol1X9Ia4UPq+61+08bbTUvRyD2GFC41j1GMJRL1SAQ=="/>
<enclosure url="https://raw.githubusercontent.com/iglance/iGlance/master/Sparkle/updates/iGlance2.0.3-2.0.1.delta" sparkle:version="2.0.3" sparkle:shortVersionString="2.0.3" sparkle:deltaFrom="2.0.1" length="147984" type="application/octet-stream" sparkle:edSignature="tLyDlxT08XKWC3RZEUin0B8Nksv6hdRKMwTVbXC/kS4qoTLxXi9r7lT1krFVS1FMOi29yabDyH8hj9S0rF9hDA=="/>
<enclosure url="https://raw.githubusercontent.com/iglance/iGlance/master/Sparkle/updates/iGlance2.0.3-2.0.delta" sparkle:version="2.0.3" sparkle:shortVersionString="2.0.3" sparkle:deltaFrom="2.0" length="166680" type="application/octet-stream" sparkle:edSignature="hkVob2S3VVXZRSbSKMGPxrKdVaJcGDT6fvuDi1WMI4r2f7ExwY7kzqxZTMs37RADod6NqmwdmBcLXa1sd06JBg=="/>
</sparkle:deltas>
</item>
</channel>
</rss>
Binary file added Sparkle/updates/iGlance2.0.3-2.0.1.delta
Binary file not shown.
Binary file added Sparkle/updates/iGlance2.0.3-2.0.2.delta
Binary file not shown.
Binary file added Sparkle/updates/iGlance2.0.3-2.0.delta
Binary file not shown.
12 changes: 8 additions & 4 deletions iGlance/iGlance/iGlance.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
B46F25D623B22E4500E0A3F4 /* GpuInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = B46F25D523B22E4500E0A3F4 /* GpuInfo.swift */; };
B47094EA23C79F9A009D85AD /* ThemedLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = B47094E923C79F9A009D85AD /* ThemedLabel.swift */; };
B47094EC23C7A30A009D85AD /* ThemedButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = B47094EB23C7A30A009D85AD /* ThemedButton.swift */; };
B472EC20243101DB002F7504 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = B472EC1F243101DB002F7504 /* Logger.swift */; };
B47D3C8D23ABEDF100DE911F /* CustomDashboardBox.swift in Sources */ = {isa = PBXBuildFile; fileRef = B47D3C8C23ABEDF100DE911F /* CustomDashboardBox.swift */; };
B48BD19123E73F8E00152931 /* CpuUsageMenuBarItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = B48BD19023E73F8E00152931 /* CpuUsageMenuBarItem.swift */; };
B49CD58F23EB17D9009711E6 /* CodableColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = B49CD58E23EB17D9009711E6 /* CodableColor.swift */; };
Expand Down Expand Up @@ -157,6 +158,7 @@
B46F25D523B22E4500E0A3F4 /* GpuInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GpuInfo.swift; sourceTree = "<group>"; };
B47094E923C79F9A009D85AD /* ThemedLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemedLabel.swift; sourceTree = "<group>"; };
B47094EB23C7A30A009D85AD /* ThemedButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThemedButton.swift; sourceTree = "<group>"; };
B472EC1F243101DB002F7504 /* Logger.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Logger.swift; sourceTree = "<group>"; };
B47D3C8C23ABEDF100DE911F /* CustomDashboardBox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomDashboardBox.swift; sourceTree = "<group>"; };
B48BD19023E73F8E00152931 /* CpuUsageMenuBarItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CpuUsageMenuBarItem.swift; sourceTree = "<group>"; };
B49CD58E23EB17D9009711E6 /* CodableColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodableColor.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -390,6 +392,7 @@
B4C37E6E23A91F2F008C7FC0 /* Theme */,
B4FE0DAD23EF1BCB00AE94E6 /* Utils */,
B46789B523A69ECA00CE572D /* AppDelegate.swift */,
B472EC1F243101DB002F7504 /* Logger.swift */,
B4DE725E23C257610001CF46 /* Extensions.swift */,
B49F5D5623C5BCAF009E9BE6 /* UserSettings.swift */,
B46789BB23A69ECB00CE572D /* Main.storyboard */,
Expand Down Expand Up @@ -721,6 +724,7 @@
B4FE0DB123EF1E0100AE94E6 /* LineGraph.swift in Sources */,
B4FE0DB323EF210500AE94E6 /* Graph.swift in Sources */,
B43ABF2A23AA32FA007F93BA /* SidebarViewController.swift in Sources */,
B472EC20243101DB002F7504 /* Logger.swift in Sources */,
B415FF2723F459EF00ED6567 /* MemoryViewController.swift in Sources */,
B4C37E6323A7946B008C7FC0 /* SidebarView.swift in Sources */,
B45AC91D24212B2A00D331AC /* NetworkInfo.swift in Sources */,
Expand Down Expand Up @@ -904,7 +908,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2.0.2;
CURRENT_PROJECT_VERSION = 2.0.3;
DEVELOPMENT_TEAM = J6GXEPK4NG;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = iGlance/Info.plist;
Expand All @@ -913,7 +917,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 2.0.2;
MARKETING_VERSION = 2.0.3;
PRODUCT_BUNDLE_IDENTIFIER = io.github.iglance.iGlance;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand All @@ -931,7 +935,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 2.0.2;
CURRENT_PROJECT_VERSION = 2.0.3;
DEVELOPMENT_TEAM = J6GXEPK4NG;
ENABLE_HARDENED_RUNTIME = YES;
INFOPLIST_FILE = iGlance/Info.plist;
Expand All @@ -940,7 +944,7 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.12;
MARKETING_VERSION = 2.0.2;
MARKETING_VERSION = 2.0.3;
PRODUCT_BUNDLE_IDENTIFIER = io.github.iglance.iGlance;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
Expand Down
25 changes: 2 additions & 23 deletions iGlance/iGlance/iGlance/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// MARK: -
// MARK: Instance Variables

let logger = Logger()

var mainWindow: MainWindowController = NSStoryboard(name: "Main", bundle: nil).instantiateController(withIdentifier: "MainWindowController") as! MainWindowController

var currentUpdateLoopTimer: Timer!
Expand All @@ -39,29 +41,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
// MARK: Lifecycle Functions

func applicationWillFinishLaunching(_ notification: Notification) {
// set the custom log formatter
DDOSLogger.sharedInstance.logFormatter = CustomLogFormatter()
// add the loggers to the loggin framework
DDLog.add(DDOSLogger.sharedInstance)

// register the logger
// logs are saved under /Library/Logs/iGlance/
let fileLogger = DDFileLogger()
fileLogger.logFormatter = CustomLogFormatter()
fileLogger.rollingFrequency = 60 * 60 * 24 // 24 hours
fileLogger.logFileManager.maximumNumberOfLogFiles = 7
DDLog.add(fileLogger)

// set the default log level to error
dynamicLogLevel = .error

if DEBUG {
// log all messages
dynamicLogLevel = .all
// open the window on startup in debug mode
showMainWindow()
}

// call the update loop once on startup to render the menu bar items
self.updateLoop()
}
Expand Down
37 changes: 37 additions & 0 deletions iGlance/iGlance/iGlance/Logger.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// Logger.swift
// iGlance
//
// Created by Dominik on 29.03.20.
// Copyright © 2020 D0miH. All rights reserved.
//

import Foundation
import CocoaLumberjack

class Logger {
let fileLogger: DDFileLogger

init() {
// set the custom log formatter
DDOSLogger.sharedInstance.logFormatter = CustomLogFormatter()
// add the loggers to the loggin framework
DDLog.add(DDOSLogger.sharedInstance)

// register the logger
// logs are saved under /Library/Logs/iGlance/
fileLogger = DDFileLogger()
fileLogger.logFormatter = CustomLogFormatter()
fileLogger.rollingFrequency = 60 * 60 * 24 // 24 hours
fileLogger.logFileManager.maximumNumberOfLogFiles = 7
DDLog.add(fileLogger)

// set the default log level to error
dynamicLogLevel = .error

if AppDelegate.userSettings.settings.advancedLogging {
// log all messages
dynamicLogLevel = .all
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,14 @@ class NetworkMenuBarItem: MenuBarItem {
let transmittedBytes = AppDelegate.systemInfo.network.getTotalTransmittedBytesOf(interface: currentInterface)

// get the difference of the currently total transmitted bytes and the total transmitted bytes on the last reset
let bytesUploaded = transmittedBytes.up - currentInterfaceLastResetValue.up
let bytesDownloaded = transmittedBytes.down - currentInterfaceLastResetValue.down
var bytesUploaded = transmittedBytes.up
var bytesDownloaded = transmittedBytes.down
if transmittedBytes.up > currentInterfaceLastResetValue.up {
bytesUploaded = transmittedBytes.up - currentInterfaceLastResetValue.up
}
if transmittedBytes.down > currentInterfaceLastResetValue.down {
bytesDownloaded = transmittedBytes.down - currentInterfaceLastResetValue.down
}

// update the dictionary
self.transmittedBytesPerInterface[currentInterface] = (up: bytesUploaded, down: bytesDownloaded)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ class PreferenceModalViewController: ModalViewController {
@IBOutlet private var autostartOnBootCheckbox: NSButton! {
didSet {
// load the initial value from the user settings
autostartOnBootCheckbox.state = AppDelegate.userSettings.settings.autostartOnBoot ? NSButton.StateValue.on : NSButton.StateValue.off
autostartOnBootCheckbox.state = AppDelegate.userSettings.settings.autostartOnBoot ? .on : .off
}
}

@IBOutlet private var advancedLoggingCheckbox: ThemedButton! {
didSet {
advancedLoggingCheckbox.state = DEBUG ? NSButton.StateValue.on : NSButton.StateValue.off
advancedLoggingCheckbox.state = AppDelegate.userSettings.settings.advancedLogging ? .on : .off
}
}

Expand Down Expand Up @@ -123,8 +123,9 @@ class PreferenceModalViewController: ModalViewController {
}

@IBAction private func advancedLoggingCheckboxChanged(_ sender: NSButton) {
let activated = sender.state == .on
// set the dynamic logging level depending on the state of the button
if sender.state == NSButton.StateValue.on {
if activated {
dynamicLogLevel = .all
DDLogInfo("Set the log level to 'all'")
DDLogInfo("Activated 'Advanced Loggin'")
Expand All @@ -133,6 +134,9 @@ class PreferenceModalViewController: ModalViewController {
DDLogInfo("Set the log level to 'error'")
DDLogInfo("Deactivated 'Advanced Loggin'")
}

// set the user setting
AppDelegate.userSettings.settings.advancedLogging = activated
}

@IBAction private func updateIntervalSelectorChanged(_ sender: NSPopUpButton) {
Expand Down
2 changes: 1 addition & 1 deletion iGlance/iGlance/iGlance/SystemInfo/DiskInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class DiskInfo {
return (0, "")
}

DDLogInfo("Output of internal disk size command: \(output)")
DDLogInfo("Output of internal disk size command: \n\(output)")

// get all the devices
var devices = output.components(separatedBy: "\n\n Capacity:")
Expand Down
2 changes: 1 addition & 1 deletion iGlance/iGlance/iGlance/SystemInfo/GpuInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class GpuInfo {
return ""
}

DDLogInfo("Output of gpu name command: \(output)")
DDLogInfo("Output of gpu name command: \n\(output)")

// seperate the lines
let lines = output.split(separator: "\n")
Expand Down
19 changes: 14 additions & 5 deletions iGlance/iGlance/iGlance/SystemInfo/NetworkInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class NetworkInfo {
// MARK: Private Variables
/// The total uploaded and downloaded bytes that were read during the last update interval of the app.
/// This variable is used to calculate the network bandwidth using [getNetworkBandwidth()](x-source-tag://getNetworkBandwidth())
private var totalTransmittedBytes: (up: UInt64, down: UInt64) = (up: 0, down: 0)
private var lastTotalTransmittedBytes: (up: UInt64, down: UInt64) = (up: 0, down: 0)

// MARK: -
// MARK: Instance Functions
Expand All @@ -37,15 +37,22 @@ class NetworkInfo {
let transmittedBytes = getTotalTransmittedBytesOf(interface: interface)

// get the transmitted byte since the last update
let upBytes = transmittedBytes.up - self.totalTransmittedBytes.up
let downBytes = transmittedBytes.down - self.totalTransmittedBytes.down
var upBytes: UInt64 = 0
var downBytes: UInt64 = 0
// if the lastTotalTransmittedBytes is greater than the current transmitted bytes, the currently used interface was changed
if transmittedBytes.up >= self.lastTotalTransmittedBytes.up {
upBytes = transmittedBytes.up - self.lastTotalTransmittedBytes.up
}
if transmittedBytes.down >= self.lastTotalTransmittedBytes.down {
downBytes = transmittedBytes.down - self.lastTotalTransmittedBytes.down
}

// divide the bandwidth by the update interval to get the average of one update duration
let upBandwidth = upBytes / UInt64(AppDelegate.userSettings.settings.updateInterval)
let downBandwidth = downBytes / UInt64(AppDelegate.userSettings.settings.updateInterval)

// update the total transmitted bytes
self.totalTransmittedBytes = transmittedBytes
self.lastTotalTransmittedBytes = transmittedBytes

return (up: upBandwidth, down: downBandwidth)
}
Expand All @@ -71,7 +78,7 @@ class NetworkInfo {
return (up: 0, down: 0)
}

DDLogInfo("Output of network bandwidth command: \(commandOutput)")
DDLogInfo("Output of network bandwidth command: \n\(commandOutput)")

// split the lines of the output
let lowerCaseOutput = commandOutput.lowercased()
Expand Down Expand Up @@ -121,6 +128,8 @@ class NetworkInfo {
// get the command output
let commandOutput = pipe.fileHandleForReading.readDataToEndOfFile()

DDLogInfo("Output of the network interface command: \n\(commandOutput)")

// get the currently used interface
guard let commandString = String(data: commandOutput, encoding: String.Encoding.utf8) else {
DDLogError("Something went wrong while casting the command output to a string")
Expand Down
1 change: 1 addition & 0 deletions iGlance/iGlance/iGlance/UserSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ struct BatterySettings: Codable {
struct IGlanceUserSettings: Codable {
// global settings
var autostartOnBoot: Bool = false
var advancedLogging: Bool = DEBUG
var updateInterval: Double = 2.0
var tempUnit: TemperatureUnit = .celsius

Expand Down

0 comments on commit 5ce3487

Please sign in to comment.