mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-05-30 09:21:07 +00:00
Add a new notification setting (#498)
* add notification type to ui_settings * notificationType -> notification * Update packages/ui-settings/src/Settings.ts * Update packages/ui-settings/src/Settings.ts Co-authored-by: Jaco <jacogr@gmail.com>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -16,6 +16,7 @@ export interface SettingsStruct {
|
||||
icon: string;
|
||||
ledgerConn: string;
|
||||
locking: string;
|
||||
notification: string;
|
||||
prefix: number;
|
||||
uiMode: string;
|
||||
uiTheme: string;
|
||||
|
||||
Reference in New Issue
Block a user