mirror of
https://github.com/pezkuwichain/pezkuwi-ui.git
synced 2026-07-20 18:35:42 +00:00
Camera settings (#234)
This commit is contained in:
@@ -25,8 +25,8 @@
|
|||||||
"react": "*"
|
"react": "*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^1.5.1",
|
"@polkadot/keyring": "^1.6.1",
|
||||||
"@polkadot/util-crypto": "^1.5.1",
|
"@polkadot/util-crypto": "^1.6.1",
|
||||||
"xmlserializer": "^0.6.1"
|
"xmlserializer": "^0.6.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,9 +30,9 @@
|
|||||||
"store": "^2.0.12"
|
"store": "^2.0.12"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/keyring": "^1.5.1",
|
"@polkadot/keyring": "^1.6.1",
|
||||||
"@polkadot/types": "^0.95.0-beta.30",
|
"@polkadot/types": "^0.95.0-beta.33",
|
||||||
"@polkadot/util": "^1.5.1"
|
"@polkadot/util": "^1.6.1"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"@ledgerhq/hw-transport-node-hid": "^4.72.2"
|
"@ledgerhq/hw-transport-node-hid": "^4.72.2"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
"store": "^2.0.12"
|
"store": "^2.0.12"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/util": "^1.5.1"
|
"@polkadot/util": "^1.6.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@polkadot/util": "*"
|
"@polkadot/util": "*"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import EventEmitter from 'eventemitter3';
|
|||||||
import store from 'store';
|
import store from 'store';
|
||||||
import { isUndefined } from '@polkadot/util';
|
import { isUndefined } from '@polkadot/util';
|
||||||
|
|
||||||
import { CRYPTOS, ENDPOINT_DEFAULT, ENDPOINTS, ICON_DEFAULT, ICONS, LANGUAGE_DEFAULT, LANGUAGES, LEDGER_CONN, LEDGER_CONN_DEFAULT, LOCKING_DEFAULT, LOCKING, PREFIX_DEFAULT, PREFIXES, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from './defaults';
|
import { CAMERA_DEFAULT, CAMERA, CRYPTOS, ENDPOINT_DEFAULT, ENDPOINTS, ICON_DEFAULT, ICONS, LANGUAGE_DEFAULT, LANGUAGES, LEDGER_CONN, LEDGER_CONN_DEFAULT, LOCKING_DEFAULT, LOCKING, PREFIX_DEFAULT, PREFIXES, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from './defaults';
|
||||||
import { Option, SettingsStruct } from './types';
|
import { Option, SettingsStruct } from './types';
|
||||||
|
|
||||||
type ChangeCallback = (settings: SettingsStruct) => void;
|
type ChangeCallback = (settings: SettingsStruct) => void;
|
||||||
@@ -15,6 +15,8 @@ type OnTypes = 'change';
|
|||||||
export class Settings implements SettingsStruct {
|
export class Settings implements SettingsStruct {
|
||||||
private _apiUrl: string;
|
private _apiUrl: string;
|
||||||
|
|
||||||
|
private _camera: string;
|
||||||
|
|
||||||
private _emitter: EventEmitter;
|
private _emitter: EventEmitter;
|
||||||
|
|
||||||
private _i18nLang: string;
|
private _i18nLang: string;
|
||||||
@@ -37,6 +39,7 @@ export class Settings implements SettingsStruct {
|
|||||||
this._emitter = new EventEmitter();
|
this._emitter = new EventEmitter();
|
||||||
|
|
||||||
this._apiUrl = settings.apiUrl || process.env.WS_URL || ENDPOINT_DEFAULT;
|
this._apiUrl = settings.apiUrl || process.env.WS_URL || ENDPOINT_DEFAULT;
|
||||||
|
this._camera = settings.camera || CAMERA_DEFAULT;
|
||||||
this._ledgerConn = settings.ledgerConn || LEDGER_CONN_DEFAULT;
|
this._ledgerConn = settings.ledgerConn || LEDGER_CONN_DEFAULT;
|
||||||
this._i18nLang = settings.i18nLang || LANGUAGE_DEFAULT;
|
this._i18nLang = settings.i18nLang || LANGUAGE_DEFAULT;
|
||||||
this._icon = settings.icon || ICON_DEFAULT;
|
this._icon = settings.icon || ICON_DEFAULT;
|
||||||
@@ -46,6 +49,10 @@ export class Settings implements SettingsStruct {
|
|||||||
this._uiTheme = settings.uiTheme || UITHEME_DEFAULT;
|
this._uiTheme = settings.uiTheme || UITHEME_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get camera (): string {
|
||||||
|
return this._camera;
|
||||||
|
}
|
||||||
|
|
||||||
public get apiUrl (): string {
|
public get apiUrl (): string {
|
||||||
return this._apiUrl;
|
return this._apiUrl;
|
||||||
}
|
}
|
||||||
@@ -78,6 +85,10 @@ export class Settings implements SettingsStruct {
|
|||||||
return this._uiTheme;
|
return this._uiTheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get availableCamera (): Option[] {
|
||||||
|
return CAMERA;
|
||||||
|
}
|
||||||
|
|
||||||
public get availableCryptos (): Option[] {
|
public get availableCryptos (): Option[] {
|
||||||
return CRYPTOS;
|
return CRYPTOS;
|
||||||
}
|
}
|
||||||
@@ -117,6 +128,7 @@ export class Settings implements SettingsStruct {
|
|||||||
public get (): SettingsStruct {
|
public get (): SettingsStruct {
|
||||||
return {
|
return {
|
||||||
apiUrl: this._apiUrl,
|
apiUrl: this._apiUrl,
|
||||||
|
camera: this._camera,
|
||||||
i18nLang: this._i18nLang,
|
i18nLang: this._i18nLang,
|
||||||
icon: this._icon,
|
icon: this._icon,
|
||||||
ledgerConn: this._ledgerConn,
|
ledgerConn: this._ledgerConn,
|
||||||
@@ -129,6 +141,7 @@ export class Settings implements SettingsStruct {
|
|||||||
|
|
||||||
public set (settings: Partial<SettingsStruct>): void {
|
public set (settings: Partial<SettingsStruct>): void {
|
||||||
this._apiUrl = settings.apiUrl || this._apiUrl;
|
this._apiUrl = settings.apiUrl || this._apiUrl;
|
||||||
|
this._camera = settings.camera || this._camera;
|
||||||
this._ledgerConn = settings.ledgerConn || this._ledgerConn;
|
this._ledgerConn = settings.ledgerConn || this._ledgerConn;
|
||||||
this._i18nLang = settings.i18nLang || this._i18nLang;
|
this._i18nLang = settings.i18nLang || this._i18nLang;
|
||||||
this._icon = settings.icon || this._icon;
|
this._icon = settings.icon || this._icon;
|
||||||
|
|||||||
@@ -10,6 +10,21 @@ import { LEDGER_CONN, LEDGER_CONN_DEFAULT } from './ledger';
|
|||||||
import { PREFIXES, PREFIX_DEFAULT } from './ss58';
|
import { PREFIXES, PREFIX_DEFAULT } from './ss58';
|
||||||
import { ICON_DEFAULT, ICON_DEFAULT_HOST, ICONS, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from './ui';
|
import { ICON_DEFAULT, ICON_DEFAULT_HOST, ICONS, UIMODE_DEFAULT, UIMODES, UITHEME_DEFAULT, UITHEMES } from './ui';
|
||||||
|
|
||||||
|
const CAMERA_DEFAULT = 'on';
|
||||||
|
|
||||||
|
const CAMERA: Option[] = [
|
||||||
|
{
|
||||||
|
info: 'on',
|
||||||
|
text: 'Allow camera access',
|
||||||
|
value: 'on'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
info: 'off',
|
||||||
|
text: 'Do not allow camera access',
|
||||||
|
value: 'off'
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
const LANGUAGE_DEFAULT = 'default';
|
const LANGUAGE_DEFAULT = 'default';
|
||||||
|
|
||||||
const LANGUAGES: Option[] = [
|
const LANGUAGES: Option[] = [
|
||||||
@@ -36,6 +51,8 @@ const LOCKING: Option[] = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
CAMERA_DEFAULT,
|
||||||
|
CAMERA,
|
||||||
CRYPTOS,
|
CRYPTOS,
|
||||||
ENDPOINT_DEFAULT,
|
ENDPOINT_DEFAULT,
|
||||||
ENDPOINTS,
|
ENDPOINTS,
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ export type Option = {
|
|||||||
|
|
||||||
export interface SettingsStruct {
|
export interface SettingsStruct {
|
||||||
apiUrl: string;
|
apiUrl: string;
|
||||||
|
camera: string;
|
||||||
i18nLang: string;
|
i18nLang: string;
|
||||||
icon: string;
|
icon: string;
|
||||||
ledgerConn: string;
|
ledgerConn: string;
|
||||||
|
|||||||
@@ -17,6 +17,6 @@
|
|||||||
"@polkadot/util-crypto": "*"
|
"@polkadot/util-crypto": "*"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@polkadot/util-crypto": "^1.5.1"
|
"@polkadot/util-crypto": "^1.6.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
{
|
{
|
||||||
"extends": "./node_modules/@polkadot/dev/config/tsconfig",
|
"extends": "./node_modules/@polkadot/dev/config/tsconfig",
|
||||||
|
"exclude": [
|
||||||
|
"build/**/*",
|
||||||
|
"**/build/**/*"
|
||||||
|
],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
"paths": {
|
"paths": {
|
||||||
|
|||||||
@@ -2140,14 +2140,14 @@
|
|||||||
typescript "^3.6.4"
|
typescript "^3.6.4"
|
||||||
vuepress "^1.2.0"
|
vuepress "^1.2.0"
|
||||||
|
|
||||||
"@polkadot/keyring@^1.5.1":
|
"@polkadot/keyring@^1.6.1":
|
||||||
version "1.5.1"
|
version "1.6.1"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-1.5.1.tgz#74091e246c9ce4bc15960f15afffdb3bb8e208c7"
|
resolved "https://registry.yarnpkg.com/@polkadot/keyring/-/keyring-1.6.1.tgz#35966afba142b647b31767e3a349652947c57a90"
|
||||||
integrity sha512-sp1uNK5FKs8Vnlvl/0NvlRZfu4KcCWtyIL6YFa3oH1iYnAmwEV+XekQwTNe4wXWJVXdjLi1Xvjxx2yGxQkWolw==
|
integrity sha512-ortPbweoaANKTKZR0JDbO796U6B3JGjj87yZD+ghlFRUWjMjlbP+LOWnfNyXHcI87yxNC23nK3YDv1KCl0eDUQ==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.6.2"
|
"@babel/runtime" "^7.6.3"
|
||||||
"@polkadot/util" "^1.5.1"
|
"@polkadot/util" "^1.6.1"
|
||||||
"@polkadot/util-crypto" "^1.5.1"
|
"@polkadot/util-crypto" "^1.6.1"
|
||||||
|
|
||||||
"@polkadot/ts@^0.1.82":
|
"@polkadot/ts@^0.1.82":
|
||||||
version "0.1.82"
|
version "0.1.82"
|
||||||
@@ -2156,10 +2156,10 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
"@types/chrome" "^0.0.91"
|
"@types/chrome" "^0.0.91"
|
||||||
|
|
||||||
"@polkadot/types@^0.95.0-beta.30":
|
"@polkadot/types@^0.95.0-beta.33":
|
||||||
version "0.95.0-beta.30"
|
version "0.95.0-beta.33"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.95.0-beta.30.tgz#2c5e6aa569b85b4eaedb3d892b4dcaab83eb63c3"
|
resolved "https://registry.yarnpkg.com/@polkadot/types/-/types-0.95.0-beta.33.tgz#bc2cd2f536bb061c926e13c0126c64dee53f24a9"
|
||||||
integrity sha512-qYcehtmDoXP2ygdPDAY8H/htHDFm6ZUhhUzEAJWALkMLNDCsJ+ZRb+U02TFg1hVvwJmRT0w9gBAeZ/kY2Oxrlg==
|
integrity sha512-d1M0z6r4vZ9kGEAaRYw9PI8s/TVCjjQAdmEfPtKPVj9uuoL8jW8TajAzA3Yvd4s/Y9F/0nNipHUg6w88UdgxYg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.6.3"
|
"@babel/runtime" "^7.6.3"
|
||||||
"@polkadot/util" "^1.5.1"
|
"@polkadot/util" "^1.5.1"
|
||||||
@@ -2189,6 +2189,28 @@
|
|||||||
tweetnacl "^1.0.1"
|
tweetnacl "^1.0.1"
|
||||||
xxhashjs "^0.2.2"
|
xxhashjs "^0.2.2"
|
||||||
|
|
||||||
|
"@polkadot/util-crypto@^1.6.1":
|
||||||
|
version "1.6.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@polkadot/util-crypto/-/util-crypto-1.6.1.tgz#6d924c5eaecbf98f971da1aac69fb60b17a4bf55"
|
||||||
|
integrity sha512-Dbo5qsIGKO82HpkysFKh9GDY0w6O6tX9h5HPRDy4KIaTaCo3H5QTmxit+hPU9n3PIHsxGhnyPq8q1i2wD/iWYQ==
|
||||||
|
dependencies:
|
||||||
|
"@babel/runtime" "^7.6.3"
|
||||||
|
"@polkadot/util" "^1.6.1"
|
||||||
|
"@polkadot/wasm-crypto" "^0.14.1"
|
||||||
|
"@types/bip39" "^2.4.2"
|
||||||
|
"@types/bs58" "^4.0.0"
|
||||||
|
"@types/pbkdf2" "^3.0.0"
|
||||||
|
"@types/secp256k1" "^3.5.0"
|
||||||
|
"@types/xxhashjs" "^0.2.1"
|
||||||
|
base-x "3.0.5"
|
||||||
|
bip39 "^2.5.0"
|
||||||
|
blakejs "^1.1.0"
|
||||||
|
bs58 "^4.0.1"
|
||||||
|
js-sha3 "^0.8.0"
|
||||||
|
secp256k1 "^3.7.0"
|
||||||
|
tweetnacl "^1.0.1"
|
||||||
|
xxhashjs "^0.2.2"
|
||||||
|
|
||||||
"@polkadot/util@^1.5.1":
|
"@polkadot/util@^1.5.1":
|
||||||
version "1.5.1"
|
version "1.5.1"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-1.5.1.tgz#acc6d1fd041959a1a781ee2a4d0fc8dae99d4e1a"
|
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-1.5.1.tgz#acc6d1fd041959a1a781ee2a4d0fc8dae99d4e1a"
|
||||||
@@ -2202,6 +2224,19 @@
|
|||||||
ip-regex "^4.1.0"
|
ip-regex "^4.1.0"
|
||||||
moment "^2.24.0"
|
moment "^2.24.0"
|
||||||
|
|
||||||
|
"@polkadot/util@^1.6.1":
|
||||||
|
version "1.6.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/@polkadot/util/-/util-1.6.1.tgz#8110c12a1670e564c5d6a1c19347cbb0dba8a3ce"
|
||||||
|
integrity sha512-uKRfapAXwZMcWQ24MdV+zg8jrYtidbKxJhUbq0G77Yy27d45OID8d+JcI3Q+d6d2pmC/h733iSeCqdiLYCKqMw==
|
||||||
|
dependencies:
|
||||||
|
"@babel/runtime" "^7.6.3"
|
||||||
|
"@types/bn.js" "^4.11.5"
|
||||||
|
bn.js "^4.11.8"
|
||||||
|
camelcase "^5.3.1"
|
||||||
|
chalk "^2.4.2"
|
||||||
|
ip-regex "^4.1.0"
|
||||||
|
moment "^2.24.0"
|
||||||
|
|
||||||
"@polkadot/wasm-crypto@^0.14.1":
|
"@polkadot/wasm-crypto@^0.14.1":
|
||||||
version "0.14.1"
|
version "0.14.1"
|
||||||
resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-0.14.1.tgz#f4923bba22d7c68a4be3575ba27790947b212633"
|
resolved "https://registry.yarnpkg.com/@polkadot/wasm-crypto/-/wasm-crypto-0.14.1.tgz#f4923bba22d7c68a4be3575ba27790947b212633"
|
||||||
|
|||||||
Reference in New Issue
Block a user