diff --git a/com.pdma.notion-timer.sdPlugin/bin/plugin.js b/com.pdma.notion-timer.sdPlugin/bin/plugin.js index 14e91b5..b715cfb 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.36"; +var CURRENT_VERSION = "1.0.37"; 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= @@ -6623,9 +6623,8 @@ var TimerToggle = class extends SingletonAction { if (activeEntryId) { await stopTimer(global.notionToken, activeEntryId); const stopped = { ...ev.payload.settings, activeEntryId: null }; - await ev.action.setSettings(stopped); this.settingsCache.set(ev.action.id, stopped); - await Promise.all([ev.action.setState(0), ev.action.setTitle(title)]); + await Promise.all([ev.action.setSettings(stopped), ev.action.setState(0), ev.action.setTitle(title)]); await setRunningEntry(null); } else { const prevEntryId = await getRunningEntryId(); @@ -6636,8 +6635,8 @@ var TimerToggle = class extends SingletonAction { const otherSettings = this.settingsCache.get(other.id); if (otherSettings?.activeEntryId === prevEntryId) { const stopped = { ...otherSettings, activeEntryId: null }; - await other.setSettings(stopped); this.settingsCache.set(other.id, stopped); + await Promise.all([other.setSettings(stopped), other.setState(0), other.setTitle(buttonTitle(otherSettings.projectName || ""))]); } } } @@ -6649,9 +6648,8 @@ var TimerToggle = class extends SingletonAction { global.userId ); const started = { ...ev.payload.settings, activeEntryId: entryId }; - await ev.action.setSettings(started); this.settingsCache.set(ev.action.id, started); - await Promise.all([ev.action.setState(1), ev.action.setTitle(`\u23F1 ${title}`)]); + await Promise.all([ev.action.setSettings(started), ev.action.setState(1), ev.action.setTitle(`\u23F1 ${title}`)]); await setRunningEntry(entryId); } } catch (err) { diff --git a/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig b/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig index 530bb5d..e65c5ea 100644 --- a/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig +++ b/com.pdma.notion-timer.sdPlugin/bin/plugin.js.sig @@ -1,2 +1 @@ -Yxek*o -h@= \ No newline at end of file +ȩԝu1B!I- bhݵ Gr7L]x~cᅻdX ޹y9B// \ No newline at end of file diff --git a/com.pdma.notion-timer.sdPlugin/manifest.json b/com.pdma.notion-timer.sdPlugin/manifest.json index 66fe687..a946959 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.36", + "Version": "1.0.37", "SDKVersion": 2, "Software": { "MinimumVersion": "5.0" }, "OS": [{ "Platform": "mac", "MinimumVersion": "10.11" }], diff --git a/notion-timer.streamDeckPlugin b/notion-timer.streamDeckPlugin index 36eeeed..01d4fca 100644 Binary files a/notion-timer.streamDeckPlugin and b/notion-timer.streamDeckPlugin differ diff --git a/src/plugin.ts b/src/plugin.ts index b21f2cd..7671351 100644 --- a/src/plugin.ts +++ b/src/plugin.ts @@ -1,4 +1,4 @@ -const CURRENT_VERSION = "1.0.36"; +const CURRENT_VERSION = "1.0.37"; const GITEA_BASE = "https://gitea.pdmarf.co.uk/pdm/stream_deck_notion_timer/raw/branch/stable-rebuild"; const SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY----- MCowBQYDK2VwAyEAN7ko8TUpuPzPAJuKAZCRjV0c4ZSlou5d9pUAF6o12b4= @@ -235,10 +235,9 @@ class TimerToggle extends SingletonAction { if (activeEntryId) { await stopTimer(global.notionToken, activeEntryId); const stopped = { ...ev.payload.settings, activeEntryId: null }; - await ev.action.setSettings(stopped); this.settingsCache.set(ev.action.id, stopped); - // Re-assert immediately — before setRunningEntry's async calls - await Promise.all([ev.action.setState(0), ev.action.setTitle(title)]); + // setSettings and setState together so the state reset doesn't flash + await Promise.all([ev.action.setSettings(stopped), ev.action.setState(0), ev.action.setTitle(title)]); await setRunningEntry(null); } else { const prevEntryId = await getRunningEntryId(); @@ -251,8 +250,8 @@ class TimerToggle extends SingletonAction { const otherSettings = this.settingsCache.get(other.id); if (otherSettings?.activeEntryId === prevEntryId) { const stopped = { ...otherSettings, activeEntryId: null }; - await other.setSettings(stopped); this.settingsCache.set(other.id, stopped); + await Promise.all([other.setSettings(stopped), other.setState(0), other.setTitle(buttonTitle(otherSettings.projectName || ""))]); } } } @@ -265,10 +264,9 @@ class TimerToggle extends SingletonAction { global.userId, ); const started = { ...ev.payload.settings, activeEntryId: entryId }; - await ev.action.setSettings(started); this.settingsCache.set(ev.action.id, started); - // Re-assert immediately — before setRunningEntry's async calls - await Promise.all([ev.action.setState(1), ev.action.setTitle(`⏱ ${title}`)]); + // setSettings and setState together so the state reset doesn't flash + await Promise.all([ev.action.setSettings(started), ev.action.setState(1), ev.action.setTitle(`⏱ ${title}`)]); await setRunningEntry(entryId); } } catch (err) { diff --git a/version.json b/version.json index e96f7f9..453a425 100644 --- a/version.json +++ b/version.json @@ -1 +1 @@ -{ "version": "1.0.36" } +{ "version": "1.0.37" }