From 196b01c65b44e7417ef570a6ec2d7db8ea30bb35 Mon Sep 17 00:00:00 2001 From: shwoghk14 Date: Mon, 20 Nov 2023 22:12:35 +0900 Subject: [PATCH 1/4] Add version check menu item. --- NearDrop/AppDelegate.swift | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/NearDrop/AppDelegate.swift b/NearDrop/AppDelegate.swift index b327fef..003ec28 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,23 @@ 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() From c1f4cf957eafe2395222d7364eaf913ca5fb28fa Mon Sep 17 00:00:00 2001 From: shwoghk14 Date: Mon, 20 Nov 2023 22:13:12 +0900 Subject: [PATCH 2/4] Add String resource for new menu item. --- NearDrop/Base.lproj/Localizable.strings | Bin 2442 -> 2758 bytes NearDrop/ko.lproj/Localizable.strings | Bin 2156 -> 2418 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/NearDrop/Base.lproj/Localizable.strings b/NearDrop/Base.lproj/Localizable.strings index 73b3883c1d580fdee3071e17fc04a9d264f67067..cd298eba02e8e16d573ecfbebe8eaff6b4f7aa0b 100644 GIT binary patch delta 274 zcmeAYJ|?=Mi_=<(!I2?}A)ld?p@cz+L4m;*h?N-p7*ZJ$8HyNOfH8Mr3jXO)jc71v`30jelr$N{RxXPPt6z9Jw@1)5cY({$M!bkkkIy7Gaf z640ee49-AT<}s*)%}4{m+9kZ9ixU708Unlk diff --git a/NearDrop/ko.lproj/Localizable.strings b/NearDrop/ko.lproj/Localizable.strings index 43e1bbc22288b599d9b39d2eb1b30daed763cf77..f997beb89fed917aa2251e44244ecc260074aaad 100644 GIT binary patch delta 170 zcmaDO@JVPx4hN?agCj!{Lq0?4 Date: Sun, 26 Nov 2023 10:33:36 +0900 Subject: [PATCH 3/4] Remove redundant space bar and lines. --- NearDrop/AppDelegate.swift | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/NearDrop/AppDelegate.swift b/NearDrop/AppDelegate.swift index 003ec28..e658cf5 100644 --- a/NearDrop/AppDelegate.swift +++ b/NearDrop/AppDelegate.swift @@ -62,12 +62,11 @@ class AppDelegate: NSObject, NSApplicationDelegate, UNUserNotificationCenterDele alert.alertStyle = .informational alert.messageText = NSLocalizedString("NotificationsVersion.Title", value: "NearDrop Current Version", comment: "") if let appVersion = appVersion { - alert.informativeText = appVersion + alert.informativeText = appVersion } else { - alert.informativeText = NSLocalizedString("NotificationVersion.Error", value: "Can't find a version.", comment: "") + alert.informativeText = NSLocalizedString("NotificationVersion.Error", value: "Can't find a version.", comment: "") } - alert.addButton(withTitle: NSLocalizedString("OK", value: "OK", comment: "")) alert.runModal() } From adb470b2e206221d4fdb0b341d16af1ff3799575 Mon Sep 17 00:00:00 2001 From: Jaehwa Noh Date: Sat, 20 Jan 2024 10:48:49 +0900 Subject: [PATCH 4/4] Add string resource for about dialog. --- NearDrop/Base.lproj/Localizable.strings | 9 ++++++++- NearDrop/ko.lproj/Localizable.strings | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) 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" = "확인";