focalboard/mac/Focalboard/WhatsNewViewController.swift

40 lines
1.1 KiB
Swift
Raw Normal View History

2021-04-12 23:02:22 +02:00
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import Cocoa
class WhatsNewViewController:
NSViewController {
@IBOutlet var textView: NSTextView!
@IBOutlet var rateButton: NSButton!
2022-06-23 01:44:20 +02:00
@IBOutlet var cloudButton: NSButton!
2021-04-12 23:02:22 +02:00
override func viewDidLoad() {
super.viewDidLoad()
loadText()
}
private func loadText() {
guard let fileUrl = Bundle.main.url(forResource: "whatsnew", withExtension: "txt") else { assertionFailure("whatsnew"); return }
guard let text = try? String(contentsOf: fileUrl, encoding: .utf8) else { assertionFailure("whatsnew"); return }
textView.string = text
textView.textStorage?.font = NSFont.systemFont(ofSize: 13)
textView.textStorage?.foregroundColor = NSColor.textColor
2021-04-12 23:02:22 +02:00
}
@IBAction func rateButtonClicked(_ sender: Any) {
let url = URL(string: "macappstore://itunes.apple.com/app/id1556908618?action=write-review")!
NSWorkspace.shared.open(url)
view.window?.close()
}
2022-06-23 01:44:20 +02:00
@IBAction func cloudButtonClicked(_ sender: Any) {
Globals.openGetCloudServerUrl()
}
2021-04-12 23:02:22 +02:00
@IBAction func closeButtonClicked(_ sender: Any) {
view.window?.close()
}
}