diff --git a/packages/ui-settings/src/Settings.ts b/packages/ui-settings/src/Settings.ts index 40b8449a..3aebdb17 100644 --- a/packages/ui-settings/src/Settings.ts +++ b/packages/ui-settings/src/Settings.ts @@ -8,7 +8,7 @@ import store from 'store'; import { isUndefined } from '@polkadot/util'; -import { CAMERA, CAMERA_DEFAULT, CRYPTOS, CRYPTOS_ETH, CRYPTOS_LEDGER, ENDPOINT_DEFAULT, ENDPOINTS, ICON_DEFAULT, ICONS, LANGUAGE_DEFAULT, LEDGER_CONN, LEDGER_CONN_DEFAULT, LOCKING, LOCKING_DEFAULT, PREFIX_DEFAULT, PREFIXES, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from './defaults'; +import { CAMERA, CAMERA_DEFAULT, CRYPTOS, CRYPTOS_ETH, CRYPTOS_LEDGER, ENDPOINT_DEFAULT, ENDPOINTS, ICON_DEFAULT, ICONS, LANGUAGE_DEFAULT, LEDGER_CONN, LEDGER_CONN_DEFAULT, LOCKING, LOCKING_DEFAULT, NOTIFICATION_DEFAULT, PREFIX_DEFAULT, PREFIXES, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from './defaults'; type ChangeCallback = (settings: SettingsStruct) => void; type OnTypes = 'change'; @@ -45,6 +45,8 @@ export class Settings implements SettingsStruct { #uiTheme: string; + #notification: string; + constructor () { const settings = (store.get('settings') as SettingsStruct) || {}; @@ -61,6 +63,7 @@ export class Settings implements SettingsStruct { this.#prefix = isUndefined(settings.prefix) ? PREFIX_DEFAULT : settings.prefix; this.#uiMode = settings.uiMode || UIMODE_DEFAULT; this.#uiTheme = settings.uiTheme || UITHEME_DEFAULT; + this.#notification = settings.notification || NOTIFICATION_DEFAULT; } public get camera (): string { @@ -83,6 +86,10 @@ export class Settings implements SettingsStruct { return this.#icon; } + public get notification (): string { + return this.#notification; + } + public get ledgerConn (): string { return this.#ledgerConn; } @@ -156,6 +163,7 @@ export class Settings implements SettingsStruct { icon: this.#icon, ledgerConn: this.#ledgerConn, locking: this.#locking, + notification: this.#notification, prefix: this.#prefix, uiMode: this.#uiMode, uiTheme: this.#uiTheme @@ -170,6 +178,7 @@ export class Settings implements SettingsStruct { this.#i18nLang = settings.i18nLang || this.#i18nLang; this.#icon = settings.icon || this.#icon; this.#locking = settings.locking || this.#locking; + this.#notification = settings.notification || this.#notification; this.#prefix = isUndefined(settings.prefix) ? this.#prefix : settings.prefix; this.#uiMode = settings.uiMode || this.#uiMode; this.#uiTheme = settings.uiTheme || this.#uiTheme; diff --git a/packages/ui-settings/src/defaults/index.ts b/packages/ui-settings/src/defaults/index.ts index c2414168..cec95580 100644 --- a/packages/ui-settings/src/defaults/index.ts +++ b/packages/ui-settings/src/defaults/index.ts @@ -7,7 +7,7 @@ import { CRYPTOS, CRYPTOS_ETH, CRYPTOS_LEDGER } from './crypto'; import { ENDPOINT_DEFAULT, ENDPOINTS } from './endpoints'; import { LEDGER_CONN, LEDGER_CONN_DEFAULT } from './ledger'; import { PREFIX_DEFAULT, PREFIXES } from './ss58'; -import { ICON_DEFAULT, ICON_DEFAULT_HOST, ICONS, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from './ui'; +import { ICON_DEFAULT, ICON_DEFAULT_HOST, ICONS, NOTIFICATION_DEFAULT, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from './ui'; const CAMERA_DEFAULT = 'off'; @@ -57,6 +57,7 @@ export { LEDGER_CONN, LOCKING_DEFAULT, LOCKING, + NOTIFICATION_DEFAULT, PREFIX_DEFAULT, PREFIXES, UIMODE_DEFAULT, diff --git a/packages/ui-settings/src/defaults/ui.ts b/packages/ui-settings/src/defaults/ui.ts index 7de1f3dd..cdb156b2 100644 --- a/packages/ui-settings/src/defaults/ui.ts +++ b/packages/ui-settings/src/defaults/ui.ts @@ -70,11 +70,14 @@ const ICONS: Option[] = [ } ]; +const NOTIFICATION_DEFAULT = 'popup'; + export { ICON_DEFAULT, ICON_DEFAULT_HOST, ICONS, LANGUAGE_DEFAULT, + NOTIFICATION_DEFAULT, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, diff --git a/packages/ui-settings/src/types.ts b/packages/ui-settings/src/types.ts index 1c3d57d1..f089bdfd 100644 --- a/packages/ui-settings/src/types.ts +++ b/packages/ui-settings/src/types.ts @@ -16,6 +16,7 @@ export interface SettingsStruct { icon: string; ledgerConn: string; locking: string; + notification: string; prefix: number; uiMode: string; uiTheme: string;