Merge branch 'multi-device' into paired_device_alias

pull/600/head
sachaaaaa 5 years ago committed by GitHub
commit 13572c3524
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -958,6 +958,9 @@
"provideDeviceAlias": {
"message": "Please provide an alias for this paired device"
},
"showPairingWordsTitle": {
"message": "Pairing Secret Words"
},
"clear": {
"message": "Clear"
},

@ -295,6 +295,14 @@
</div>
</script>
<script type='text/x-tmpl-mustache' id='device-pairing-words-dialog'>
<div class="content">
<h4>{{ title }}</h4>
<p>{{ secretWords }}</p>
<button id='close'>{{ closeText }}</button>
</div>
</script>
<script type='text/x-tmpl-mustache' id='beta-disclaimer-dialog'>
<div class="content">
<div class="betaDisclaimerView" style="display: none;">
@ -796,6 +804,7 @@
<script type='text/javascript' src='js/views/import_view.js'></script>
<script type='text/javascript' src='js/views/clear_data_view.js'></script>
<script type='text/javascript' src='js/views/device_pairing_dialog_view.js'></script>
<script type='text/javascript' src='js/views/device_pairing_words_dialog_view.js'></script>
<script type='text/javascript' src='js/wall_clock_listener.js'></script>
<script type='text/javascript' src='js/rotate_signed_prekey_listener.js'></script>

@ -799,6 +799,12 @@
}
});
Whisper.events.on('showDevicePairingWordsDialog', async () => {
if (appView) {
appView.showDevicePairingWordsDialog();
}
});
Whisper.events.on('calculatingPoW', ({ pubKey, timestamp }) => {
try {
const conversation = ConversationController.get(pubKey);

@ -224,6 +224,10 @@
});
this.el.append(dialog.el);
},
showDevicePairingWordsDialog() {
const dialog = new Whisper.DevicePairingWordsDialogView();
this.el.append(dialog.el);
},
showAddServerDialog() {
const dialog = new Whisper.AddServerDialogView();
this.el.append(dialog.el);

@ -0,0 +1,35 @@
/* global Whisper, i18n, textsecure */
// eslint-disable-next-line func-names
(function() {
'use strict';
window.Whisper = window.Whisper || {};
Whisper.DevicePairingWordsDialogView = Whisper.View.extend({
className: 'loki-dialog device-pairing-words-dialog modal',
templateName: 'device-pairing-words-dialog',
initialize() {
const pubKey = textsecure.storage.user.getNumber();
this.secretWords = window.mnemonic
.mn_encode(pubKey.slice(2), 'english')
.split(' ')
.slice(-3)
.join(' ');
this.render();
},
events: {
'click #close': 'close',
},
render_attributes() {
return {
title: i18n('showPairingWordsTitle'),
closeText: i18n('close'),
secretWords: this.secretWords,
};
},
close() {
this.remove();
},
});
})();

@ -381,6 +381,14 @@ export class MainHeader extends React.Component<Props, any> {
trigger('showDevicePairingDialog');
},
});
} else {
menuItems.push({
id: 'showPairingWords',
name: 'Show Pairing Words',
onClick: () => {
trigger('showDevicePairingWordsDialog');
},
});
}
this.setState({ menuItems });

Loading…
Cancel
Save