Skip to content

Commit 1cdb6f7

Browse files
committed
hot fix
1 parent 45da2ae commit 1cdb6f7

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed
-898 Bytes
Binary file not shown.

ClockBar/AppDelegate.swift

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,12 @@ class AppDelegate: NSObject, NSApplicationDelegate {
3939
launchAtLoginCheckbox.state = LoginServiceKit.isExistLoginItems() ? .on : .off
4040

4141
switch UserDefaults.standard.string(forKey: "timeFormat") {
42-
case "h:mm":
43-
timeFormat12h.state = .on
44-
timeFormat24h.state = .off
4542
case "HH:mm":
4643
timeFormat12h.state = .off
4744
timeFormat24h.state = .on
4845
default:
49-
return
46+
timeFormat12h.state = .on
47+
timeFormat24h.state = .off
5048
}
5149

5250
clockBar()
@@ -65,7 +63,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
6563
DFRSystemModalShowsCloseBoxWhenFrontMost(true)
6664

6765
timeFormatter = DateFormatter()
68-
timeFormatter?.dateFormat = UserDefaults.standard.string(forKey: "timeFormat")
66+
timeFormatter?.dateFormat = UserDefaults.standard.string(forKey: "timeFormat") ?? "h:mm"
6967
let nowTime = timeFormatter?.string(from: Date())
7068

7169
let clockBarIdentifier = NSTouchBarItem.Identifier(rawValue: "ClockBar")
@@ -78,7 +76,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
7876

7977
// update time
8078
@objc func updateTime() {
81-
timeFormatter?.dateFormat = UserDefaults.standard.string(forKey: "timeFormat")
79+
timeFormatter?.dateFormat = UserDefaults.standard.string(forKey: "timeFormat") ?? "h:mm"
8280
touchBarButton?.title = (timeFormatter?.string(from: Date()))!
8381
}
8482

@@ -99,8 +97,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
9997
}
10098
}
10199

102-
103-
104100
// click status bar menu item
105101
@IBAction func didClickStatusBarMenuItem(_ sender: NSMenuItem) {
106102
switch sender.tag {

appcast.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<title>1.1.1</title>
77
<pubDate>周日, 05 1月 2020 22:39:00 +0800</pubDate>
88
<sparkle:minimumSystemVersion>10.13</sparkle:minimumSystemVersion>
9-
<enclosure url="https://github.com/L1cardo/ClockBar/releases/download/v1.1.1/ClockBar.dmg" sparkle:version="20200105" sparkle:shortVersionString="1.1.1" length="6134675" type="application/octet-stream" sparkle:edSignature="pHMCW8aoTkp0gJURkyn1EKqxnhQuNs4JboYEJBNo3LYPdQdpCS3L2Faz4Noyd0cZ3WDCGO0OKCHACqtIy3FCAw=="/>
9+
<enclosure url="https://github.com/L1cardo/ClockBar/releases/download/v1.1.1/ClockBar.dmg" sparkle:version="20200105" sparkle:shortVersionString="1.1.1" length="6134906" type="application/octet-stream" sparkle:edSignature="tOurgXZnFSCQSYU4vYVoQrA8NR5YE97X3CNM+x37VGKVQoJyFSnmKhFZuKtZvJw/u5930P8eofSnhnm3qzwPAQ=="/>
1010
</item>
1111
</channel>
1212
</rss>

0 commit comments

Comments
 (0)