From 7debdf912bb3a75d7d5e37a8fe938b0fb6269f25 Mon Sep 17 00:00:00 2001 From: Overtorment Date: Thu, 27 Sep 2018 20:29:13 +0100 Subject: [PATCH] REF: cleanup dead code --- MainBottomTabs.js | 15 ---- screen/receive.js | 16 ---- screen/receive/list.js | 98 ---------------------- screen/send.js | 17 ---- screen/send/list.js | 113 -------------------------- screen/transactions.js | 17 ---- screen/transactions/list.js | 158 ------------------------------------ 7 files changed, 434 deletions(-) delete mode 100644 screen/receive.js delete mode 100644 screen/receive/list.js delete mode 100644 screen/send.js delete mode 100644 screen/send/list.js delete mode 100644 screen/transactions.js delete mode 100644 screen/transactions/list.js diff --git a/MainBottomTabs.js b/MainBottomTabs.js index 37ff77a6..9b0efbc9 100644 --- a/MainBottomTabs.js +++ b/MainBottomTabs.js @@ -1,10 +1,7 @@ import { createStackNavigator } from 'react-navigation'; -import transactions from './screen/transactions'; import wallets from './screen/wallets'; -import send from './screen/send'; import settings from './screen/settings'; -import receive from './screen/receive'; const Tabs = createStackNavigator( { @@ -12,18 +9,6 @@ const Tabs = createStackNavigator( screen: wallets, path: 'wallets', }, - Transactions: { - screen: transactions, - path: 'trans', - }, - Send: { - screen: send, - path: 'cart', - }, - Receive: { - screen: receive, - path: 'receive', - }, Settings: { screen: settings, path: 'settings', diff --git a/screen/receive.js b/screen/receive.js deleted file mode 100644 index 0cdd895c..00000000 --- a/screen/receive.js +++ /dev/null @@ -1,16 +0,0 @@ -import { createStackNavigator } from 'react-navigation'; - -import list from './receive/list'; - -const ReceiveNavigator = createStackNavigator( - { - SendList: { - screen: list, - }, - }, - { - mode: 'modal', - }, -); - -export default ReceiveNavigator; diff --git a/screen/receive/list.js b/screen/receive/list.js deleted file mode 100644 index b3fcc966..00000000 --- a/screen/receive/list.js +++ /dev/null @@ -1,98 +0,0 @@ -import React, { Component } from 'react'; -import { FlatList, StyleSheet } from 'react-native'; -import { BlueLoading, SafeBlueArea, BlueCard, BlueListItem, BlueHeader } from '../../BlueComponents'; -import PropTypes from 'prop-types'; -/** @type {AppStorage} */ -let BlueApp = require('../../BlueApp'); -let EV = require('../../events'); -let loc = require('../../loc'); - -export default class ReceiveList extends Component { - constructor(props) { - super(props); - this.state = { - isLoading: true, - }; - this.walletsCount = 0; - EV(EV.enum.WALLETS_COUNT_CHANGED, () => { - return this.componentDidMount(); - }); - } - - async componentDidMount() { - console.log('receive/list - componentDidMount'); - let list = []; - - this.walletsCount = 0; - for (let w of BlueApp.getWallets()) { - list.push({ - title: w.getAddress(), - subtitle: w.getLabel(), - }); - this.walletsCount++; - } - - this.setState({ - isLoading: false, - list: list, - dataSource: list, - }); - } - - _keyExtractor = (item, index) => item.hash; - - render() { - const { navigate } = this.props.navigation; - - if (this.state.isLoading) { - return ; - } - - return ( - - - - - { - return ( - { - navigate('ReceiveDetails', { address: item.title }); - }} - leftIcon={{ - name: 'bitcoin', - type: 'font-awesome', - color: BlueApp.settings.foregroundColor, - }} - /> - ); - }} - /> - - - ); - } -} - -const Styles = StyleSheet.create({ - flatList: { - flex: 1, - }, -}); - -ReceiveList.propTypes = { - navigation: PropTypes.shape({ - navigate: PropTypes.func, - }), -}; diff --git a/screen/send.js b/screen/send.js deleted file mode 100644 index ec8e1377..00000000 --- a/screen/send.js +++ /dev/null @@ -1,17 +0,0 @@ -import { createStackNavigator } from 'react-navigation'; - -import list from './send/list'; - -const SendNavigator = createStackNavigator( - { - SendList: { - screen: list, - }, - }, - { - headerMode: 'none', - mode: 'modal', - }, -); - -export default SendNavigator; diff --git a/screen/send/list.js b/screen/send/list.js deleted file mode 100644 index 64f6d32a..00000000 --- a/screen/send/list.js +++ /dev/null @@ -1,113 +0,0 @@ -import React, { Component } from 'react'; -import { ActivityIndicator, View, FlatList, StyleSheet } from 'react-native'; -import Ionicons from 'react-native-vector-icons/Ionicons'; -import { SafeBlueArea, BlueCard, BlueListItem, BlueHeader } from '../../BlueComponents'; -import PropTypes from 'prop-types'; -let EV = require('../../events'); -/** @type {AppStorage} */ -let BlueApp = require('../../BlueApp'); -let loc = require('../../loc'); - -export default class SendList extends Component { - static navigationOptions = { - tabBarLabel: loc.send.list.tabBarLabel, - tabBarIcon: ({ tintColor, focused }) => ( - - ), - }; - - constructor(props) { - super(props); - this.state = { - isLoading: true, - }; - this.walletsCount = 0; - EV(EV.enum.WALLETS_COUNT_CHANGED, () => { - return this.componentDidMount(); - }); - } - - async componentDidMount() { - console.log('receive/list - componentDidMount'); - let list = []; - - this.walletsCount = 0; - for (let w of BlueApp.getWallets()) { - list.push({ - title: w.getAddress(), - subtitle: w.getLabel(), - }); - this.walletsCount++; - } - - this.setState({ - isLoading: false, - list: list, - dataSource: list, - }); - } - - _keyExtractor = (item, index) => item.hash; - - render() { - const { navigate } = this.props.navigation; - - if (this.state.isLoading) { - return ( - - - - - - ); - } - - return ( - - - - - { - return ( - { - navigate('SendDetails', { fromAddress: item.title }); - }} - leftIcon={{ - name: 'bitcoin', - type: 'font-awesome', - color: BlueApp.settings.foregroundColor, - }} - /> - ); - }} - /> - - - ); - } -} - -const Styles = StyleSheet.create({ - flatList: { - flex: 1, - }, -}); - -SendList.propTypes = { - navigation: PropTypes.shape({ - navigate: PropTypes.func, - }), -}; diff --git a/screen/transactions.js b/screen/transactions.js deleted file mode 100644 index 27dcd4de..00000000 --- a/screen/transactions.js +++ /dev/null @@ -1,17 +0,0 @@ -import { createStackNavigator } from 'react-navigation'; - -import list from './transactions/list'; - -const TransactionsNavigator = createStackNavigator( - { - TransactionsList: { - screen: list, - }, - }, - { - headerMode: 'none', - mode: 'modal', - }, -); - -export default TransactionsNavigator; diff --git a/screen/transactions/list.js b/screen/transactions/list.js deleted file mode 100644 index bf440966..00000000 --- a/screen/transactions/list.js +++ /dev/null @@ -1,158 +0,0 @@ -import React, { Component } from 'react'; -import { FlatList } from 'react-native'; -import Ionicons from 'react-native-vector-icons/Ionicons'; -import { Header, Icon } from 'react-native-elements'; -import { BlueLoading, BlueList, SafeBlueArea, BlueCard, BlueText, BlueListItem } from '../../BlueComponents'; -import PropTypes from 'prop-types'; -let loc = require('../../loc'); -let EV = require('../../events'); -/** @type {AppStorage} */ -let BlueApp = require('../../BlueApp'); - -export default class TransactionsList extends Component { - static navigationOptions = { - tabBarLabel: loc.transactions.list.tabBarLabel, - tabBarIcon: ({ tintColor, focused }) => ( - - ), - }; - - constructor(props) { - super(props); - this.state = { - isLoading: true, - }; - - EV(EV.enum.TRANSACTIONS_COUNT_CHANGED, this.refreshFunction.bind(this)); - } - - async componentDidMount() { - console.log('transaction/list- componentDidMount'); - this.refreshFunction(); - } // end - - refreshFunction() { - this.setState( - { - isLoading: true, - }, - () => { - setTimeout(() => { - this.setState({ - isLoading: false, - final_balance: BlueApp.getBalance(), - dataSource: BlueApp.getTransactions(), - }); - }, 1); - }, - ); - } - - txMemo(hash) { - if (BlueApp.tx_metadata[hash] && BlueApp.tx_metadata[hash]['memo']) { - return ' | ' + BlueApp.tx_metadata[hash]['memo']; - } - return ''; - } - - refresh() { - this.setState( - { - isLoading: true, - }, - async function() { - let that = this; - setTimeout(async function() { - // more responsive - let noErr = true; - try { - await BlueApp.fetchWalletTransactions(); - await BlueApp.fetchWalletBalances(); - } catch (err) { - noErr = false; - console.warn(err); - } - if (noErr) await BlueApp.saveToDisk(); // caching - EV(EV.enum.WALLETS_COUNT_CHANGED); // TODO: some other event type? - that.setState({ - isLoading: false, - final_balance: BlueApp.getBalance(), - dataSource: BlueApp.getTransactions(), - }); - }, 10); - }, - ); - } - - _keyExtractor = (item, index) => item.hash; - - render() { - console.warn(this.state.dataSource); - const { navigate } = this.props.navigation; - - if (this.state.isLoading) { - return ; - } - - return ( - -
this.refresh()} />} - /> - - {loc.transactions.list.description} - - - { - return ( - { - return (rowData.confirmations && ((rowData.value < 0 && '#900') || '#080')) || '#ebebeb'; - })()} - name={(() => { - return (rowData.value < 0 && 'call-made') || 'call-received'; - })()} - /> - } - title={rowData.value / 100000000 + ' BTC' + this.txMemo(rowData.hash)} - subtitle={ - rowData.received - .replace(['T'], ' ') - .replace(['Z'], ' ') - .split('.')[0] + - ' | ' + - loc.transactions.list.conf + - ': ' + - rowData.confirmations + - '\nYOLO' - } - onPress={() => { - navigate('TransactionDetails', { hash: rowData.hash }); - }} - /> - ); - }} - /> - - - - ); - } -} - -TransactionsList.propTypes = { - navigation: PropTypes.shape({ - navigate: PropTypes.func, - }), -};