Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 0 additions & 19 deletions src/preload/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ interface TestApi {
tray: { updateColor: (n?: number) => void };
openExternalLink: (u: string, f: boolean) => void;
app: { version: () => Promise<string>; show?: () => void; hide?: () => void };
onSystemThemeUpdate: (cb: (t: string) => void) => void;
raiseNativeNotification: (t: string, b: string, u?: string) => unknown;
}

Expand Down Expand Up @@ -134,24 +133,6 @@ describe('preload/index', () => {
process.env.NODE_ENV = originalEnv;
});

it('onSystemThemeUpdate registers listener', async () => {
const api = getExposedApi();
const callback = vi.fn();
api.onSystemThemeUpdate(callback);

expect(onRendererEventMock).toHaveBeenCalledWith(
EVENTS.UPDATE_THEME,
expect.any(Function),
);

// Simulate event
const listener = onRendererEventMock.mock.calls[0][1];

listener({}, 'dark');

expect(callback).toHaveBeenCalledWith('dark');
});

it('raiseNativeNotification without url calls app.show', async () => {
const api = getExposedApi();

Expand Down
9 changes: 0 additions & 9 deletions src/preload/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,6 @@ export const api = {
onRendererEvent(EVENTS.AUTH_CALLBACK, (_, url) => callback(url));
},

/**
* Register a callback invoked when the OS system theme changes.
*
* @param callback - Called with the new theme string (`"light"` or `"dark"`).
*/
onSystemThemeUpdate: (callback: (theme: string) => void) => {
onRendererEvent(EVENTS.UPDATE_THEME, (_, theme) => callback(theme));
},

/**
* Display a native OS notification.
*
Expand Down
1 change: 0 additions & 1 deletion src/renderer/__helpers__/vitest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ window.gitify = {
notificationSoundPath: vi.fn(),
onAuthCallback: vi.fn(),
onResetApp: vi.fn(),
onSystemThemeUpdate: vi.fn(),
setAutoLaunch: vi.fn(),
applyKeyboardShortcut: vi.fn().mockResolvedValue({ success: true }),
raiseNativeNotification: vi.fn(),
Expand Down
2 changes: 0 additions & 2 deletions src/shared/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export const EVENTS = {
NOTIFICATION_SOUND_PATH: `${P}notification-sound-path`,
OPEN_EXTERNAL: `${P}open-external`,
RESET_APP: `${P}reset-app`,
UPDATE_THEME: `${P}update-theme`,
TWEMOJI_DIRECTORY: `${P}twemoji-directory`,
} as const;

Expand Down Expand Up @@ -87,7 +86,6 @@ export type EventContracts = AssertEventCoverage<{
[EVENTS.NOTIFICATION_SOUND_PATH]: { request: undefined; response: string };
[EVENTS.OPEN_EXTERNAL]: { request: IOpenExternal; response: undefined };
[EVENTS.RESET_APP]: { request: undefined; response: undefined };
[EVENTS.UPDATE_THEME]: { request: string; response: undefined };
[EVENTS.TWEMOJI_DIRECTORY]: { request: undefined; response: string };
}>;

Expand Down
Loading