import Component from '@glimmer/component'; import { action } from '@ember/object'; import { inject as service } from '@ember/service'; import { on } from '@ember/modifier'; import { eq } from 'ember-truth-helpers'; import qrCode from '../modifiers/qr-code'; export default class NostrConnectComponent extends Component { @service nostrAuth; get hasExtension() { return typeof window !== 'undefined' && typeof window.nostr !== 'undefined'; } @action async connectExtension() { try { await this.nostrAuth.login('extension'); if (this.args.onConnect) { this.args.onConnect(); } } catch (e) { console.error(e); alert(e.message); } } @action async connectApp() { try { await this.nostrAuth.login('connect'); if (this.args.onConnect) { this.args.onConnect(); } } catch (e) { console.error(e); alert(e.message); } } }