Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
86a2f2f84c |
@@ -31,8 +31,6 @@
|
||||
BA74C14E20ADA33E00306B27 /* PPColor.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA74C14D20ADA33E00306B27 /* PPColor.swift */; };
|
||||
BAA17B7320B14CC100625455 /* LaunchAtLogin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BAA17B6F20B14CC000625455 /* LaunchAtLogin.framework */; };
|
||||
BAA17B7420B14CC100625455 /* LaunchAtLogin.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BAA17B6F20B14CC000625455 /* LaunchAtLogin.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
BAA17B7720B14CC100625455 /* CleanroomLogger.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BAA17B7120B14CC000625455 /* CleanroomLogger.framework */; };
|
||||
BAA17B7820B14CC100625455 /* CleanroomLogger.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BAA17B7120B14CC000625455 /* CleanroomLogger.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
BAA17B7920B14CC100625455 /* MASShortcut.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BAA17B7220B14CC100625455 /* MASShortcut.framework */; };
|
||||
BAA17B7A20B14CC100625455 /* MASShortcut.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BAA17B7220B14CC100625455 /* MASShortcut.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
BAA17B7C20B14CEB00625455 /* SwiftyJSON.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BAA17B7B20B14CEB00625455 /* SwiftyJSON.framework */; };
|
||||
@@ -59,7 +57,6 @@
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
BAA17B7D20B14CEB00625455 /* SwiftyJSON.framework in Embed Frameworks */,
|
||||
BAA17B7820B14CC100625455 /* CleanroomLogger.framework in Embed Frameworks */,
|
||||
BAA17B7A20B14CC100625455 /* MASShortcut.framework in Embed Frameworks */,
|
||||
BAA17B7420B14CC100625455 /* LaunchAtLogin.framework in Embed Frameworks */,
|
||||
);
|
||||
@@ -99,7 +96,6 @@
|
||||
BA74C14320AA609500306B27 /* PPOverlayWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PPOverlayWrapper.swift; sourceTree = "<group>"; };
|
||||
BA74C14D20ADA33E00306B27 /* PPColor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PPColor.swift; sourceTree = "<group>"; };
|
||||
BAA17B6F20B14CC000625455 /* LaunchAtLogin.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = LaunchAtLogin.framework; path = Carthage/Build/Mac/LaunchAtLogin.framework; sourceTree = "<group>"; };
|
||||
BAA17B7120B14CC000625455 /* CleanroomLogger.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CleanroomLogger.framework; path = Carthage/Build/Mac/CleanroomLogger.framework; sourceTree = "<group>"; };
|
||||
BAA17B7220B14CC100625455 /* MASShortcut.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MASShortcut.framework; path = Carthage/Build/Mac/MASShortcut.framework; sourceTree = "<group>"; };
|
||||
BAA17B7B20B14CEB00625455 /* SwiftyJSON.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftyJSON.framework; path = Carthage/Build/Mac/SwiftyJSON.framework; sourceTree = "<group>"; };
|
||||
BAB6F14E221ABB3500EA11D4 /* ShowAndHideCursor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShowAndHideCursor.swift; sourceTree = "<group>"; };
|
||||
@@ -120,7 +116,6 @@
|
||||
files = (
|
||||
BAA17B7920B14CC100625455 /* MASShortcut.framework in Frameworks */,
|
||||
BAA17B7320B14CC100625455 /* LaunchAtLogin.framework in Frameworks */,
|
||||
BAA17B7720B14CC100625455 /* CleanroomLogger.framework in Frameworks */,
|
||||
BA22232720AFEC1B0001069C /* ApplicationServices.framework in Frameworks */,
|
||||
BAA17B7C20B14CEB00625455 /* SwiftyJSON.framework in Frameworks */,
|
||||
);
|
||||
@@ -156,7 +151,6 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BAA17B7B20B14CEB00625455 /* SwiftyJSON.framework */,
|
||||
BAA17B7120B14CC000625455 /* CleanroomLogger.framework */,
|
||||
BAA17B6F20B14CC000625455 /* LaunchAtLogin.framework */,
|
||||
BAA17B7220B14CC100625455 /* MASShortcut.framework */,
|
||||
15FF0CCC204A231800E04103 /* Bridging-Header.h */,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//
|
||||
|
||||
import MASShortcut
|
||||
import CleanroomLogger
|
||||
//import CleanroomLogger
|
||||
|
||||
@NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
|
||||
@@ -20,16 +20,16 @@ import CleanroomLogger
|
||||
|
||||
// Setup logging and load state.
|
||||
func applicationWillFinishLaunching(_ notification: Notification) {
|
||||
let minimumSeverity: LogSeverity = PPState.shared.defaults.bool(forKey: "debugMode") ? .debug : .info
|
||||
var logConfigurations: [LogConfiguration] = [
|
||||
RotatingLogFileConfiguration(minimumSeverity: minimumSeverity, daysToKeep: 7, directoryPath: defaultLogPath().path)
|
||||
]
|
||||
|
||||
#if DEBUG
|
||||
logConfigurations.append(XcodeLogConfiguration(minimumSeverity: .debug))
|
||||
#endif
|
||||
|
||||
Log.enable(configuration: logConfigurations)
|
||||
// let minimumSeverity: LogSeverity = PPState.shared.defaults.bool(forKey: "debugMode") ? .debug : .info
|
||||
// var logConfigurations: [LogConfiguration] = [
|
||||
// RotatingLogFileConfiguration(minimumSeverity: minimumSeverity, daysToKeep: 7, directoryPath: defaultLogPath().path)
|
||||
// ]
|
||||
//
|
||||
// #if DEBUG
|
||||
// logConfigurations.append(XcodeLogConfiguration(minimumSeverity: .debug))
|
||||
// #endif
|
||||
//
|
||||
// Log.enable(configuration: logConfigurations)
|
||||
PPState.shared.loadFromDisk()
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ import CleanroomLogger
|
||||
// hardware events are suppressed after functions like CGWarpMouseCursorPosition are used.
|
||||
CGEventSource(stateID: CGEventSourceStateID.combinedSessionState)?.localEventsSuppressionInterval = 0.05
|
||||
|
||||
Log.info?.message("Sucessfully launched.")
|
||||
// Log.info?.message("Sucessfully launched.")
|
||||
}
|
||||
|
||||
func applicationWillTerminate(_ aNotification: Notification) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Pixel Picker
|
||||
//
|
||||
|
||||
import CleanroomLogger
|
||||
//import CleanroomLogger
|
||||
|
||||
extension CGImage {
|
||||
// In order to get the color at a given pixel from a CGImage, we need to convert the CGImage's
|
||||
@@ -55,7 +55,7 @@ extension CGImage {
|
||||
|
||||
// Creating the context failed, so return a default color instead.
|
||||
// Hopefully, this should never happen.
|
||||
Log.error?.message("Failed to create CGContext!")
|
||||
// Log.error?.message("Failed to create CGContext!")
|
||||
return NSColor.black
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Pixel Picker
|
||||
//
|
||||
|
||||
import CleanroomLogger
|
||||
//import CleanroomLogger
|
||||
|
||||
// This is the controller for the actual pixel picker itself.
|
||||
class PPOverlayController: NSWindowController {
|
||||
|
||||
+11
-10
@@ -6,7 +6,7 @@
|
||||
import SwiftyJSON
|
||||
import MASShortcut
|
||||
import LaunchAtLogin
|
||||
import CleanroomLogger
|
||||
//import CleanroomLogger
|
||||
|
||||
// This state class is responsible for saving/loading application state and keeping
|
||||
// track of the active state and user configuration.
|
||||
@@ -105,10 +105,10 @@ import CleanroomLogger
|
||||
try loadFromString(jsonString)
|
||||
} catch {
|
||||
// Ignore error when there's no file.
|
||||
let err = error as NSError
|
||||
if err.domain != NSCocoaErrorDomain && err.code != CocoaError.fileReadNoSuchFile.rawValue {
|
||||
Log.error?.message("Unexpected error loading application state from disk: \(error)")
|
||||
}
|
||||
// let err = error as NSError
|
||||
// if err.domain != NSCocoaErrorDomain && err.code != CocoaError.fileReadNoSuchFile.rawValue {
|
||||
// Log.error?.message("Unexpected error loading application state from disk: \(error)")
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,11 +151,12 @@ import CleanroomLogger
|
||||
case "recentPicks":
|
||||
recentPicks = deserializeRecentPicks(fromJSON: value)
|
||||
default:
|
||||
Log.warning?.message("unknown key '\(key)' encountered in json")
|
||||
continue
|
||||
// Log.warning?.message("unknown key '\(key)' encountered in json")
|
||||
}
|
||||
}
|
||||
|
||||
Log.info?.message("Loaded config from disk")
|
||||
// Log.info?.message("Loaded config from disk")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -196,12 +197,12 @@ import CleanroomLogger
|
||||
let configDir = savePath.deletingLastPathComponent()
|
||||
try FileManager.default.createDirectory(atPath: configDir.path, withIntermediateDirectories: true, attributes: nil)
|
||||
try jsonString.write(to: savePath, atomically: false, encoding: .utf8)
|
||||
Log.info?.message("Saved config to disk")
|
||||
// Log.info?.message("Saved config to disk")
|
||||
} else {
|
||||
Log.error?.message("Could not serialise config")
|
||||
// Log.error?.message("Could not serialise config")
|
||||
}
|
||||
} catch {
|
||||
Log.error?.message("Unexpected error saving application state to disk: \(error)")
|
||||
// Log.error?.message("Unexpected error saving application state to disk: \(error)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Pixel Picker
|
||||
//
|
||||
|
||||
import CleanroomLogger
|
||||
//import CleanroomLogger
|
||||
|
||||
let APP_NAME = Bundle.main.infoDictionary![kCFBundleNameKey as String] as! String
|
||||
let APPLE_INTERFACE_STYLE = "AppleInterfaceStyle"
|
||||
@@ -82,10 +82,10 @@ func defaultLogPath() -> URL {
|
||||
do {
|
||||
try FileManager.default.createDirectory(at: url, withIntermediateDirectories: true, attributes: nil)
|
||||
} catch {
|
||||
Log.error?.message("Unexpected error creating log directory: \(error)")
|
||||
// Log.error?.message("Unexpected error creating log directory: \(error)")
|
||||
}
|
||||
|
||||
Log.info?.message("Default Log Path: \(url.path)")
|
||||
// Log.info?.message("Default Log Path: \(url.path)")
|
||||
return url
|
||||
}
|
||||
|
||||
@@ -98,6 +98,6 @@ func defaultConfigurationPath() -> URL {
|
||||
url = URL(fileURLWithPath: "\(NSHomeDirectory())/Library/Preferences/\(APP_NAME)/configuration.json")
|
||||
}
|
||||
|
||||
Log.info?.message("Default Config Path: \(url.path)")
|
||||
// Log.info?.message("Default Config Path: \(url.path)")
|
||||
return url
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user