Skip to content

Commit

Permalink
Add tip tooltip to the conversion completed view (#105)
Browse files Browse the repository at this point in the history
Co-Authored-By: 艁ukasz Mr贸z <thesunshinejr@gmail.com>
  • Loading branch information
sindresorhus and sunshinejr committed Aug 4, 2019
1 parent b788f2b commit 479e6a1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Gifski/ConversionCompletedViewController.swift
Expand Up @@ -16,6 +16,13 @@ final class ConversionCompletedViewController: NSViewController {
private var conversion: Gifski.Conversion!
private var gifUrl: URL!

private let tooltip = Tooltip(
identifier: "conversionCompletedTips",
text: "Go ahead and drag the thumbnail to the Finder or Safari! You can also press Space to enlarge the preview.",
showOnlyOnce: true,
maxWidth: 260
)

convenience init(conversion: Gifski.Conversion, gifUrl: URL) {
self.init()

Expand Down Expand Up @@ -50,6 +57,10 @@ final class ConversionCompletedViewController: NSViewController {
draggableFile.layer?.animateScaleMove(fromScale: 3, fromY: view.frame.height + draggableFile.frame.size.height)
wrapperView.fadeIn(duration: 0.5, delay: 0.15, completion: nil)
}

delay(seconds: 1) {
self.tooltip.show(from: self.draggableFile, preferredEdge: .maxY)
}
}

private func setUpUI() {
Expand Down
5 changes: 5 additions & 0 deletions Gifski/util.swift
Expand Up @@ -21,6 +21,11 @@ func with<T>(_ item: T, update: (inout T) throws -> Void) rethrows -> T {
}


func delay(seconds: TimeInterval, closure: @escaping () -> Void) {
DispatchQueue.main.asyncAfter(deadline: .now() + seconds, execute: closure)
}


struct Meta {
static func openSubmitFeedbackPage(message: String? = nil) {
let defaultMessage = "<!--\nProvide your feedback here. Include as many details as possible.\nYou can also email me at sindresorhus@gmail.com\n-->"
Expand Down

0 comments on commit 479e6a1

Please sign in to comment.