mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
Constants rework
This commit is contained in:
parent
2f42a19987
commit
0a6a035750
|
@ -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"
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue