signal-desktop/js/views/safety_number_change_dialog_view.js
2020-10-26 15:48:44 -07:00

38 lines
1.1 KiB
JavaScript

/* global Whisper, Signal */
// eslint-disable-next-line func-names
(function() {
window.Whisper = window.Whisper || {};
Whisper.SafetyNumberChangeDialogView = Whisper.View.extend({
templateName: 'safety-number-change-dialog',
initialize(options) {
const dialog = new Whisper.ReactWrapperView({
Component: window.Signal.Components.SafetyNumberChangeDialog,
props: {
confirmText: options.confirmText,
contacts: options.contacts.map(contact => contact.format()),
i18n: window.i18n,
onCancel: () => {
dialog.remove();
this.remove();
options.reject();
},
onConfirm: () => {
dialog.remove();
this.remove();
options.resolve();
},
renderSafetyNumber(props) {
return Signal.State.Roots.createSafetyNumberViewer(
window.reduxStore,
props
);
},
},
});
this.$('.safety-number-change-dialog-wrapper').append(dialog.el);
},
});
})();