fix: timestamp auto-updates without triggering fetch on tray open

- Reverted auto-refresh on tray click (fetch only happens on schedule
  or manual Refresh button)
- Timestamp now uses TimelineView(.periodic) to auto-update every 30s:
  'Just now' → '1m ago' → '5m ago' → etc. without any user action

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
tigerenwork 2026-06-29 23:54:28 +08:00
parent 5b1811db10
commit 3f1367790e
2 changed files with 11 additions and 5 deletions

View File

@ -64,8 +64,6 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
} else {
popover.show(relativeTo: button.bounds, of: button, preferredEdge: .minY)
popover.contentViewController?.view.window?.makeKey()
// Refresh on open (PollerService deduplicates if already fetching)
Task { await PollerService.shared.fetchNow() }
}
}

View File

@ -31,9 +31,17 @@ struct BugListPopover: View {
Image(systemName: "arrow.triangle.2.circlepath")
.font(.caption2)
.foregroundStyle(.secondary)
Text(bugStore.lastUpdated.map(formatted) ?? "Never")
.font(.caption)
.foregroundStyle(.secondary)
if let lastUpdated = bugStore.lastUpdated {
TimelineView(.periodic(from: lastUpdated, by: 30)) { _ in
Text(formatted(lastUpdated))
.font(.caption)
.foregroundStyle(.secondary)
}
} else {
Text("Never")
.font(.caption)
.foregroundStyle(.secondary)
}
}
Button("Mark all seen") {
bugStore.markAllSeen()