Skip to content
This repository has been archived by the owner on Oct 8, 2022. It is now read-only.

Ability to add external accounts via QR #127

Open
vikiival opened this issue Sep 1, 2020 · 0 comments
Open

Ability to add external accounts via QR #127

vikiival opened this issue Sep 1, 2020 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@vikiival
Copy link
Member

vikiival commented Sep 1, 2020

Having compatibility with Parity Signer adds huge UX improvement for users.

Easiest lib for reading QR

whole impl

<template>
  <div>
    <p class="error">{{ error }}</p>
    <qrcode-stream @decode="onDecode" @init="onInit" />
  </div>
</template>

<script lang="ts">
import { Component, Prop, PropSync, Vue, Watch, Emit } from 'vue-property-decorator';
// @ts-ignore
import { QrcodeStream } from 'vue-qrcode-reader'
const components = {
 QrcodeStream
}
@Component({
    components
})
export default class QRScanner extends Vue {
    private result: string = '';
    private error: string = '';
    @Emit('decode')
    private onDecode(result: string) {
      return result
    }
    @Emit('error')
    private handleError(error: Error) {
      return error;
    }
    private async onInit(promise: Promise<any>) {
      try {
        await promise
      } catch (error) {
          this.handleError(error);
        if (error.name === 'NotAllowedError') {
          this.error = "ERROR: you need to grant camera access permisson"
        } else if (error.name === 'NotFoundError') {
          this.error = "ERROR: no camera on this device"
        } else if (error.name === 'NotSupportedError') {
          this.error = "ERROR: secure context required (HTTPS, localhost)"
        } else if (error.name === 'NotReadableError') {
          this.error = "ERROR: is the camera already in use?"
        } else if (error.name === 'OverconstrainedError') {
          this.error = "ERROR: installed cameras are not suitable"
        } else if (error.name === 'StreamApiNotSupportedError') {
          this.error = "ERROR: Stream API is not supported in this browser"
        }
      }
    }
}
</script>
@vikiival vikiival added the enhancement New feature or request label Sep 1, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants