fix(toast): correct sleep duration — 2.0s → 2.6s

UInt64(durationSeconds) truncated the Double 2.6 to 2 before
multiplying by 1e9 ns, so toasts vanished 0.6s early. Move the
multiplication inside the cast.

Caught in 2026-05-19 code review, swift-verified.

Bump CFBundleVersion 3 → 4.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
徐翔宇 2026-05-19 17:49:29 +08:00
parent 63c7c0bc60
commit a4a747bc77
2 changed files with 7 additions and 2 deletions

View File

@ -17,7 +17,7 @@
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.3.0</string> <string>0.3.0</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>3</string> <string>4</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>
<string>FundPlugin.FundPlugin</string> <string>FundPlugin.FundPlugin</string>
<!-- <!--

View File

@ -61,7 +61,12 @@ final class ToastController: ObservableObject {
toasts.append(item) toasts.append(item)
} }
Task { [weak self] in Task { [weak self] in
try? await Task.sleep(nanoseconds: UInt64(self?.durationSeconds ?? 2.6) * 1_000_000_000) // BUG fix (2026-05-19 review): `UInt64(2.6)` truncates to 2,
// so the previous `UInt64(dur) * 1_000_000_000` slept 2.0s
// instead of 2.6s every toast vanished 0.6s early. Do the
// multiply first, then cast.
let dur = self?.durationSeconds ?? 2.6
try? await Task.sleep(nanoseconds: UInt64(dur * 1_000_000_000))
await MainActor.run { [weak self] in await MainActor.run { [weak self] in
self?.dismiss(item.id) self?.dismiss(item.id)
} }