Skip to content

armgit / mimik

Public Imported from GitHub
0

🎬 A browser extension and desktop app that turns your clicks into step-by-step guides with annotated screenshots πŸ“–

fix(desktop): keep whether the mic was on before a pause on the state machine

Luis Ortizfccd01719d5c
diff --git a/apps/desktop/src/main/ipc.ts b/apps/desktop/src/main/ipc.ts
index b057e73..5894b00 100644
--- a/apps/desktop/src/main/ipc.ts
+++ b/apps/desktop/src/main/ipc.ts
@@ -4,6 +4,7 @@ import type { OverlayCommand } from './overlay';
export interface DesktopStateUpdate extends CaptureStateUpdate {
command: OverlayCommand | null;
+ narrationWasLive: boolean;
}
export type DesktopCaptureStepData = CaptureStepData & {
diff --git a/apps/desktop/src/main/overlay/index.ts b/apps/desktop/src/main/overlay/index.ts
index 25dcc8c..5127a60 100644
--- a/apps/desktop/src/main/overlay/index.ts
+++ b/apps/desktop/src/main/overlay/index.ts
@@ -513,7 +513,11 @@ export class CaptureOverlay {
if (this.starting) return;
if (command === 'pause' && state === CaptureState.RECORDING) {
const area = this.mode() === 'area';
- this.capture.send({ type: 'PAUSE_CAPTURE', reason: area ? 'area' : 'manual' });
+ this.capture.send({
+ type: 'PAUSE_CAPTURE',
+ reason: area ? 'area' : 'manual',
+ narrationWasLive: this.narration !== null && !this.narration.reason,
+ });
this.onCommand(command);
if (area) this.edit();
} else if (command === 'resume' && state === CaptureState.PAUSED) {
diff --git a/packages/core/src/capture/machine.ts b/packages/core/src/capture/machine.ts
index 2325d1a..9728bed 100644
--- a/packages/core/src/capture/machine.ts
+++ b/packages/core/src/capture/machine.ts
@@ -110,7 +110,7 @@ export const captureMachine = setup({
on: {
RESUME_CAPTURE: {
target: CaptureState.RECORDING,
- actions: assign({ pauseReason: null, narrationWasLive: false }),
+ actions: assign({ pauseReason: null }),
},
STEP_REMOVED: { actions: 'removeStep' },
STOP_RECORDING: {
diff --git a/src/entrypoints/background/__tests__/pause-narration.test.ts b/src/entrypoints/background/__tests__/pause-narration.test.ts
index c77fa8c..777c3b6 100644
--- a/src/entrypoints/background/__tests__/pause-narration.test.ts
+++ b/src/entrypoints/background/__tests__/pause-narration.test.ts
@@ -80,10 +80,12 @@ describe('remembering that narration was on', () => {
expect(stopVoiceNarration).not.toHaveBeenCalled();
});
- it('clears the flag on resume so a later pause starts clean', async () => {
+ it('records the mic afresh at the next pause, so an old value never carries over', async () => {
voicePhase = 'recording';
await pauseCapture('manual');
await resumeCapture(vi.fn().mockResolvedValue(true));
+ voicePhase = 'idle';
+ await pauseCapture('manual');
expect(actor.getSnapshot().context.narrationWasLive).toBe(false);
});