diff --git a/.gitignore b/.gitignore index 65dee30484..49b5deea67 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ Telegram.xcodeproj/xcuserdata/telegram.xcuserdatad/xcschemes/Telegram.xcscheme Telegram.xcodeproj/xcuserdata/telegram.xcuserdatad/xcschemes/xcschememanagement.plist TGUIKit/TGUIKit.xcodeproj/xcuserdata/telegram.xcuserdatad/xcschemes/TGUIKit.xcscheme TGUIKit/TGUIKit.xcodeproj/xcuserdata/telegram.xcuserdatad/xcschemes/xcschememanagement.plist +xcuserdata diff --git a/Telegram-Mac/AppDelegate.swift b/Telegram-Mac/AppDelegate.swift index 08c834a81f..13d304e54c 100644 --- a/Telegram-Mac/AppDelegate.swift +++ b/Telegram-Mac/AppDelegate.swift @@ -856,8 +856,11 @@ class AppDelegate: NSResponder, NSApplicationDelegate, NSUserNotificationCenterD } @IBAction func aboutAction(_ sender: Any) { - showModal(with: AboutModalController(), for: window) - window.makeKeyAndOrderFront(sender) + let aboutStoryboard = NSStoryboard.init(name: "TGAboutWindow", bundle: nil) + let aboutWindow = aboutStoryboard.instantiateController(withIdentifier: "TGAboutWindowController") as! NSWindowController + aboutWindow.showWindow(self) + //showModal(with: AboutModalController(), for: window) + //window.makeKeyAndOrderFront(sender) } @IBAction func preferencesAction(_ sender: Any) { diff --git a/Telegram-Mac/TGAboutViewController.swift b/Telegram-Mac/TGAboutViewController.swift new file mode 100644 index 0000000000..ebaf435ce1 --- /dev/null +++ b/Telegram-Mac/TGAboutViewController.swift @@ -0,0 +1,35 @@ +// +// TGAboutViewController.swift +// Telegram +// +// Created by s0ph0s on 2019-04-06. +// Copyright © 2019 Telegram. All rights reserved. +// + +import Cocoa + +class TGAboutViewController: NSViewController { + + @IBOutlet weak var appIconImageView: NSImageView! + @IBOutlet weak var versionLabel: NSTextField! + let versionString = Bundle.main.infoDictionary?["CFBundleShortVersionString"] ?? "1" + let buildString = Bundle.main.infoDictionary?["CFBundleVersion"] ?? "0" + #if STABLE + let releaseChannel = "Stable" + #elseif APP_STORE + let releaseChannel = "Mac App Store" + #else + let releaseChannel = "Beta" + #endif + + override func viewDidLoad() { + super.viewDidLoad() + + versionLabel.stringValue = "Version \(versionString) (\(buildString))\n\(releaseChannel)" + appIconImageView.image = NSImage(named: "AppIcon") + } + + @IBAction func copyButtonClicked(_ sender: Any) { + copyToClipboard("\(versionString) (\(buildString)) \(releaseChannel)") + } +} diff --git a/Telegram-Mac/TGAboutWindow.storyboard b/Telegram-Mac/TGAboutWindow.storyboard new file mode 100644 index 0000000000..9b75acbf26 --- /dev/null +++ b/Telegram-Mac/TGAboutWindow.storyboard @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Copyright © 2019 TELEGRAM MESSENGER LLP. +All rights reserved. + + + + + + + + + + + Version 5.0.1 (123456) +Mac App Store + + + + + + + + + + + + + + + + + diff --git a/Telegram-Mac/TGAboutWindow.swift b/Telegram-Mac/TGAboutWindow.swift new file mode 100644 index 0000000000..412a87b89f --- /dev/null +++ b/Telegram-Mac/TGAboutWindow.swift @@ -0,0 +1,15 @@ +// +// TGAboutWindow.swift +// Telegram +// +// Created by s0ph0s on 2019-04-06. +// Copyright © 2019 Telegram. All rights reserved. +// + +import Cocoa + +class TGAboutWindow: NSWindow { + override func cancelOperation(_ sender: Any?) { + self.orderOut(sender) + } +}