mirror of
https://github.com/johannesjo/super-productivity.git
synced 2026-01-22 18:30:09 +00:00
The tray icon was jumping between showing task time and focus session time when focus mode was active with a task being tracked. This occurred because the tray display logic didn't know which focus mode was active. Changes: - Send focus mode type (Countdown/Pomodoro/Flowtime) from frontend to Electron - Update IPC handler to receive and pass focus mode type to tray message creation - Implement three-mode priority logic in createIndicatorMessage(): 1. Countdown/Pomodoro modes: Show focus session countdown timer 2. Flowtime mode: Show task estimate or title (no timer) 3. No focus mode: Show normal task time (existing behavior) - Update TypeScript type definitions for updateCurrentTask() - Update unit tests to mock the new mode() signal This ensures the tray displays the correct timer without jumping based on the active focus mode, matching the behavior of the overlay indicator. Fixes jumping tray indicator during focus mode + tracking
161 lines
3.9 KiB
TypeScript
161 lines
3.9 KiB
TypeScript
import { IpcRendererEvent } from 'electron';
|
|
import {
|
|
GlobalConfigState,
|
|
TakeABreakConfig,
|
|
} from '../src/app/features/config/global-config.model';
|
|
import { KeyboardConfig } from '../src/app/features/config/keyboard-config.model';
|
|
import { JiraCfg } from '../src/app/features/issue/providers/jira/jira.model';
|
|
import { AppDataCompleteLegacy, SyncGetRevResult } from '../src/app/imex/sync/sync.model';
|
|
import { Task } from '../src/app/features/tasks/task.model';
|
|
import { LocalBackupMeta } from '../src/app/imex/local-backup/local-backup.model';
|
|
import { AppDataComplete } from '../src/app/op-log/model/model-config';
|
|
import {
|
|
PluginNodeScriptRequest,
|
|
PluginNodeScriptResult,
|
|
PluginManifest,
|
|
} from '../packages/plugin-api/src/types';
|
|
|
|
export interface ElectronAPI {
|
|
on(
|
|
channel: string,
|
|
listener: (event: IpcRendererEvent, ...args: unknown[]) => void,
|
|
): void;
|
|
|
|
// INVOKE
|
|
// ------
|
|
getUserDataPath(): Promise<string>;
|
|
|
|
getBackupPath(): Promise<string>;
|
|
|
|
checkBackupAvailable(): Promise<false | LocalBackupMeta>;
|
|
|
|
loadBackupData(backupPath: string): Promise<string>;
|
|
|
|
fileSyncGetRevAndClientUpdate(args: {
|
|
filePath: string;
|
|
localRev: string | null;
|
|
}): Promise<{ rev: string; clientUpdate?: number } | SyncGetRevResult>;
|
|
|
|
fileSyncSave(args: {
|
|
filePath: string;
|
|
localRev: string | null;
|
|
dataStr: string;
|
|
}): Promise<string | Error>;
|
|
|
|
fileSyncLoad(args: {
|
|
filePath: string;
|
|
localRev: string | null;
|
|
}): Promise<{ rev: string; dataStr: string | undefined } | Error>;
|
|
|
|
fileSyncRemove(args: { filePath: string }): Promise<unknown | Error>;
|
|
|
|
fileSyncListFiles(args: { dirPath: string }): Promise<string[] | Error>; // NEW
|
|
|
|
checkDirExists(args: { dirPath: string }): Promise<true | Error>;
|
|
|
|
pickDirectory(): Promise<string | undefined>;
|
|
|
|
// checkDirExists(dirPath: string): Promise<true | Error>;
|
|
|
|
// STANDARD
|
|
// --------
|
|
setZoomFactor(zoomFactor: number): void;
|
|
|
|
getZoomFactor(): number;
|
|
|
|
openPath(path: string): void;
|
|
|
|
openExternalUrl(url: string): void;
|
|
|
|
saveFileDialog(
|
|
filename: string,
|
|
data: string,
|
|
): Promise<{ success: boolean; path?: string }>;
|
|
|
|
shareNative(payload: {
|
|
text?: string;
|
|
url?: string;
|
|
title?: string;
|
|
files?: string[];
|
|
}): Promise<{ success: boolean; error?: string }>;
|
|
|
|
isLinux(): boolean;
|
|
|
|
isMacOS(): boolean;
|
|
|
|
isSnap(): boolean;
|
|
|
|
isFlatpak(): boolean;
|
|
|
|
// SEND
|
|
// ----
|
|
reloadMainWin(): void;
|
|
|
|
openDevTools(): void;
|
|
|
|
showEmojiPanel(): void;
|
|
|
|
relaunch(): void;
|
|
|
|
exit(exitCode: number): void;
|
|
|
|
shutdownNow(): void;
|
|
|
|
flashFrame(): void;
|
|
|
|
showOrFocus(): void;
|
|
|
|
lockScreen(): void;
|
|
|
|
informAboutAppReady(): void;
|
|
|
|
scheduleRegisterBeforeClose(id: string): void;
|
|
|
|
unscheduleRegisterBeforeClose(id: string): void;
|
|
|
|
setDoneRegisterBeforeClose(id: string): void;
|
|
|
|
setProgressBar(args: {
|
|
progress: number;
|
|
progressBarMode: 'normal' | 'pause' | 'none';
|
|
}): void;
|
|
|
|
sendAppSettingsToElectron(globalCfg: GlobalConfigState): void;
|
|
|
|
sendSettingsUpdate(globalCfg: GlobalConfigState): void;
|
|
|
|
updateTitleBarDarkMode(isDarkMode: boolean): void;
|
|
|
|
registerGlobalShortcuts(keyboardConfig: KeyboardConfig): void;
|
|
|
|
showFullScreenBlocker(args: { msg?: string; takeABreakCfg: TakeABreakConfig }): void;
|
|
|
|
// TODO use invoke instead
|
|
makeJiraRequest(args: {
|
|
requestId: string;
|
|
url: string;
|
|
requestInit: RequestInit;
|
|
jiraCfg: JiraCfg;
|
|
}): void;
|
|
|
|
jiraSetupImgHeaders(args: { jiraCfg: JiraCfg }): void;
|
|
|
|
backupAppData(appData: AppDataCompleteLegacy | AppDataComplete): void;
|
|
|
|
updateCurrentTask(
|
|
task: Task | null,
|
|
isPomodoroEnabled: boolean,
|
|
currentPomodoroSessionTime: number,
|
|
isFocusModeEnabled?: boolean,
|
|
currentFocusSessionTime?: number,
|
|
focusModeMode?: string,
|
|
);
|
|
|
|
exec(command: string): void;
|
|
|
|
pluginExecNodeScript(
|
|
pluginId: string,
|
|
manifest: PluginManifest,
|
|
request: PluginNodeScriptRequest,
|
|
): Promise<PluginNodeScriptResult>;
|
|
}
|