Skip to content

Not properly return a value after close button and still in await when the button clicked #81

Description

@charl-alvs
try {
      await this.loadingService.present('Opening Camera');

      const permissions = await Camera.checkPermissions();
      if (permissions.camera === 'granted') {
        await this.loadingService.dismiss();

        const result = await CapacitorBarcodeScanner.scanBarcode({
          hint: CapacitorBarcodeScannerTypeHint.QR_CODE,
          scanOrientation: CapacitorBarcodeScannerScanOrientation.PORTRAIT
        });

        this.scanResult.set(result.ScanResult);
      }
      else {
        // execute when camera permission denied
        await this.loadingService.dismiss();
        await this.alertService.show(
          'Oops!',
          'Failed to open camera. Please check permission.',
          AlertButtonType.OK
        );
        this.rescanner.set(true); // disable loop when permission denied
        this.navController.pop(); // pop back to last page
      }
    } 
    catch (error: any) {
      this.alertService.show(
        'Oops!',
        error || 'Something error',
        AlertButtonType.OK
      );
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions