Skip to content

Commit

Permalink
transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
waterFallFlow committed Dec 17, 2018
1 parent d810014 commit bf6d852
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 23 deletions.
13 changes: 8 additions & 5 deletions shared/components/ActionModal/WhiteListTips.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import * as whiteListActions from 'actions/whiteList'
import { whiteListAuthorizedSelector } from 'selectors/whiteList'
import BPImage from 'components/BPNativeComponents/BPImage'
import Images from 'resources/images'
import messges from 'resources/messages'
import styles from './styles'

@connect(
Expand Down Expand Up @@ -49,7 +50,7 @@ export default class WhiteListTips extends PureComponent {
}

render() {
const { value, selectedDapp, authorized } = this.props
const { value, selectedDapp, authorized, locale } = this.props
const accept = selectedDapp.get('accept')
const settingDisplay = selectedDapp.get('settingDisplay')
const settingEnabled = selectedDapp.get('settingEnabled')
Expand All @@ -63,11 +64,11 @@ export default class WhiteListTips extends PureComponent {

<View style={styles.titleContainer}>
<Text style={styles.text15}>
{(authorized && accept) ? ' ' : '开启白名单'}
{(authorized && accept) ? ' ' : messges[locale].transaction_detail_label_enable_whitelist}
</Text>
<View style={styles.titleSetting}>
<Text onPress={this.switchSetting} style={[styles.text14, { marginTop: -4 }, signedColor]}>
高级设置
{messges[locale].transaction_detail_button_advanced_settings}
</Text>
<Ionicons name={settingDisplay ? 'md-arrow-dropdown' : "md-arrow-dropright"} size={18} color={arrowColor} />
</View>
Expand All @@ -78,7 +79,9 @@ export default class WhiteListTips extends PureComponent {
<View style={styles.settingContainer}>
<View style={styles.textSettingDes}>
<BPImage source={Images.whiteList_warning} style={[styles.image, { marginRight: 10 }]} />
<Text style={styles.text12}> 打开高级设置,下次进行该操作时,无需进行弹框确认直接执行,开启后可前往钱包管理中关闭 </Text>
<Text style={styles.text12}>
{messges[locale].transaction_detail_text_agree_whitelist}
</Text>
</View>
<View style={styles.switchContainer}>
<Switch
Expand All @@ -101,7 +104,7 @@ export default class WhiteListTips extends PureComponent {
</TouchableOpacity>
<View style={styles.textContentDes}>
<Text style={styles.text12}>
您可以将此操作列入白名单,下次就不必在此授权。
{messges[locale].transaction_detail_text_agree_whitelist}
</Text>
</View>
</View>
Expand Down
7 changes: 4 additions & 3 deletions shared/components/WalletCard/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import CurrencyText from 'components/CurrencyText'
import LinearGradientContainer from 'components/LinearGradientContainer'
import { View, Text, TouchableWithoutFeedback } from 'react-native'
import Ionicons from 'react-native-vector-icons/Ionicons'
import messages from 'resources/messages'
import Colors from 'resources/colors'
import styles from './styles'

export default ({ accountType, accountName, balanceTitle, eosValue, eosAmount, active, colors, imported, onPress }) => (
export default ({ locale, accountType, accountName, balanceTitle, eosValue, eosAmount, active, colors, imported, onPress }) => (
<TouchableWithoutFeedback disabled={imported} onPress={onPress}>
<View style={styles.cardContainer}>
<LinearGradientContainer type="right" colors={imported ? Colors.disabled : colors} style={[styles.contentContainer, styles.topRadius]}>
Expand All @@ -22,15 +23,15 @@ export default ({ accountType, accountName, balanceTitle, eosValue, eosAmount, a
imported &&
<View style={[styles.textRadius, { paddingHorizontal: 6, paddingVertical: 3, marginLeft: 10 }]}>
<Text style={[styles.text12, { color: Colors.textColor_255_76_118 }]}>
已导入
{messages[locale].add_import_success_label_imported}
</Text>
</View>
}
{
active &&
<View style={[styles.textRadius, { paddingHorizontal: 6, paddingVertical: 3, marginLeft: 10 }]}>
<Text style={[styles.text12, { color: Colors.textColor_255_76_118 }]}>
当前钱包
{messages[locale].add_import_success_label_current}
</Text>
</View>
}
Expand Down
20 changes: 20 additions & 0 deletions shared/resources/messages/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,25 @@
"transaction_label_status_failed": "Failed",
"transaction_label_status_completed": "Completed",

"transaction_detail_label_enable_whitelist": "Enable whitelist",
"transaction_detail_button_advanced_settings": "Advanced",
"transaction_detail_text_agree_whitelist": "You can whitelist this action and don't have to authorize it next time.",
"transaction_detail_text_enable_advanced_settings": "You don't need to confirm transaction popup by enabling advanced. You can turn it off in wallet management.",

"wallet_mgmt_button_whitelist_detail": "Whitelist Details",
"wallet_mgmt_whitelist_title_whitelist": "Whitelist List",
"wallet_mgmt_whitelist_label_enabled_dapps": "Enabled DApps",
"wallet_mgmt_whitelist_label_advance_settings": "Advanced",
"wallet_mgmt_whitelist_text_no_enabled_dapps": "You have not authorized any whitelist DApps.",

"account_change_title_change": "Change Account",
"account_change_button_add_account": "Add",
"add_import_success_label_imported": "Imported",
"add_import_success_label_current": "Current",

"whitelist_title_tips": "Tips",
"whitelist_title_content": "DApp’s whitelist has moved to App Setting, meanwhile, we added an advanced mode to improve the experience. Do you wanna turn it on?",

"resource_label_available": "Available",
"resource_label_total": "Total",
"resource_label_used": "Used",
Expand Down Expand Up @@ -351,6 +370,7 @@
"settings_button_language": "Language",
"settings_button_currency": "Default Currency",
"settings_button_node": "Node Settings",
"settings_label_whitelist": "Whitelist",
"settings_node_label_default_node": "Default Node",
"settings_node_label_customized_node": "Custom Node",
"settings_node_button_add_node": "Add Node",
Expand Down
21 changes: 21 additions & 0 deletions shared/resources/messages/ko/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,26 @@
"transaction_detail_button_confirm": "확인",
"transaction_label_status_failed": "실패",
"transaction_label_status_completed": "완료",

"transaction_detail_label_enable_whitelist": "Enable whitelist",
"transaction_detail_button_advanced_settings": "Advanced",
"transaction_detail_text_agree_whitelist": "You can whitelist this action and don't have to authorize it next time.",
"transaction_detail_text_enable_advanced_settings": "You don't need to confirm transaction popup by enabling advanced. You can turn it off in wallet management.",

"wallet_mgmt_button_whitelist_detail": "Whitelist Details",
"wallet_mgmt_whitelist_title_whitelist": "Whitelist List",
"wallet_mgmt_whitelist_label_enabled_dapps": "Enabled DApps",
"wallet_mgmt_whitelist_label_advance_settings": "Advanced",
"wallet_mgmt_whitelist_text_no_enabled_dapps": "You have not authorized any whitelist DApps.",

"account_change_title_change": "Change Account",
"account_change_button_add_account": "Add",
"add_import_success_label_imported": "Imported",
"add_import_success_label_current": "Current",

"whitelist_title_tips": "Tips",
"whitelist_title_content": "DApp’s whitelist has moved to App Setting, meanwhile, we added an advanced mode to improve the experience. Do you wanna turn it on?",

"resource_label_available": "Available",
"resource_label_total": "Total",
"resource_label_used": "사용됨",
Expand Down Expand Up @@ -329,6 +349,7 @@
"settings_button_language": "언어",
"settings_button_currency": "시스템 언어",
"settings_button_node": "노드 설정",
"settings_label_whitelist": "Whitelist",
"settings_node_label_default_node": "시스템 노드",
"settings_node_label_customized_node": "커스텀 노드",
"settings_node_button_add_node": "노드 추가",
Expand Down
20 changes: 20 additions & 0 deletions shared/resources/messages/zh/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,25 @@
"transaction_label_status_failed": "已失败",
"transaction_label_status_completed": "已确认",

"transaction_detail_label_enable_whitelist": "开启白名单",
"transaction_detail_button_advanced_settings": "高级设置",
"transaction_detail_text_agree_whitelist": "您可以将此操作列入白名单,下次就不必再次授权。",
"transaction_detail_text_enable_advanced_settings": "打开高级设置,下次进行该操作时,无需进行弹窗确认直接执行,开启后可前往钱包管理中关闭",

"wallet_mgmt_button_whitelist_detail": "白名单详情",
"wallet_mgmt_whitelist_title_whitelist": "白名单列表",
"wallet_mgmt_whitelist_label_enabled_dapps": "已开启应用",
"wallet_mgmt_whitelist_label_advance_settings": "高级设置",
"wallet_mgmt_whitelist_text_no_enabled_dapps": "暂无任何授权白名单的应用",

"account_change_title_change": "切换账户",
"account_change_button_add_account": "添加账户",
"add_import_success_label_imported": "已导入",
"add_import_success_label_current": "当前钱包",

"whitelist_title_tips": "提示",
"whitelist_title_content": "DApp白名单开关已经移置设置,新增了体验更流畅的高级模式,是否前往开启白名单功能?",

"resource_label_available": "可用",
"resource_label_total": "总量",
"resource_label_used": "已用",
Expand Down Expand Up @@ -350,6 +369,7 @@
"settings_button_language": "语言",
"settings_button_currency": "默认货币",
"settings_button_node": "节点设置",
"settings_label_whitelist": "白名单功能",
"settings_node_label_default_node": "默认节点",
"settings_node_label_customized_node": "自定义节点",
"settings_node_button_add_node": "添加节点",
Expand Down
5 changes: 3 additions & 2 deletions shared/sagas/whiteList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as actions from 'actions/whiteList'
import storage from 'utils/storage'
import Dialog from 'components/Dialog'
import Immutable from 'immutable'
import messages from 'resources/messages'

function* noticeWhiteList(action: any) {
try {
Expand All @@ -21,8 +22,8 @@ function* noticeWhiteList(action: any) {
const storeInfo = { dappLuanched: true }
yield call(storage.mergeItem, 'bitportal_white_list', storeInfo, true)
Dialog.whiteListAlert(
'提示',
'DApp白名单开关已经移置设置,新增了体验更流畅的高级模式,是否前往开启白名单功能?',
messages[locale].whitelist_title_tips,
messages[locale].whitelist_title_content,
locale,
action.payload.componentId
)
Expand Down
1 change: 1 addition & 0 deletions shared/screens/Account/AccountSelection/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export default class AccountSelection extends Component {
eosValue={+eosPrice * +keyPermission.balance}
eosAmount={keyPermission.balance}
balanceTitle="Balance"
locale={locale}
imported={hasEOSAccountImported(
{
eosAccountName: keyPermission.accountName,
Expand Down
4 changes: 2 additions & 2 deletions shared/screens/Account/AccountSwitch/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ export default class AccountSwitchModal extends Component {
<Ionicons name="ios-close" size={28} color={Colors.bgColor_FFFFFF} />
</TouchableOpacity>
<Text style={styles.title}>
账户切换
{messages[locale].account_change_title_change}
</Text>
<TouchableOpacity onPress={routeToNewAccount} style={styles.close}>
<Text style={[styles.text14, { color: Colors.textColor_89_185_226 }]}>
添加新钱包
{messages[locale].account_change_button_add_account}
</Text>
</TouchableOpacity>

Expand Down
10 changes: 5 additions & 5 deletions shared/screens/Profile/AccountDetails/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import SettingItem from 'components/SettingItem'
import { Navigation } from 'react-native-navigation'
import NavigationBar, { CommonButton } from 'components/NavigationBar'
import { connect } from 'react-redux'
import { FormattedMessage, IntlProvider } from 'react-intl'
import { IntlProvider } from 'react-intl'
import * as keystoreActions from 'actions/keystore'
import { logoutRequested, clearLogoutError } from 'actions/wallet'
import { WALLET_MGT_EXPORT, WALLET_MGT_RESET_PW, WALLET_MGT_LOGOUT } from 'constants/analytics'
Expand Down Expand Up @@ -144,7 +144,7 @@ export default class AccountDetails extends Component {
contentContainerStyle={{ alignItems: 'center', paddingBottom: 20 }}
>
<SettingItem
leftItemTitle={<FormattedMessage id="wallet_mgmt_button_export_private_key" />}
leftItemTitle={messages[locale].wallet_mgmt_button_export_private_key}
onPress={this.showExportPrompt}
extraStyle={{
marginTop: 10,
Expand All @@ -153,19 +153,19 @@ export default class AccountDetails extends Component {
}}
/>
<SettingItem
leftItemTitle={<FormattedMessage id="wallet_mgmt_button_change_password" />}
leftItemTitle={messages[locale].wallet_mgmt_button_change_password}
onPress={this.resetPassword}
/>
<SettingItem
leftItemTitle='白名单详情'
leftItemTitle={messages[locale].wallet_mgmt_button_whitelist_detail}
onPress={this.routeToWhiteListDetails}
extraStyle={{
borderBottomLeftRadius: FLOATING_CARD_BORDER_RADIUS,
borderBottomRightRadius: FLOATING_CARD_BORDER_RADIUS
}}
/>
<SettingItem
leftItemTitle={<FormattedMessage id="wallet_mgmt_button_sign_out" />}
leftItemTitle={messages[locale].wallet_mgmt_button_sign_out}
rightItemTitle=" "
onPress={this.showLogoutPrompt}
extraStyle={{
Expand Down
3 changes: 2 additions & 1 deletion shared/screens/Profile/AccountManager/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export default class AccountManager extends Component {
eosValue={+eosPrice * +item.get('balance')}
eosAmount={item.get('balance')}
balanceTitle="Balance"
locale={locale}
active={item.get('active')}
onPress={this.checkAccountDetails.bind(this, item)}
colors={item.get('permission').toLowerCase() !== 'owner' && Colors.ramColor}
Expand All @@ -93,7 +94,7 @@ export default class AccountManager extends Component {
<View style={{ flex: 1, paddingVertical: 10, paddingHorizontal: 15, borderRadius: 8 }}>
<BPGradientButton onPress={this.routeToNewAccount} extraStyle={{ marginHorizontal: 10 }}>
<Text style={[styles.text14, { color: Colors.textColor_255_255_238 }]}>
添加新钱包
{messages[locale].account_change_button_add_account}
</Text>
</BPGradientButton>
</View>
Expand Down
2 changes: 1 addition & 1 deletion shared/screens/Profile/Settings/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export default class Setting extends Component {
/>
<SettingItem
disabled={true}
leftItemTitle="白名单功能"
leftItemTitle={<FormattedMessage id="settings_label_whitelist" />}
rightItemTitle='switch'
value={value}
onValueChange={this.onValueChange}
Expand Down
8 changes: 4 additions & 4 deletions shared/screens/Profile/WhiteListDetails/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ export default class WhiteListDetails extends Component {
renderHeader = () => (
<View style={styles.header}>
<Text style={[styles.text14, { color: Colors.textColor_255_255_238 }]}>
白名单列表
{messages[this.props.locale].wallet_mgmt_whitelist_label_enabled_dapps}
</Text>
<Text style={[styles.text14, { color: Colors.textColor_255_255_238 }]}>
高级设置
{messages[this.props.locale].wallet_mgmt_whitelist_label_advance_settings}
</Text>
</View>
)
Expand All @@ -106,7 +106,7 @@ export default class WhiteListDetails extends Component {
<IntlProvider messages={messages[locale]}>
<View style={styles.container}>
<NavigationBar
title='白名单详情'
title={messages[locale].wallet_mgmt_whitelist_title_whitelist}
leftButton={<CommonButton iconName="md-arrow-back" onPress={this.goBack} />}
/>
<View style={styles.scrollContainer}>
Expand All @@ -125,7 +125,7 @@ export default class WhiteListDetails extends Component {
:
<ScrollView contentContainerStyle={{ paddingTop: 20 }}>
<Text style={styles.text14}>
暂无白名单授权列表
{messages[locale].wallet_mgmt_whitelist_text_no_enabled_dapps}
</Text>
</ScrollView>
}
Expand Down

0 comments on commit bf6d852

Please sign in to comment.