Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
mergeMap(accounts => {
const data = encode({
accounts,
settings: {
pairExchanges: {},
currenciesSettings: {}
},
exporterName: "ledger-live-cli",
exporterVersion: "0.0.0"
});
const frames = dataToFrames(data, 80, 4);
if (opts.out) {
return of(Buffer.from(JSON.stringify(frames)).toString("base64"));
} else {
const qrObservables = frames.map(str =>
asQR(str).pipe(shareReplay())
);
return interval(300).pipe(
mergeMap(i => qrObservables[i % qrObservables.length])
);
}
}),
tap(() => console.clear()) // eslint-disable-line no-console
constructor(props) {
super()
const { accounts, settings } = props
const data = encode({
accounts,
settings,
exporterName: 'desktop',
exporterVersion: __APP_VERSION__,
})
this.chunks = dataToFrames(data, 160, 4)
setTimeout(() => {
const BRIDGESTREAM_DATA = Buffer.from(JSON.stringify(this.chunks)).toString('base64')
console.log(`BRIDGESTREAM_DATA=${BRIDGESTREAM_DATA}`) // eslint-disable-line
}, 500)
}
onBarCodeRead = ({ data }: { data: string }) => {
if (data && data !== this.lastData && !this.completed) {
this.lastData = data;
try {
this.frames = parseFramesReducer(this.frames, data);
this.setState({ progress: progressOfFrames(this.frames) });
if (areFramesComplete(this.frames)) {
try {
this.onResult(decode(framesToData(this.frames).toString()));
this.completed = true;
} catch (error) {
this.frames = null;
this.setState({ error, progress: 0 });
}
}
} catch (e) {
console.warn(e);
}
}
};
onBarCodeRead = ({ data }: { data: string }) => {
if (data && data !== this.lastData && !this.completed) {
this.lastData = data;
try {
this.frames = parseFramesReducer(this.frames, data);
this.setState({ progress: progressOfFrames(this.frames) });
if (areFramesComplete(this.frames)) {
try {
this.onResult(decode(framesToData(this.frames).toString()));
this.completed = true;
} catch (error) {
this.frames = null;
this.setState({ error, progress: 0 });
}
}
} catch (e) {
console.warn(e);
}
}
};
onBarCodeRead = ({ data }: { data: string }) => {
if (data && data !== this.lastData && !this.completed) {
this.lastData = data;
try {
this.frames = parseFramesReducer(this.frames, data);
this.setState({ progress: progressOfFrames(this.frames) });
if (areFramesComplete(this.frames)) {
try {
this.onResult(decode(framesToData(this.frames).toString()));
this.completed = true;
} catch (error) {
this.frames = null;
this.setState({ error, progress: 0 });
}
}
} catch (e) {
console.warn(e);
}
}
onBarCodeRead = ({ data }: { data: string }) => {
if (data && data !== this.lastData && !this.completed) {
this.lastData = data;
try {
this.frames = parseFramesReducer(this.frames, data);
this.setState({ progress: progressOfFrames(this.frames) });
if (areFramesComplete(this.frames)) {
try {
this.onResult(decode(framesToData(this.frames).toString()));
this.completed = true;
} catch (error) {
this.frames = null;
this.setState({ error, progress: 0 });
}
}
} catch (e) {
console.warn(e);
}
}
};
componentDidMount() {
const { navigation } = this.props;
const data = navigation.getParam("data");
if (data) {
const frames = data.reduce(parseFramesReducer, null);
if (areFramesComplete(frames)) {
this.onResult(decode(framesToData(frames).toString()));
}
}
}
componentDidMount() {
const { navigation } = this.props;
const data = navigation.getParam("data");
if (data) {
const frames = data.reduce(parseFramesReducer, null);
if (areFramesComplete(frames)) {
this.onResult(decode(framesToData(frames).toString()));
}
}
}