Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

TokenStep 各版本的更新内容,新版本在前。每个版本的完整说明在 [docs/RELEASE_NOTES_<版本号>.md](docs/)。

## 0.2.22 更新:刷新时同步更新 Token Rank 榜单,面板显示榜单用量

面板和主窗口的刷新按钮(以及 ⌘R)现在会跳过缓存重新读取 Token Rank 榜单和排名,关联了 Token Rank 时刷新按钮会等榜单读取完再停止转圈;面板的「今日排名」在名次旁显示你在榜单上的 Token 用量。详见 [0.2.22 发布说明](docs/RELEASE_NOTES_0.2.22.md)。

## 0.2.21 更新:仪表盘与设置改版

仪表盘和设置参考 Token Rank 个人页重新设计:今日页新增与昨天对比、Token 构成、近 5 周热力图和按客户端堆叠的分时图;历史页新增年度热力图、常用时段和最长连续达标;设置改为左侧栏分组,改动立即生效。详见 [0.2.21 发布说明](docs/RELEASE_NOTES_0.2.21.md)。
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ TokenStep 是一个 macOS 菜单栏 App,用来本地统计你在 Codex、Claud

下载最新版 DMG,打开后把 `TokenStep.app` 拖进「应用程序」即可使用:

[下载 TokenStep 最新版](https://github.com/Backtthefuture/TokenStep/releases/latest/download/TokenStep-0.2.21.dmg)
[下载 TokenStep 最新版](https://github.com/Backtthefuture/TokenStep/releases/latest/download/TokenStep-0.2.22.dmg)

也可以从 Release 页面查看所有版本:

Expand All @@ -32,9 +32,9 @@ TokenStep 已使用 Developer ID 签名并通过 Apple 公证。首次打开时

Windows版本由十七做了移植,欢迎大家前往使用:https://github.com/canyexuanfan/TokenStep-Windows/releases

## 最新版本:0.2.21
## 最新版本:0.2.22

仪表盘和设置参考 Token Rank 个人页重新设计:今日页新增与昨天对比、Token 构成、近 5 周热力图和按客户端堆叠的分时图;历史页新增年度热力图、常用时段和最长连续达标;设置改为左侧栏分组,改动立即生效。详见 [0.2.21 发布说明](docs/RELEASE_NOTES_0.2.21.md)。
面板和主窗口的刷新按钮(以及 ⌘R)现在会跳过缓存重新读取 Token Rank 榜单和排名,关联了 Token Rank 时刷新按钮会等榜单读取完再停止转圈;面板的「今日排名」在名次旁显示你在榜单上的 Token 用量。详见 [0.2.22 发布说明](docs/RELEASE_NOTES_0.2.22.md)。

历次更新(主题包、引力动效、自动更新等)见 [CHANGELOG.md](CHANGELOG.md)。

Expand Down Expand Up @@ -95,7 +95,7 @@ TokenStep 默认只做本地统计。

## 安装方式

1. 下载 [TokenStep 最新版 DMG](https://github.com/Backtthefuture/TokenStep/releases/latest/download/TokenStep-0.2.21.dmg)。
1. 下载 [TokenStep 最新版 DMG](https://github.com/Backtthefuture/TokenStep/releases/latest/download/TokenStep-0.2.22.dmg)。
2. 打开 DMG。
3. 把 `TokenStep.app` 拖到「应用程序」。
4. 启动 TokenStep。
Expand Down Expand Up @@ -166,7 +166,7 @@ TokenStepSwift/dist/TokenStep.app
公开发布强制执行 Developer ID 签名、Apple 公证、票据装订、系统分发检查和隔离安装验证。不再生成可被误上传的“仅签名、未公证”发布包:

```bash
TOKENSTEP_VERSION=0.2.21 \
TOKENSTEP_VERSION=0.2.22 \
CODE_SIGN_IDENTITY="Developer ID Application: Your Name (TEAMID)" \
TOKENSTEP_NOTARY_PROFILE="tokenstep-notary" \
./script/package_release.sh --notarize
Expand Down
8 changes: 7 additions & 1 deletion TokenStepSwift/Sources/TokenStepSwift/Stores/AppState.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ final class AppState: ObservableObject {
settings.agentWorkRankVisibility.shouldShow(hasLocalIdentity: agentWorkRankIdentity != nil)
}

/// What the refresh buttons show as syncing: usage, plus the TokenRank board when it is linked.
var isRefreshingForDisplay: Bool {
isRefreshing || (shouldShowAgentWorkRank && isRefreshingTokenRank)
}

func load() {
defer { MemoryPressure.relieveAllocatorPressure() }
let loadedSettings = DataService.loadSettingsForAppLaunch()
Expand Down Expand Up @@ -196,10 +201,11 @@ final class AppState: ObservableObject {
autostartEnabled = AutostartService.isEnabled
}

/// The refresh button and ⌘R: usage plus quotas, skipping quota caches.
/// The refresh button and ⌘R: usage, quotas and the TokenRank board, skipping caches.
func refreshNow() {
refresh()
refreshCodexQuota(force: true, bypassCache: true)
refreshTokenRank(force: true)
}

func refresh(forceCollection: Bool = true) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -571,6 +571,7 @@ enum TokenStepLocalization {
"本地比榜单多 %@,同步后预计升到 #%d": "%@ more locally than on the board; about #%d after sync",
"本地比榜单多 %@,等待同步": "%@ more locally than on the board, waiting for sync",
"榜单 %@": "Board %@",
"榜单用量 %@": "%@ on board",
"照此速度会提前用完": "Runs out early at this pace",
"%@额度会提前用完": "%@ runs out early",
"已重置": "Reset",
Expand Down Expand Up @@ -1328,6 +1329,7 @@ enum TokenStepLocalization {
"本地比榜单多 %@,同步后预计升到 #%d": "本機比榜單多 %@,同步後預計升到 #%d",
"本地比榜单多 %@,等待同步": "本機比榜單多 %@,等待同步",
"榜单 %@": "榜單 %@",
"榜单用量 %@": "榜單用量 %@",
"照此速度会提前用完": "照此速度會提前用完",
"%@额度会提前用完": "%@額度會提前用完",
"已重置": "已重置",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ struct MainWindowView: View {
HStack(spacing: 8) {
HStack(spacing: 6) {
Circle()
.fill(appState.isRefreshing ? Color.secondary.opacity(0.7) : Color.tokenSuccess)
.fill(appState.isRefreshingForDisplay ? Color.secondary.opacity(0.7) : Color.tokenSuccess)
.frame(width: 7, height: 7)
Text(appState.isRefreshing ? L("同步中") : L("已同步"))
Text(appState.isRefreshingForDisplay ? L("同步中") : L("已同步"))
.font(.caption.weight(.heavy))
}
.padding(.horizontal, 10)
Expand All @@ -135,8 +135,8 @@ struct MainWindowView: View {
.frame(width: 28, height: 28)
}
.buttonStyle(.plain)
.disabled(appState.isRefreshing)
.help(appState.isRefreshing ? L("同步中") : L("刷新"))
.disabled(appState.isRefreshingForDisplay)
.help(appState.isRefreshingForDisplay ? L("同步中") : L("刷新"))

DashboardUpdateButton()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,12 @@ struct CompactRankSection: View {
.font(.system(size: 12))
.foregroundStyle(.secondary)
Spacer(minLength: 4)
if let tokens = section.myBoardTokens {
Text(LFormat("榜单用量 %@", TokenStepFormat.tokens(tokens, compact: true)))
.font(.system(size: 12, weight: .semibold))
.monospacedDigit()
.foregroundStyle(Color.tokenInk)
}
}
.contentShape(Rectangle())
.onTapGesture { openMyPage?() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ struct PopoverPanelView: View {
appState.refreshNow()
} label: {
Group {
if appState.isRefreshing {
if appState.isRefreshingForDisplay {
ProgressView().controlSize(.small)
} else {
Image(systemName: "arrow.clockwise")
Expand All @@ -161,8 +161,8 @@ struct PopoverPanelView: View {
.contentShape(Rectangle())
}
.buttonStyle(.plain)
.disabled(appState.isRefreshing)
.help(appState.isRefreshing ? L("同步中") : L("刷新"))
.disabled(appState.isRefreshingForDisplay)
.help(appState.isRefreshingForDisplay ? L("同步中") : L("刷新"))
.accessibilityLabel(L("刷新"))

Button {
Expand Down
9 changes: 9 additions & 0 deletions docs/RELEASE_NOTES_0.2.22.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# TokenStep 0.2.22

点刷新按钮时,Token Rank 榜单也会一起更新;面板里能看到你在榜单上的 Token 用量。

- **刷新榜单**:面板和主窗口的刷新按钮(以及 ⌘R)现在会跳过缓存,重新读取 Token Rank 榜单和你的排名。之前刷新只更新用量和额度,榜单最多要等 30 分钟才会变。
- **榜单用量**:面板的「今日排名」在名次旁显示你今天在榜单上的 Token 用量。
- **同步状态**:关联了 Token Rank 时,刷新按钮会等榜单也读取完再停止转圈;没有关联时和以前一样。

Token、金额与额度的统计口径不变。
2 changes: 1 addition & 1 deletion script/build_swiftui_and_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ HELPER_EXECUTABLE="$BUILD_DIR/$HELPER_NAME"
ICON_FILE="$ROOT_DIR/TokenUsageMenuApp/assets/TokenStepIcon.icns"
ODYSSEY_ASSET_DIR="$ROOT_DIR/TokenUsageMenuApp/assets/odyssey"
INTERSTELLAR_ASSET_DIR="$ROOT_DIR/TokenUsageMenuApp/assets/interstellar"
VERSION="${TOKENSTEP_VERSION:-0.2.21}"
VERSION="${TOKENSTEP_VERSION:-0.2.22}"
LAUNCH=true
VERIFY=false

Expand Down
Loading