From 93616d3a1a6e4b4aeeda17099dfaf6e8bd586a11 Mon Sep 17 00:00:00 2001 From: pdmarf <135653545+pdmarf@users.noreply.github.com> Date: Fri, 24 Apr 2026 09:07:55 +0100 Subject: [PATCH] v1.0.34: fix both buttons showing green simultaneously MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When pressing B while A was running, B went green immediately but A stayed green until getGlobal()+getRunningEntryId() resolved. Now uses settingsCache to turn off all running buttons in the same synchronous pass as turning B on — no async gap where both appear active. Co-Authored-By: Claude Sonnet 4.6 --- com.pdma.notion-timer.sdPlugin/bin/plugin.js | 16 +++++++-------- .../bin/plugin.js.sig | Bin 64 -> 64 bytes com.pdma.notion-timer.sdPlugin/manifest.json | 2 +- notion-timer.streamDeckPlugin | Bin 99173 -> 99183 bytes src/plugin.ts | 19 +++++++++--------- version.json | 2 +- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/com.pdma.notion-timer.sdPlugin/bin/plugin.js b/com.pdma.notion-timer.sdPlugin/bin/plugin.js index a0451ff..4eca5f3 100644 --- a/com.pdma.notion-timer.sdPlugin/bin/plugin.js +++ b/com.pdma.notion-timer.sdPlugin/bin/plugin.js @@ -6438,7 +6438,7 @@ async function stopTimer(token, entryId) { } // src/plugin.ts -var CURRENT_VERSION = "1.0.33"; +var CURRENT_VERSION = "1.0.34"; var GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild"; var SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY----- MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4= @@ -6599,6 +6599,13 @@ var TimerToggle = class extends SingletonAction { if (activeEntryId) { await Promise.all([ev.action.setState(0), ev.action.setTitle(title)]); } else { + for (const other of this.actions) { + if (other.id === ev.action.id) continue; + const otherSettings = this.settingsCache.get(other.id); + if (otherSettings?.activeEntryId) { + await Promise.all([other.setState(0), other.setTitle(buttonTitle(otherSettings.projectName || ""))]); + } + } await Promise.all([ev.action.setState(1), ev.action.setTitle(`\u23F1 ${title}`)]); } } @@ -6622,13 +6629,6 @@ var TimerToggle = class extends SingletonAction { } 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 stopTimer(global.notionToken, prevEntryId); for (const other of this.actions) { if (other.id === ev.action.id) continue; diff --git a/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig b/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig index 16c9287dadcf274eb17c99ce5fe1578e20a240c9..60549bc1c9c135ef466c71149148ee38f63551ca 100644 GIT binary patch literal 64 zcmV-G0KflYYcV8Pfaq(TFP-^yaA6kruiRD9!2p>)pkdIcSwiC)rs1A}#U|Ss~S`UZA7QXjKq2sT^rVlydxwzjTT~~{&=W0SdG5DD)ZUu)y3p-=` W78fOgA39)bw}ijvu=T*x;pPYfd>`ik diff --git a/com.pdma.notion-timer.sdPlugin/manifest.json b/com.pdma.notion-timer.sdPlugin/manifest.json index 90dce3e..6be727b 100644 --- a/com.pdma.notion-timer.sdPlugin/manifest.json +++ b/com.pdma.notion-timer.sdPlugin/manifest.json @@ -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.33", + "Version": "1.0.34", "SDKVersion": 2, "Software": { "MinimumVersion": "5.0" }, "OS": [{ "Platform": "mac", "MinimumVersion": "10.11" }], diff --git a/notion-timer.streamDeckPlugin b/notion-timer.streamDeckPlugin index 7d03184e1e6450d72c495098130aa708d092de17..da4ea6612b8ad3b47b0969e5c36b53f7f6fa37ad 100644 GIT binary patch delta 1642 zcmZ8i2{_bS6#rji#>miO%Q6_o(u_=Hd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wMDT)erhj=AC9d&|5tbP>mhrUzZg0PPgxkb>2$r4=?&#P4AWn9 z8>x1!3%3)wrv{!22W3JnOI%Im5UNhK9?_D%HUbeqR5 z_ZFOSkL+&C+6lI(RO{kNj;U(JvV?G^m+89 z$kIBPByYpVPg(z!wu z(}S5aZ9;yLFc75ul|;5-Kn4~OQe;0dDCL0li2;y}}w5EGCCuMR4P1(TyOif6t(@QR4xN(%G zWpqIA>YH^alae5njT1YUY}`VtIXCxoiW^fJ_jl-kY%SS^d)@ny3*kUz!&Odx`y7s} zSen&)xje3JjjwgW+0yQ6iTC?HOi!PdYi?2eL_iwCfu_&>6o0h+qSaJ&lD||;#q;u^ zrG&&FKU;@P-(ZTkf%cQ+HruvBw8iqkc%?sfEUx3fakhpNb+3nc#Jc=?E8t6k9RGM> zPidrW?#H`#tnhw$tU%9}Y~#I;*uozMC>8W~Sw-CFfC9`BT^Oh&dC5F$r2}a!AR|L( zffXuL9U;PCt=K;@ia5Z4Dw0j)&>5gC`5$>h-oU^dP`?gB3?hLF%6b6lr-SuKUnIaH zj7VULy8k0WLro6;EA1Wy_MmGG0Q=;C2J$8f>_dm2`sPrW-~hTN { if (activeEntryId) { await Promise.all([ev.action.setState(0), ev.action.setTitle(title)]); } else { + // Turn off any other running button immediately using the cache — no async needed + for (const other of this.actions) { + if (other.id === ev.action.id) continue; + const otherSettings = this.settingsCache.get(other.id); + if (otherSettings?.activeEntryId) { + await Promise.all([other.setState(0), other.setTitle(buttonTitle(otherSettings.projectName || ""))]); + } + } await Promise.all([ev.action.setState(1), ev.action.setTitle(`⏱ ${title}`)]); } } @@ -233,15 +241,8 @@ class TimerToggle extends SingletonAction { } else { const prevEntryId = await getRunningEntryId(); - // Turn off the previously running button immediately + // Stop previous timer and update its settings 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 stopTimer(global.notionToken, prevEntryId); for (const other of this.actions) { if (other.id === ev.action.id) continue; diff --git a/version.json b/version.json index 5c1b696..020e2df 100644 --- a/version.json +++ b/version.json @@ -1 +1 @@ -{ "version": "1.0.33" } +{ "version": "1.0.34" }