Skip to content

Commit

Permalink
Merge pull request #157 from iglance/release/v2.0.7
Browse files Browse the repository at this point in the history
Version 2.0.7
  • Loading branch information
D0miH committed Apr 21, 2020
2 parents a422dbc + ff530b3 commit 214b8a1
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 56 deletions.
17 changes: 17 additions & 0 deletions Sparkle/updates/appcast.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,22 @@
<enclosure url="https://github.com/raw/iglance/iGlance/master/Sparkle/updates/iGlance2.0.6-2.0.delta" sparkle:version="2.0.6" sparkle:shortVersionString="2.0.6" sparkle:deltaFrom="2.0" length="315802" type="application/octet-stream" sparkle:edSignature="4x2uEUfhnNhJv0OqaQLuQ54GxLRpCSjnvj8pCM5YbxbSMvjeyinU8h+jxe1PEY3S9JX9ZI5EEqfRPP6O4OONBw=="/>
</sparkle:deltas>
</item>
<item>
<title>2.0.7</title>
<pubDate>Tue, 21 Apr 2020 19:04:15 +0200</pubDate>
<sparkle:releaseNotesLink>
https://iglance.github.io/release-notes.html
</sparkle:releaseNotesLink>
<sparkle:minimumSystemVersion>10.12</sparkle:minimumSystemVersion>
<enclosure url="https://github.com/iglance/iGlance/releases/download/v2.0.7/iGlance_v2.0.7.zip" sparkle:version="2.0.7" sparkle:shortVersionString="2.0.7" length="10115259" type="application/octet-stream" sparkle:edSignature="z2aJa8SFx10LUKF5PAmoI3SGFmofx0HkqKb//CSafgU9QhpSPWEyzoPvpYeiUu6M5MhMlxuaWjvBNBfsrKCvDw=="/>
<sparkle:deltas>
<enclosure url="https://github.com/raw/iglance/iGlance/master/Sparkle/updates/iGlance2.0.7-2.0.6.delta" sparkle:version="2.0.7" sparkle:shortVersionString="2.0.7" sparkle:deltaFrom="2.0.6" length="140952" type="application/octet-stream" sparkle:edSignature="M7DoOXX6Wl8TxwFg+QAGqGpIODHTPMBw2XijBi/x4dp3ZcKbLNNRHNg9xq/YvJLSl/4nLaqzhVwBEuOPDX58BA=="/>
<enclosure url="https://github.com/raw/iglance/iGlance/master/Sparkle/updates/iGlance2.0.7-2.0.5.delta" sparkle:version="2.0.7" sparkle:shortVersionString="2.0.7" sparkle:deltaFrom="2.0.5" length="163430" type="application/octet-stream" sparkle:edSignature="YJLLXNBtPAw+LwZA8/NwWveWtPFBcIsJ0sbmdK7ZgCQGPHlJZ+sVJbJdLVhzkANeo7NfI8sRPA04vrVZH04OCQ=="/>
<enclosure url="https://github.com/raw/iglance/iGlance/master/Sparkle/updates/iGlance2.0.7-2.0.4.delta" sparkle:version="2.0.7" sparkle:shortVersionString="2.0.7" sparkle:deltaFrom="2.0.4" length="197735" type="application/octet-stream" sparkle:edSignature="uOyud++RPuQoeky3FsPVRjz3Xnl0hca9E1Sg/yMD1b5Enk7xU+mNW51zmEr31euVTiiQghP6sq6gDWZ9j8v5Bw=="/>
<enclosure url="https://github.com/raw/iglance/iGlance/master/Sparkle/updates/iGlance2.0.7-2.0.3.delta" sparkle:version="2.0.7" sparkle:shortVersionString="2.0.7" sparkle:deltaFrom="2.0.3" length="292548" type="application/octet-stream" sparkle:edSignature="Qj+5Uc1jg8mr+pOllkABFzSxnz8nZOlDWeSSIFRXWkZ8BSrp5PHGqp0/yOlCSXdNaawZYt3E3zif9GmhKkQ2Aw=="/>
<enclosure url="https://github.com/raw/iglance/iGlance/master/Sparkle/updates/iGlance2.0.7-2.0.2.delta" sparkle:version="2.0.7" sparkle:shortVersionString="2.0.7" sparkle:deltaFrom="2.0.2" length="299878" type="application/octet-stream" sparkle:edSignature="mgfVgSxUWDwTKVkgTA88ROH8JKEAVFQ4yhPkmUeeWzwIBfMMwqUPfACEQxwZ0sM7hE5zE0HGi1vAanB4mSQvCQ=="/>
<enclosure url="https://github.com/raw/iglance/iGlance/master/Sparkle/updates/iGlance2.0.7-2.0.1.delta" sparkle:version="2.0.7" sparkle:shortVersionString="2.0.7" sparkle:deltaFrom="2.0.1" length="309772" type="application/octet-stream" sparkle:edSignature="070F3l6auFJw8sPy87MagYnyuUHR7KrQ7I3yaHbqEMlrC5CgcTGNQHIkmtR/wq68GZnhWdxQ8iSvK/AYvW8fBw=="/>
</sparkle:deltas>
</item>
</channel>
</rss>
Binary file added Sparkle/updates/iGlance2.0.7-2.0.1.delta
Binary file not shown.
Binary file added Sparkle/updates/iGlance2.0.7-2.0.2.delta
Binary file not shown.
Binary file added Sparkle/updates/iGlance2.0.7-2.0.3.delta
Binary file not shown.
Binary file added Sparkle/updates/iGlance2.0.7-2.0.4.delta
Binary file not shown.
Binary file added Sparkle/updates/iGlance2.0.7-2.0.5.delta
Binary file not shown.
Binary file added Sparkle/updates/iGlance2.0.7-2.0.6.delta
Binary file not shown.
8 changes: 4 additions & 4 deletions iGlance/iGlance/iGlance.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 = "";
Expand All @@ -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;
Expand All @@ -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 = "";
Expand Down
2 changes: 2 additions & 0 deletions iGlance/iGlance/iGlance/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ class AppDelegate: NSObject, NSApplicationDelegate {
let timer = RepeatingTimer(timeInterval: interval)
timer.eventHandler = updateLoop
timer.resume()

self.currentUpdateLoopTimer = timer
}

// MARK: -
Expand Down
73 changes: 21 additions & 52 deletions iGlance/iGlance/iGlance/SystemInfo/NetworkInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit 214b8a1

Please sign in to comment.