diff --git a/BlueComponents.js b/BlueComponents.js index 2ea9021a5..18227f36e 100644 --- a/BlueComponents.js +++ b/BlueComponents.js @@ -25,13 +25,11 @@ import { import Clipboard from '@react-native-clipboard/clipboard'; import { BlurView } from '@react-native-community/blur'; import NetworkTransactionFees, { NetworkTransactionFee, NetworkTransactionFeeType } from './models/networkTransactionFees'; -import { encodeUR } from './blue_modules/ur'; import AsyncStorage from '@react-native-async-storage/async-storage'; import { useTheme } from '@react-navigation/native'; import { BlueCurrentTheme } from './components/themes'; import loc, { formatStringAddTwoWhiteSpaces } from './loc'; import { BlueStorageContext } from './blue_modules/storage-context'; -import QRCodeComponent from './components/QRCodeComponent'; const { height, width } = Dimensions.get('window'); const aspectRatio = height / width; @@ -1206,151 +1204,3 @@ export const BlueTabs = ({ active, onSwitch, tabs }) => ( ))} ); - -export class DynamicQRCode extends Component { - constructor() { - super(); - const qrCodeHeight = height > width ? width - 40 : width / 3; - const qrCodeMaxHeight = 370; - this.state = { - index: 0, - total: 0, - qrCodeHeight: Math.min(qrCodeHeight, qrCodeMaxHeight), - intervalHandler: null, - }; - } - - fragments = []; - - componentDidMount() { - const { value, capacity = 200 } = this.props; - this.fragments = encodeUR(value, capacity); - this.setState( - { - total: this.fragments.length, - }, - () => { - this.startAutoMove(); - }, - ); - } - - moveToNextFragment = () => { - const { index, total } = this.state; - if (index === total - 1) { - this.setState({ - index: 0, - }); - } else { - this.setState(state => ({ - index: state.index + 1, - })); - } - }; - - startAutoMove = () => { - if (!this.state.intervalHandler) - this.setState(() => ({ - intervalHandler: setInterval(this.moveToNextFragment, 500), - })); - }; - - stopAutoMove = () => { - clearInterval(this.state.intervalHandler); - this.setState(() => ({ - intervalHandler: null, - })); - }; - - moveToPreviousFragment = () => { - const { index, total } = this.state; - if (index > 0) { - this.setState(state => ({ - index: state.index - 1, - })); - } else { - this.setState(state => ({ - index: total - 1, - })); - } - }; - - render() { - const currentFragment = this.fragments[this.state.index]; - return currentFragment ? ( - - - - - - - - - {loc.formatString(loc._.of, { number: this.state.index + 1, total: this.state.total })} - - - - - - {loc.send.dynamic_prev} - - - {this.state.intervalHandler ? loc.send.dynamic_stop : loc.send.dynamic_start} - - - {loc.send.dynamic_next} - - - - ) : ( - - {loc.send.dynamic_init} - - ); - } -} - -const animatedQRCodeStyle = StyleSheet.create({ - container: { - flex: 1, - flexDirection: 'column', - alignItems: 'center', - }, - qrcodeContainer: { - alignItems: 'center', - justifyContent: 'center', - - margin: 6, - }, - controller: { - width: '90%', - flexDirection: 'row', - justifyContent: 'space-between', - alignItems: 'center', - borderRadius: 25, - height: 45, - paddingHorizontal: 18, - }, - button: { - alignItems: 'center', - height: 45, - justifyContent: 'center', - }, - text: { - fontSize: 14, - color: BlueCurrentTheme.colors.foregroundColor, - fontWeight: 'bold', - }, -}); diff --git a/screen/send/psbtWithHardwareWallet.js b/screen/send/psbtWithHardwareWallet.js index b73719e77..ccbe1cae3 100644 --- a/screen/send/psbtWithHardwareWallet.js +++ b/screen/send/psbtWithHardwareWallet.js @@ -20,19 +20,12 @@ import { isMacCatalina } from '../../blue_modules/environment'; import RNFS from 'react-native-fs'; import Biometric from '../../class/biometrics'; -import { - SecondButton, - BlueText, - SafeBlueArea, - BlueCard, - BlueSpacing20, - BlueCopyToClipboardButton, - DynamicQRCode, -} from '../../BlueComponents'; +import { SecondButton, BlueText, SafeBlueArea, BlueCard, BlueSpacing20, BlueCopyToClipboardButton } from '../../BlueComponents'; import navigationStyle from '../../components/navigationStyle'; import loc from '../../loc'; import { BlueStorageContext } from '../../blue_modules/storage-context'; import Notifications from '../../blue_modules/notifications'; +import { DynamicQRCode } from '../../components/DynamicQRCode'; const BlueElectrum = require('../../blue_modules/BlueElectrum'); const bitcoin = require('bitcoinjs-lib'); const fs = require('../../blue_modules/fs');