From e52542e0620cef9e9e68fe3577aa0583d29c6121 Mon Sep 17 00:00:00 2001 From: ue Date: Thu, 28 Nov 2019 22:02:24 +0300 Subject: [PATCH] added new api enhanced settings screen --- src/providers/esteem/esteem.js | 4 +- src/screens/settings/screen/settingsScreen.js | 471 +++++++++--------- 2 files changed, 229 insertions(+), 246 deletions(-) diff --git a/src/providers/esteem/esteem.js b/src/providers/esteem/esteem.js index aa8c0c52f..5abdfd4dc 100644 --- a/src/providers/esteem/esteem.js +++ b/src/providers/esteem/esteem.js @@ -4,10 +4,10 @@ import imageApi from '../../config/imageApi'; import serverList from '../../config/serverListApi'; import { jsonStringify } from '../../utils/jsonUtils'; import bugsnag from '../../config/bugsnag'; - +//market-data/currency-rate/USD/estm export const getCurrencyRate = currency => api - .get(`/currencyRate/${currency.toUpperCase()}/steem`) + .get(`/market-data/currency-rate/${currency.toUpperCase()}/steem`) .then(resp => resp.data) .catch(err => { console.log('err :', err); diff --git a/src/screens/settings/screen/settingsScreen.js b/src/screens/settings/screen/settingsScreen.js index dade3e7b0..832879ba1 100644 --- a/src/screens/settings/screen/settingsScreen.js +++ b/src/screens/settings/screen/settingsScreen.js @@ -1,5 +1,5 @@ /* eslint-disable react/jsx-wrap-multilines */ -import React, { PureComponent, Fragment } from 'react'; +import React, { Fragment } from 'react'; import { ScrollView, View, RefreshControl } from 'react-native'; import { injectIntl } from 'react-intl'; @@ -17,261 +17,244 @@ import { BasicHeader, SettingsItem, CollapsibleCard } from '../../../components' // Styles import styles from './settingsStyles'; -class SettingsScreen extends PureComponent { - /* Props - * ------------------------------------------------ - * @prop { type } name - Description.... - */ - constructor(props) { - super(props); - this.state = {}; - } +const SettingsScreen = ({ + handleOnChange, + intl, + isDarkTheme, + isPinCodeOpen, + isLoggedIn, + isNotificationSettingsOpen, + nsfw, + selectedApi, + selectedCurrency, + selectedLanguage, + serverList, + isNotificationMenuOpen, + commentNotification, + followNotification, + mentionNotification, + reblogNotification, + transfersNotification, + voteNotification, + handleOnButtonPress, + isLoading, +}) => { + return ( + + - // Component Life Cycles - - // Component Functions - // TODO: REFACTOR ME ! - render() { - const { - handleOnChange, - intl, - isDarkTheme, - isPinCodeOpen, - isLoggedIn, - isNotificationSettingsOpen, - nsfw, - selectedApi, - selectedCurrency, - selectedLanguage, - serverList, - isNotificationMenuOpen, - commentNotification, - followNotification, - mentionNotification, - reblogNotification, - transfersNotification, - voteNotification, - handleOnButtonPress, - isLoading, - } = this.props; - - return ( - - - - - } - > - + + } + > + + + + + groomingServerName(serverName))} + selectedOptionIndex={serverList.indexOf(selectedApi)} + defaultText={ + groomingServerName(selectedApi) || + intl.formatMessage({ + id: 'alert.checking', + }) + } + handleOnChange={handleOnChange} + /> + + intl.formatMessage({ + id: item, + }), + )} + selectedOptionIndex={parseInt(nsfw, 10)} + handleOnChange={handleOnChange} + /> + + {!!isLoggedIn && ( - - - groomingServerName(serverName))} - selectedOptionIndex={serverList.indexOf(selectedApi)} - defaultText={ - groomingServerName(selectedApi) || - intl.formatMessage({ - id: 'alert.checking', - }) - } - handleOnChange={handleOnChange} - /> - - intl.formatMessage({ - id: item, - }), - )} - selectedOptionIndex={parseInt(nsfw, 10)} - handleOnChange={handleOnChange} - /> - - {!!isLoggedIn && ( + )} + + {!!isLoggedIn && !!isPinCodeOpen && ( + + + // + )} + + {!!isLoggedIn && ( + + + } + noBorder + fitContent + locked + isExpanded={isNotificationSettingsOpen} + expanded={isNotificationMenuOpen} + > + - )} - - {!!isLoggedIn && !!isPinCodeOpen && ( - - - - // - )} + + + + + + - {!!isLoggedIn && ( - - - } - noBorder - fitContent - locked - isExpanded={isNotificationSettingsOpen} - expanded={isNotificationMenuOpen} - > - - - - - - - - - )} - - - - - - ); - } -} + )} + + + + + + ); +}; export default injectIntl(SettingsScreen);