diff --git a/app/components/settings/icon.tsx b/app/components/settings/icon.tsx index 6455f4e7..0c2b2840 100644 --- a/app/components/settings/icon.tsx +++ b/app/components/settings/icon.tsx @@ -3,6 +3,7 @@ import Entypo from 'react-native-vector-icons/Entypo' import Ionicons from 'react-native-vector-icons/Ionicons' import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons' import Fontisto from 'react-native-vector-icons/Fontisto' +import { ActivityIndicator } from 'react-native' import * as CSS from '../../res/css' @@ -26,7 +27,7 @@ const _Icon: React.FC = ({ name }) => { } if (name === 'check') { - return + return } if (name === 'checkbox-passive') { @@ -46,7 +47,13 @@ const _Icon: React.FC = ({ name }) => { } if (name === 'copy') { - return + return ( + + ) + } + + if (name === 'spinner') { + return } throw new Error(`: wrong icon name supplied.`) diff --git a/app/screens/Debug.tsx b/app/screens/Debug.tsx index 078eb580..7a02b954 100644 --- a/app/screens/Debug.tsx +++ b/app/screens/Debug.tsx @@ -1,222 +1,204 @@ import React from 'react' -import { - Clipboard, - ScrollView, - Button, - Text, - ToastAndroid, - View, -} from 'react-native' +import { View, Text, ToastAndroid } from 'react-native' +import { NavigationEvents } from 'react-navigation' import { connect } from 'react-redux' -import uuid from 'uuid/v1' +import { StackNavigationOptions } from 'react-navigation-stack/lib/typescript/src/vendor/types' +import * as FS from 'react-native-fs' +import Share from 'react-native-share' import * as CSS from '../res/css' -import * as Cache from '../services/cache' +import { + SettingOrData, + headerStyle, + headerTitleStyle, + headerBackImage, + ScrollViewContainer, + PAD_BETWEEN_ITEMS, +} from '../components/settings' + +import Pad from '../components/Pad' import * as Store from '../store' import * as Services from '../services' -import QR from './WalletOverview/QR' - interface OwnProps {} interface StateProps { - chatsAmt: number - sentReqsAmt: number - receivedReqsAmt: number - ownPostsAmt: number - feedPostsAmt: number - followsAmt: number - host: string + err?: string debugModeEnabled: boolean - - online: boolean - - token: string - - deviceID: string - - err: string } interface DispatchProps { enableDebug(): void disableDebug(): void - tokenDidInvalidate(): void - hostWasSet(h: ''): void } type Props = OwnProps & StateProps & DispatchProps -class Debug extends React.PureComponent> { - state: Record = {} +interface State { + sharingWalletLog: boolean + sharingAPILog: boolean +} - mounted = false +class Debug extends React.PureComponent { + static navigationOptions: StackNavigationOptions = { + title: 'Debug', + headerStyle, + headerTitleAlign: 'center', + headerTitleStyle, + headerBackImage, + } + + state: State = { + sharingAPILog: false, + sharingWalletLog: false, + } - subs = [() => {}] + mounted = false componentDidMount() { this.mounted = true - const { host } = this.props - - const s = Services.rifle(host, `$user::currentHandshakeAddress::on`) - - s.on('$shock', (data: string) => { - this.setState({ - handshakeAddr: data, - }) - }) - - this.subs.push(() => { - s.off('*') - s.close() - }) - - this.props.enableDebug() - ToastAndroid.show('Debug mode enabled', 800) } componentWillUnmount() { this.mounted = false } - copyDeviceID = () => { - Clipboard.setString(this.props.deviceID) - ToastAndroid.show('Copied', 800) - } - - copyToken = () => { - Clipboard.setString(this.props.token) - ToastAndroid.show('Copied', 800) - } - - clearAuthData = () => { - Cache.writeStoredAuthData(null) - this.props.tokenDidInvalidate() - this.props.hostWasSet('') - } - - generateNewHandshakeNode = () => { - Services.post(`api/gun/put`, { - body: `$user>currentHandshakeAddress`, - value: uuid(), - }) + enableDebugMode = () => { + this.props.enableDebug() + ToastAndroid.show('Debug mode enabled', 800) } disableDebugMode = () => { this.props.disableDebug() } - render() { - const { - err, - chatsAmt, - deviceID, - feedPostsAmt, - followsAmt, - online, - ownPostsAmt, - receivedReqsAmt, - sentReqsAmt, - token, - debugModeEnabled, - } = this.props - - if (err) { - return ( - - {err} - - ) + toggleDebugMode = () => { + if (this.props.debugModeEnabled) { + this.disableDebugMode() + } else { + this.enableDebugMode() } + } - const { handshakeAddr } = this.state + shareWalletLog = async () => { + ToastAndroid.show('Coming soon', ToastAndroid.LONG) + // try { + // this.setState({ + // sharingWalletLog: true, + // }) - return ( - - A random Number: {Math.random().toString()} -