diff --git a/NearDrop/AppDelegate.swift b/NearDrop/AppDelegate.swift index b327fef..e658cf5 100644 --- a/NearDrop/AppDelegate.swift +++ b/NearDrop/AppDelegate.swift @@ -19,6 +19,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele menu.addItem(withTitle: NSLocalizedString("VisibleToEveryone", value: "Visible to everyone", comment: ""), action: nil, keyEquivalent: "") menu.addItem(withTitle: String(format: NSLocalizedString("DeviceName", value: "Device name: %@", comment: ""), arguments: [Host.current().localizedName!]), action: nil, keyEquivalent: "") menu.addItem(NSMenuItem.separator()) + menu.addItem(withTitle: NSLocalizedString("About", value: "NearDrop Version", comment: ""), action: #selector(showVersionAlert), keyEquivalent: "") menu.addItem(withTitle: NSLocalizedString("Quit", value: "Quit NearDrop", comment: ""), action: #selector(NSApplication.terminate(_:)), keyEquivalent: "") statusItem=NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength) statusItem?.button?.image=NSImage(named: "MenuBarIcon") @@ -53,6 +54,22 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool { return true } + + @objc + func showVersionAlert() { + let alert = NSAlert() + let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String + alert.alertStyle = .informational + alert.messageText = NSLocalizedString("NotificationsVersion.Title", value: "NearDrop Current Version", comment: "") + if let appVersion = appVersion { + alert.informativeText = appVersion + } else { + alert.informativeText = NSLocalizedString("NotificationVersion.Error", value: "Can't find a version.", comment: "") + } + + alert.addButton(withTitle: NSLocalizedString("OK", value: "OK", comment: "")) + alert.runModal() + } func showNotificationsDeniedAlert(){ let alert=NSAlert() diff --git a/NearDrop/Base.lproj/Localizable.strings b/NearDrop/Base.lproj/Localizable.strings index 6d28946..39a00f2 100644 --- a/NearDrop/Base.lproj/Localizable.strings +++ b/NearDrop/Base.lproj/Localizable.strings @@ -1,4 +1,4 @@ -/* No comment provided by engineer. */ +/* No comment provided by engineer. */ "Accept" = "Accept"; /* No comment provided by engineer. */ @@ -40,3 +40,10 @@ /* No comment provided by engineer. */ "VisibleToEveryone" = "Visible to everyone"; +"About" = "NearDrop Version"; + +"NotificationsVersion.Title" = "NearDrop Current Version"; + +"NotificationVersion.Error"="Can't find a version."; + +"OK" = "OK"; diff --git a/NearDrop/ko.lproj/Localizable.strings b/NearDrop/ko.lproj/Localizable.strings index baf60a5..d772370 100644 --- a/NearDrop/ko.lproj/Localizable.strings +++ b/NearDrop/ko.lproj/Localizable.strings @@ -1,4 +1,4 @@ -/* No comment provided by engineer. */ +/* No comment provided by engineer. */ "Accept" = "수락"; /* No comment provided by engineer. */ @@ -40,3 +40,10 @@ /* No comment provided by engineer. */ "VisibleToEveryone" = "모든 사용자에게 공개"; +"About" = "NearDrop 버전"; + +"NotificationsVersion.Title" = "NearDrop 현재 버전"; + +"NotificationVersion.Error"="버전 확인 불가."; + +"OK" = "확인";