Merge pull request #28626 from element-hq/t3chguy/web-friendly-buffers

Remove usages of Buffer so we don't need to ship the polyfill
This commit is contained in:
Michael Telatynski
2024-12-04 22:10:30 +00:00
committed by GitHub
17 changed files with 24 additions and 34 deletions

View File

@@ -37,7 +37,6 @@ interface IState {
userCode?: string;
checkCode?: string;
failureReason?: FailureReason;
lastScannedCode?: Buffer;
}
export enum LoginWithQRFailureReason {
@@ -154,7 +153,7 @@ export default class LoginWithQR extends React.Component<IProps, IState> {
throw new Error("Rendezvous not found");
}
if (!this.state.lastScannedCode && this.state.rendezvous?.checkCode !== checkCode) {
if (this.state.rendezvous?.checkCode !== checkCode) {
this.setState({ failureReason: LoginWithQRFailureReason.CheckCodeMismatch });
return;
}
@@ -201,7 +200,6 @@ export default class LoginWithQR extends React.Component<IProps, IState> {
failureReason: undefined,
userCode: undefined,
checkCode: undefined,
lastScannedCode: undefined,
mediaPermissionError: false,
});
}

View File

@@ -12,7 +12,7 @@ import QRCode from "../QRCode";
interface IProps {
/** The data for the QR code. If `undefined`, a spinner is shown. */
qrCodeBytes: undefined | Buffer;
qrCodeBytes: undefined | Uint8ClampedArray;
}
export default class VerificationQRCode extends React.PureComponent<IProps> {

View File

@@ -46,7 +46,7 @@ interface IState {
* We attempt to calculate this once the verification request transitions into the "Ready" phase. If the other
* side cannot scan QR codes, it will remain `undefined`.
*/
qrCodeBytes: Buffer | undefined;
qrCodeBytes: Uint8ClampedArray | undefined;
sasEvent: ShowSasCallbacks | null;
emojiButtonClicked?: boolean;