diff --git a/Aware.xcodeproj/project.pbxproj b/Aware.xcodeproj/project.pbxproj index 1e7c19d..bad3f93 100644 --- a/Aware.xcodeproj/project.pbxproj +++ b/Aware.xcodeproj/project.pbxproj @@ -144,12 +144,12 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0810; + LastUpgradeCheck = 0940; ORGANIZATIONNAME = "Joshua Peek"; TargetAttributes = { 036EBD141C1408C200121D0B = { CreatedOnToolsVersion = 7.1.1; - LastSwiftMigration = 0800; + LastSwiftMigration = 0940; SystemCapabilities = { com.apple.Sandbox = { enabled = 1; @@ -158,7 +158,7 @@ }; 03F9E2251C24CAD3001DBE86 = { CreatedOnToolsVersion = 7.2; - LastSwiftMigration = 0800; + LastSwiftMigration = 0940; TestTargetID = 036EBD141C1408C200121D0B; }; }; @@ -251,14 +251,22 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -297,14 +305,22 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -338,7 +354,7 @@ MACOSX_DEPLOYMENT_TARGET = 10.11; PRODUCT_BUNDLE_IDENTIFIER = com.awaremac.Aware; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Debug; }; @@ -354,7 +370,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.awaremac.Aware; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.0; }; name = Release; }; @@ -367,7 +383,8 @@ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.awaremac.AwareTests; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Aware.app/Contents/MacOS/Aware"; }; name = Debug; @@ -382,7 +399,8 @@ PRODUCT_BUNDLE_IDENTIFIER = com.awaremac.AwareTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 3.0; + SWIFT_SWIFT3_OBJC_INFERENCE = On; + SWIFT_VERSION = 4.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Aware.app/Contents/MacOS/Aware"; }; name = Release; diff --git a/Aware.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/Aware.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000..18d9810 --- /dev/null +++ b/Aware.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/Aware.xcodeproj/xcshareddata/xcschemes/Aware.xcscheme b/Aware.xcodeproj/xcshareddata/xcschemes/Aware.xcscheme index 902e9ef..6c349dc 100644 --- a/Aware.xcodeproj/xcshareddata/xcschemes/Aware.xcscheme +++ b/Aware.xcodeproj/xcshareddata/xcschemes/Aware.xcscheme @@ -1,6 +1,6 @@ let AnyInputEventType = CGEventType(rawValue: UInt32.max)! - let statusItem = NSStatusBar.system().statusItem(withLength: NSVariableStatusItemLength) + let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) @IBOutlet weak var menu: NSMenu! { didSet { statusItem.menu = menu @@ -46,9 +46,9 @@ class AppDelegate: NSObject, NSApplicationDelegate { updateButton() let _ = Timer.scheduledTimer(buttonRefreshRate, userInfo: nil, repeats: true) { _ in self.updateButton() } - let notificationCenter = NSWorkspace.shared().notificationCenter - notificationCenter.addObserver(forName: NSNotification.Name.NSWorkspaceWillSleep, object: nil, queue: nil) { _ in self.resetTimer() } - notificationCenter.addObserver(forName: NSNotification.Name.NSWorkspaceDidWake, object: nil, queue: nil) { _ in self.resetTimer() } + let notificationCenter = NSWorkspace.shared.notificationCenter + notificationCenter.addObserver(forName: NSWorkspace.willSleepNotification, object: nil, queue: nil) { _ in self.resetTimer() } + notificationCenter.addObserver(forName: NSWorkspace.didWakeNotification, object: nil, queue: nil) { _ in self.resetTimer() } } func resetTimer() { @@ -83,12 +83,15 @@ class AppDelegate: NSObject, NSApplicationDelegate { if (idle) { statusItem.button!.attributedTitle = updateAttributedString(statusItem.button!.attributedTitle, [ - NSForegroundColorAttributeName: NSColor.controlTextColor.withAlphaComponent(0.1) + NSAttributedStringKey.foregroundColor: NSColor.controlTextColor.withAlphaComponent(0.1) ]) // On next mouse event, immediately update button if mouseEventMonitor == nil { - mouseEventMonitor = NSEvent.addGlobalMonitorForEvents(matching: [.mouseMoved, .leftMouseDown], handler: onMouseEvent) + mouseEventMonitor = NSEvent.addGlobalMonitorForEvents(matching: [ + NSEvent.EventTypeMask.mouseMoved, + NSEvent.EventTypeMask.leftMouseDown + ], handler: onMouseEvent) } } } @@ -105,7 +108,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { return userActivityEventTypes.map { CGEventSource.secondsSinceLastEventType(.combinedSessionState, eventType: $0) }.min()! } - func updateAttributedString(_ attributedString: NSAttributedString, _ attributes: [String: AnyObject]) -> NSAttributedString { + func updateAttributedString(_ attributedString: NSAttributedString, _ attributes: [NSAttributedStringKey: Any]) -> NSAttributedString { let str = NSMutableAttributedString(attributedString: attributedString) str.addAttributes(attributes, range: NSMakeRange(0, str.length)) return str