Merge pull request #5989 from BlueWallet/scandismiss

FIX: DIsmissing Scanner would result in undefined reject
This commit is contained in:
GLaDOS 2024-01-07 20:37:44 +00:00 committed by GitHub
commit c72a716937
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 5 deletions

View file

@ -15,13 +15,14 @@ function scanQrHelper(
navigateFunc: (scr: string, params?: any) => void,
currentScreenName: string,
showFileImportButton = true,
onDismiss?: () => void,
): Promise<string | null> {
return requestCameraAuthorization().then(() => {
return new Promise(resolve => {
const params = {
showFileImportButton: Boolean(showFileImportButton),
onBarScanned: (data: any) => {},
onDismiss: () => {},
onDismiss,
};
params.onBarScanned = function (data: any) {
@ -29,10 +30,6 @@ function scanQrHelper(
navigateFunc(currentScreenName);
};
params.onDismiss = function () {
setTimeout(() => resolve(null), 1);
};
navigateFunc('ScanQRCodeRoot', {
screen: 'ScanQRCode',
params,

View file

@ -410,6 +410,8 @@ ScanQRCode.initialParams = {
urTotal: undefined,
urHave: undefined,
backdoorText: '',
onDismiss: undefined,
showFileImportButton: true,
backdoorVisible: false,
animatedQRCodeData: {},
};