Constants rework

This commit is contained in:
Vincent 2020-01-30 09:34:24 +11:00
parent 2f42a19987
commit 0a6a035750
5 changed files with 44 additions and 3 deletions

View file

@ -295,6 +295,9 @@
}
}
},
"capsLockOn": {
"message": "Caps lock is on."
},
"me": {
"message": "Me",
"description": "The label for yourself when shown in a group member list"

View file

@ -1,9 +1,9 @@
{
"name": "loki-messenger-desktop",
"name": "session-messenger-desktop",
"productName": "Session Messenger",
"description": "Private messaging from your desktop",
"repository": "https://github.com/loki-project/loki-messenger.git",
"version": "1.0.0-beta9",
"version": "1.0.0",
"license": "GPL-3.0",
"author": {
"name": "Loki Project",

View file

@ -31,6 +31,13 @@ export class SessionPasswordModal extends React.Component<Props, State> {
this.setPassword = this.setPassword.bind(this);
this.closeDialog = this.closeDialog.bind(this);
this.onKeyUp = this.onKeyUp.bind(this);
window.addEventListener('keyup', this.onKeyUp);
}
public componentDidMount() {
setTimeout(() => $('#password-modal-input').focus(), 100);
}
public render() {
@ -182,4 +189,17 @@ export class SessionPasswordModal extends React.Component<Props, State> {
this.props.onClose();
}
}
private async onKeyUp(event: any) {
const { onOk } = this.props;
const setPasswordFocussed =
$('#password-modal-input').is(':focus') ||
$('#password-modal-input-confirm').is(':focus');
if (event.key === 'Enter' && setPasswordFocussed) {
await this.setPassword(onOk);
}
event.preventDefault();
}
}

View file

@ -31,6 +31,10 @@ export class SessionPasswordPrompt extends React.PureComponent<{}, State> {
window.addEventListener('keyup', this.onKeyUp);
}
public componentDidMount() {
setTimeout(() => $('#password-prompt-input').focus(), 100);
}
public render() {
const showResetElements =
this.state.errorCount >= window.CONSTANTS.MAX_LOGIN_TRIES;
@ -56,7 +60,6 @@ export class SessionPasswordPrompt extends React.PureComponent<{}, State> {
<input
id="password-prompt-input"
type="password"
autoFocus={true}
defaultValue=""
placeholder={' '}
maxLength={window.CONSTANTS.MAX_PASSWORD_LENGTH}

View file

@ -68,9 +68,14 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
this.hasPassword();
this.refreshLinkedDevice = this.refreshLinkedDevice.bind(this);
this.onKeyUp = this.onKeyUp.bind(this);
window.addEventListener('keyup', this.onKeyUp);
}
public componentDidMount() {
setTimeout(() => $('#password-lock-input').focus(), 100);
window.Whisper.events.on('refreshLinkedDeviceList', async () => {
setTimeout(() => {
this.refreshLinkedDevice();
@ -552,4 +557,14 @@ export class SettingsView extends React.Component<SettingsViewProps, State> {
});
});
}
private async onKeyUp(event: any) {
const lockPasswordFocussed = $('#password-lock-input').is(':focus');
if (event.key === 'Enter' && lockPasswordFocussed) {
await this.validatePasswordLock();
}
event.preventDefault();
}
}