Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions NearDrop/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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()
Expand Down
9 changes: 8 additions & 1 deletion NearDrop/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* No comment provided by engineer. */
/* No comment provided by engineer. */
"Accept" = "Accept";

/* No comment provided by engineer. */
Expand Down Expand Up @@ -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";
9 changes: 8 additions & 1 deletion NearDrop/ko.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* No comment provided by engineer. */
/* No comment provided by engineer. */
"Accept" = "수락";

/* No comment provided by engineer. */
Expand Down Expand Up @@ -40,3 +40,10 @@
/* No comment provided by engineer. */
"VisibleToEveryone" = "모든 사용자에게 공개";

"About" = "NearDrop 버전";

"NotificationsVersion.Title" = "NearDrop 현재 버전";

"NotificationVersion.Error"="버전 확인 불가.";

"OK" = "확인";