Merge branch 'master' of https://github.com/esteemapp/esteem-mobile into feature/boost-promote

This commit is contained in:
u-e 2019-07-08 20:11:00 +03:00
commit ebb0825832
14 changed files with 389 additions and 200 deletions

View File

@ -303,6 +303,8 @@
"auto_vests": "Automatically power up to the target account", "auto_vests": "Automatically power up to the target account",
"stop": "Stop", "stop": "Stop",
"stop_information": "Are you sure to stop?", "stop_information": "Are you sure to stop?",
"incoming_funds": "Incoming Funds" "incoming_funds": "Incoming Funds",
"sc_power_down_error": "Steem connect setWithdrawVestingRoute not implemented yet.",
"estimated_weekly": "Estimated Weekly"
} }
} }

View File

@ -38,12 +38,12 @@
"vote": "Szavazás", "vote": "Szavazás",
"reblog": "Megosztás", "reblog": "Megosztás",
"login": "Bejelentkezés", "login": "Bejelentkezés",
"incoming_transfer_title": "Incoming transfer", "incoming_transfer_title": "Bejövő átutalás",
"outgoing_transfer_title": "Outgoing transfer", "outgoing_transfer_title": "Kimenő átutalás",
"checkin_extra": "Bónusz", "checkin_extra": "Bónusz",
"delegation": "Delegation", "delegation": "Delegálás",
"delegation_title": "Delegation reward", "delegation_title": "Delegálási jutalom",
"delegation_desc": "You can earn 1 point per day for each 100sp delegation", "delegation_desc": "Minen 100sp delegálásért napi 1 pontot kaphatsz",
"post_title": "Bejegyzés pontok", "post_title": "Bejegyzés pontok",
"comment_title": "Hozzászólás pontok", "comment_title": "Hozzászólás pontok",
"vote_title": "Szavazási pontok", "vote_title": "Szavazási pontok",
@ -203,12 +203,12 @@
"no_internet": "Nincs kapcsolat!", "no_internet": "Nincs kapcsolat!",
"confirm": "Megerősítés", "confirm": "Megerősítés",
"removed": "Eltávolítva", "removed": "Eltávolítva",
"same_user": "This user already added to list" "same_user": "Ez a felhasználó már szerepel a listán"
}, },
"post": { "post": {
"reblog_alert": "Biztos, hogy megosztod?", "reblog_alert": "Biztos, hogy megosztod?",
"removed_hint": "A bejegyzést eltávolította", "removed_hint": "A bejegyzést eltávolította",
"copy_link": "Copy Link" "copy_link": "Link másolása"
}, },
"drafts": { "drafts": {
"title": "Piszkozatok", "title": "Piszkozatok",
@ -283,26 +283,26 @@
"memo_desc": "Ez az üzenet nyilvános", "memo_desc": "Ez az üzenet nyilvános",
"to_placeholder": "Felhasználónév", "to_placeholder": "Felhasználónév",
"memo_placeholder": "Megjegyzés ide", "memo_placeholder": "Megjegyzés ide",
"transfer_token": "Transfer", "transfer_token": "Átutalás",
"points": "Points Transfer", "points": "Pontok Átutalása",
"transfer_to_saving": "Transfer To Saving", "transfer_to_saving": "Átutalás a megtakarításokhoz",
"powerUp": "Power Up", "powerUp": "Power Up",
"withdraw_to_saving": "Withdraw To Saving", "withdraw_to_saving": "Átutalás A Megtakarításokhoz",
"steemconnect_title": "Steemconnect átutalás", "steemconnect_title": "Steemconnect átutalás",
"next": "KÖVETKEZŐ", "next": "KÖVETKEZŐ",
"withdraw_steem": "Withdraw Steem", "withdraw_steem": "Steem Visszavonás",
"withdraw_sbd": "Withdraw Steem Dollar", "withdraw_sbd": "Steem Dollár Visszavonás",
"delegate": "Delegate", "delegate": "Delegálás",
"power_down": "Power Down", "power_down": "Power Down",
"account": "Account", "account": "Fiók",
"destination_accounts": "Destination Account(s)", "destination_accounts": "Cél Fiók(ok)",
"amount_information": "Drag the sliderto adjust to amount", "amount_information": "A csúszka húzásával állítsd be a mennyiséget",
"save": "Save", "save": "Mentés",
"percent": "Percentage", "percent": "Százalék",
"percent_information": "Percentage of power down to this account", "percent_information": "Power Down százaléka ennek a fióknak",
"auto_vests": "Automatically power up to the target account", "auto_vests": "Automatikus power up a megadott fióknak",
"stop": "Stop", "stop": "Megállítás",
"stop_information": "Are you sure to stop?", "stop_information": "Bistos megállítod?",
"incoming_funds": "Incoming Funds" "incoming_funds": "Bejövő tőke"
} }
} }

View File

@ -203,7 +203,7 @@
"no_internet": "인터넷 연결을 확인하세요!", "no_internet": "인터넷 연결을 확인하세요!",
"confirm": "확인", "confirm": "확인",
"removed": "삭제되었습니다", "removed": "삭제되었습니다",
"same_user": "This user already added to list" "same_user": "이 사용자는 목록에 이미 추가되었습니다"
}, },
"post": { "post": {
"reblog_alert": "정말 리블로그 하시겠습니까?", "reblog_alert": "정말 리블로그 하시겠습니까?",
@ -289,19 +289,19 @@
"withdraw_to_saving": "안전 금고로 출금", "withdraw_to_saving": "안전 금고로 출금",
"steemconnect_title": "Steemconnect 송금", "steemconnect_title": "Steemconnect 송금",
"next": "다음", "next": "다음",
"withdraw_steem": "Withdraw Steem", "withdraw_steem": "스팀 출금",
"withdraw_sbd": "Withdraw Steem Dollar", "withdraw_sbd": "스팀 달러 출금",
"delegate": "Delegate", "delegate": "임대",
"power_down": "Power Down", "power_down": "파워 다운",
"account": "Account", "account": "계정",
"destination_accounts": "Destination Account(s)", "destination_accounts": "대상 계정",
"amount_information": "Drag the sliderto adjust to amount", "amount_information": "슬라이드를 드래그해서 수량을 설정할 수 있습니다",
"save": "Save", "save": "저장",
"percent": "Percentage", "percent": "비율",
"percent_information": "Percentage of power down to this account", "percent_information": "이 계정에 대한 파워 다운 비율",
"auto_vests": "Automatically power up to the target account", "auto_vests": "대상 계정에 자동으로 파워 업 하기",
"stop": "Stop", "stop": "중지",
"stop_information": "Are you sure to stop?", "stop_information": "중지하시겠습니까?",
"incoming_funds": "Incoming Funds" "incoming_funds": "입금 예정 스팀"
} }
} }

View File

@ -203,7 +203,7 @@
"no_internet": "Sem ligação!", "no_internet": "Sem ligação!",
"confirm": "Confirmar", "confirm": "Confirmar",
"removed": "Removido", "removed": "Removido",
"same_user": "This user already added to list" "same_user": "Este usuário já foi adicionado à lista"
}, },
"post": { "post": {
"reblog_alert": "Tem certeza de que deseja reblogar?", "reblog_alert": "Tem certeza de que deseja reblogar?",
@ -290,19 +290,19 @@
"withdraw_to_saving": "Levantar das poupanças", "withdraw_to_saving": "Levantar das poupanças",
"steemconnect_title": "Transferência por Steemconnect", "steemconnect_title": "Transferência por Steemconnect",
"next": "SEGUINTE", "next": "SEGUINTE",
"withdraw_steem": "Withdraw Steem", "withdraw_steem": "Levantar Steem",
"withdraw_sbd": "Withdraw Steem Dollar", "withdraw_sbd": "Levantar Steem Dólar",
"delegate": "Delegate", "delegate": "Delegar",
"power_down": "Power Down", "power_down": "Decarregar Poder",
"account": "Account", "account": "Conta",
"destination_accounts": "Destination Account(s)", "destination_accounts": "Conta(s) de destino",
"amount_information": "Drag the sliderto adjust to amount", "amount_information": "Arraste o controle deslizante para ajustar a quantidade",
"save": "Save", "save": "Guardar",
"percent": "Percentage", "percent": "Percentagem",
"percent_information": "Percentage of power down to this account", "percent_information": "Percentagem de Descarga de Poder para esta conta",
"auto_vests": "Automatically power up to the target account", "auto_vests": "Carregar Poder automaticamente para a conta alvo",
"stop": "Stop", "stop": "Parar",
"stop_information": "Are you sure to stop?", "stop_information": "Tem certeza que deseja parar?",
"incoming_funds": "Incoming Funds" "incoming_funds": "Fundos recebidos"
} }
} }

View File

@ -203,7 +203,7 @@
"no_internet": "Nu există conexiune!", "no_internet": "Nu există conexiune!",
"confirm": "Confirmă", "confirm": "Confirmă",
"removed": "Şters", "removed": "Şters",
"same_user": "This user already added to list" "same_user": "Utilizator adăugat deja la listă"
}, },
"post": { "post": {
"reblog_alert": "Ești sigur că vrei să redistribui?", "reblog_alert": "Ești sigur că vrei să redistribui?",
@ -284,25 +284,25 @@
"to_placeholder": "Nume de utilizator", "to_placeholder": "Nume de utilizator",
"memo_placeholder": "Introdu comentariul tău aici", "memo_placeholder": "Introdu comentariul tău aici",
"transfer_token": "Transfer", "transfer_token": "Transfer",
"points": "Points Transfer", "points": "Transfer Puncte",
"transfer_to_saving": "Tranferă la economii", "transfer_to_saving": "Tranferă la economii",
"powerUp": "Power Up", "powerUp": "Power Up",
"withdraw_to_saving": "Retrage la economii", "withdraw_to_saving": "Retrage la economii",
"steemconnect_title": "Transfer Steemconnect", "steemconnect_title": "Transfer Steemconnect",
"next": "URMĂTORUL", "next": "URMĂTORUL",
"withdraw_steem": "Withdraw Steem", "withdraw_steem": "Retrage Steem",
"withdraw_sbd": "Withdraw Steem Dollar", "withdraw_sbd": "Retrage Steem Dolar",
"delegate": "Delegate", "delegate": "Delegare",
"power_down": "Power Down", "power_down": "Power Down",
"account": "Account", "account": "Cont",
"destination_accounts": "Destination Account(s)", "destination_accounts": "Cont(uri) de Destinație",
"amount_information": "Drag the sliderto adjust to amount", "amount_information": "Trage glisorul pentru a ajusta cantitatea",
"save": "Save", "save": "Salvează",
"percent": "Percentage", "percent": "Procentaj",
"percent_information": "Percentage of power down to this account", "percent_information": "Procentul de power down la acest cont",
"auto_vests": "Automatically power up to the target account", "auto_vests": "Power up automat contul ţintă",
"stop": "Stop", "stop": "Oprește",
"stop_information": "Are you sure to stop?", "stop_information": "Ești sigur că vrei să te oprești?",
"incoming_funds": "Incoming Funds" "incoming_funds": "Fondurile Primite"
} }
} }

View File

@ -23,7 +23,7 @@
"comingsoon": "Доска Лидерства будет здесь!", "comingsoon": "Доска Лидерства будет здесь!",
"notification": "Уведомления", "notification": "Уведомления",
"leaderboard": "Лидеры", "leaderboard": "Лидеры",
"epoint": "Очки", "epoint": "Баллы",
"leaderboard_title": "Доска Лидерства", "leaderboard_title": "Доска Лидерства",
"recent": "Недавно", "recent": "Недавно",
"yesterday": "Вчера", "yesterday": "Вчера",
@ -38,29 +38,29 @@
"vote": "Голос", "vote": "Голос",
"reblog": "Репост", "reblog": "Репост",
"login": "Логин", "login": "Логин",
"incoming_transfer_title": "Incoming transfer", "incoming_transfer_title": "Входящий перевод",
"outgoing_transfer_title": "Outgoing transfer", "outgoing_transfer_title": "Исходящий перевод",
"checkin_extra": "Бонус", "checkin_extra": "Бонус",
"delegation": "Delegation", "delegation": "Делегирование",
"delegation_title": "Delegation reward", "delegation_title": "Награда за делегирование",
"delegation_desc": "You can earn 1 point per day for each 100sp delegation", "delegation_desc": "За каждые делегированные 100SP вы будете получать 1 балл в день",
"post_title": "Очки за пост", "post_title": "Баллы за пост",
"comment_title": "Очки за комментарий", "comment_title": "Баллы за комментарий",
"vote_title": "Очки за голос", "vote_title": "Баллы за голос",
"reblog_title": "Очки за репост", "reblog_title": "Баллы за репост",
"login_title": "Очки за логин", "login_title": "Баллы за логин",
"checkin_title": "Очки за пользование", "checkin_title": "Баллы за пользование",
"checkin_extra_title": "Бонус за использование", "checkin_extra_title": "Бонус за использование",
"no_activity": "Здесь пусто!", "no_activity": "Здесь пусто!",
"outgoing_transfer_description": "", "outgoing_transfer_description": "",
"incoming_transfer_description": "", "incoming_transfer_description": "",
"post_desc": "Зарабатывай очки за посты. По 15 очков за каждый.", "post_desc": "Зарабатывай баллы за посты. По 15 баллов за каждый.",
"comment_desc": "Каждый коммент помогает набирать аудиторию, завязывает дружбу и приносит 5 очков.", "comment_desc": "Каждый коммент помогает набирать аудиторию, завязывает дружбу и приносит 5 баллов.",
"checkin_desc": "Чекин в приложении eSteem даёт 0.25 очков и помогает оставаться на связи с друзьями.", "checkin_desc": "Чекин в приложении eSteem даёт 0.25 баллов и помогает оставаться на связи с друзьями.",
"vote_desc": "Голосуя вы награждаете других и высказываете своё уважение, а также получаете процент очков в зависимости от силы голоса.", "vote_desc": "Голосуя вы награждаете других и высказываете своё уважение, а также получаете процент баллов в зависимости от силы голоса.",
"reblog_desc": "Делитесь постами с друзьями и получайте по 1 очку.", "reblog_desc": "Делитесь постами с друзьями и получайте по 1 баллу.",
"login_desc": "Когда вы логинитесь в приложения eSteem, вы автоматически получаете 100 очков.", "login_desc": "Когда вы логинитесь в приложения eSteem, вы автоматически получаете 100 баллов.",
"checkin_extra_desc": "Постоянное использование приложения даёт вам дополнительный шанс получить 10 очков. Чем больше активности, тем больше очков." "checkin_extra_desc": "Постоянное использование приложения даёт вам дополнительный шанс получить 10 баллов. Чем больше активности, тем больше награда."
}, },
"messages": { "messages": {
"comingsoon": "Здесь будут сообщения!" "comingsoon": "Здесь будут сообщения!"
@ -203,12 +203,12 @@
"no_internet": "No internet connection", "no_internet": "No internet connection",
"confirm": "Подтвердить", "confirm": "Подтвердить",
"removed": "Удалено", "removed": "Удалено",
"same_user": "This user already added to list" "same_user": "Этот пользователь уже добавлен в список"
}, },
"post": { "post": {
"reblog_alert": "Вы уверены, что хотите сделать репост?", "reblog_alert": "Вы уверены, что хотите сделать репост?",
"removed_hint": "Сообщение удалено", "removed_hint": "Сообщение удалено",
"copy_link": "Copy Link" "copy_link": "Копировать ссылку"
}, },
"drafts": { "drafts": {
"title": "Черновики", "title": "Черновики",
@ -283,26 +283,26 @@
"memo_desc": "Эта заметка публична", "memo_desc": "Эта заметка публична",
"to_placeholder": "Пользователь", "to_placeholder": "Пользователь",
"memo_placeholder": "Введите свою заметку", "memo_placeholder": "Введите свою заметку",
"transfer_token": "Transfer", "transfer_token": "Перевод",
"points": "Points Transfer", "points": "Передача баллов",
"transfer_to_saving": "Transfer To Saving", "transfer_to_saving": "Перевести в сейф",
"powerUp": "Увеличение силы", "powerUp": "Увеличение силы",
"withdraw_to_saving": "Withdraw To Saving", "withdraw_to_saving": "Снять в сейф",
"steemconnect_title": "Перевод Steemconnect", "steemconnect_title": "Перевод Steemconnect",
"next": "ДАЛЕЕ", "next": "ДАЛЕЕ",
"withdraw_steem": "Withdraw Steem", "withdraw_steem": "Вывести Steem",
"withdraw_sbd": "Withdraw Steem Dollar", "withdraw_sbd": "Вывести Steem Dollar",
"delegate": "Delegate", "delegate": "Делегировать",
"power_down": "Power Down", "power_down": "Понижение Силы",
"account": "Account", "account": "Aккаунт",
"destination_accounts": "Destination Account(s)", "destination_accounts": "Аккаунт(ы) получателя",
"amount_information": "Drag the sliderto adjust to amount", "amount_information": "Потяните ползунок для регулировки количества",
"save": "Save", "save": "Сохранить",
"percent": "Percentage", "percent": "Проценты",
"percent_information": "Percentage of power down to this account", "percent_information": "Процент понижения Силы в этот аккаунт",
"auto_vests": "Automatically power up to the target account", "auto_vests": "Автоматически переводить в Силу на целевой аккаунт",
"stop": "Stop", "stop": "Остановить",
"stop_information": "Are you sure to stop?", "stop_information": "Вы уверены, что хотите остановить?",
"incoming_funds": "Incoming Funds" "incoming_funds": "Входящие средства"
} }
} }

View File

@ -692,7 +692,7 @@ export const delegateVestingShares = (currentAccount, pin, data) => {
'delegate_vesting_shares', 'delegate_vesting_shares',
{ {
delegator: data.from, delegator: data.from,
delegatee: data.to, delegatee: data.destination,
vesting_shares: data.amount, vesting_shares: data.amount,
}, },
], ],

View File

@ -1,48 +1,18 @@
import React, { PureComponent, Fragment } from 'react'; import React from 'react';
import { View, Text } from 'react-native'; import { View } from 'react-native';
// Constants
// Components
import { Logo } from '../../../components'; import { Logo } from '../../../components';
// import styles from './launchStyles'; const LaunchScreen = () => (
<View
class LaunchScreen extends PureComponent { style={{
/* Props flex: 1,
* ------------------------------------------------ justifyContent: 'center',
* @prop { type } name - Description.... alignItems: 'center',
*/ marginBottom: 80,
}}
constructor(props) { >
super(props); <Logo style={{ width: 105, height: 110 }} />
this.state = {}; </View>
} );
// Component Life Cycles
// Component Functions
render() {
return <Fragment />;
// Temporarily removed
// return (
// <View
// style={{
// flex: 1,
// justifyContent: 'center',
// alignItems: 'center',
// marginBottom: 130,
// }}
// >
// <Logo style={{ width: 130, height: 130 }} />
// {/* <Text style={{ fontSize: 24 }}>eSteem</Text>
// <Text style={{ fontSize: 24 }}>mobile</Text> */}
// </View>
// );
}
}
export default LaunchScreen; export default LaunchScreen;

View File

@ -1,25 +0,0 @@
import EStyleSheet from 'react-native-extended-stylesheet';
export default EStyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'red',
},
title: {
fontFamily: 'Sansation_Bold',
color: '$primaryDarkBlue',
fontSize: 30,
paddingBottom: 0,
},
subTitle: {
fontFamily: 'Sansation_Regular',
color: '#00519c',
fontSize: 24,
},
logo: {
width: '$deviceWidth / 4',
height: '$deviceWidth / 4',
},
});

View File

@ -134,6 +134,8 @@ class TransferContainer extends Component {
break; break;
case 'delegate': case 'delegate':
func = delegateVestingShares; func = delegateVestingShares;
currentAccount = selectedAccount;
data.amount = `${amount.toFixed(6)} VESTS`;
break; break;
default: default:
break; break;

View File

@ -4,6 +4,7 @@ import TransferContainer from './container/transferContainer';
import TransferView from './screen/transferScreen'; import TransferView from './screen/transferScreen';
import PowerDownView from './screen/powerDownScreen'; import PowerDownView from './screen/powerDownScreen';
import DelegateView from './screen/delegateScreen';
const Transfer = ({ navigation }) => ( const Transfer = ({ navigation }) => (
<TransferContainer navigation={navigation}> <TransferContainer navigation={navigation}>
@ -44,7 +45,19 @@ const Transfer = ({ navigation }) => (
/> />
); );
case 'delegate': case 'delegate':
return null; return (
<DelegateView
accounts={accounts}
currentAccountName={currentAccountName}
selectedAccount={selectedAccount}
getAccountsWithUsername={getAccountsWithUsername}
balance={balance}
fetchBalance={fetchBalance}
transferToAccount={transferToAccount}
accountType={accountType}
handleOnModalClose={handleOnModalClose}
/>
);
case 'power_down': case 'power_down':
return ( return (
<PowerDownView <PowerDownView

View File

@ -0,0 +1,232 @@
import React, { Component, Fragment } from 'react';
import { View, Text, WebView } from 'react-native';
import { injectIntl } from 'react-intl';
import Slider from 'react-native-slider';
import get from 'lodash/get';
import ActionSheet from 'react-native-actionsheet';
// Constants
import AUTH_TYPE from '../../../constants/authType';
import { steemConnectOptions } from '../../../constants/steemConnectOptions';
// Components
import { BasicHeader } from '../../../components/basicHeader';
import { TransferFormItem } from '../../../components/transferFormItem';
import { DropdownButton } from '../../../components/dropdownButton';
import { TextInput } from '../../../components/textInput';
import { MainButton } from '../../../components/mainButton';
import { UserAvatar } from '../../../components/userAvatar';
import { Icon } from '../../../components/icon';
import { Modal } from '../../../components/modal';
import parseToken from '../../../utils/parseToken';
import { isEmptyDate } from '../../../utils/time';
// Styles
import styles from './transferStyles';
class DelegateScreen extends Component {
constructor(props) {
super(props);
this.state = {
amount: 0,
isTransfering: false,
from: props.currentAccountName,
destination: '',
steemConnectTransfer: false,
};
this.startActionSheet = React.createRef();
}
// Component Life Cycles
// Component Functions
_setState = (key, value) => {
const { getAccountsWithUsername, balance } = this.props;
if (key) {
switch (key) {
case 'destination':
getAccountsWithUsername(value).then(res => {
const isValid = res.includes(value);
this.setState({ isUsernameValid: isValid });
});
this.setState({ [key]: value });
break;
case 'amount':
if (parseFloat(Number(value)) <= parseFloat(balance)) {
this.setState({ [key]: value });
}
break;
default:
this.setState({ [key]: value });
break;
}
}
};
_handleTransferAction = () => {
const { transferToAccount, accountType } = this.props;
const { from, destination, amount } = this.state;
this.setState({ isTransfering: true });
if (accountType === AUTH_TYPE.STEEM_CONNECT) {
this.setState({ steemConnectTransfer: true });
} else {
transferToAccount(from, destination, amount, '');
}
};
_handleOnAmountChange = (state, amount) => {
let _amount = amount.toString();
if (_amount.includes(',')) {
_amount = amount.replace(',', '.');
}
this._setState(state, _amount);
};
_handleOnDropdownChange = value => {
const { fetchBalance } = this.props;
fetchBalance(value);
this.setState({ from: value, amount: 0 });
};
_renderDropdown = (accounts, currentAccountName) => (
<DropdownButton
dropdownButtonStyle={styles.dropdownButtonStyle}
rowTextStyle={styles.rowTextStyle}
style={styles.dropdown}
dropdownStyle={styles.dropdownStyle}
textStyle={styles.dropdownText}
options={accounts.map(item => item.username)}
defaultText={currentAccountName}
selectedOptionIndex={accounts.findIndex(item => item.username === currentAccountName)}
onSelect={(index, value) => this._handleOnDropdownChange(value)}
/>
);
_renderInput = (placeholder, state, keyboardType, isTextArea) => (
<TextInput
style={[isTextArea ? styles.textarea : styles.input]}
onChangeText={amount => this._handleOnAmountChange(state, amount)}
value={this.state[state]}
placeholder={placeholder}
placeholderTextColor="#c1c5c7"
autoCapitalize="none"
multiline={isTextArea}
numberOfLines={isTextArea ? 4 : 1}
keyboardType={keyboardType}
/>
);
_renderInformationText = text => <Text style={styles.amountText}>{text}</Text>;
render() {
const { intl, accounts, currentAccountName, selectedAccount, handleOnModalClose } = this.props;
const { amount, isTransfering, from, destination, steemConnectTransfer } = this.state;
let availableVestingShares = 0;
if (!isEmptyDate(get(selectedAccount, 'next_vesting_withdrawal'))) {
// powering down
availableVestingShares =
parseToken(get(selectedAccount, 'vesting_shares')) -
(Number(get(selectedAccount, 'to_withdraw')) - Number(get(selectedAccount, 'withdrawn'))) /
1e6 -
parseToken(get(selectedAccount, 'delegated_vesting_shares'));
} else {
// not powering down
availableVestingShares =
parseToken(get(selectedAccount, 'vesting_shares')) -
parseToken(get(selectedAccount, 'delegated_vesting_shares'));
}
const fixedAmount = `${amount.toFixed(6)} VESTS`;
const path = `sign/delegate-vesting-shares?delegator=${from}&delegatee=${destination}&vesting_shares=${encodeURIComponent(
fixedAmount,
)}`;
return (
<Fragment>
<BasicHeader title={intl.formatMessage({ id: 'transfer.delegate' })} />
<View style={styles.container}>
<View style={styles.topContent}>
<UserAvatar username={from} size="xl" style={styles.userAvatar} noAction />
<Icon style={styles.icon} name="arrow-forward" iconType="MaterialIcons" />
<UserAvatar username={destination} size="xl" style={styles.userAvatar} noAction />
</View>
<View style={styles.middleContent}>
<TransferFormItem
label={intl.formatMessage({ id: 'transfer.account' })}
rightComponent={() => this._renderDropdown(accounts, currentAccountName)}
/>
<TransferFormItem
label={intl.formatMessage({ id: 'transfer.to' })}
rightComponent={() =>
this._renderInput(
intl.formatMessage({ id: 'transfer.to_placeholder' }),
'destination',
'default',
)
}
/>
<TransferFormItem
label={intl.formatMessage({ id: 'transfer.amount' })}
rightComponent={() => this._renderInformationText(`${amount.toFixed(6)} VESTS`)}
/>
<Slider
style={styles.slider}
trackStyle={styles.track}
thumbStyle={styles.thumb}
minimumTrackTintColor="#357ce6"
thumbTintColor="#007ee5"
maximumValue={availableVestingShares}
value={amount}
onValueChange={value => {
this.setState({ amount: value });
}}
/>
<Text style={styles.informationText}>
{intl.formatMessage({ id: 'transfer.amount_information' })}
</Text>
</View>
<View style={styles.bottomContent}>
<MainButton
style={styles.button}
onPress={() => this.startActionSheet.current.show()}
isLoading={isTransfering}
>
<Text style={styles.buttonText}>{intl.formatMessage({ id: 'transfer.next' })}</Text>
</MainButton>
</View>
</View>
<ActionSheet
ref={this.startActionSheet}
options={[
intl.formatMessage({ id: 'alert.confirm' }),
intl.formatMessage({ id: 'alert.cancel' }),
]}
title={intl.formatMessage({ id: 'transfer.information' })}
cancelButtonIndex={1}
destructiveButtonIndex={0}
onPress={index => (index === 0 ? this._handleTransferAction() : null)}
/>
<Modal
isOpen={steemConnectTransfer}
isFullScreen
isCloseButton
handleOnModalClose={handleOnModalClose}
title={intl.formatMessage({ id: 'transfer.steemconnect_title' })}
>
<WebView source={{ uri: `${steemConnectOptions.base_url}${path}` }} />
</Modal>
</Fragment>
);
}
}
export default injectIntl(DelegateScreen);

View File

@ -1,12 +1,11 @@
import React, { Fragment, Component } from 'react'; import React, { Fragment, Component } from 'react';
import { Text, View, WebView, ScrollView, Alert } from 'react-native'; import { Text, View, ScrollView, Alert } from 'react-native';
import ActionSheet from 'react-native-actionsheet'; import ActionSheet from 'react-native-actionsheet';
import { injectIntl } from 'react-intl'; import { injectIntl } from 'react-intl';
import Slider from 'react-native-slider'; import Slider from 'react-native-slider';
import get from 'lodash/get'; import get from 'lodash/get';
import { getWithdrawRoutes } from '../../../providers/steem/dsteem'; import { getWithdrawRoutes } from '../../../providers/steem/dsteem';
import { steemConnectOptions } from '../../../constants/steemConnectOptions';
import AUTH_TYPE from '../../../constants/authType'; import AUTH_TYPE from '../../../constants/authType';
import { BasicHeader } from '../../../components/basicHeader'; import { BasicHeader } from '../../../components/basicHeader';
@ -75,13 +74,16 @@ class PowerDownView extends Component {
}; };
_handleTransferAction = () => { _handleTransferAction = () => {
const { transferToAccount, accountType } = this.props; const { transferToAccount, accountType, intl } = this.props;
const { from, destinationAccounts, amount } = this.state; const { from, destinationAccounts, amount } = this.state;
this.setState({ isTransfering: true }); this.setState({ isTransfering: true });
if (accountType === AUTH_TYPE.STEEM_CONNECT) { if (accountType === AUTH_TYPE.STEEM_CONNECT) {
this.setState({ steemConnectTransfer: true }); Alert.alert(
intl.formatMessage({ id: 'alert.warning' }),
intl.formatMessage({ id: 'transfer.sc_power_down_error' }),
);
} else { } else {
transferToAccount(from, destinationAccounts, amount, ''); transferToAccount(from, destinationAccounts, amount, '');
} }
@ -190,14 +192,12 @@ class PowerDownView extends Component {
accounts, accounts,
selectedAccount, selectedAccount,
intl, intl,
handleOnModalClose,
getAccountsWithUsername, getAccountsWithUsername,
transferType, transferType,
currentAccountName, currentAccountName,
steemPerMVests, steemPerMVests,
} = this.props; } = this.props;
const { amount, steemConnectTransfer, isTransfering, isOpenWithdrawAccount } = this.state; const { amount, isTransfering, isOpenWithdrawAccount } = this.state;
let path;
let poweringDownVests = 0; let poweringDownVests = 0;
let availableVestingShares = 0; let availableVestingShares = 0;
@ -293,6 +293,9 @@ class PowerDownView extends Component {
style={styles.steemInformation} style={styles.steemInformation}
text={`+ ${fundPerWeek.toFixed(3)} STEEM`} text={`+ ${fundPerWeek.toFixed(3)} STEEM`}
/> />
<Text style={styles.informationText}>
{intl.formatMessage({ id: 'transfer.estimated_weekly' })}
</Text>
<MainButton <MainButton
style={styles.button} style={styles.button}
isDisable={amount <= 0} isDisable={amount <= 0}
@ -355,15 +358,6 @@ class PowerDownView extends Component {
handleOnSubmit={this._handleOnSubmit} handleOnSubmit={this._handleOnSubmit}
/> />
</Modal> </Modal>
<Modal
isOpen={steemConnectTransfer}
isFullScreen
isCloseButton
handleOnModalClose={handleOnModalClose}
title={intl.formatMessage({ id: 'transfer.steemconnect_title' })}
>
<WebView source={{ uri: `${steemConnectOptions.base_url}${path}` }} />
</Modal>
</Fragment> </Fragment>
); );
} }

View File

@ -46,6 +46,7 @@ export default EStyleSheet.create({
marginTop: 30, marginTop: 30,
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
fontWeight: 'bold',
}, },
stopButton: { stopButton: {
width: '$deviceWidth / 3', width: '$deviceWidth / 3',
@ -53,6 +54,7 @@ export default EStyleSheet.create({
justifyContent: 'center', justifyContent: 'center',
alignItems: 'center', alignItems: 'center',
backgroundColor: 'red', backgroundColor: 'red',
fontWeight: 'bold',
}, },
buttonText: { buttonText: {
color: 'white', color: 'white',
@ -107,11 +109,10 @@ export default EStyleSheet.create({
elevation: 3, elevation: 3,
}, },
slider: { slider: {
flex: 1,
marginHorizontal: 30, marginHorizontal: 30,
}, },
formButton: { formButton: {
padding: 7, padding: 12,
borderRadius: 5, borderRadius: 5,
backgroundColor: '$primaryBlue', backgroundColor: '$primaryBlue',
marginTop: 5, marginTop: 5,
@ -126,7 +127,7 @@ export default EStyleSheet.create({
informationText: { informationText: {
alignSelf: 'center', alignSelf: 'center',
color: '$iconColor', color: '$iconColor',
marginLeft: 5, margin: 10,
}, },
spInformation: { spInformation: {
backgroundColor: 'red', backgroundColor: 'red',