-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #928 from glouel/master
1.8.0
- Loading branch information
Showing
27 changed files
with
1,379 additions
and
389 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "Extern/Sparkle"] | ||
path = Extern/Sparkle | ||
url = https://github.com/sparkle-project/Sparkle.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// UpdateReleaseController.swift | ||
// Aerial | ||
// | ||
// Created by Guillaume Louel on 17/02/2020. | ||
// Copyright © 2020 Guillaume Louel. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import AppKit | ||
import WebKit | ||
|
||
class UpdateReleaseController: NSWindowController { | ||
var controller: PreferencesWindowController? | ||
|
||
@IBOutlet var updateWindow: NSWindow! | ||
|
||
@IBOutlet var noUpdateWindow: NSWindow! | ||
|
||
@IBOutlet var versionTextField: NSTextField! | ||
@IBOutlet var releaseNotesWKWebView: WKWebView! | ||
|
||
@IBOutlet var helpPopover: NSPopover! | ||
|
||
// MARK: - Update available | ||
func show(sender: NSButton, controller: PreferencesWindowController) { | ||
self.controller = controller | ||
|
||
if !updateWindow.isVisible { | ||
let autoUpdates = AutoUpdates.sharedInstance | ||
|
||
updateWindow.makeKeyAndOrderFront(nil) | ||
versionTextField.stringValue = autoUpdates.getVersion() | ||
|
||
releaseNotesWKWebView.configuration.preferences.javaScriptEnabled = false | ||
let html = "<html><head><style>body { font-family: -apple-system }</style></head><body>\(autoUpdates.getReleaseNotes())</body></html>" | ||
releaseNotesWKWebView.loadHTMLString(html, baseURL: nil) | ||
} | ||
} | ||
|
||
@IBAction func visitReleasePageClick(_ sender: NSButton) { | ||
let workspace = NSWorkspace.shared | ||
let autoUpdates = AutoUpdates.sharedInstance | ||
|
||
// We construct the URL this way... This is not great ! | ||
let url = URL(string: "https://github.com/JohnCoates/Aerial/releases/tag/v\(autoUpdates.getVersion())")! | ||
workspace.open(url) | ||
|
||
updateWindow.close() | ||
} | ||
|
||
@IBAction func helpButtonClick(_ sender: NSButton) { | ||
helpPopover.show(relativeTo: sender.preparedContentRect, of: sender, preferredEdge: .maxY) | ||
} | ||
|
||
@IBAction func closeClick(_ sender: NSButton) { | ||
updateWindow.close() | ||
} | ||
|
||
// MARK: - No update available | ||
func showNoUpdate() { | ||
if !noUpdateWindow.isVisible { | ||
noUpdateWindow.makeKeyAndOrderFront(nil) | ||
} | ||
} | ||
|
||
@IBAction func noUpdateCloseClick(_ sender: Any) { | ||
noUpdateWindow.close() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.