Don't get stuck on user input

This commit is contained in:
RMidhunSuresh 2023-05-15 23:01:43 +05:30
parent 2ef934c39d
commit 901c149e9e

View File

@ -75,7 +75,9 @@ export class CalculateSASStage extends BaseSASVerificationStage {
const sasBytes = this.generateSASBytes(); const sasBytes = this.generateSASBytes();
this.emoji = generateEmojiSas(Array.from(sasBytes)); this.emoji = generateEmojiSas(Array.from(sasBytes));
this.eventEmitter.emit("EmojiGenerated", this); this.eventEmitter.emit("EmojiGenerated", this);
await emojiConfirmationPromise; const cancellationReceived = this.channel.waitForEvent(VerificationEventType.Cancel);
// Don't get stuck on waiting for user input!
await Promise.race([emojiConfirmationPromise, cancellationReceived]);
this.setNextStage(new SendMacStage(this.options)); this.setNextStage(new SendMacStage(this.options));
}); });
} }