mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
lint and remove unused code
This commit is contained in:
parent
4ad62284fa
commit
b1406ed391
2 changed files with 10 additions and 98 deletions
|
@ -1,3 +1,4 @@
|
|||
/* eslint-disable no-plusplus */
|
||||
/* global
|
||||
Whisper,
|
||||
*/
|
||||
|
@ -14,18 +15,6 @@
|
|||
className: 'session-fullscreen',
|
||||
initialize() {
|
||||
this.render();
|
||||
|
||||
/*
|
||||
|
||||
this.$passwordInput = this.$('#password');
|
||||
this.$passwordConfirmationInput = this.$('#password-confirmation');
|
||||
this.$passwordInputError = this.$('.password-inputs .error');
|
||||
|
||||
this.pairingInterval = null;
|
||||
|
||||
this.onSecondaryDeviceRegistered = this.onSecondaryDeviceRegistered.bind(
|
||||
this
|
||||
); */
|
||||
},
|
||||
render() {
|
||||
this.session_registration_view = new Whisper.ReactWrapperView({
|
||||
|
@ -37,86 +26,7 @@
|
|||
this.$el.append(this.session_registration_view.el);
|
||||
return this;
|
||||
},
|
||||
/* events: {
|
||||
keyup: 'onKeyup',
|
||||
'validation input.number': 'onValidation',
|
||||
'click #request-voice': 'requestVoice',
|
||||
'click #request-sms': 'requestSMSVerification',
|
||||
'change #code': 'onChangeCode',
|
||||
'click #register': 'registerWithoutMnemonic',
|
||||
'click #register-mnemonic': 'registerWithMnemonic',
|
||||
'click #register-secondary-device': 'registerSecondaryDevice',
|
||||
'click #cancel-secondary-device': 'cancelSecondaryDevice',
|
||||
'click #back-button': 'onBack',
|
||||
'click #save-button': 'onSaveProfile',
|
||||
'change #mnemonic': 'onChangeMnemonic',
|
||||
'click #generate-mnemonic': 'onGenerateMnemonic',
|
||||
'change #mnemonic-display-language': 'onGenerateMnemonic',
|
||||
'click #copy-mnemonic': 'onCopyMnemonic',
|
||||
'click .section-toggle': 'toggleSection',
|
||||
'keyup #password': 'onValidatePassword',
|
||||
'keyup #password-confirmation': 'onValidatePassword',
|
||||
},
|
||||
|
||||
|
||||
onKeyup(event) {
|
||||
|
||||
const validName = this.sanitiseNameInput();
|
||||
switch (event.key) {
|
||||
case 'Enter':
|
||||
if (event.target.id === 'mnemonic') {
|
||||
this.registerWithMnemonic();
|
||||
} else if (event.target.id === 'primary-pubkey') {
|
||||
this.registerSecondaryDevice();
|
||||
} else if (validName) {
|
||||
this.onSaveProfile();
|
||||
}
|
||||
break;
|
||||
case 'Escape':
|
||||
case 'Esc':
|
||||
this.onBack();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
},
|
||||
|
||||
registerWithoutMnemonic() {
|
||||
const mnemonic = this.$('#mnemonic-display').text();
|
||||
const language = this.$('#mnemonic-display-language').val();
|
||||
this.showProfilePage(mnemonic, language);
|
||||
},
|
||||
|
||||
|
||||
|
||||
registerWithMnemonic() {
|
||||
const mnemonic = this.$('#mnemonic').val();
|
||||
const language = this.$('#mnemonic-language').val();
|
||||
try {
|
||||
window.mnemonic.mn_decode(mnemonic, language);
|
||||
} catch (error) {
|
||||
this.$('#mnemonic').addClass('error-input');
|
||||
this.$('#error').text(error);
|
||||
this.$('#error').show();
|
||||
return;
|
||||
}
|
||||
this.$('#error').hide();
|
||||
this.$('#mnemonic').removeClass('error-input');
|
||||
if (!mnemonic) {
|
||||
this.log('Please provide a mnemonic word list');
|
||||
} else {
|
||||
this.showProfilePage(mnemonic, language);
|
||||
}
|
||||
},
|
||||
onSaveProfile() {
|
||||
if (_.isEmpty(this.registrationParams)) {
|
||||
this.onBack();
|
||||
return;
|
||||
}
|
||||
|
||||
const { mnemonic, language } = this.registrationParams;
|
||||
this.register(mnemonic, language);
|
||||
},
|
||||
*/
|
||||
log(s) {
|
||||
window.log.info(s);
|
||||
this.$('#status').text(s);
|
||||
|
@ -207,11 +117,10 @@
|
|||
randomChar() {
|
||||
return this.chars[Math.floor(Math.random() * this.chars.length)];
|
||||
}
|
||||
|
||||
}
|
||||
window.Session = window.Session || {};
|
||||
|
||||
window.Session.setNewSessionID = (sessionID) => {
|
||||
window.Session.setNewSessionID = sessionID => {
|
||||
const el = document.querySelector('.session-signin-enter-session-id');
|
||||
const fx = new TextScramble(el);
|
||||
fx.setText(sessionID);
|
||||
|
|
|
@ -287,11 +287,14 @@ export class RegistrationTabs extends React.Component<Props, State> {
|
|||
}
|
||||
|
||||
private async onSignUpGenerateSessionIDClick() {
|
||||
this.setState({
|
||||
signUpMode: SignUpMode.SessionIDShown,
|
||||
}, () => {
|
||||
window.Session.setNewSessionID(this.state.hexGeneratedPubKey);
|
||||
});
|
||||
this.setState(
|
||||
{
|
||||
signUpMode: SignUpMode.SessionIDShown,
|
||||
},
|
||||
() => {
|
||||
window.Session.setNewSessionID(this.state.hexGeneratedPubKey);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private onSignUpGetStartedClick() {
|
||||
|
|
Loading…
Reference in a new issue