add custom text for confirm modal buttons
This commit is contained in:
parent
27fee8e10c
commit
0aa370aeb9
|
@ -100,6 +100,8 @@ export default new class E2EE extends BuiltinModule {
|
|||
if (ECDH_STORAGE.hasOwnProperty(dmChannelID)) {
|
||||
delete ECDH_STORAGE[dmChannelID];
|
||||
Toasts.error('Key exchange expired!');
|
||||
if (this.preExchangeState) this.encryptNewMessages = this.preExchangeState;
|
||||
this.preExchangeState = null;
|
||||
}
|
||||
}, 30000);
|
||||
return Security.generateECDHKeys(ECDH_STORAGE[dmChannelID]);
|
||||
|
@ -131,9 +133,9 @@ export default new class E2EE extends BuiltinModule {
|
|||
const splitContent = component.props.message.content.split('\n');
|
||||
if (splitContent.length < 5) return;
|
||||
const [tagstart, begin, key, end, tagend] = splitContent;
|
||||
console.log(component);
|
||||
|
||||
try {
|
||||
await Modals.confirm('Key Exhcange', 'Public key received. Accept?').promise;
|
||||
await Modals.confirm('Key Exhchange', 'Public key received. Accept?', 'Accept', 'Reject').promise;
|
||||
// We already sent our key
|
||||
if (!ECDH_STORAGE.hasOwnProperty(channelId)) {
|
||||
const publicKeyMessage = `\`\`\`\n-----BEGIN PUBLIC KEY-----\n${this.createKeyExchange(channelId)}\n-----END PUBLIC KEY-----\n\`\`\``;
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
<div slot="body" class="bd-modal-basic-body">{{ modal.text }}</div>
|
||||
<div slot="footer" class="bd-modal-controls">
|
||||
<div class="bd-flex-grow"></div>
|
||||
<div class="bd-button" @click="modal.close">Cancel</div>
|
||||
<div class="bd-button bd-ok" @click="() => { modal.confirm(); modal.close(); }">OK</div>
|
||||
<div class="bd-button" @click="modal.close">{{ modal.cancelText || 'Cancel' }}</div>
|
||||
<div class="bd-button bd-ok" @click="() => { modal.confirm(); modal.close(); }">{{ modal.confirmText || 'OK' }}</div>
|
||||
</div>
|
||||
</Modal>
|
||||
</template>
|
||||
|
|
|
@ -163,12 +163,12 @@ export default class Modals {
|
|||
* @param {String} text A string that will be displayed in the modal body
|
||||
* @return {Modal}
|
||||
*/
|
||||
static confirm(title, text) {
|
||||
return this.add(this.createConfirmModal(title, text));
|
||||
static confirm(title, text, confirmText, cancelText) {
|
||||
return this.add(this.createConfirmModal(title, text, confirmText, cancelText));
|
||||
}
|
||||
|
||||
static createConfirmModal(title, text) {
|
||||
const modal = { title, text };
|
||||
static createConfirmModal(title, text, confirmText, cancelText) {
|
||||
const modal = { title, text, confirmText, cancelText };
|
||||
modal.promise = new Promise((resolve, reject) => {
|
||||
modal.confirm = () => resolve(true);
|
||||
modal.beforeClose = () => reject();
|
||||
|
|
Loading…
Reference in New Issue