v1.0.26: eliminate double-green flash when switching timers
Both buttons now flip to their final visual state immediately on key press, before any API calls. Previously the old button stayed green throughout the stopTimer network round-trip (~0.5–2s), causing a window where both buttons appeared green simultaneously. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6438,7 +6438,7 @@ async function stopTimer(token, entryId) {
|
||||
}
|
||||
|
||||
// src/plugin.ts
|
||||
var CURRENT_VERSION = "1.0.25";
|
||||
var CURRENT_VERSION = "1.0.26";
|
||||
var GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/master";
|
||||
var SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
||||
MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4=
|
||||
@@ -6589,6 +6589,16 @@ var TimerToggle = class extends SingletonAction {
|
||||
await setRunningEntry(null);
|
||||
} else {
|
||||
const prevEntryId = await getRunningEntryId();
|
||||
if (prevEntryId) {
|
||||
for (const other of this.actions) {
|
||||
if (other.id === ev.action.id) continue;
|
||||
const otherSettings = this.settingsCache.get(other.id);
|
||||
if (otherSettings?.activeEntryId === prevEntryId) {
|
||||
await Promise.all([other.setState(0), other.setTitle(buttonTitle(otherSettings.projectName || ""))]);
|
||||
}
|
||||
}
|
||||
}
|
||||
await Promise.all([ev.action.setState(1), ev.action.setTitle(`\u23F1 ${title}`)]);
|
||||
if (prevEntryId) {
|
||||
await stopTimer(global.notionToken, prevEntryId);
|
||||
for (const other of this.actions) {
|
||||
@@ -6598,8 +6608,6 @@ var TimerToggle = class extends SingletonAction {
|
||||
const stopped = { ...otherSettings, activeEntryId: null };
|
||||
await other.setSettings(stopped);
|
||||
this.settingsCache.set(other.id, stopped);
|
||||
await other.setState(0);
|
||||
await other.setTitle(buttonTitle(otherSettings.projectName || ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6614,8 +6622,6 @@ var TimerToggle = class extends SingletonAction {
|
||||
await ev.action.setSettings(started);
|
||||
this.settingsCache.set(ev.action.id, started);
|
||||
await setRunningEntry(entryId);
|
||||
await ev.action.setState(1);
|
||||
await ev.action.setTitle(`\u23F1 ${title}`);
|
||||
}
|
||||
} catch (err) {
|
||||
plugin_default.logger.error("Timer toggle failed:", err);
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
чжр╨╞
|
||||
HJК{lн И▐>ь┘0^Уt<fх▄╦┼Ь╢\ME
|
||||
/куCБ╡ЗsW
|
||||
KH›YƢRK>q2lĚűZ
|
||||
e>ÓřťőüW%"YŔ8gĆe<C486>€Ý8BÓŻ$>ŤWĎ=kIÜÇÄŹ¸Mîe2K
|
||||
@@ -2,7 +2,7 @@
|
||||
"Author": "Pete Marfleet",
|
||||
"Description": "Toggle Notion time tracking for a project with a single button press.",
|
||||
"Name": "Notion Timer",
|
||||
"Version": "1.0.25",
|
||||
"Version": "1.0.26",
|
||||
"SDKVersion": 2,
|
||||
"Software": { "MinimumVersion": "5.0" },
|
||||
"OS": [{ "Platform": "mac", "MinimumVersion": "10.11" }],
|
||||
|
||||
Reference in New Issue
Block a user