Skip to content

Commit

Permalink
[DDW-881] Reimplement WalletSettingsStateEnum to TS native enum
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonmaslowski committed Feb 3, 2022
1 parent 649c731 commit 370d9d1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
17 changes: 6 additions & 11 deletions source/common/ipc/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,15 @@ export type SubmitBugReportRequestMainResponse = void;
/**
* Channel to rebuild the electron application menu after the language setting changes
*/
export type WalletSettingsStateValue = 'hidden' | 'disabled' | 'enabled';
// @ts-ignore ts-migrate(2304) FIXME: Cannot find name 'EnumMap'.
export const WalletSettingsStateEnum: EnumMap<
WalletSettingsStateValue,
WalletSettingsStateValue
> = {
hidden: 'hidden',
disabled: 'disabled',
enabled: 'enabled',
};
export enum WalletSettingsStateEnum {
hidden = 'hidden',
disabled = 'disabled',
enabled = 'enabled',
}
export const REBUILD_APP_MENU_CHANNEL = 'REBUILD_APP_MENU_CHANNEL';
export type RebuildAppMenuRendererRequest = {
isNavigationEnabled: boolean;
walletSettingsState: WalletSettingsStateValue;
walletSettingsState: WalletSettingsStateEnum;
};
export type RebuildAppMenuMainResponse = void;

Expand Down
3 changes: 1 addition & 2 deletions source/main/menus/osx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { showUiPartChannel } from '../ipc/control-ui-parts';
import { NOTIFICATIONS } from '../../common/ipc/constants';
import { generateSupportRequestLink } from '../../common/utils/reporting';
import { WalletSettingsStateEnum } from '../../common/ipc/api';
import type { WalletSettingsStateValue } from '../../common/ipc/api';
import { getRtsFlags } from '../utils/rtsFlags';

const id = 'menu';
Expand All @@ -22,7 +21,7 @@ export const osxMenu = (
translations: {},
locale: string,
isNavigationEnabled: boolean,
walletSettingsState: WalletSettingsStateValue,
walletSettingsState: WalletSettingsStateEnum,
translation: (...args: Array<any>) => any = getTranslation(translations, id)
) => [
{
Expand Down
3 changes: 1 addition & 2 deletions source/main/menus/win-linux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { NOTIFICATIONS } from '../../common/ipc/constants';
import { showUiPartChannel } from '../ipc/control-ui-parts';
import { generateSupportRequestLink } from '../../common/utils/reporting';
import { WalletSettingsStateEnum } from '../../common/ipc/api';
import type { WalletSettingsStateValue } from '../../common/ipc/api';
import { getRtsFlags } from '../utils/rtsFlags';

const id = 'menu';
Expand All @@ -22,7 +21,7 @@ export const winLinuxMenu = (
translations: {},
locale: string,
isNavigationEnabled: boolean,
walletSettingsState: WalletSettingsStateValue,
walletSettingsState: WalletSettingsStateEnum,
translation: (...args: Array<any>) => any = getTranslation(translations, id)
) => [
{
Expand Down
8 changes: 4 additions & 4 deletions source/main/utils/buildAppMenus.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { app, BrowserWindow, dialog, globalShortcut, Menu } from 'electron';
import type { WalletSettingsStateValue } from '../../common/ipc/api';
import { WalletSettingsStateEnum } from '../../common/ipc/api';
import { environment } from '../environment';
import { winLinuxMenu } from '../menus/win-linux';
import { osxMenu } from '../menus/osx';
Expand All @@ -12,10 +12,10 @@ import { getTranslation } from './getTranslation';
import { setRtsFlagsAndRestart } from './rtsFlags';
import { RTS_FLAGS } from '../config';

type Data = {
interface Data {
isNavigationEnabled: boolean;
walletSettingsState: WalletSettingsStateValue;
};
walletSettingsState: WalletSettingsStateEnum;
}
export const buildAppMenus = async (
mainWindow: BrowserWindow,
cardanoNode: CardanoNode | null | undefined,
Expand Down

0 comments on commit 370d9d1

Please sign in to comment.