Skip to content

Commit

Permalink
Merge branch 'release/0.7' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mangerlahn committed Dec 20, 2020
2 parents 0794257 + 4f36769 commit df4e996
Show file tree
Hide file tree
Showing 58 changed files with 1,957 additions and 803 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: swift
os: osx
osx_image: xcode11
osx_image: xcode12.2
xcode_project: Latest.xcodeproj
xcode_scheme: Latest
script: xcodebuild -project Latest.xcodeproj -scheme 'Latest' CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO
2 changes: 1 addition & 1 deletion Frameworks/Sparkle
Submodule Sparkle updated 208 files
2 changes: 1 addition & 1 deletion Frameworks/mas-cli
Submodule mas-cli updated 834 files
112 changes: 103 additions & 9 deletions Latest.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

13 changes: 5 additions & 8 deletions Latest/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}

func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool {
if !flag {
sender.windows.first(where: { $0.windowController as? MainWindowController != nil })?.makeKeyAndOrderFront(self)
}

return !flag
}

func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
// Always terminate the app if the main window is closed
return true
}

}

422 changes: 155 additions & 267 deletions Latest/Interface/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,25 @@ import Cocoa
/// The controller presenting a small activity indicator, showing the user that release notes are currently loading
class ReleaseNotesLoadingViewController: NSViewController {

// Outlets
@IBOutlet weak var activityIndicator: NSProgressIndicator!
@IBOutlet weak var horizontalConstraint: NSLayoutConstraint!

override func viewDidLoad() {
super.viewDidLoad()

self.activityIndicator.startAnimation(nil)
}


// MARK: - Accessors

/// The top inset ensuring the loading content to appear centered.
var topInset: CGFloat = 0 {
didSet {
self.horizontalConstraint.constant = (self.topInset / 2)
}
}

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ fileprivate let ReleaseNotesTextParagraphCellIdentifier = NSUserInterfaceItemIde
/// The controller displaying the actual release notes
class ReleaseNotesTextViewController: NSViewController {

/// The inset of the text
let contentInset: CGFloat = 14

/// The view displaying the release notes
@IBOutlet var textView: NSTextView!

Expand All @@ -29,7 +32,8 @@ class ReleaseNotesTextViewController: NSViewController {
let scrollView = self.textView.enclosingScrollView

scrollView?.automaticallyAdjustsContentInsets = false
scrollView?.contentInsets.top = inset + 5 // 5 is some padding
scrollView?.contentInsets = NSEdgeInsetsMake(inset + contentInset, contentInset, contentInset, contentInset)
scrollView?.scrollerInsets = NSEdgeInsetsMake(-contentInset, -contentInset, -contentInset, -contentInset)

self.view.layout()
scrollView?.documentView?.scroll(CGPoint(x: 0, y: -inset * 2))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ fileprivate enum ReleaseNotesContent {
/// The actual content
case text(ReleaseNotesTextViewController?)

/// Exposes the view controller holding the release notes, if available.
var textController: ReleaseNotesTextViewController? {
switch self {
case .text(let controller):
Expand All @@ -37,6 +38,17 @@ fileprivate enum ReleaseNotesContent {
}
}

/// Exposes the view controller indicating a loading action, if available.
var loadingController: ReleaseNotesLoadingViewController? {
switch self {
case .loading(let controller):
return controller
default:
return nil
}
}

/// Exposes the view controller holding an error, if available.
var errorController: ReleaseNotesErrorViewController? {
switch self {
case .error(let controller):
Expand Down Expand Up @@ -69,7 +81,7 @@ class ReleaseNotesViewController: NSViewController {
@IBOutlet weak var appInfoBackgroundView: NSVisualEffectView!
@IBOutlet weak var appInfoContentView: NSStackView!

@IBOutlet weak var updateButton: NSButton!
@IBOutlet weak var updateButton: UpdateButton!

@IBOutlet weak var appNameTextField: NSTextField!
@IBOutlet weak var appDateTextField: NSTextField!
Expand All @@ -79,22 +91,9 @@ class ReleaseNotesViewController: NSViewController {

/// The app currently presented
private(set) var app: AppBundle? {
willSet {
if let app = self.app {
UpdateQueue.shared.removeObserver(self, for: app)
}
}

didSet {
// Forward app
self.progressViewController.app = self.app

// Add ourselfs as observer to the app
if let app = self.app {
UpdateQueue.shared.addObserver(self, to: app) { _ in
self.updateButtonAppearance()
}
}
self.updateButton.app = self.app
}
}

Expand All @@ -106,27 +105,12 @@ class ReleaseNotesViewController: NSViewController {
override func viewWillAppear() {
super.viewWillAppear()

let constraint = NSLayoutConstraint(item: self.appInfoContentView!, attribute: .top, relatedBy: .equal, toItem: self.view.window?.contentLayoutGuide, attribute: .top, multiplier: 1.0, constant: -5)
let constraint = NSLayoutConstraint(item: self.appInfoContentView!, attribute: .top, relatedBy: .equal, toItem: self.view.window?.contentLayoutGuide, attribute: .top, multiplier: 1.0, constant: 0)
constraint.isActive = true

self.setEmptyState()

// Align progress view controller to update button
self.progressViewController.leadingProgressAnchor.constraint(equalTo: self.updateButton.leadingAnchor).isActive = true
self.progressViewController.displayCancelButton = false
}

func updateButtonAppearance() {
if self.app?.isUpdating ?? false {
self.updateButton.title = NSLocalizedString("Cancel", comment: "Cancel button title to cancel the update of an app")
self.updateButton.action = #selector(cancelUpdate(_:))
} else {
self.updateButton.title = NSLocalizedString("Update", comment: "Update button title to update an app")
self.updateButton.action = #selector(update(_:))
}

self.updateButton.target = self
}


// MARK: - Actions
Expand Down Expand Up @@ -216,7 +200,6 @@ class ReleaseNotesViewController: NSViewController {
self.appNewVersionTextField.stringValue = versionInformation.new

self.appNewVersionTextField.isHidden = !app.updateAvailable
self.updateButton.isHidden = !app.updateAvailable

let dateFormatter = DateFormatter()
dateFormatter.dateStyle = .long
Expand Down Expand Up @@ -244,7 +227,6 @@ class ReleaseNotesViewController: NSViewController {
self.content?.errorController?.titleTextField.stringValue = NSLocalizedString("No app selected.", comment: "Title of release notes empty state")

self.appInfoBackgroundView.isHidden = true
self.updateButton.isHidden = true
}

/**
Expand Down Expand Up @@ -303,6 +285,8 @@ class ReleaseNotesViewController: NSViewController {
constraints.append(self.view.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0))

NSLayoutConstraint.activate(constraints)

self.updateInsets()
}

private func displayUnavailableReleaseNotes() {
Expand Down Expand Up @@ -339,19 +323,13 @@ class ReleaseNotesViewController: NSViewController {
private func updateInsets() {
let inset = self.appInfoBackgroundView.frame.size.height
self.content?.textController?.updateInsets(with: inset)
self.content?.loadingController?.topInset = inset
}

/// Switches the content to error and displays the localized error
private func show(_ error: Error) {
self.loadContent(.error)
self.content?.errorController?.show(error)
}

/// The view controller displaying update progress
private var progressViewController: UpdateProgressViewController {
return self.children.compactMap { controller -> UpdateProgressViewController? in
return controller as? UpdateProgressViewController
}.first!
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ extension UpdateTableViewController {

// Reload all visible lists
self.reloadTableView()
if #available(OSX 10.12.2, *) {
self.scrubber?.reloadData()
}
self.scrubber?.reloadData()
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,10 @@ extension UpdateTableViewController: NSScrubberDataSource, NSScrubberDelegate, N

private func view(for section: AppDataStore.Section) -> NSScrubberItemView {
let view = NSScrubberTextItemView()

view.textField.font = NSFont.boldSystemFont(ofSize: NSFont.systemFontSize(for: .small))
view.textField.textColor = NSColor.secondaryLabelColor

switch section {
case .updateAvailable:
view.textField.stringValue = NSLocalizedString("Available", comment: "Touch Bar section title for available updates")
case .installed:
view.textField.stringValue = NSLocalizedString("Installed", comment: "Touch Bar section title for installed apps")
case .ignored:
view.textField.stringValue = NSLocalizedString("Ignored", comment: "Touch Bar section title for ignored apps")
}
view.textField.stringValue = section.shortTitle

return view
}
Expand Down
Loading

0 comments on commit df4e996

Please sign in to comment.