Skip to content

Commit

Permalink
Update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed May 15, 2018
1 parent 1e0fd5f commit 23c8d14
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
7 changes: 5 additions & 2 deletions Gifski/Vendor/Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@ public extension UserDefaults {
return _get(key.name)
}
set {
if let value = newValue {
_set(key.name, to: value)
guard let value = newValue else {
set(nil, forKey: key.name)
return
}

_set(key.name, to: value)
}
}

Expand Down
16 changes: 7 additions & 9 deletions Gifski/Vendor/DockProgress.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public final class DockProgress {

public static var progressValue: Double = 0 {
didSet {
if previousProgressValue == 0 || (progressValue - previousProgressValue).magnitude > 0.001 {
if previousProgressValue == 0 || (progressValue - previousProgressValue).magnitude > 0.01 {
previousProgressValue = progressValue
updateDockIcon()
}
Expand All @@ -41,14 +41,12 @@ public final class DockProgress {

/// TODO: Make the progress smoother by also animating the steps between each call to `updateDockIcon()`
private static func updateDockIcon() {
DispatchQueue.global(qos: .utility).async {
/// TODO: If the `progressValue` is 1, draw the full circle, then schedule another draw in n milliseconds to hide it
let icon = (0..<1).contains(self.progressValue) ? self.draw() : appIcon
DispatchQueue.main.async {
/// TODO: Make this better by drawing in the `contentView` directly instead of using an image
dockImageView.image = icon
NSApp.dockTile.display()
}
/// TODO: If the `progressValue` is 1, draw the full circle, then schedule another draw in n milliseconds to hide it
let icon = (0..<1).contains(self.progressValue) ? self.draw() : appIcon
DispatchQueue.main.async {
/// TODO: Make this better by drawing in the `contentView` directly instead of using an image
dockImageView.image = icon
NSApp.dockTile.display()
}
}

Expand Down

0 comments on commit 23c8d14

Please sign in to comment.