CodexBar 是一个 macOS 菜单栏应用,用于查看本机 Codex 账号状态、额度、Token 用量、详细统计信息
Swift appkitcodexcodex-clideveloper-toolsmacosmacos-appmenu-bar-appopenai-codexproductivityswiftswiftuiusage-tracker
fix: 优化重置次数抽屉动画
Bob1ae7ffae55d6
diff --git a/CodexBar.xcodeproj/project.pbxproj b/CodexBar.xcodeproj/project.pbxprojindex 5e9f46c..cf759a8 100644--- a/CodexBar.xcodeproj/project.pbxproj+++ b/CodexBar.xcodeproj/project.pbxproj@@ -282,7 +282,7 @@"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";CODE_SIGN_STYLE = Automatic;COMBINE_HIDPI_IMAGES = YES;- CURRENT_PROJECT_VERSION = 36;+ CURRENT_PROJECT_VERSION = 37;DEAD_CODE_STRIPPING = YES;DEVELOPMENT_TEAM = 4KJ362VJW5;ENABLE_APP_INTENTS_METADATA_GENERATION = NO;@@ -298,7 +298,7 @@"$(inherited)","@executable_path/../Frameworks",);- MARKETING_VERSION = 3.2.8;+ MARKETING_VERSION = 3.2.9;PRODUCT_BUNDLE_IDENTIFIER = app.zabrian.codexbar;PRODUCT_NAME = "$(TARGET_NAME)";REGISTER_APP_GROUPS = YES;@@ -321,7 +321,7 @@"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";CODE_SIGN_STYLE = Automatic;COMBINE_HIDPI_IMAGES = YES;- CURRENT_PROJECT_VERSION = 36;+ CURRENT_PROJECT_VERSION = 37;DEAD_CODE_STRIPPING = YES;DEVELOPMENT_TEAM = 4KJ362VJW5;ENABLE_APP_INTENTS_METADATA_GENERATION = NO;@@ -337,7 +337,7 @@"$(inherited)","@executable_path/../Frameworks",);- MARKETING_VERSION = 3.2.8;+ MARKETING_VERSION = 3.2.9;PRODUCT_BUNDLE_IDENTIFIER = app.zabrian.codexbar;PRODUCT_NAME = "$(TARGET_NAME)";PROVISIONING_PROFILE_SPECIFIER = "";diff --git a/CodexBar/Controllers/ResetCreditsPanelController.swift b/CodexBar/Controllers/ResetCreditsPanelController.swiftindex f575278..572b032 100644--- a/CodexBar/Controllers/ResetCreditsPanelController.swift+++ b/CodexBar/Controllers/ResetCreditsPanelController.swift@@ -15,6 +15,7 @@ final class ResetCreditsPanelController {overscan: Metrics.drawerOverscan)private var visibilityGeneration = 0+ private var isExitAnimationRunning = falseprivate var currentSide = UsageHeatmapDetailSide.rightprivate weak var menuSurfaceWindow: NSWindow?@@ -48,20 +49,34 @@ final class ResetCreditsPanelController {}func hide(immediate: Bool = false) {- visibilityGeneration += 1-guard let panel, panel.isVisible else {return}- guard !immediate else {- drawerAnimator.resetVisualState(for: panel)- orderOut(panel)+ if immediate {+ visibilityGeneration += 1+ hideImmediately(panel)+ return+ }++ guard !isExitAnimationRunning else {return}+ hideWithAnimation(panel)+ }++ private func hideImmediately(_ panel: NSPanel) {+ drawerAnimator.resetVisualState(for: panel)+ isExitAnimationRunning = false+ orderOut(panel)+ }++ private func hideWithAnimation(_ panel: NSPanel) {+ visibilityGeneration += 1let generation = visibilityGenerationlet side = currentSide+ isExitAnimationRunning = truelet hidden = drawerAnimator.hiddenTranslation(for: side, panelWidth: panel.frame.width)drawerAnimator.animateTranslation(to: hidden,@@ -76,6 +91,7 @@ final class ResetCreditsPanelController {orderOut(panel)drawerAnimator.setTranslation(0)+ isExitAnimationRunning = false}}}@@ -118,6 +134,7 @@ final class ResetCreditsPanelController {}visibilityGeneration += 1+ isExitAnimationRunning = falseapply(context: resolvedContext, panelSize: panelSize, position: position, to: panel)showPanelWithDrawerAnimation(panel, relativeTo: menuSurfaceWindow)}diff --git a/CodexBar/Controllers/StatusItemController.swift b/CodexBar/Controllers/StatusItemController.swiftindex 4491b57..7fcbc00 100644--- a/CodexBar/Controllers/StatusItemController.swift+++ b/CodexBar/Controllers/StatusItemController.swift@@ -995,7 +995,7 @@ private final class StatusItemController: NSObject, NSMenuDelegate {}if context != nil {- resetCreditsPanelController.hide(immediate: true)+ resetCreditsPanelController.hide()}heatmapDetailPanelController.update(diff --git a/appcast.xml b/appcast.xmlindex 0995d0c..5e04821 100644--- a/appcast.xml+++ b/appcast.xml@@ -7,6 +7,15 @@<link>https://codexbar.zabrian.app/appcast.xml</link><description>CodexBar appcast feed</description><language>zh-CN</language>+ <item>+ <title>CodexBar.app 3.2.9</title>+ <sparkle:version>37</sparkle:version>+ <sparkle:shortVersionString>3.2.9</sparkle:shortVersionString>+ <sparkle:minimumSystemVersion>15.0</sparkle:minimumSystemVersion>+ <sparkle:releaseNotesLink>https://codexbar.zabrian.app/notes#3.2.9</sparkle:releaseNotesLink>+ <pubDate>Tue, 07 Jul 2026 13:35:43 +0800</pubDate>+ <enclosure url="https://codexbar.zabrian.app/download/CodexBar-v3.2.9.dmg" sparkle:edSignature="WUhGhr7nzZx5kexAzC6t7FgWJij8scl/DGvlhhLL1qKFhgRIy+UkA5khALdGB0U2AHX6jVrHjkB0fO6+rF+/Cg==" length="3481077" type="application/octet-stream"/>+ </item><item><title>CodexBar.app 3.2.8</title><sparkle:version>36</sparkle:version>