diff --git a/app/src/assets/stripe@2x.png b/app/src/assets/stripe@2x.png new file mode 100644 index 00000000..e377b672 Binary files /dev/null and b/app/src/assets/stripe@2x.png differ diff --git a/app/src/component/AppNavigator.js b/app/src/component/AppNavigator.js index d5251bb4..402501ee 100644 --- a/app/src/component/AppNavigator.js +++ b/app/src/component/AppNavigator.js @@ -1,10 +1,12 @@ import React from 'react'; +import AboutPage from '../page/about'; import DiscoverPage from '../page/discover'; import FilePage from '../page/file'; import SearchPage from '../page/search'; import SettingsPage from '../page/settings'; -import AboutPage from '../page/about'; import SplashScreen from '../page/splash'; +import TransactionHistoryPage from '../page/transactionHistory'; +import WalletPage from '../page/wallet'; import SearchInput from '../component/searchInput'; import { addNavigationHelpers, @@ -19,9 +21,10 @@ import { AsyncStorage, BackHandler, NativeModules, - TextInput + TextInput, + ToastAndroid } from 'react-native'; -import { SETTINGS } from 'lbry-redux'; +import { SETTINGS, doHideNotification, selectNotification } from 'lbry-redux'; import { makeSelectClientSetting } from '../redux/selectors/settings'; import Feather from 'react-native-vector-icons/Feather'; import discoverStyle from '../styles/discover'; @@ -55,8 +58,29 @@ const discoverStack = StackNavigator({ headerMode: 'screen', }); +const walletStack = StackNavigator({ + Wallet: { + screen: WalletPage, + navigationOptions: ({ navigation }) => ({ + title: 'Wallet', + headerLeft: navigation.navigate('DrawerOpen')} />, + headerRight: navigation.navigate('Search')} /> + }) + }, + TransactionHistory: { + screen: TransactionHistoryPage, + navigationOptions: { + title: 'Transaction History', + drawerLockMode: 'locked-closed' + } + } +}, { + headerMode: 'screen' +}); + const drawer = DrawerNavigator({ Discover: { screen: discoverStack }, + Wallet: { screen: walletStack }, Settings: { screen: SettingsPage, navigationOptions: { drawerLockMode: 'locked-closed' } }, About: { screen: AboutPage, navigationOptions: { drawerLockMode: 'locked-closed' } } }, { @@ -79,6 +103,8 @@ export const AppNavigator = new StackNavigator({ }); class AppWithNavigationState extends React.Component { + static supportedDisplayTypes = ['toast']; + componentWillMount() { AppState.addEventListener('change', this._handleAppStateChange); BackHandler.addEventListener('hardwareBackPress', function() { @@ -106,7 +132,33 @@ class AppWithNavigationState extends React.Component { AppState.removeEventListener('change', this._handleAppStateChange); BackHandler.removeEventListener('hardwareBackPress'); } - + + componentWillUpdate(nextProps) { + const { dispatch } = this.props; + const { notification } = nextProps; + if (notification) { + const { displayType, message } = notification; + let currentDisplayType; + if (displayType.length) { + for (let i = 0; i < displayType.length; i++) { + const type = displayType[i]; + if (AppWithNavigationState.supportedDisplayTypes.indexOf(type) > -1) { + currentDisplayType = type; + break; + } + } + } else if (AppWithNavigationState.supportedDisplayTypes.indexOf(displayType) > -1) { + currentDisplayType = displayType; + } + + if ('toast' === currentDisplayType) { + ToastAndroid.show(message, ToastAndroid.SHORT); + } + + dispatch(doHideNotification()); + } + } + _handleAppStateChange = (nextAppState) => { // Check if the app was suspended if (AppState.currentState && AppState.currentState.match(/inactive|background/)) { @@ -136,8 +188,9 @@ class AppWithNavigationState extends React.Component { const mapStateToProps = state => ({ nav: state.nav, + notification: selectNotification(state), keepDaemonRunning: makeSelectClientSetting(SETTINGS.KEEP_DAEMON_RUNNING)(state), showNsfw: makeSelectClientSetting(SETTINGS.SHOW_NSFW)(state) }); -export default connect(mapStateToProps)(AppWithNavigationState); \ No newline at end of file +export default connect(mapStateToProps)(AppWithNavigationState); diff --git a/app/src/component/address/index.js b/app/src/component/address/index.js new file mode 100644 index 00000000..9aaa4a3b --- /dev/null +++ b/app/src/component/address/index.js @@ -0,0 +1,7 @@ +import { connect } from 'react-redux'; +import { doNotify } from 'lbry-redux'; +import Address from './view'; + +export default connect(null, { + doNotify, +})(Address); diff --git a/app/src/component/address/view.js b/app/src/component/address/view.js new file mode 100644 index 00000000..1730dd27 --- /dev/null +++ b/app/src/component/address/view.js @@ -0,0 +1,29 @@ +// @flow +import * as React from 'react'; +import { Clipboard, Text, View } from 'react-native'; +import Button from '../button'; +import walletStyle from '../../styles/wallet'; + +type Props = { + address: string, + doNotify: ({ message: string, displayType: Array }) => void, +}; + +export default class Address extends React.PureComponent { + render() { + const { address, doNotify, style } = this.props; + + return ( + + {address || ''} +