fix default name for linked device

pull/725/head
Audric Ackermann 6 years ago
parent e4def110f5
commit 805ccef7a1

@ -10,13 +10,13 @@ interface Props {
} }
interface State { interface State {
currentPubKey: string | null; currentPubKey: string | undefined;
accepted: boolean; accepted: boolean;
pubKeyRequests: Array<any>; pubKeyRequests: Array<any>;
currentView: 'filterRequestView' | 'qrcodeView'; currentView: 'filterRequestView' | 'qrcodeView';
errors: any; errors: any;
loading: boolean; loading: boolean;
deviceAlias: string | null; deviceAlias: string | undefined;
} }
export class DevicePairingDialog extends React.Component<Props, State> { export class DevicePairingDialog extends React.Component<Props, State> {
@ -33,13 +33,13 @@ export class DevicePairingDialog extends React.Component<Props, State> {
this.handleUpdateDeviceAlias = this.handleUpdateDeviceAlias.bind(this); this.handleUpdateDeviceAlias = this.handleUpdateDeviceAlias.bind(this);
this.state = { this.state = {
currentPubKey: null, currentPubKey: undefined,
accepted: false, accepted: false,
pubKeyRequests: Array(), pubKeyRequests: Array(),
currentView: 'qrcodeView', currentView: 'qrcodeView',
loading: false, loading: false,
errors: undefined, errors: undefined,
deviceAlias: null, deviceAlias: 'Unnamed Device',
}; };
} }
@ -59,7 +59,6 @@ export class DevicePairingDialog extends React.Component<Props, State> {
public renderFilterRequestsView() { public renderFilterRequestsView() {
const { currentPubKey, accepted, deviceAlias } = this.state; const { currentPubKey, accepted, deviceAlias } = this.state;
const secretWords = window.mnemonic.pubkey_to_secret_words(currentPubKey); const secretWords = window.mnemonic.pubkey_to_secret_words(currentPubKey);
const deviceAliasPlaceholder = 'Unnamed Device';
if (accepted) { if (accepted) {
return ( return (
@ -69,7 +68,7 @@ export class DevicePairingDialog extends React.Component<Props, State> {
onClose={this.closeDialog} onClose={this.closeDialog}
> >
<div className="session-modal__centered"> <div className="session-modal__centered">
<input onChange={this.handleUpdateDeviceAlias}>{deviceAliasPlaceholder}</input> <input type="text" onChange={this.handleUpdateDeviceAlias} value={deviceAlias} id={currentPubKey}/>
<div className="session-modal__button-group"> <div className="session-modal__button-group">
<SessionButton <SessionButton
text={window.i18n('ok')} text={window.i18n('ok')}
@ -170,11 +169,11 @@ export class DevicePairingDialog extends React.Component<Props, State> {
private reset() { private reset() {
this.setState({ this.setState({
currentPubKey: null, currentPubKey: undefined,
accepted: false, accepted: false,
pubKeyRequests: Array(), pubKeyRequests: Array(),
currentView: 'filterRequestView', currentView: 'filterRequestView',
deviceAlias: null, deviceAlias: 'Unnamed Device',
}); });
} }
@ -312,7 +311,7 @@ export class DevicePairingDialog extends React.Component<Props, State> {
if (!!trimmed) { if (!!trimmed) {
this.setState({ deviceAlias: trimmed }); this.setState({ deviceAlias: trimmed });
} else { } else {
this.setState({ deviceAlias: null }); this.setState({ deviceAlias: undefined });
} }
} }
} }

Loading…
Cancel
Save