-
Notifications
You must be signed in to change notification settings - Fork 517
feat: feature announcement toast #2642
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
janburzinski
wants to merge
21
commits into
main
Choose a base branch
from
emdash/changelog-announcement-s8i8c
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,081
−2
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
ec7a5a5
feat: add feature announcements
janburzinski aad0104
feat: present announcements as toast
janburzinski e7b5e43
style: polish announcement presentation
janburzinski e5d22f1
chore: add announcement dev controls
janburzinski c50afd1
style: simplify announcement hover states
janburzinski 098f9b7
refactor: make announcements toast-only
janburzinski 7fb8648
test: validate announcement manifest
janburzinski 515da3f
fix(announcements): narrow CTA actions
janburzinski b3dea47
test(announcements): guard schema drift
janburzinski afbe110
refactor(announcements): isolate toast effects
janburzinski 0684b10
fix(announcements): show dev preview directly
janburzinski f18ae68
fix(announcements): persist dismissals in settings
janburzinski d9fdd00
fix(announcements): address review feedback
janburzinski 9f24adb
feat(announcements): move announcement to sidebar
janburzinski 5546daf
feat(announcements): show announcement toast
janburzinski cf91d72
fix(announcements): remove feature icons
janburzinski 595075d
style(announcements): format schema import
janburzinski 14aa952
test(announcements): type schema required field
janburzinski ac9ac57
feat: add sidebar changelog toast
janburzinski ba55d31
fix(announcements): gate toast display
janburzinski a050b26
refactor(announcements): trim toast manifest
janburzinski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| { | ||
| "$id": "feature-announcements.schema.json", | ||
| "title": "Emdash feature announcement manifest", | ||
| "description": "In-app feature announcement shown as a bottom-left sidebar toast. Runtime validation uses the Zod schema in src/shared/feature-announcements/schema.ts — keep both in sync.", | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "required": ["id", "title", "changelogUrl"], | ||
| "properties": { | ||
| "enabled": { | ||
| "type": "boolean", | ||
| "default": false, | ||
| "description": "Set to false to hide the announcement without deleting content." | ||
| }, | ||
| "id": { | ||
| "type": "string", | ||
| "minLength": 1, | ||
| "description": "Stable identifier used for dismissal persistence." | ||
| }, | ||
| "eyebrow": { | ||
| "type": "string", | ||
| "minLength": 1, | ||
| "default": "Now available" | ||
| }, | ||
| "title": { | ||
| "type": "string", | ||
| "minLength": 1 | ||
| }, | ||
| "changelogUrl": { | ||
| "type": "string", | ||
| "format": "uri" | ||
| }, | ||
| "minAppVersion": { | ||
| "type": "string", | ||
| "minLength": 1, | ||
| "description": "Semver minimum; older app versions ignore this manifest." | ||
| }, | ||
| "cta": { | ||
| "$ref": "#/$defs/cta" | ||
| } | ||
| }, | ||
| "$defs": { | ||
| "cta": { | ||
| "type": "object", | ||
| "additionalProperties": false, | ||
| "properties": { | ||
| "action": { | ||
| "type": "string", | ||
| "enum": ["open-automations"] | ||
| }, | ||
| "url": { | ||
| "type": "string", | ||
| "format": "uri" | ||
| } | ||
| }, | ||
| "oneOf": [ | ||
| { | ||
| "required": ["action"], | ||
| "not": { | ||
| "required": ["url"] | ||
| } | ||
| }, | ||
| { | ||
| "required": ["url"], | ||
| "not": { | ||
| "required": ["action"] | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| #:schema ./feature-announcements.schema.json | ||
| # | ||
| # In-app feature announcement shown as a bottom-left sidebar toast. | ||
| # | ||
| # Edit this file on GitHub to announce major features without shipping a new app | ||
| # release. Set `enabled = false` to hide the toast while keeping content around | ||
| # for the next launch. | ||
| # | ||
| # Runtime validation: src/shared/feature-announcements/schema.ts (Zod). | ||
| # Editor/CI schema: feature-announcements.schema.json (keep in sync with Zod). | ||
| # | ||
| # The app fetches this file from the main branch at startup. | ||
|
|
||
| enabled = true | ||
| id = "automations-2026-06" | ||
| eyebrow = "Now available" | ||
| title = "Emdash Automations" | ||
| changelogUrl = "https://emdash.sh/changelog" | ||
| minAppVersion = "1.1.27" | ||
|
|
||
| [cta] | ||
| action = "open-automations" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
apps/emdash-desktop/src/main/core/feature-announcements/controller.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| import { createRPCController } from '@shared/lib/ipc/rpc'; | ||
| import { featureAnnouncementsService } from './service'; | ||
|
|
||
| export const featureAnnouncementsController = createRPCController({ | ||
| getCurrent: async () => { | ||
| try { | ||
| const manifest = await featureAnnouncementsService.getCurrent(); | ||
| return { success: true as const, data: manifest }; | ||
| } catch (error) { | ||
| return { | ||
| success: false as const, | ||
| error: error instanceof Error ? error.message : String(error), | ||
| }; | ||
| } | ||
| }, | ||
| preview: async () => { | ||
| if (!import.meta.env.DEV) { | ||
| return { success: false as const, error: 'Preview is only available in development builds' }; | ||
| } | ||
|
|
||
| try { | ||
| const manifest = await featureAnnouncementsService.preview(); | ||
| return { success: true as const, data: manifest }; | ||
| } catch (error) { | ||
| return { | ||
| success: false as const, | ||
| error: error instanceof Error ? error.message : String(error), | ||
| }; | ||
| } | ||
| }, | ||
| }); |
115 changes: 115 additions & 0 deletions
115
apps/emdash-desktop/src/main/core/feature-announcements/service.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| import { readFile } from 'node:fs/promises'; | ||
| import { join } from 'node:path'; | ||
| import { app } from 'electron'; | ||
| import semver from 'semver'; | ||
| import * as toml from 'smol-toml'; | ||
| import { resolveAppVersion } from '@main/core/app/utils'; | ||
| import { log } from '@main/lib/logger'; | ||
| import { | ||
| FEATURE_ANNOUNCEMENT_MANIFEST_FILENAME, | ||
| FEATURE_ANNOUNCEMENT_MANIFEST_URL, | ||
| } from '@shared/feature-announcements/constants'; | ||
| import { | ||
| parseFeatureAnnouncementManifest, | ||
| parseFeatureAnnouncementManifestRaw, | ||
| type FeatureAnnouncementManifest, | ||
| } from '@shared/feature-announcements/schema'; | ||
|
|
||
| const MANIFEST_CACHE_TTL_MS = 15 * 60 * 1000; | ||
|
|
||
| type CachedManifest = { | ||
| fetchedAt: number; | ||
| manifest: FeatureAnnouncementManifest | null; | ||
| }; | ||
|
|
||
| class FeatureAnnouncementsService { | ||
| private cache: CachedManifest | null = null; | ||
|
|
||
| async getCurrent(): Promise<FeatureAnnouncementManifest | null> { | ||
| const manifest = await this.loadManifest(); | ||
| if (!manifest) return null; | ||
|
|
||
| if (manifest.minAppVersion) { | ||
| const currentVersion = await resolveAppVersion(); | ||
| const min = semver.coerce(manifest.minAppVersion); | ||
| const current = semver.coerce(currentVersion); | ||
| if (min && current && semver.lt(current, min)) { | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| return manifest; | ||
| } | ||
|
|
||
| async preview(): Promise<FeatureAnnouncementManifest | null> { | ||
| const content = await this.readManifestContent(); | ||
| if (!content) return null; | ||
|
|
||
| try { | ||
| return parseFeatureAnnouncementManifestRaw(toml.parse(content)); | ||
| } catch (error) { | ||
| log.warn('[feature-announcements] Failed to parse preview manifest', error); | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| private async loadManifest(options?: { | ||
| bypassCache?: boolean; | ||
| }): Promise<FeatureAnnouncementManifest | null> { | ||
| if ( | ||
| !options?.bypassCache && | ||
| this.cache && | ||
| Date.now() - this.cache.fetchedAt < MANIFEST_CACHE_TTL_MS | ||
| ) { | ||
| return this.cache.manifest; | ||
| } | ||
|
|
||
| const content = await this.readManifestContent(); | ||
| if (!content) { | ||
| this.cache = { fetchedAt: Date.now(), manifest: null }; | ||
| return null; | ||
| } | ||
|
|
||
| try { | ||
| const parsed = parseFeatureAnnouncementManifest(toml.parse(content)); | ||
| this.cache = { fetchedAt: Date.now(), manifest: parsed }; | ||
| return parsed; | ||
| } catch (error) { | ||
| log.warn('[feature-announcements] Failed to parse manifest', error); | ||
| this.cache = { fetchedAt: Date.now(), manifest: null }; | ||
| return null; | ||
| } | ||
| } | ||
|
|
||
| private async readManifestContent(): Promise<string | null> { | ||
| if (import.meta.env.DEV) { | ||
| try { | ||
| const localPath = join(app.getAppPath(), FEATURE_ANNOUNCEMENT_MANIFEST_FILENAME); | ||
| return await readFile(localPath, 'utf8'); | ||
| } catch (error) { | ||
| log.debug( | ||
| '[feature-announcements] Local manifest unavailable, falling back to remote', | ||
| error | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| try { | ||
| const response = await fetch(FEATURE_ANNOUNCEMENT_MANIFEST_URL, { | ||
| headers: { 'Cache-Control': 'no-cache' }, | ||
| }); | ||
| if (!response.ok) { | ||
| log.warn('[feature-announcements] Remote manifest request failed', { | ||
| status: response.status, | ||
| }); | ||
| return null; | ||
| } | ||
| return await response.text(); | ||
| } catch (error) { | ||
| log.warn('[feature-announcements] Remote manifest fetch failed', error); | ||
| return null; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| export const featureAnnouncementsService = new FeatureAnnouncementsService(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.