mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-09-19 17:46:33 +00:00
rm unused QRScanner
This commit is contained in:
parent
4dc116179c
commit
375dfc001f
@ -63,7 +63,6 @@
|
||||
"@noble/secp256k1": "^1.7.1",
|
||||
"@scure/bip32": "^1.1.3",
|
||||
"@scure/bip39": "^1.1.0",
|
||||
"@zxing/library": "^0.19.2",
|
||||
"aether-torrent": "^0.3.0",
|
||||
"bech32": "^2.0.0",
|
||||
"bech32-buffer": "^0.2.1",
|
||||
|
@ -21,7 +21,6 @@ import Torrent from './views/Torrent';
|
||||
import Component from './BaseComponent';
|
||||
import Helpers from './Helpers';
|
||||
import localState from './LocalState';
|
||||
import QRScanner from './QRScanner';
|
||||
|
||||
import '@fontsource/lato/400.css';
|
||||
import '@fontsource/lato/700.css';
|
||||
@ -62,7 +61,6 @@ class Main extends Component<Props, ReactState> {
|
||||
const activeRoute = e.url;
|
||||
this.setState({ activeRoute });
|
||||
localState.get('activeRoute').put(activeRoute);
|
||||
QRScanner.cleanupScanner();
|
||||
}
|
||||
|
||||
onClickOverlay(): void {
|
||||
|
@ -1,51 +0,0 @@
|
||||
let codeReader;
|
||||
|
||||
function startPrivKeyQRScanner() {
|
||||
return new Promise((resolve) => {
|
||||
startQRScanner('privkey-qr-video', (result) => {
|
||||
let qr = JSON.parse(result.text);
|
||||
if (qr.priv !== undefined) {
|
||||
resolve(qr);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function startChatLinkQRScanner(callback) {
|
||||
startQRScanner('chatlink-qr-video', callback);
|
||||
}
|
||||
|
||||
async function startQRScanner(videoElementId, callback) {
|
||||
const { BrowserQRCodeReader } = await import('@zxing/library');
|
||||
codeReader = new BrowserQRCodeReader();
|
||||
codeReader
|
||||
.decodeFromInputVideoDevice(undefined, videoElementId)
|
||||
.then((result) => {
|
||||
if (callback(result)) {
|
||||
cleanupScanner();
|
||||
}
|
||||
})
|
||||
.catch((err) => {
|
||||
if (err != undefined) {
|
||||
console.error(err);
|
||||
}
|
||||
if (codeReader != undefined && codeReader != null) {
|
||||
cleanupScanner();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function cleanupScanner() {
|
||||
if (codeReader != undefined || codeReader != null) {
|
||||
codeReader.reset();
|
||||
codeReader = null;
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
cleanupScanner,
|
||||
startQRScanner,
|
||||
startChatLinkQRScanner,
|
||||
startPrivKeyQRScanner,
|
||||
};
|
@ -623,7 +623,8 @@ class Note extends Component {
|
||||
<div
|
||||
key=${this.props.event.id}
|
||||
ref=${this.ref}
|
||||
class="msg ${s.isThumbnail ? 'thumbnail' : ''} ${this.props.asReply ? 'reply' : ''} ${this.props.standalone
|
||||
class="msg ${s.isThumbnail ? 'thumbnail' : ''} ${this.props.asReply ? 'reply' : ''} ${this
|
||||
.props.standalone
|
||||
? 'standalone'
|
||||
: ''} ${asQuote ? 'quote' : ''}
|
||||
${quoting ? 'quoting' : ''}
|
||||
|
Loading…
Reference in New Issue
Block a user