diff options
| -rw-r--r-- | DWA140Menu.xcodeproj/project.pbxproj | 19 | ||||
| -rw-r--r-- | DWA140Menu.xcodeproj/xcuserdata/dylanbolger.xcuserdatad/xcschemes/xcschememanagement.plist | 5 | ||||
| -rw-r--r-- | DWA140Menu/AppDelegate.swift | 28 | ||||
| -rw-r--r-- | DWA140Menu/Assets.xcassets/CreditsPNG.imageset/Contents.json | 8 | ||||
| -rw-r--r-- | DWA140Menu/Assets.xcassets/WifiError.imageset/AirPortError-1_55A54008AD1BA589AA210D2629C1DF41_0.png (renamed from DWA140Menu/Assets.xcassets/wifierror.imageset/AirPortError-1_55A54008AD1BA589AA210D2629C1DF41_0.png) | bin | 743 -> 743 bytes | |||
| -rw-r--r-- | DWA140Menu/Assets.xcassets/WifiError.imageset/Contents.json (renamed from DWA140Menu/Assets.xcassets/wifierror.imageset/Contents.json) | 0 | ||||
| -rw-r--r-- | DWA140Menu/Base.lproj/Main.storyboard | 49 |
7 files changed, 41 insertions, 68 deletions
diff --git a/DWA140Menu.xcodeproj/project.pbxproj b/DWA140Menu.xcodeproj/project.pbxproj index 02e624c..1aa69f3 100644 --- a/DWA140Menu.xcodeproj/project.pbxproj +++ b/DWA140Menu.xcodeproj/project.pbxproj @@ -194,13 +194,16 @@ TargetAttributes = { E7DA7E45213DD9DD00931016 = { CreatedOnToolsVersion = 9.4.1; + LastSwiftMigration = 1010; }; E7DA7E57213DD9DD00931016 = { CreatedOnToolsVersion = 9.4.1; + LastSwiftMigration = 1010; TestTargetID = E7DA7E45213DD9DD00931016; }; E7DA7E62213DD9DD00931016 = { CreatedOnToolsVersion = 9.4.1; + LastSwiftMigration = 1010; TestTargetID = E7DA7E45213DD9DD00931016; }; }; @@ -336,7 +339,7 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; + CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; @@ -397,7 +400,7 @@ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CODE_SIGN_IDENTITY = "-"; + CODE_SIGN_IDENTITY = ""; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; @@ -433,7 +436,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.FivePixels.DWA140Menu; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -451,7 +454,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.FivePixels.DWA140Menu; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -470,7 +473,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.FivePixels.DWA140MenuTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DWA140Menu.app/Contents/MacOS/DWA140Menu"; }; name = Debug; @@ -490,7 +493,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.FivePixels.DWA140MenuTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/DWA140Menu.app/Contents/MacOS/DWA140Menu"; }; name = Release; @@ -509,7 +512,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.FivePixels.DWA140MenuUITests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_TARGET_NAME = DWA140Menu; }; name = Debug; @@ -528,7 +531,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = com.FivePixels.DWA140MenuUITests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; TEST_TARGET_NAME = DWA140Menu; }; name = Release; diff --git a/DWA140Menu.xcodeproj/xcuserdata/dylanbolger.xcuserdatad/xcschemes/xcschememanagement.plist b/DWA140Menu.xcodeproj/xcuserdata/dylanbolger.xcuserdatad/xcschemes/xcschememanagement.plist index 6480145..3774684 100644 --- a/DWA140Menu.xcodeproj/xcuserdata/dylanbolger.xcuserdatad/xcschemes/xcschememanagement.plist +++ b/DWA140Menu.xcodeproj/xcuserdata/dylanbolger.xcuserdatad/xcschemes/xcschememanagement.plist @@ -9,6 +9,11 @@ <key>orderHint</key> <integer>0</integer> </dict> + <key>DWA140Menu.xcscheme_^#shared#^_</key> + <dict> + <key>orderHint</key> + <integer>0</integer> + </dict> </dict> </dict> </plist> diff --git a/DWA140Menu/AppDelegate.swift b/DWA140Menu/AppDelegate.swift index cd78f1a..b3d0ee6 100644 --- a/DWA140Menu/AppDelegate.swift +++ b/DWA140Menu/AppDelegate.swift @@ -45,6 +45,7 @@ struct Networking { } + // Credit to Martin R http://stackoverflow.com/a/34016247/600753 for this lovely code // New Swift 3 implementation needed upated to replace unsafepointer calls with .withMemoryRebound func getInterfaces() -> [(name : String, addr: String, mac : String)] { @@ -99,13 +100,14 @@ struct Networking { freeifaddrs(ifaddr) + + // Now add the mac address to the tuples: for (i, addr) in addresses.enumerated() { if let mac = nameToMac[addr.name] { addresses[i] = (name: addr.name, addr: addr.addr, mac : mac) } } - return addresses } } @@ -113,17 +115,17 @@ struct Networking { class AppDelegate: NSObject, NSApplicationDelegate { @objc func openCredits() { - let myWindowController = NSStoryboard(name: NSStoryboard.Name(rawValue: "Main"), bundle: nil).instantiateController(withIdentifier: NSStoryboard.SceneIdentifier(rawValue: "credits")) as! NSWindowController - myWindowController.showWindow(self) + + NSWorkspace.shared.open((URL(string:"https://github.com/fivepixels/dwa140shortcut") ?? nil)!) } @objc func changeIcon() { if let button = statusItem.button { if Networking.isConnectedByEthernet { - button.image = NSImage(named: NSImage.Name(rawValue: "WifiConnected")) + button.image = NSImage(named: "WifiConnected") } else { - button.image = NSImage(named: NSImage.Name(rawValue: "wifierror")) + button.image = NSImage(named: "WifiError") } } @@ -152,7 +154,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { } @objc func ethStatus() -> String { if Networking.isConnectedByEthernet { - return "USB WiFi is connected. (en4)" + return "USB WiFi is connected." } else { return "USB WiFi is disconnected." } @@ -162,25 +164,23 @@ class AppDelegate: NSObject, NSApplicationDelegate { let statusItem = NSStatusBar.system.statusItem(withLength:NSStatusItem.squareLength) func applicationDidFinishLaunching(_ aNotification: Notification) { - changeIcon() - -constructMenu() - } + constructMenu() + } func applicationWillTerminate(_ aNotification: Notification) { // Insert code here to tear down your application } func constructMenu() { let menu = NSMenu() - menu.addItem(NSMenuItem(title: "DWA-140 Shortcut", action: #selector(openCredits), keyEquivalent: "")) + menu.addItem(NSMenuItem(title: "DWA-140 Shortcut (GitHub)", action: #selector(openCredits), keyEquivalent: "")) menu.addItem(NSMenuItem.separator()) menu.addItem(NSMenuItem(title: ethStatus(), action: nil, keyEquivalent: "")) - menu.addItem(NSMenuItem(title: "Refresh Status", action: #selector(restartApp), keyEquivalent: "")) - menu.addItem(NSMenuItem(title: "Open DWA-140" , action: #selector(openDWA), keyEquivalent: "")) + menu.addItem(NSMenuItem(title: "Refresh Status", action: #selector(restartApp), keyEquivalent: "r")) + menu.addItem(NSMenuItem(title: "Open DWA-140" , action: #selector(openDWA), keyEquivalent: "t1")) menu.addItem(NSMenuItem(title: "Network Preferences" , action: #selector(openNetwork), keyEquivalent: "")) menu.addItem(NSMenuItem.separator()) - menu.addItem(NSMenuItem(title: "Quit", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "q")) + menu.addItem(NSMenuItem(title: "Quit", action: #selector(NSApplication.terminate(_:)), keyEquivalent: "")) statusItem.menu = menu diff --git a/DWA140Menu/Assets.xcassets/CreditsPNG.imageset/Contents.json b/DWA140Menu/Assets.xcassets/CreditsPNG.imageset/Contents.json index 03a16f6..5e49329 100644 --- a/DWA140Menu/Assets.xcassets/CreditsPNG.imageset/Contents.json +++ b/DWA140Menu/Assets.xcassets/CreditsPNG.imageset/Contents.json @@ -4,6 +4,14 @@ "idiom" : "universal", "filename" : "CreditsPNG.png", "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "idiom" : "universal", + "scale" : "3x" } ], "info" : { diff --git a/DWA140Menu/Assets.xcassets/wifierror.imageset/AirPortError-1_55A54008AD1BA589AA210D2629C1DF41_0.png b/DWA140Menu/Assets.xcassets/WifiError.imageset/AirPortError-1_55A54008AD1BA589AA210D2629C1DF41_0.png Binary files differindex 039d66f..039d66f 100644 --- a/DWA140Menu/Assets.xcassets/wifierror.imageset/AirPortError-1_55A54008AD1BA589AA210D2629C1DF41_0.png +++ b/DWA140Menu/Assets.xcassets/WifiError.imageset/AirPortError-1_55A54008AD1BA589AA210D2629C1DF41_0.png diff --git a/DWA140Menu/Assets.xcassets/wifierror.imageset/Contents.json b/DWA140Menu/Assets.xcassets/WifiError.imageset/Contents.json index 3f18ed4..3f18ed4 100644 --- a/DWA140Menu/Assets.xcassets/wifierror.imageset/Contents.json +++ b/DWA140Menu/Assets.xcassets/WifiError.imageset/Contents.json diff --git a/DWA140Menu/Base.lproj/Main.storyboard b/DWA140Menu/Base.lproj/Main.storyboard index 42bdba8..5744e11 100644 --- a/DWA140Menu/Base.lproj/Main.storyboard +++ b/DWA140Menu/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> -<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> +<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="14460.31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES"> <dependencies> - <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/> - <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> + <deployment identifier="macosx"/> + <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14460.31"/> </dependencies> <scenes> <!--Application--> @@ -680,48 +680,5 @@ </objects> <point key="canvasLocation" x="75" y="0.0"/> </scene> - <!--Window Controller--> - <scene sceneID="Qjy-2V-LMd"> - <objects> - <windowController storyboardIdentifier="credits" showSeguePresentationStyle="single" id="nRX-BA-ezW" sceneMemberID="viewController"> - <window key="window" title="Credits" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" titlebarAppearsTransparent="YES" id="rZh-6e-Tf1"> - <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/> - <rect key="contentRect" x="735" y="354" width="475" height="195"/> - <rect key="screenRect" x="0.0" y="0.0" width="1920" height="1058"/> - <connections> - <outlet property="delegate" destination="nRX-BA-ezW" id="gZ6-jx-7xG"/> - </connections> - </window> - <connections> - <segue destination="0aO-16-CgC" kind="relationship" relationship="window.shadowedContentViewController" id="pKN-ne-ylG"/> - </connections> - </windowController> - <customObject id="ggv-1R-9Ps" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/> - </objects> - <point key="canvasLocation" x="-40" y="580"/> - </scene> - <!--View Controller--> - <scene sceneID="Mzy-En-CiB"> - <objects> - <viewController id="0aO-16-CgC" sceneMemberID="viewController"> - <view key="view" id="bth-bX-hYV"> - <rect key="frame" x="0.0" y="0.0" width="475" height="195"/> - <autoresizingMask key="autoresizingMask"/> - <subviews> - <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="RcP-h0-2uh"> - <rect key="frame" x="-3" y="-3" width="480" height="200"/> - <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> - <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="CreditsPNG" id="Xsm-jF-xX3"/> - </imageView> - </subviews> - </view> - </viewController> - <customObject id="zDu-Zs-kKh" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/> - </objects> - <point key="canvasLocation" x="666.5" y="554.5"/> - </scene> </scenes> - <resources> - <image name="CreditsPNG" width="480" height="200"/> - </resources> </document> |
