mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-05-30 05:51:04 +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 { 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 ChangeCallback = (settings: SettingsStruct) => void;
|
||||||
type OnTypes = 'change';
|
type OnTypes = 'change';
|
||||||
@@ -45,6 +45,8 @@ export class Settings implements SettingsStruct {
|
|||||||
|
|
||||||
#uiTheme: string;
|
#uiTheme: string;
|
||||||
|
|
||||||
|
#notification: string;
|
||||||
|
|
||||||
constructor () {
|
constructor () {
|
||||||
const settings = (store.get('settings') as SettingsStruct) || {};
|
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.#prefix = isUndefined(settings.prefix) ? PREFIX_DEFAULT : settings.prefix;
|
||||||
this.#uiMode = settings.uiMode || UIMODE_DEFAULT;
|
this.#uiMode = settings.uiMode || UIMODE_DEFAULT;
|
||||||
this.#uiTheme = settings.uiTheme || UITHEME_DEFAULT;
|
this.#uiTheme = settings.uiTheme || UITHEME_DEFAULT;
|
||||||
|
this.#notification = settings.notification || NOTIFICATION_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get camera (): string {
|
public get camera (): string {
|
||||||
@@ -83,6 +86,10 @@ export class Settings implements SettingsStruct {
|
|||||||
return this.#icon;
|
return this.#icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get notification (): string {
|
||||||
|
return this.#notification;
|
||||||
|
}
|
||||||
|
|
||||||
public get ledgerConn (): string {
|
public get ledgerConn (): string {
|
||||||
return this.#ledgerConn;
|
return this.#ledgerConn;
|
||||||
}
|
}
|
||||||
@@ -156,6 +163,7 @@ export class Settings implements SettingsStruct {
|
|||||||
icon: this.#icon,
|
icon: this.#icon,
|
||||||
ledgerConn: this.#ledgerConn,
|
ledgerConn: this.#ledgerConn,
|
||||||
locking: this.#locking,
|
locking: this.#locking,
|
||||||
|
notification: this.#notification,
|
||||||
prefix: this.#prefix,
|
prefix: this.#prefix,
|
||||||
uiMode: this.#uiMode,
|
uiMode: this.#uiMode,
|
||||||
uiTheme: this.#uiTheme
|
uiTheme: this.#uiTheme
|
||||||
@@ -170,6 +178,7 @@ export class Settings implements SettingsStruct {
|
|||||||
this.#i18nLang = settings.i18nLang || this.#i18nLang;
|
this.#i18nLang = settings.i18nLang || this.#i18nLang;
|
||||||
this.#icon = settings.icon || this.#icon;
|
this.#icon = settings.icon || this.#icon;
|
||||||
this.#locking = settings.locking || this.#locking;
|
this.#locking = settings.locking || this.#locking;
|
||||||
|
this.#notification = settings.notification || this.#notification;
|
||||||
this.#prefix = isUndefined(settings.prefix) ? this.#prefix : settings.prefix;
|
this.#prefix = isUndefined(settings.prefix) ? this.#prefix : settings.prefix;
|
||||||
this.#uiMode = settings.uiMode || this.#uiMode;
|
this.#uiMode = settings.uiMode || this.#uiMode;
|
||||||
this.#uiTheme = settings.uiTheme || this.#uiTheme;
|
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 { ENDPOINT_DEFAULT, ENDPOINTS } from './endpoints';
|
||||||
import { LEDGER_CONN, LEDGER_CONN_DEFAULT } from './ledger';
|
import { LEDGER_CONN, LEDGER_CONN_DEFAULT } from './ledger';
|
||||||
import { PREFIX_DEFAULT, PREFIXES } from './ss58';
|
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';
|
const CAMERA_DEFAULT = 'off';
|
||||||
|
|
||||||
@@ -57,6 +57,7 @@ export {
|
|||||||
LEDGER_CONN,
|
LEDGER_CONN,
|
||||||
LOCKING_DEFAULT,
|
LOCKING_DEFAULT,
|
||||||
LOCKING,
|
LOCKING,
|
||||||
|
NOTIFICATION_DEFAULT,
|
||||||
PREFIX_DEFAULT,
|
PREFIX_DEFAULT,
|
||||||
PREFIXES,
|
PREFIXES,
|
||||||
UIMODE_DEFAULT,
|
UIMODE_DEFAULT,
|
||||||
|
|||||||
@@ -70,11 +70,14 @@ const ICONS: Option[] = [
|
|||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const NOTIFICATION_DEFAULT = 'popup';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
ICON_DEFAULT,
|
ICON_DEFAULT,
|
||||||
ICON_DEFAULT_HOST,
|
ICON_DEFAULT_HOST,
|
||||||
ICONS,
|
ICONS,
|
||||||
LANGUAGE_DEFAULT,
|
LANGUAGE_DEFAULT,
|
||||||
|
NOTIFICATION_DEFAULT,
|
||||||
UIMODE_DEFAULT,
|
UIMODE_DEFAULT,
|
||||||
UIMODES,
|
UIMODES,
|
||||||
UITHEME_DEFAULT,
|
UITHEME_DEFAULT,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export interface SettingsStruct {
|
|||||||
icon: string;
|
icon: string;
|
||||||
ledgerConn: string;
|
ledgerConn: string;
|
||||||
locking: string;
|
locking: string;
|
||||||
|
notification: string;
|
||||||
prefix: number;
|
prefix: number;
|
||||||
uiMode: string;
|
uiMode: string;
|
||||||
uiTheme: string;
|
uiTheme: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user