diff --git a/Sparkle/updates/appcast.xml b/Sparkle/updates/appcast.xml index 082545a..3726eb7 100644 --- a/Sparkle/updates/appcast.xml +++ b/Sparkle/updates/appcast.xml @@ -98,5 +98,22 @@ + + 2.0.7 + Tue, 21 Apr 2020 19:04:15 +0200 + + https://iglance.github.io/release-notes.html + + 10.12 + + + + + + + + + + diff --git a/Sparkle/updates/iGlance2.0.7-2.0.1.delta b/Sparkle/updates/iGlance2.0.7-2.0.1.delta new file mode 100644 index 0000000..9cc6940 Binary files /dev/null and b/Sparkle/updates/iGlance2.0.7-2.0.1.delta differ diff --git a/Sparkle/updates/iGlance2.0.7-2.0.2.delta b/Sparkle/updates/iGlance2.0.7-2.0.2.delta new file mode 100644 index 0000000..ce78caa Binary files /dev/null and b/Sparkle/updates/iGlance2.0.7-2.0.2.delta differ diff --git a/Sparkle/updates/iGlance2.0.7-2.0.3.delta b/Sparkle/updates/iGlance2.0.7-2.0.3.delta new file mode 100644 index 0000000..70bc31d Binary files /dev/null and b/Sparkle/updates/iGlance2.0.7-2.0.3.delta differ diff --git a/Sparkle/updates/iGlance2.0.7-2.0.4.delta b/Sparkle/updates/iGlance2.0.7-2.0.4.delta new file mode 100644 index 0000000..63c9b30 Binary files /dev/null and b/Sparkle/updates/iGlance2.0.7-2.0.4.delta differ diff --git a/Sparkle/updates/iGlance2.0.7-2.0.5.delta b/Sparkle/updates/iGlance2.0.7-2.0.5.delta new file mode 100644 index 0000000..c09ea78 Binary files /dev/null and b/Sparkle/updates/iGlance2.0.7-2.0.5.delta differ diff --git a/Sparkle/updates/iGlance2.0.7-2.0.6.delta b/Sparkle/updates/iGlance2.0.7-2.0.6.delta new file mode 100644 index 0000000..bd1ca38 Binary files /dev/null and b/Sparkle/updates/iGlance2.0.7-2.0.6.delta differ diff --git a/iGlance/iGlance/iGlance.xcodeproj/project.pbxproj b/iGlance/iGlance/iGlance.xcodeproj/project.pbxproj index 827d135..456be13 100644 --- a/iGlance/iGlance/iGlance.xcodeproj/project.pbxproj +++ b/iGlance/iGlance/iGlance.xcodeproj/project.pbxproj @@ -916,7 +916,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2.0.6; + CURRENT_PROJECT_VERSION = 2.0.7; DEVELOPMENT_TEAM = J6GXEPK4NG; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = iGlance/Info.plist; @@ -925,7 +925,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.12; - MARKETING_VERSION = 2.0.6; + MARKETING_VERSION = 2.0.7; PRODUCT_BUNDLE_IDENTIFIER = io.github.iglance.iGlance; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -943,7 +943,7 @@ CODE_SIGN_IDENTITY = "Apple Development"; CODE_SIGN_STYLE = Automatic; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 2.0.6; + CURRENT_PROJECT_VERSION = 2.0.7; DEVELOPMENT_TEAM = J6GXEPK4NG; ENABLE_HARDENED_RUNTIME = YES; INFOPLIST_FILE = iGlance/Info.plist; @@ -952,7 +952,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 10.12; - MARKETING_VERSION = 2.0.6; + MARKETING_VERSION = 2.0.7; PRODUCT_BUNDLE_IDENTIFIER = io.github.iglance.iGlance; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/iGlance/iGlance/iGlance/AppDelegate.swift b/iGlance/iGlance/iGlance/AppDelegate.swift index a1eb6af..8fe5b63 100644 --- a/iGlance/iGlance/iGlance/AppDelegate.swift +++ b/iGlance/iGlance/iGlance/AppDelegate.swift @@ -239,6 +239,8 @@ class AppDelegate: NSObject, NSApplicationDelegate { let timer = RepeatingTimer(timeInterval: interval) timer.eventHandler = updateLoop timer.resume() + + self.currentUpdateLoopTimer = timer } // MARK: - diff --git a/iGlance/iGlance/iGlance/SystemInfo/NetworkInfo.swift b/iGlance/iGlance/iGlance/SystemInfo/NetworkInfo.swift index 19da449..786242c 100644 --- a/iGlance/iGlance/iGlance/SystemInfo/NetworkInfo.swift +++ b/iGlance/iGlance/iGlance/SystemInfo/NetworkInfo.swift @@ -104,61 +104,30 @@ class NetworkInfo { * Returns the name of the currently used network interface as a string. If something went wrong the default network interface "en0" is returned. */ func getCurrentlyUsedInterface() -> String { - // idea is from https://apple.stackexchange.com/a/223446 - // get the srvice list - let arguments = ["networksetup", "-listallhardwareports"] - guard let netCmdOutput = executeCommand(launchPath: "/usr/bin/env", arguments: arguments) else { - DDLogError("Something went wrong while executing the networksetup command") - return "en0" - } - let interfaceList = netCmdOutput.split(separator: "\n") - .filter { $0.contains("Device:") } - .map { $0.replacingOccurrences(of: "Device: ", with: "") } + // create the process for the command + let process = Process() + process.launchPath = "/bin/bash" + process.arguments = ["-c", "route get 0.0.0.0 2>/dev/null | grep interface: | awk '{print $2}'"] - // the default interface is en0 - var activeInterfaces = ["en0"] + // create the pipe for the output + let pipe = Pipe() + process.standardOutput = pipe + process.launch() - // get all the network interfaces of ifconfig - guard let ifconfigInterfacesCommand = executeCommand(launchPath: "/usr/bin/env", arguments: ["ifconfig", "-lu"]) else { - DDLogError("Something went wrong while executing the ifconfig command to retrieve all interfaces") - return activeInterfaces[0] - } - let ifconfigInterfacesList = ifconfigInterfacesCommand - .replacingOccurrences(of: "\n", with: "") - .split(separator: " ") - .map { String($0) } - - // iterate the list from top to bottom - for interfaceName in interfaceList where ifconfigInterfacesList.contains(interfaceName) { - // get more info about the current network interface - guard let ifconfOutput = executeCommand(launchPath: "/usr/bin/env", arguments: ["ifconfig", interfaceName]) else { - DDLogError("Something went wrong while executing the ifconfig command for interface \(interfaceName)") - continue - } - - // get the status line - let statusString = ifconfOutput.split(separator: "\n") - .filter { $0.contains("status:") } - .map { $0.replacingOccurrences(of: "\tstatus: ", with: "") } - - // check if the string array is empty - if statusString.isEmpty { - DDLogInfo("Could not find a status string for interface \(interfaceName)") - continue - } - - // if we got more values log it, but proceed and check if one of them is active - if statusString.count > 1 { - DDLogError("Read more than one status string for interface \(interfaceName)") - } - - if statusString.contains("active") && !activeInterfaces.contains(interfaceName) { - // add the active interface to the list - activeInterfaces.insert(interfaceName, at: 0) - } + // 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") + return "en0" } - // return the first interface in the list - return activeInterfaces[0] + // get the interface name + let interfaceName = commandString.trimmingCharacters(in: .whitespacesAndNewlines) + + return interfaceName.isEmpty ? "en0" : interfaceName } }