easy-claude 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -4,12 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
需要 Node.js 22+ 与 Claude Code 订阅登录;不支持把 API Key 账单余额当作订阅额度。
|
|
6
6
|
|
|
7
|
-
## v0.2.
|
|
7
|
+
## v0.2.8 更新说明
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
- 额度菜单重置时间跟随系统12/24小时制及AM/PM。
|
|
12
|
-
- 修复更新重开后临时日志残留;检查失败保留已知新版绿点并显示失败提示。
|
|
9
|
+
- 当前时间浮窗与城市菜单跟随系统12/24小时制及地区格式,继续使用所选城市时区。
|
|
10
|
+
- 浮窗文字自动适应宽度,12小时制的上午/下午标记不会被截断;保留位置、配色和显示设置。
|
|
13
11
|
|
|
14
12
|
历史版本更新记录见 [CHANGELOG](CHANGELOG.md)。
|
|
15
13
|
|
package/native/Overlay.swift
CHANGED
|
@@ -185,14 +185,23 @@ func resetDescription(_ resetsAt: Double?, weekly: Bool, now: Date = Date(), zon
|
|
|
185
185
|
return "\(duration)后 \(time) 重置"
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
func clockText(at date: Date, zone: TimeZone) -> String {
|
|
188
|
+
func clockText(at date: Date, zone: TimeZone, locale: Locale = .autoupdatingCurrent) -> String {
|
|
189
189
|
let formatter = DateFormatter()
|
|
190
|
-
formatter.locale =
|
|
190
|
+
formatter.locale = locale
|
|
191
191
|
formatter.timeZone = zone
|
|
192
|
-
formatter.
|
|
192
|
+
formatter.setLocalizedDateFormatFromTemplate("jm")
|
|
193
193
|
return formatter.string(from: date)
|
|
194
194
|
}
|
|
195
195
|
|
|
196
|
+
|
|
197
|
+
@MainActor
|
|
198
|
+
func fittedClockFont(for text: String, width: CGFloat, baseSize: CGFloat) -> NSFont {
|
|
199
|
+
let base = NSFont.monospacedDigitSystemFont(ofSize: baseSize, weight: .medium)
|
|
200
|
+
let measured = max(1, (text as NSString).size(withAttributes: [.font: base]).width)
|
|
201
|
+
let size = min(baseSize, baseSize * max(1, width - 2) / measured)
|
|
202
|
+
return NSFont.monospacedDigitSystemFont(ofSize: size, weight: .medium)
|
|
203
|
+
}
|
|
204
|
+
|
|
196
205
|
func clockState(at date: Date, zone: TimeZone) -> RingState {
|
|
197
206
|
var calendar = Calendar(identifier: .gregorian)
|
|
198
207
|
calendar.timeZone = zone
|
|
@@ -212,7 +221,7 @@ final class ClockView: RingView {
|
|
|
212
221
|
let now = Date()
|
|
213
222
|
let time = clockText(at: now, zone: zone)
|
|
214
223
|
(time as NSString).draw(in: CGRect(x: 0, y: 17, width: bounds.width, height: 25),
|
|
215
|
-
withAttributes: [.font:
|
|
224
|
+
withAttributes: [.font: fittedClockFont(for: time, width: bounds.width, baseSize: 20),
|
|
216
225
|
.foregroundColor: clockState(at: now, zone: zone).color, .paragraphStyle: style])
|
|
217
226
|
let city = cityName
|
|
218
227
|
(city as NSString).draw(in: CGRect(x: 0, y: 1, width: bounds.width, height: 15),
|
|
@@ -648,6 +657,16 @@ struct Main {
|
|
|
648
657
|
let countdownStart = ISO8601DateFormatter().date(from: "2026-10-15T04:57:00Z")!
|
|
649
658
|
let countdownUTC = TimeZone(secondsFromGMT: 0)!
|
|
650
659
|
let afternoon = ISO8601DateFormatter().date(from: "2026-10-21T14:30:00Z")!
|
|
660
|
+
for identifier in ["en_US", "en_GB", "zh_CN"] {
|
|
661
|
+
let text = clockText(at: afternoon, zone: countdownUTC, locale: Locale(identifier: identifier))
|
|
662
|
+
if identifier == "en_US" { precondition(text.contains("PM") && !text.contains("14:30")) }
|
|
663
|
+
else { precondition(text == "14:30") }
|
|
664
|
+
let font = fittedClockFont(for: text, width: 96, baseSize: 20)
|
|
665
|
+
precondition((text as NSString).size(withAttributes: [.font: font]).width <= 96 - 1)
|
|
666
|
+
}
|
|
667
|
+
let laClock = clockText(at: afternoon, zone: TimeZone(identifier: "America/Los_Angeles")!, locale: Locale(identifier: "en_US"))
|
|
668
|
+
precondition(laClock.contains("7:30") && laClock.contains("AM"))
|
|
669
|
+
|
|
651
670
|
let morning = ISO8601DateFormatter().date(from: "2026-10-21T02:30:00Z")!
|
|
652
671
|
for weekly in [false, true] {
|
|
653
672
|
let us = resetDescription(afternoon.timeIntervalSince1970, weekly: weekly,
|
|
@@ -683,9 +702,9 @@ struct Main {
|
|
|
683
702
|
let singapore = TimeZone(identifier: "Asia/Singapore")!
|
|
684
703
|
let winter = ISO8601DateFormatter().date(from: "2026-01-15T12:00:00Z")!
|
|
685
704
|
let summer = ISO8601DateFormatter().date(from: "2026-07-15T12:00:00Z")!
|
|
686
|
-
precondition(clockText(at: winter, zone: la) == "04:00")
|
|
687
|
-
precondition(clockText(at: summer, zone: la) == "05:00")
|
|
688
|
-
precondition(clockText(at: winter, zone: singapore) == "20:00")
|
|
705
|
+
precondition(clockText(at: winter, zone: la, locale: Locale(identifier: "en_GB")) == "04:00")
|
|
706
|
+
precondition(clockText(at: summer, zone: la, locale: Locale(identifier: "en_GB")) == "05:00")
|
|
707
|
+
precondition(clockText(at: winter, zone: singapore, locale: Locale(identifier: "en_GB")) == "20:00")
|
|
689
708
|
precondition(TimeZone(identifier: "Invalid/Zone") == nil)
|
|
690
709
|
let utc = TimeZone(secondsFromGMT: 0)!
|
|
691
710
|
for (hour, state) in [(0, RingState.red), (6, .red), (8, .red), (9, .green), (14, .green), (15, .green), (17, .green), (18, .orange), (23, .orange)] {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<key>CFBundleIdentifier</key><string>com.unionschool.easy-claude.overlay</string>
|
|
6
6
|
<key>CFBundleName</key><string>Easy Claude Overlay</string>
|
|
7
7
|
<key>CFBundlePackageType</key><string>APPL</string>
|
|
8
|
-
<key>CFBundleShortVersionString</key><string>0.2.
|
|
8
|
+
<key>CFBundleShortVersionString</key><string>0.2.8</string>
|
|
9
9
|
<key>LSMinimumSystemVersion</key><string>14.0</string>
|
|
10
10
|
<key>LSUIElement</key><true/>
|
|
11
11
|
<key>NSHighResolutionCapable</key><true/>
|
|
Binary file
|