From e7e92088b5350122159b5648fe53d66cd4af51fb Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Thu, 3 Feb 2022 20:54:01 +0500 Subject: [PATCH 01/46] added autocomplete to user --- .../view/transferFormItemView.js | 4 +- src/screens/transfer/screen/delegateScreen.js | 116 ++++++++++++++---- src/screens/transfer/screen/transferStyles.js | 31 ++++- 3 files changed, 123 insertions(+), 28 deletions(-) diff --git a/src/components/transferFormItem/view/transferFormItemView.js b/src/components/transferFormItem/view/transferFormItemView.js index 66af36526..f4d8fd22f 100644 --- a/src/components/transferFormItem/view/transferFormItemView.js +++ b/src/components/transferFormItem/view/transferFormItemView.js @@ -7,8 +7,8 @@ import styles from './transferFormItemStyles'; * @prop { type } name - Description.... */ -const TransferFormItemView = ({ rightComponent, label }) => ( - +const TransferFormItemView = ({ rightComponent, label, containerStyle }) => ( + {label && {label}} {rightComponent && rightComponent()} diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 0e3b49365..338f2fabb 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -1,11 +1,12 @@ import React, { Component, Fragment } from 'react'; -import { View, Text } from 'react-native'; +import { View, Text, FlatList, TouchableOpacity } from 'react-native'; import { WebView } from 'react-native-webview'; import { injectIntl } from 'react-intl'; import Slider from '@esteemapp/react-native-slider'; import get from 'lodash/get'; // Constants +import { debounce } from 'lodash'; import AUTH_TYPE from '../../../constants/authType'; import { hsOptions } from '../../../constants/hsOptions'; @@ -30,6 +31,19 @@ import styles from './transferStyles'; import { OptionsModal } from '../../../components/atoms'; class DelegateScreen extends Component { + _handleOnAmountChange = debounce( + async (state, amount) => { + let _amount = amount.toString(); + if (_amount.includes(',')) { + _amount = amount.replace(',', '.'); + } + + this._setState(state, _amount); + }, + 200, + { leading: true }, + ); + constructor(props) { super(props); this.state = { @@ -38,6 +52,7 @@ class DelegateScreen extends Component { from: props.currentAccountName, destination: '', steemConnectTransfer: false, + usersResult: [], }; this.startActionSheet = React.createRef(); @@ -48,16 +63,18 @@ class DelegateScreen extends Component { // 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({ usersResult: [...res] }); this.setState({ isUsernameValid: isValid }); }); - this.setState({ [key]: value }); + if (!value) { + this.setState({ destination: '' }); + } + break; case 'amount': if (parseFloat(Number(value)) <= parseFloat(balance)) { @@ -85,15 +102,6 @@ class DelegateScreen extends Component { } }; - _handleOnAmountChange = (state, amount) => { - let _amount = amount.toString(); - if (_amount.includes(',')) { - _amount = amount.replace(',', '.'); - } - - this._setState(state, _amount); - }; - _handleOnDropdownChange = (value) => { const { fetchBalance } = this.props; @@ -115,19 +123,77 @@ class DelegateScreen extends Component { /> ); - _renderInput = (placeholder, state, keyboardType, isTextArea) => ( - this._handleOnAmountChange(state, amount)} - value={this.state[state]} - placeholder={placeholder} - placeholderTextColor="#c1c5c7" - autoCapitalize="none" - multiline={isTextArea} - numberOfLines={isTextArea ? 4 : 1} - keyboardType={keyboardType} + _renderUsersDropdownItem = ({ item }) => { + const username = item; + return ( + { + this.setState({ destination: username, usersResult: [] }); + }} + style={styles.usersDropItemRow} + > + {username} + + ); + }; + + _renderUsersDropdown = () => ( + `searched-user-${item}`} + style={styles.usersDropdown} + ListFooterComponent={} + ListFooterComponentStyle={{ height: 20 }} /> ); + _renderInput = (placeholder, state, keyboardType, isTextArea) => { + switch (state) { + case 'destination': + return ( + + { + this.setState({ destination: amount }); + this._handleOnAmountChange(state, amount); + }} + value={this.state[state]} + placeholder={placeholder} + placeholderTextColor="#c1c5c7" + autoCapitalize="none" + multiline={isTextArea} + numberOfLines={isTextArea ? 4 : 1} + keyboardType={keyboardType} + /> + + + {this.state.destination !== '' && + this.state.usersResult.length !== 0 && + this._renderUsersDropdown()} + + + ); + case 'amount': + return ( + this._handleOnAmountChange(state, amount)} + value={this.state[state]} + placeholder={placeholder} + placeholderTextColor="#c1c5c7" + autoCapitalize="none" + multiline={isTextArea} + numberOfLines={isTextArea ? 4 : 1} + keyboardType={keyboardType} + /> + ); + default: + null; + break; + } + }; _renderInformationText = (text) => {text}; @@ -163,7 +229,6 @@ class DelegateScreen extends Component { )}`; const spCalculated = vestsToHp(amount, hivePerMVests); - return ( @@ -187,6 +252,7 @@ class DelegateScreen extends Component { 'default', ) } + containerStyle={{ zIndex: 1 }} /> Date: Thu, 3 Feb 2022 22:52:29 +0500 Subject: [PATCH 02/46] added input for amount selection --- src/screens/transfer/screen/delegateScreen.js | 162 +++++++++++------- src/screens/transfer/screen/transferStyles.js | 12 ++ 2 files changed, 115 insertions(+), 59 deletions(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 338f2fabb..e6c55df2d 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -25,6 +25,7 @@ import { import parseToken from '../../../utils/parseToken'; import { isEmptyDate } from '../../../utils/time'; import { vestsToHp } from '../../../utils/conversions'; +import TransferFormItemView from '../../../components/transferFormItem/view/transferFormItemView'; // Styles import styles from './transferStyles'; @@ -53,6 +54,7 @@ class DelegateScreen extends Component { destination: '', steemConnectTransfer: false, usersResult: [], + step: 0, }; this.startActionSheet = React.createRef(); @@ -89,6 +91,16 @@ class DelegateScreen extends Component { } }; + _handleAmountChange = (value, availableBalance) => { + const parsedValue = parseFloat(Number(value)); + if (Number.isNaN(parsedValue)) { + this.setState({ amount: 0 }); + } else if (parsedValue > availableBalance) { + this.setState({ amount: availableBalance }); + } else { + this.setState({ amount: parsedValue }); + } + }; _handleTransferAction = () => { const { transferToAccount, accountType } = this.props; const { from, destination, amount } = this.state; @@ -145,10 +157,10 @@ class DelegateScreen extends Component { keyExtractor={(item) => `searched-user-${item}`} style={styles.usersDropdown} ListFooterComponent={} - ListFooterComponentStyle={{ height: 20 }} + ListFooterComponentStyle={{ height: 20 }} //this fixes the last item visibility bug /> ); - _renderInput = (placeholder, state, keyboardType, isTextArea) => { + _renderInput = (placeholder, state, keyboardType, availableVestingShares, isTextArea) => { switch (state) { case 'destination': return ( @@ -179,8 +191,10 @@ class DelegateScreen extends Component { return ( this._handleOnAmountChange(state, amount)} - value={this.state[state]} + onChangeText={(amount) => { + this._handleAmountChange(amount, availableVestingShares); + }} + value={this.state.amount.toString()} placeholder={placeholder} placeholderTextColor="#c1c5c7" autoCapitalize="none" @@ -207,7 +221,7 @@ class DelegateScreen extends Component { hivePerMVests, accountType, } = this.props; - const { amount, isTransfering, from, destination, steemConnectTransfer } = this.state; + const { amount, isTransfering, from, destination, steemConnectTransfer, step } = this.state; let availableVestingShares = 0; if (!isEmptyDate(get(selectedAccount, 'next_vesting_withdrawal'))) { // powering down @@ -229,64 +243,94 @@ class DelegateScreen extends Component { )}`; const spCalculated = vestsToHp(amount, hivePerMVests); + const totalHP = vestsToHp(availableVestingShares, hivePerMVests); + const _renderStepOne = () => ( + + + + + + + this._renderDropdown(accounts, currentAccountName)} + /> + + this._renderInput( + intl.formatMessage({ id: 'transfer.to_placeholder' }), + 'destination', + 'default', + ) + } + /> + + ); + const _renderStepTwo = () => ( + + {/* this._renderInformationText(`${amount.toFixed(6)} VESTS`)} + /> */} + + this._renderInput( + intl.formatMessage({ id: 'transfer.amount' }), + 'amount', + 'number-pad', + availableVestingShares, + ) + } + /> + + + this._renderInformationText(`${(availableVestingShares - amount).toFixed(6)} VESTS`) + } + /> + + this._renderInformationText(`${(totalHP - spCalculated).toFixed(3)} HP`) + } + /> + { + this.setState({ amount: value }); + }} + /> + + {intl.formatMessage({ id: 'transfer.amount_information' })} + + + ); + const _renderStepThree = () => ( + + this.startActionSheet.current.show()} + isLoading={isTransfering} + > + {intl.formatMessage({ id: 'transfer.next' })} + + + ); + return ( - - - - - - - this._renderDropdown(accounts, currentAccountName)} - /> - - this._renderInput( - intl.formatMessage({ id: 'transfer.to_placeholder' }), - 'destination', - 'default', - ) - } - containerStyle={{ zIndex: 1 }} - /> - this._renderInformationText(`${amount.toFixed(6)} VESTS`)} - /> - - this._renderInformationText(`${spCalculated.toFixed(3)} HP`)} - /> - { - this.setState({ amount: value }); - }} - /> - - {intl.formatMessage({ id: 'transfer.amount_information' })} - - - - this.startActionSheet.current.show()} - isLoading={isTransfering} - > - {intl.formatMessage({ id: 'transfer.next' })} - - + {_renderStepOne()} + {_renderStepTwo()} + {_renderStepThree()} Date: Fri, 4 Feb 2022 12:07:10 +0500 Subject: [PATCH 03/46] added multistep and HP input --- src/screens/transfer/screen/delegateScreen.js | 62 +++++++++++-------- src/screens/transfer/screen/transferStyles.js | 3 + src/utils/conversions.ts | 13 ++-- 3 files changed, 48 insertions(+), 30 deletions(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index e6c55df2d..5ac269e95 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -24,7 +24,7 @@ import { import parseToken from '../../../utils/parseToken'; import { isEmptyDate } from '../../../utils/time'; -import { vestsToHp } from '../../../utils/conversions'; +import { hpToVests, vestsToHp } from '../../../utils/conversions'; import TransferFormItemView from '../../../components/transferFormItem/view/transferFormItemView'; // Styles @@ -49,12 +49,13 @@ class DelegateScreen extends Component { super(props); this.state = { amount: 0, + hp: 0, isTransfering: false, from: props.currentAccountName, destination: '', steemConnectTransfer: false, usersResult: [], - step: 0, + step: 1, }; this.startActionSheet = React.createRef(); @@ -74,7 +75,7 @@ class DelegateScreen extends Component { this.setState({ isUsernameValid: isValid }); }); if (!value) { - this.setState({ destination: '' }); + this.setState({ destination: '', step: 1 }); } break; @@ -91,14 +92,17 @@ class DelegateScreen extends Component { } }; - _handleAmountChange = (value, availableBalance) => { - const parsedValue = parseFloat(Number(value)); + _handleAmountChange = (hp, availableVests) => { + const parsedValue = parseFloat(Number(hp)); + const { hivePerMVests } = this.props; + const vestsForHp = hpToVests(hp, hivePerMVests); + const totalHP = vestsToHp(availableVests, hivePerMVests).toFixed(3); if (Number.isNaN(parsedValue)) { - this.setState({ amount: 0 }); - } else if (parsedValue > availableBalance) { - this.setState({ amount: availableBalance }); + this.setState({ amount: 0, hp: 0, step: 2 }); + } else if (parsedValue > totalHP) { + this.setState({ amount: hpToVests(totalHP, hivePerMVests), hp: totalHP, step: 2 }); } else { - this.setState({ amount: parsedValue }); + this.setState({ amount: vestsForHp, hp: hp, step: 3 }); } }; _handleTransferAction = () => { @@ -140,7 +144,7 @@ class DelegateScreen extends Component { return ( { - this.setState({ destination: username, usersResult: [] }); + this.setState({ destination: username, usersResult: [], step: 2 }); }} style={styles.usersDropItemRow} > @@ -167,9 +171,9 @@ class DelegateScreen extends Component { { - this.setState({ destination: amount }); - this._handleOnAmountChange(state, amount); + onChangeText={(value) => { + this.setState({ destination: value }); + this._handleOnAmountChange(state, value); }} value={this.state[state]} placeholder={placeholder} @@ -194,7 +198,7 @@ class DelegateScreen extends Component { onChangeText={(amount) => { this._handleAmountChange(amount, availableVestingShares); }} - value={this.state.amount.toString()} + value={this.state.hp.toString()} placeholder={placeholder} placeholderTextColor="#c1c5c7" autoCapitalize="none" @@ -244,8 +248,9 @@ class DelegateScreen extends Component { const spCalculated = vestsToHp(amount, hivePerMVests); const totalHP = vestsToHp(availableVestingShares, hivePerMVests); + console.log('availableHP : ', vestsToHp(availableVestingShares - amount, hivePerMVests)); const _renderStepOne = () => ( - + <> @@ -265,10 +270,10 @@ class DelegateScreen extends Component { ) } /> - + ); const _renderStepTwo = () => ( - + <> {/* this._renderInformationText(`${amount.toFixed(6)} VESTS`)} @@ -283,13 +288,14 @@ class DelegateScreen extends Component { availableVestingShares, ) } + containerStyle={styles.paddBottom} /> - + {/* this._renderInformationText(`${(availableVestingShares - amount).toFixed(6)} VESTS`) } - /> + /> */} this._renderInformationText(`${(totalHP - spCalculated).toFixed(3)} HP`) @@ -304,16 +310,19 @@ class DelegateScreen extends Component { maximumValue={availableVestingShares} value={amount} onValueChange={(value) => { - this.setState({ amount: value }); + this.setState({ amount: value, hp: vestsToHp(value, hivePerMVests).toFixed(3) }); + if (value !== 0 && value !== availableVestingShares) { + this.setState({ step: 3 }); + } }} /> {intl.formatMessage({ id: 'transfer.amount_information' })} - + ); const _renderStepThree = () => ( - + <> this.startActionSheet.current.show()} @@ -321,16 +330,17 @@ class DelegateScreen extends Component { > {intl.formatMessage({ id: 'transfer.next' })} - + ); + console.log('remaining vests : ', availableVestingShares - amount); return ( - {_renderStepOne()} - {_renderStepTwo()} - {_renderStepThree()} + {_renderStepOne()} + {step >= 2 && _renderStepTwo()} + {step >= 3 && _renderStepThree()} { return (vests / 1e6) * hivePerMVests; }; - -export const vestsToRshares = (vests:number, votingPower:number, weight:number) => { +export const hpToVests = (hp, hivePerMVests) => { + if (!hp || !hivePerMVests) { + return 0; + } + return (hp * 1e6) / hivePerMVests; +}; +export const vestsToRshares = (vests: number, votingPower: number, weight: number) => { if (!vests || !votingPower || !weight) { return 0; } const finalVest = vests * 1e6; - const power = (votingPower * weight / 10000) / 50 - return (power * finalVest / 1000) + const power = (votingPower * weight) / 10000 / 50; + return (power * finalVest) / 1000; }; From b8195479d28a641cf053dbe976b33c15cf1e3249 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Fri, 4 Feb 2022 12:13:24 +0500 Subject: [PATCH 04/46] added userAvatar in users autocomplete dropdown --- src/screens/transfer/screen/delegateScreen.js | 1 + src/screens/transfer/screen/transferStyles.js | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 5ac269e95..9d46566f6 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -148,6 +148,7 @@ class DelegateScreen extends Component { }} style={styles.usersDropItemRow} > + {username} ); diff --git a/src/screens/transfer/screen/transferStyles.js b/src/screens/transfer/screen/transferStyles.js index 15c59a9da..4e65f5751 100644 --- a/src/screens/transfer/screen/transferStyles.js +++ b/src/screens/transfer/screen/transferStyles.js @@ -227,14 +227,17 @@ export default EStyleSheet.create({ backgroundColor: '$primaryLightBackground', }, usersDropItemRow: { - height: 35, - justifyContent: 'center', + height: 50, + flexDirection: 'row', + justifyContent: 'flex-start', + alignItems: 'center', paddingHorizontal: 10, - paddingVertical: 5, + paddingVertical: 10, }, usersDropItemRowText: { color: '$primaryDarkGray', textAlign: 'left', + marginLeft: 5, }, paddBottom: { paddingBottom: 12, From 486df4f2bdce087f28ddb3e690df79a676441277 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Fri, 4 Feb 2022 13:00:22 +0500 Subject: [PATCH 05/46] added keyboardAwareScrollView and input error border --- src/screens/transfer/screen/delegateScreen.js | 34 +++++++++++++------ src/screens/transfer/screen/transferStyles.js | 7 ++++ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 9d46566f6..bcee85041 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -4,6 +4,7 @@ import { WebView } from 'react-native-webview'; import { injectIntl } from 'react-intl'; import Slider from '@esteemapp/react-native-slider'; import get from 'lodash/get'; +import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'; // Constants import { debounce } from 'lodash'; @@ -49,6 +50,7 @@ class DelegateScreen extends Component { super(props); this.state = { amount: 0, + isAmountValid: false, hp: 0, isTransfering: false, from: props.currentAccountName, @@ -93,16 +95,25 @@ class DelegateScreen extends Component { }; _handleAmountChange = (hp, availableVests) => { + if (!hp) { + this.setState({ step: 2, hp: 0, amount: 0, isAmountValid: false }); + return; + } const parsedValue = parseFloat(Number(hp)); const { hivePerMVests } = this.props; const vestsForHp = hpToVests(hp, hivePerMVests); const totalHP = vestsToHp(availableVests, hivePerMVests).toFixed(3); if (Number.isNaN(parsedValue)) { - this.setState({ amount: 0, hp: 0, step: 2 }); + this.setState({ amount: 0, hp: 0, step: 2, isAmountValid: false }); } else if (parsedValue > totalHP) { - this.setState({ amount: hpToVests(totalHP, hivePerMVests), hp: totalHP, step: 2 }); + this.setState({ + amount: hpToVests(totalHP, hivePerMVests), + hp: totalHP, + step: 2, + isAmountValid: false, + }); } else { - this.setState({ amount: vestsForHp, hp: hp, step: 3 }); + this.setState({ amount: vestsForHp, hp: parsedValue, step: 3, isAmountValid: true }); } }; _handleTransferAction = () => { @@ -166,6 +177,7 @@ class DelegateScreen extends Component { /> ); _renderInput = (placeholder, state, keyboardType, availableVestingShares, isTextArea) => { + const { isAmountValid } = this.state; switch (state) { case 'destination': return ( @@ -195,7 +207,7 @@ class DelegateScreen extends Component { case 'amount': return ( { this._handleAmountChange(amount, availableVestingShares); }} @@ -249,7 +261,6 @@ class DelegateScreen extends Component { const spCalculated = vestsToHp(amount, hivePerMVests); const totalHP = vestsToHp(availableVestingShares, hivePerMVests); - console.log('availableHP : ', vestsToHp(availableVestingShares - amount, hivePerMVests)); const _renderStepOne = () => ( <> @@ -334,15 +345,16 @@ class DelegateScreen extends Component { ); - console.log('remaining vests : ', availableVestingShares - amount); return ( - - {_renderStepOne()} - {step >= 2 && _renderStepTwo()} - {step >= 3 && _renderStepThree()} - + + + {_renderStepOne()} + {step >= 2 && _renderStepTwo()} + {step >= 3 && _renderStepThree()} + + Date: Fri, 4 Feb 2022 13:04:55 +0500 Subject: [PATCH 06/46] fix slider input valid --- src/screens/transfer/screen/delegateScreen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index bcee85041..c6260df32 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -324,7 +324,7 @@ class DelegateScreen extends Component { onValueChange={(value) => { this.setState({ amount: value, hp: vestsToHp(value, hivePerMVests).toFixed(3) }); if (value !== 0 && value !== availableVestingShares) { - this.setState({ step: 3 }); + this.setState({ step: 3, isAmountValid: true }); } }} /> From 160a7987c4ea3f1933da29fa836bd3e3f55bd01c Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Tue, 8 Feb 2022 19:34:30 +0500 Subject: [PATCH 07/46] added getVestShare method in ecency.ts --- ios/Podfile.lock | 4 ++-- src/providers/ecency/ecency.ts | 19 +++++++++++++++++++ src/screens/transfer/screen/delegateScreen.js | 10 +++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index c052bc551..c67e30b0e 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -335,7 +335,7 @@ PODS: - React - react-native-version-number (0.3.6): - React - - react-native-webview (11.2.3): + - react-native-webview (11.17.1): - React-Core - React-RCTActionSheet (0.63.4): - React-Core/RCTActionSheetHeaders (= 0.63.4) @@ -736,7 +736,7 @@ SPEC CHECKSUMS: react-native-splash-screen: 200d11d188e2e78cea3ad319964f6142b6384865 react-native-udp: ff9d13e523f2b58e6bc5d4d32321ac60671b5dc9 react-native-version-number: b415bbec6a13f2df62bf978e85bc0d699462f37f - react-native-webview: 6520e3e7b4933de76b95ef542c8d7115cf45b68e + react-native-webview: 162b6453d074e0b1c7025242bb7a939b6f72b9e7 React-RCTActionSheet: 89a0ca9f4a06c1f93c26067af074ccdce0f40336 React-RCTAnimation: 1bde3ecc0c104c55df246eda516e0deb03c4e49b React-RCTBlob: a97d378b527740cc667e03ebfa183a75231ab0f0 diff --git a/src/providers/ecency/ecency.ts b/src/providers/ecency/ecency.ts index fac3363cb..1fd1e10ae 100644 --- a/src/providers/ecency/ecency.ts +++ b/src/providers/ecency/ecency.ts @@ -733,3 +733,22 @@ export const signUp = async (username:string, email:string, referral?:string) => throw error; } }; + +/** + * + * details + * @param username of user + */ + export const getReceivedVestingShares = async (username:string) => { + try { + console.log('Fetching received vesting shares entries'); + return ecencyApi.get(`/private-api/received-vesting/${username}`).then((resp) => { + return resp.data ? resp.data : null + }); + + } catch (error) { + console.warn("Failed to get received vesting shares" + error) + bugsnagInstance.notify(error); + return error; + } +}; diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index c6260df32..4e3ce4260 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -31,6 +31,7 @@ import TransferFormItemView from '../../../components/transferFormItem/view/tran // Styles import styles from './transferStyles'; import { OptionsModal } from '../../../components/atoms'; +import { getReceivedVestingShares } from '../../../providers/ecency/ecency'; class DelegateScreen extends Component { _handleOnAmountChange = debounce( @@ -154,7 +155,9 @@ class DelegateScreen extends Component { const username = item; return ( { + onPress={async () => { + const receivedVS = await getReceivedVestingShares(username); + console.log('receivedVS : ', receivedVS); this.setState({ destination: username, usersResult: [], step: 2 }); }} style={styles.usersDropItemRow} @@ -313,6 +316,11 @@ class DelegateScreen extends Component { this._renderInformationText(`${(totalHP - spCalculated).toFixed(3)} HP`) } /> + + this._renderInformationText(`${(totalHP - spCalculated).toFixed(3)} HP`) + } + /> Date: Wed, 9 Feb 2022 11:52:34 +0500 Subject: [PATCH 08/46] added react-native-video for extension based urls --- android/build.gradle | 1 + ios/Podfile.lock | 13 ++- package.json | 1 + .../postHtmlRenderer/postHtmlRenderer.tsx | 20 +--- .../videoPlayer/videoPlayerView.tsx | 94 +++++++++++-------- yarn.lock | 26 +++++ 6 files changed, 100 insertions(+), 55 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 2ffe7ae60..41addf6a6 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -63,6 +63,7 @@ allprojects { includeGroup("com.facebook.fbjni") includeGroup("com.henninghall.android") includeGroup("org.matomo.sdk") + includeModule("com.yqritc", "android-scalablevideoview") } } } diff --git a/ios/Podfile.lock b/ios/Podfile.lock index c052bc551..6451ba9a7 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -335,7 +335,12 @@ PODS: - React - react-native-version-number (0.3.6): - React - - react-native-webview (11.2.3): + - react-native-video (5.2.0): + - React-Core + - react-native-video/Video (= 5.2.0) + - react-native-video/Video (5.2.0): + - React-Core + - react-native-webview (11.17.1): - React-Core - React-RCTActionSheet (0.63.4): - React-Core/RCTActionSheetHeaders (= 0.63.4) @@ -496,6 +501,7 @@ DEPENDENCIES: - react-native-splash-screen (from `../node_modules/react-native-splash-screen`) - react-native-udp (from `../node_modules/react-native-udp`) - react-native-version-number (from `../node_modules/react-native-version-number`) + - react-native-video (from `../node_modules/react-native-video`) - react-native-webview (from `../node_modules/react-native-webview`) - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) @@ -621,6 +627,8 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native-udp" react-native-version-number: :path: "../node_modules/react-native-version-number" + react-native-video: + :path: "../node_modules/react-native-video" react-native-webview: :path: "../node_modules/react-native-webview" React-RCTActionSheet: @@ -736,7 +744,8 @@ SPEC CHECKSUMS: react-native-splash-screen: 200d11d188e2e78cea3ad319964f6142b6384865 react-native-udp: ff9d13e523f2b58e6bc5d4d32321ac60671b5dc9 react-native-version-number: b415bbec6a13f2df62bf978e85bc0d699462f37f - react-native-webview: 6520e3e7b4933de76b95ef542c8d7115cf45b68e + react-native-video: a4c2635d0802f983594b7057e1bce8f442f0ad28 + react-native-webview: 162b6453d074e0b1c7025242bb7a939b6f72b9e7 React-RCTActionSheet: 89a0ca9f4a06c1f93c26067af074ccdce0f40336 React-RCTAnimation: 1bde3ecc0c104c55df246eda516e0deb03c4e49b React-RCTBlob: a97d378b527740cc667e03ebfa183a75231ab0f0 diff --git a/package.json b/package.json index c4d2daa09..ba052717d 100644 --- a/package.json +++ b/package.json @@ -128,6 +128,7 @@ "react-native-vector-icons": "^6.6.0", "react-native-version": "^4.0.0", "react-native-version-number": "^0.3.5", + "react-native-video": "^5.2.0", "react-native-webview": "^11.17.1", "react-native-youtube-iframe": "^2.1.1", "react-navigation": "^4.0.10", diff --git a/src/components/postHtmlRenderer/postHtmlRenderer.tsx b/src/components/postHtmlRenderer/postHtmlRenderer.tsx index ce677a56d..9b25eebf8 100644 --- a/src/components/postHtmlRenderer/postHtmlRenderer.tsx +++ b/src/components/postHtmlRenderer/postHtmlRenderer.tsx @@ -150,9 +150,9 @@ export const PostHtmlRenderer = memo( } else { return ( - - `, - }:{ - uri: iframeProps.source.uri, - }; //TODO: remove android check logic when fix for react-native-webiew scrollview crash is available //ref: https://github.com/react-native-webview/react-native-webview/issues/2364 @@ -254,9 +241,10 @@ export const PostHtmlRenderer = memo( ) }else{ return ( + ); diff --git a/src/components/videoPlayer/videoPlayerView.tsx b/src/components/videoPlayer/videoPlayerView.tsx index 60bd9fb67..94b96fd97 100644 --- a/src/components/videoPlayer/videoPlayerView.tsx +++ b/src/components/videoPlayer/videoPlayerView.tsx @@ -1,37 +1,35 @@ -import React, { useState } from 'react'; +import React, { useState, useRef } from 'react'; import { Dimensions } from 'react-native'; import { View, StyleSheet, ActivityIndicator } from 'react-native'; import WebView from 'react-native-webview'; import YoutubeIframe, { InitialPlayerParams } from 'react-native-youtube-iframe'; -import { WebViewSource } from 'react-native-webview/lib/WebViewTypes'; +import Video from 'react-native-video'; interface VideoPlayerProps { - mode: 'source'|'youtube'|'url'; + mode: 'source' | 'youtube'; contentWidth?: number; youtubeVideoId?: string; - videoUrl?: string; startTime?: number; - source?: WebViewSource; - + source?: string; //prop for youtube player - disableAutoplay?:boolean; + disableAutoplay?: boolean; } -const VideoPlayer = ({ - youtubeVideoId, - videoUrl, - startTime, - source, - contentWidth = Dimensions.get('screen').width, - mode, - disableAutoplay - }: VideoPlayerProps) => { - +const VideoPlayer = ({ + youtubeVideoId, + startTime, + source, + contentWidth = Dimensions.get('screen').width, + mode, + disableAutoplay, +}: VideoPlayerProps) => { const PLAYER_HEIGHT = contentWidth * (9 / 16); + const checkSrcRegex = /(.*?)\.(mp4|webm|ogg)$/gi; + const isExtensionType = mode === 'source' ? source.match(checkSrcRegex) : false; const [shouldPlay, setShouldPlay] = useState(false); const [loading, setLoading] = useState(true); - + const videoPlayerRef = useRef(null); const _onReady = () => { setLoading(false); setShouldPlay(disableAutoplay ? false : true); @@ -67,26 +65,41 @@ const VideoPlayer = ({ /> )} - {((mode === 'source' && source) || (mode === 'url' && videoUrl)) && ( + {mode === 'source' && source && ( - { - setLoading(false); - }} - onLoadStart={() => { - setLoading(true); - }} - source={source || { uri: videoUrl }} - style={{ width: contentWidth, height: PLAYER_HEIGHT}} - startInLoadingState={true} - onShouldStartLoadWithRequest={() => true} - mediaPlaybackRequiresUserAction={true} - allowsInlineMediaPlayback={true} - /> + {isExtensionType ? ( + )} {loading && } @@ -109,4 +122,11 @@ const styles = StyleSheet.create({ left: 0, right: 0, }, + videoPlayer: { + position: 'absolute', + top: 0, + bottom: 0, + left: 0, + right: 0, + }, }); diff --git a/yarn.lock b/yarn.lock index eddbd939e..3dfb5dcf9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3927,6 +3927,11 @@ elliptic@^6.5.2, elliptic@^6.5.3: minimalistic-assert "^1.0.1" minimalistic-crypto-utils "^1.0.1" +eme-encryption-scheme-polyfill@^2.0.1: + version "2.0.3" + resolved "https://registry.yarnpkg.com/eme-encryption-scheme-polyfill/-/eme-encryption-scheme-polyfill-2.0.3.tgz#2ca6e06480e06cceb5e50efd27943ac46c959878" + integrity sha512-44CNFMsqzHdKHrzWxlS7xZ8KUHn5XutBqpmCuWzNIynmAyFInHrrD3ozv/RvK9ZhgV6QY6Easx8EWAmxteNodg== + emoji-regex@^7.0.1: version "7.0.3" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" @@ -6543,6 +6548,11 @@ jsx-ast-utils@^2.2.3: array-includes "^3.1.2" object.assign "^4.1.2" +keymirror@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/keymirror/-/keymirror-0.1.1.tgz#918889ea13f8d0a42e7c557250eee713adc95c35" + integrity sha1-kYiJ6hP40KQufFVyUO7nE63JXDU= + kind-of@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-1.1.0.tgz#140a3d2d41a36d2efcfa9377b62c24f8495a5c44" @@ -8856,6 +8866,15 @@ react-native-version@^4.0.0: resolve-from "^5.0.0" semver "^7.0.0" +react-native-video@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/react-native-video/-/react-native-video-5.2.0.tgz#c3f2c541775f4fda7e0d26d75a6fb59819b13d5e" + integrity sha512-5SK1lxyzrCkZF+WuxUxLR1Pt65E0rsWB1w1GrGxSLdC9zWYBumcmuHl+wPJ7UQvznjaH2Ze7uU1R3arejI7+WQ== + dependencies: + keymirror "^0.1.1" + prop-types "^15.7.2" + shaka-player "^2.5.9" + react-native-webview@^11.17.1: version "11.17.1" resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-11.17.1.tgz#a7c9d995d749539995a4fdad8aa6456bac77fc8f" @@ -9643,6 +9662,13 @@ sha.js@^2.4.0, sha.js@^2.4.8: inherits "^2.0.1" safe-buffer "^5.0.1" +shaka-player@^2.5.9: + version "2.5.23" + resolved "https://registry.yarnpkg.com/shaka-player/-/shaka-player-2.5.23.tgz#db92d1c6cf2314f0180a2cec11b0e2f2560336f5" + integrity sha512-3MC9k0OXJGw8AZ4n/ZNCZS2yDxx+3as5KgH6Tx4Q5TRboTBBCu6dYPI5vp1DxKeyU12MBN1Zcbs7AKzXv2EnCg== + dependencies: + eme-encryption-scheme-polyfill "^2.0.1" + shallow-clone@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/shallow-clone/-/shallow-clone-1.0.0.tgz#4480cd06e882ef68b2ad88a3ea54832e2c48b571" From 8a0f7101ce50c2f78e1139f7c902ac0fe57ec7fb Mon Sep 17 00:00:00 2001 From: noumantahir Date: Wed, 9 Feb 2022 12:50:59 +0500 Subject: [PATCH 09/46] integrated vested shares api --- src/config/ecencyApi.ts | 1 + src/providers/ecency/ecency.ts | 27 ++++++++++++++++ src/providers/ecency/ecency.types.ts | 6 ++++ src/screens/transfer/screen/delegateScreen.js | 31 +++++++++++++++++-- 4 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 src/providers/ecency/ecency.types.ts diff --git a/src/config/ecencyApi.ts b/src/config/ecencyApi.ts index c626acb86..a5e888e09 100644 --- a/src/config/ecencyApi.ts +++ b/src/config/ecencyApi.ts @@ -23,6 +23,7 @@ api.interceptors.request.use((request) => { || request.url === '/auth-api/hs-token-refresh' || request.url === '/private-api/promoted-entries' || request.url.startsWith('private-api/leaderboard') + || request.url.startsWith('/private-api/received-vesting/') ){ return request } diff --git a/src/providers/ecency/ecency.ts b/src/providers/ecency/ecency.ts index fac3363cb..dc7e3b84e 100644 --- a/src/providers/ecency/ecency.ts +++ b/src/providers/ecency/ecency.ts @@ -6,6 +6,15 @@ import bugsnagInstance from '../../config/bugsnag'; import { SERVER_LIST } from '../../constants/options/api'; import { parsePost } from '../../utils/postParser'; import { extractMetadata, makeJsonMetadata } from '../../utils/editor'; +import { ReceivedVestingShare, ReceivedVestingShares } from './ecency.types'; + + + +/** + * ************************************ + * CURRENCY APIS IMPLEMENTATION + * ************************************ + */ export const getCurrencyRate = (currency) => api @@ -27,6 +36,24 @@ export const getCurrencyTokenRate = (currency, token) => }); +export const getReceivedVestingShares = async (username: string):Promise => { + try{ + const res = await ecencyApi.get(`/private-api/received-vesting/${username}`); + console.log("Vesting Shares User", username, res.data); + if(!res.data || !res.data.list){ + throw new Error("No vesting shares for user") + } + return res.data.list; + } catch (error){ + bugsnagInstance.notify(error); + console.warn(error); + throw error + } +} + + + + /** * returns list of saved drafts on ecency server diff --git a/src/providers/ecency/ecency.types.ts b/src/providers/ecency/ecency.types.ts new file mode 100644 index 000000000..bb00d7332 --- /dev/null +++ b/src/providers/ecency/ecency.types.ts @@ -0,0 +1,6 @@ +export interface ReceivedVestingShare { + delgator:string; + delegatee:string; + vesting_shares:string; + timestamp:string; +} diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index c6260df32..c6b02fcdc 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -1,5 +1,5 @@ import React, { Component, Fragment } from 'react'; -import { View, Text, FlatList, TouchableOpacity } from 'react-native'; +import { View, Text, FlatList, TouchableOpacity, Alert } from 'react-native'; import { WebView } from 'react-native-webview'; import { injectIntl } from 'react-intl'; import Slider from '@esteemapp/react-native-slider'; @@ -26,11 +26,11 @@ import { import parseToken from '../../../utils/parseToken'; import { isEmptyDate } from '../../../utils/time'; import { hpToVests, vestsToHp } from '../../../utils/conversions'; -import TransferFormItemView from '../../../components/transferFormItem/view/transferFormItemView'; // Styles import styles from './transferStyles'; import { OptionsModal } from '../../../components/atoms'; +import { getReceivedVestingShares } from '../../../providers/ecency/ecency'; class DelegateScreen extends Component { _handleOnAmountChange = debounce( @@ -64,6 +64,11 @@ class DelegateScreen extends Component { } // Component Life Cycles + componentDidUpdate = (prevProps, prevState) => { + if (prevState.step !== this.state.step && this.state.step === 2) { + this._fetchReceivedVestingShare(); + } + }; // Component Functions _setState = (key, value) => { @@ -129,6 +134,27 @@ class DelegateScreen extends Component { } }; + _fetchReceivedVestingShare = async () => { + try { + const delegateeUser = this.state.destination; + const vestingShares = await getReceivedVestingShares(delegateeUser); + if (vestingShares && vestingShares.length) { + const curShare = vestingShares.find((item) => { + item.delgator === this.state.from; + }); + + if (curShare) { + //TOOD: use already delegated vests from here. + Alert.alert('DEV: Received Vests from current user', curShare.vesting_shares); + } else { + Alert.alert('DEV: No previous delegated vests'); + } + } + } catch (err) { + console.warn(err); + } + }; + _handleOnDropdownChange = (value) => { const { fetchBalance } = this.props; @@ -176,6 +202,7 @@ class DelegateScreen extends Component { ListFooterComponentStyle={{ height: 20 }} //this fixes the last item visibility bug /> ); + _renderInput = (placeholder, state, keyboardType, availableVestingShares, isTextArea) => { const { isAmountValid } = this.state; switch (state) { From ceb744494eb31a7a5155fd07616f2f51395b1340 Mon Sep 17 00:00:00 2001 From: noumantahir Date: Wed, 9 Feb 2022 12:54:49 +0500 Subject: [PATCH 10/46] removed existing implementation of vesting shares --- src/providers/ecency/ecency.ts | 18 ------------------ src/screens/transfer/screen/delegateScreen.js | 2 -- 2 files changed, 20 deletions(-) diff --git a/src/providers/ecency/ecency.ts b/src/providers/ecency/ecency.ts index 719a98d20..ff5c552b8 100644 --- a/src/providers/ecency/ecency.ts +++ b/src/providers/ecency/ecency.ts @@ -761,21 +761,3 @@ export const signUp = async (username:string, email:string, referral?:string) => } }; -/** - * - * details - * @param username of user - */ - export const getReceivedVestingShares = async (username:string) => { - try { - console.log('Fetching received vesting shares entries'); - return ecencyApi.get(`/private-api/received-vesting/${username}`).then((resp) => { - return resp.data ? resp.data : null - }); - - } catch (error) { - console.warn("Failed to get received vesting shares" + error) - bugsnagInstance.notify(error); - return error; - } -}; diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index b68352828..99868d138 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -181,8 +181,6 @@ class DelegateScreen extends Component { return ( { - const receivedVS = await getReceivedVestingShares(username); - console.log('receivedVS : ', receivedVS); this.setState({ destination: username, usersResult: [], step: 2 }); }} style={styles.usersDropItemRow} From 53e7d4cada55656ba6d3694ae8c6a6e146107e63 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Thu, 10 Feb 2022 08:46:17 +0500 Subject: [PATCH 11/46] added delegated hp and remaining hp added delegated hp and remaining hp with amount validation checks --- src/config/locales/en-US.json | 4 +- src/providers/ecency/ecency.types.ts | 2 +- src/screens/transfer/screen/delegateScreen.js | 62 +++++++++++++------ 3 files changed, 46 insertions(+), 22 deletions(-) diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index 416ce5be2..a6e4b4ad9 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -574,7 +574,9 @@ "incoming_funds": "Incoming Funds", "stop": "Stop", "sc_power_down_error": "This feature is not implemented for Hivesigner login, yet", - "address_view": "View address" + "address_view": "View address", + "already_delegated": "Already Delegated", + "remain_hp": "Remaining HP" }, "boost": { "title": "Get Points", diff --git a/src/providers/ecency/ecency.types.ts b/src/providers/ecency/ecency.types.ts index bb00d7332..c46e8c4c5 100644 --- a/src/providers/ecency/ecency.types.ts +++ b/src/providers/ecency/ecency.types.ts @@ -1,5 +1,5 @@ export interface ReceivedVestingShare { - delgator:string; + delegator:string; delegatee:string; vesting_shares:string; timestamp:string; diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 99868d138..2321dfab3 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -26,7 +26,7 @@ import { import parseToken from '../../../utils/parseToken'; import { isEmptyDate } from '../../../utils/time'; import { hpToVests, vestsToHp } from '../../../utils/conversions'; - +import parseAsset from '../../../utils/parseAsset'; // Styles import styles from './transferStyles'; import { OptionsModal } from '../../../components/atoms'; @@ -58,6 +58,7 @@ class DelegateScreen extends Component { steemConnectTransfer: false, usersResult: [], step: 1, + delegatedHP: 0, }; this.startActionSheet = React.createRef(); @@ -108,7 +109,7 @@ class DelegateScreen extends Component { const { hivePerMVests } = this.props; const vestsForHp = hpToVests(hp, hivePerMVests); const totalHP = vestsToHp(availableVests, hivePerMVests).toFixed(3); - if (Number.isNaN(parsedValue)) { + if (!parsedValue || Number.isNaN(parsedValue)) { this.setState({ amount: 0, hp: 0, step: 2, isAmountValid: false }); } else if (parsedValue > totalHP) { this.setState({ @@ -136,19 +137,21 @@ class DelegateScreen extends Component { _fetchReceivedVestingShare = async () => { try { + const { hivePerMVests } = this.props; const delegateeUser = this.state.destination; const vestingShares = await getReceivedVestingShares(delegateeUser); if (vestingShares && vestingShares.length) { - const curShare = vestingShares.find((item) => { - item.delgator === this.state.from; - }); - + const curShare = vestingShares.find((item) => item.delegator === this.state.from); if (curShare) { - //TOOD: use already delegated vests from here. - Alert.alert('DEV: Received Vests from current user', curShare.vesting_shares); - } else { - Alert.alert('DEV: No previous delegated vests'); + const vest_shares = parseAsset(curShare.vesting_shares); + this.setState({ + delegatedHP: vestsToHp(vest_shares.amount, hivePerMVests).toFixed(3), + }); } + } else { + this.setState({ + delegatedHP: 0, + }); } } catch (err) { console.warn(err); @@ -162,6 +165,22 @@ class DelegateScreen extends Component { this.setState({ from: value, amount: 0 }); }; + _handleSliderValueChange = (value, availableVestingShares) => { + const { hivePerMVests } = this.props; + if (!value || value === availableVestingShares) { + this.setState({ isAmountValid: false }); + } + if (value !== 0 && value !== availableVestingShares) { + this.setState({ + step: 3, + isAmountValid: true, + amount: value, + hp: vestsToHp(value, hivePerMVests).toFixed(3), + }); + } else { + this.setState({ amount: value, hp: vestsToHp(value, hivePerMVests).toFixed(3), step: 2 }); + } + }; _renderDropdown = (accounts, currentAccountName) => ( */} - this._renderInformationText(`${(totalHP - spCalculated).toFixed(3)} HP`) - } + label={intl.formatMessage({ id: 'transfer.already_delegated' })} + rightComponent={() => this._renderInformationText(`${delegatedHP} HP`)} /> this._renderInformationText(`${(totalHP - spCalculated).toFixed(3)} HP`) } @@ -353,12 +380,7 @@ class DelegateScreen extends Component { thumbTintColor="#007ee5" maximumValue={availableVestingShares} value={amount} - onValueChange={(value) => { - this.setState({ amount: value, hp: vestsToHp(value, hivePerMVests).toFixed(3) }); - if (value !== 0 && value !== availableVestingShares) { - this.setState({ step: 3, isAmountValid: true }); - } - }} + onValueChange={(value) => this._handleSliderValueChange(value, availableVestingShares)} /> {intl.formatMessage({ id: 'transfer.amount_information' })} From e5cf2762f39d3467cf9d4092a6a5357892f32ec5 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Fri, 11 Feb 2022 23:23:05 +0500 Subject: [PATCH 12/46] new delegate screen design implemented --- .../view/transferFormItemStyles.js | 10 +- src/config/locales/en-US.json | 9 +- src/screens/transfer/screen/delegateScreen.js | 125 ++++++++++++------ src/screens/transfer/screen/transferStyles.js | 110 ++++++++++----- 4 files changed, 176 insertions(+), 78 deletions(-) diff --git a/src/components/transferFormItem/view/transferFormItemStyles.js b/src/components/transferFormItem/view/transferFormItemStyles.js index ac5daafbb..a697cb3ed 100644 --- a/src/components/transferFormItem/view/transferFormItemStyles.js +++ b/src/components/transferFormItem/view/transferFormItemStyles.js @@ -3,13 +3,17 @@ import EStyleSheet from 'react-native-extended-stylesheet'; export default EStyleSheet.create({ container: { flexDirection: 'row', - paddingHorizontal: 20, + justifyContent: 'space-between', + paddingHorizontal: 16, + height: 40, + marginVertical: 8, }, leftPart: { flex: 1, - padding: 10, justifyContent: 'center', + alignItems: 'flex-start', color: '$primaryBlack', + height: 40, }, text: { color: '$primaryBlack', @@ -18,6 +22,6 @@ export default EStyleSheet.create({ }, rightPart: { flex: 2, - padding: 10, + // padding: 10, }, }); diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index a6e4b4ad9..ae23c0292 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -575,8 +575,13 @@ "stop": "Stop", "sc_power_down_error": "This feature is not implemented for Hivesigner login, yet", "address_view": "View address", - "already_delegated": "Already Delegated", - "remain_hp": "Remaining HP" + "already_delegated": "Already Delegated to ", + "remain_hp": "Remaining HP", + "add_account": "Add Account Details", + "delegat_detail_head": "Delegation Details", + "delegat_detail_subhead": "New Amount overwrite the previous delegated HIVE Power ", + "new_amount": "New Amount", + "review": "Review" }, "boost": { "title": "Get Points", diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 2321dfab3..976e80205 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -50,7 +50,7 @@ class DelegateScreen extends Component { super(props); this.state = { amount: 0, - isAmountValid: false, + isAmountValid: true, hp: 0, isTransfering: false, from: props.currentAccountName, @@ -109,9 +109,9 @@ class DelegateScreen extends Component { const { hivePerMVests } = this.props; const vestsForHp = hpToVests(hp, hivePerMVests); const totalHP = vestsToHp(availableVests, hivePerMVests).toFixed(3); - if (!parsedValue || Number.isNaN(parsedValue)) { + if (Number.isNaN(parsedValue)) { this.setState({ amount: 0, hp: 0, step: 2, isAmountValid: false }); - } else if (parsedValue > totalHP) { + } else if (parsedValue >= totalHP) { this.setState({ amount: hpToVests(totalHP, hivePerMVests), hp: totalHP, @@ -122,6 +122,7 @@ class DelegateScreen extends Component { this.setState({ amount: vestsForHp, hp: parsedValue, step: 3, isAmountValid: true }); } }; + _handleTransferAction = () => { const { transferToAccount, accountType } = this.props; const { from, destination, amount } = this.state; @@ -167,7 +168,7 @@ class DelegateScreen extends Component { _handleSliderValueChange = (value, availableVestingShares) => { const { hivePerMVests } = this.props; - if (!value || value === availableVestingShares) { + if (value === availableVestingShares) { this.setState({ isAmountValid: false }); } if (value !== 0 && value !== availableVestingShares) { @@ -181,6 +182,15 @@ class DelegateScreen extends Component { this.setState({ amount: value, hp: vestsToHp(value, hivePerMVests).toFixed(3), step: 2 }); } }; + + _handleNext = () => { + const { step } = this.state; + if (step === 1) { + this.setState({ step: 2 }); + } else { + console.log('this is step : ', step); + } + }; _renderDropdown = (accounts, currentAccountName) => ( { this.setState({ destination: value }); this._handleOnAmountChange(state, value); @@ -292,6 +302,8 @@ class DelegateScreen extends Component { steemConnectTransfer, step, delegatedHP, + hp, + isAmountValid, } = this.state; let availableVestingShares = 0; if (!isEmptyDate(get(selectedAccount, 'next_vesting_withdrawal'))) { @@ -315,13 +327,39 @@ class DelegateScreen extends Component { const spCalculated = vestsToHp(amount, hivePerMVests); const totalHP = vestsToHp(availableVestingShares, hivePerMVests); - const _renderStepOne = () => ( - <> - - - - + const _renderToFromAvatars = () => ( + + + + + + ); + const _renderSlider = () => ( + + + + this._handleSliderValueChange(value, availableVestingShares)} + /> + + {`${hp} HP`} + {`${totalHP.toFixed(3)} HP`} + + + ); + const _renderStepOne = () => ( + + + {intl.formatMessage({ id: 'transfer.add_account' })} + this._renderDropdown(accounts, currentAccountName)} @@ -335,17 +373,27 @@ class DelegateScreen extends Component { 'default', ) } + containerStyle={styles.elevate} /> - + {_renderToFromAvatars()} + ); const _renderStepTwo = () => ( - <> - {/* this._renderInformationText(`${amount.toFixed(6)} VESTS`)} - /> */} + + + {intl.formatMessage({ id: 'transfer.delegat_detail_head' })} + + + {intl.formatMessage({ id: 'transfer.delegat_detail_subhead' })} + + + + {`${intl.formatMessage({ id: 'transfer.already_delegated' })} @${destination}`} + + {`${delegatedHP} HP`} + this._renderInput( intl.formatMessage({ id: 'transfer.amount' }), @@ -362,7 +410,7 @@ class DelegateScreen extends Component { this._renderInformationText(`${(availableVestingShares - amount).toFixed(6)} VESTS`) } /> */} - this._renderInformationText(`${delegatedHP} HP`)} /> @@ -371,32 +419,25 @@ class DelegateScreen extends Component { rightComponent={() => this._renderInformationText(`${(totalHP - spCalculated).toFixed(3)} HP`) } - /> - this._handleSliderValueChange(value, availableVestingShares)} - /> - - {intl.formatMessage({ id: 'transfer.amount_information' })} - - + /> */} + {_renderSlider()} + ); - const _renderStepThree = () => ( - <> + const _renderMainBtn = () => ( + this.startActionSheet.current.show()} + onPress={this._handleNext} isLoading={isTransfering} + isDisable={!isAmountValid} > - {intl.formatMessage({ id: 'transfer.next' })} + + {step === 2 + ? intl.formatMessage({ id: 'transfer.review' }) + : intl.formatMessage({ id: 'transfer.next' })} + - + ); return ( @@ -404,9 +445,9 @@ class DelegateScreen extends Component { - {_renderStepOne()} - {step >= 2 && _renderStepTwo()} - {step >= 3 && _renderStepThree()} + {step >= 1 && _renderStepOne()} + {step >= 2 && _renderStepTwo()} + {_renderMainBtn()} Date: Sat, 12 Feb 2022 00:52:55 +0500 Subject: [PATCH 13/46] added action modal in delegation screen --- .../container/actionModalContainer.tsx | 1 + .../actionModal/view/actionModalView.tsx | 8 +++- src/config/locales/en-US.json | 5 ++- src/containers/transferContainer.js | 13 +++++- src/redux/actions/uiAction.ts | 3 +- src/screens/transfer/index.js | 4 ++ src/screens/transfer/screen/delegateScreen.js | 40 ++++++++++++++++++- 7 files changed, 67 insertions(+), 7 deletions(-) diff --git a/src/components/actionModal/container/actionModalContainer.tsx b/src/components/actionModal/container/actionModalContainer.tsx index 0b026df6d..29134b64c 100644 --- a/src/components/actionModal/container/actionModalContainer.tsx +++ b/src/components/actionModal/container/actionModalContainer.tsx @@ -8,6 +8,7 @@ import ActionModalView, { ActionModalRef } from '../view/actionModalView'; export interface ActionModalData { title:string, body:string, + para?: string, buttons:AlertButton[], headerImage?:Source, onClosed:()=>void, diff --git a/src/components/actionModal/view/actionModalView.tsx b/src/components/actionModal/view/actionModalView.tsx index 674668870..a633fa90e 100644 --- a/src/components/actionModal/view/actionModalView.tsx +++ b/src/components/actionModal/view/actionModalView.tsx @@ -42,7 +42,8 @@ const ActionModalView = ({onClose, data}: ActionModalViewProps, ref) => { title, body, buttons, - headerImage + headerImage, + para } = data; @@ -61,7 +62,10 @@ const ActionModalView = ({onClose, data}: ActionModalViewProps, ref) => { {title} {!!body && ( - {body} + <> + {body} + {para} + )} diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index ae23c0292..c6951b731 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -581,7 +581,10 @@ "delegat_detail_head": "Delegation Details", "delegat_detail_subhead": "New Amount overwrite the previous delegated HIVE Power ", "new_amount": "New Amount", - "review": "Review" + "review": "Review", + "confirm": "Confirm Delegation", + "confirm_summary": "Delegate {hp} HP ({vests} VESTS) To @{delegator} from @{delegatee} ", + "confirm_summary_para": "This will overwrite your previous delegation of {prev} HP to this user.
" }, "boost": { "title": "Get Points", diff --git a/src/containers/transferContainer.js b/src/containers/transferContainer.js index de6afa615..7f4cda0cc 100644 --- a/src/containers/transferContainer.js +++ b/src/containers/transferContainer.js @@ -221,7 +221,15 @@ class TransferContainer extends Component { }; render() { - const { accounts, navigation, children, hivePerMVests, currentAccount } = this.props; + const { + accounts, + navigation, + children, + hivePerMVests, + currentAccount, + actionModalVisible, + dispatch, + } = this.props; const { balance, fundType, selectedAccount, tokenAddress } = this.state; const transferType = navigation.getParam('transferType', ''); @@ -229,6 +237,7 @@ class TransferContainer extends Component { return ( children && children({ + dispatch, accounts, balance, tokenAddress, @@ -236,6 +245,7 @@ class TransferContainer extends Component { transferType, selectedAccount, hivePerMVests, + actionModalVisible, fetchBalance: this.fetchBalance, getAccountsWithUsername: this._getAccountsWithUsername, transferToAccount: this._transferToAccount, @@ -253,6 +263,7 @@ const mapStateToProps = (state) => ({ currentAccount: state.account.currentAccount, pinCode: state.application.pin, hivePerMVests: state.account.globalProps.hivePerMVests, + actionModalVisible: state.ui.actionModalVisible, }); export default connect(mapStateToProps)(injectIntl(TransferContainer)); diff --git a/src/redux/actions/uiAction.ts b/src/redux/actions/uiAction.ts index 68d9568a4..288a67346 100644 --- a/src/redux/actions/uiAction.ts +++ b/src/redux/actions/uiAction.ts @@ -23,12 +23,13 @@ export const toastNotification = (payload:string) => ({ type: TOAST_NOTIFICATION, }); -export const showActionModal = (title:string, body?:string, buttons?:AlertButton[], headerImage?:any, onClosed?:()=>void) => ({ +export const showActionModal = (title:string, body?:string, para?: string, buttons?:AlertButton[], headerImage?:any, onClosed?:()=>void) => ({ payload: { actionModalVisible: new Date().getTime(), actionModalData: { title, body, + para, buttons, headerImage, onClosed, diff --git a/src/screens/transfer/index.js b/src/screens/transfer/index.js index 2018830a4..6baafdef1 100644 --- a/src/screens/transfer/index.js +++ b/src/screens/transfer/index.js @@ -22,7 +22,9 @@ const Transfer = ({ navigation }) => ( accountType, currentAccountName, hivePerMVests, + actionModalVisible, setWithdrawVestingRoute, + dispatch, }) => { switch (transferType) { case 'transfer_token': @@ -61,6 +63,8 @@ const Transfer = ({ navigation }) => ( accountType={accountType} handleOnModalClose={handleOnModalClose} hivePerMVests={hivePerMVests} + actionModalVisible={actionModalVisible} + dispatch={dispatch} /> ); case 'power_down': diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 976e80205..e5437533b 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -31,6 +31,7 @@ import parseAsset from '../../../utils/parseAsset'; import styles from './transferStyles'; import { OptionsModal } from '../../../components/atoms'; import { getReceivedVestingShares } from '../../../providers/ecency/ecency'; +import { showActionModal } from '../../../redux/actions/uiAction'; class DelegateScreen extends Component { _handleOnAmountChange = debounce( @@ -184,11 +185,44 @@ class DelegateScreen extends Component { }; _handleNext = () => { - const { step } = this.state; + const { step, hp, amount, destination, from, delegatedHP } = this.state; + const { dispatch, intl } = this.props; if (step === 1) { this.setState({ step: 2 }); } else { - console.log('this is step : ', step); + dispatch( + showActionModal( + intl.formatMessage({ id: 'transfer.confirm' }), + intl.formatMessage( + { id: 'transfer.confirm_summary' }, + { + hp: hp, + vests: amount, + delegatee: from, + delegator: destination, + }, + ), + intl.formatMessage( + { id: 'transfer.confirm_summary_para' }, + { + prev: delegatedHP, + }, + ), + [ + { + text: intl.formatMessage({ id: 'alert.cancel' }), + onPress: () => console.log('cancel'), + }, + { + text: intl.formatMessage({ id: 'alert.confirm' }), + onPress: () => console.log('confirm'), + }, + ], + ), + + Header + , + ); } }; _renderDropdown = (accounts, currentAccountName) => ( @@ -292,6 +326,7 @@ class DelegateScreen extends Component { selectedAccount, handleOnModalClose, hivePerMVests, + actionModalVisible, accountType, } = this.props; const { @@ -305,6 +340,7 @@ class DelegateScreen extends Component { hp, isAmountValid, } = this.state; + console.log('actionModalVisible : ', this.props.actionModalVisible); let availableVestingShares = 0; if (!isEmptyDate(get(selectedAccount, 'next_vesting_withdrawal'))) { // powering down From ad9b8bb4afbcb577c6c0cd18431e181c0c845874 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Sat, 12 Feb 2022 09:23:04 +0500 Subject: [PATCH 14/46] changed card background --- src/screens/transfer/screen/transferStyles.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/screens/transfer/screen/transferStyles.js b/src/screens/transfer/screen/transferStyles.js index d47da9d5e..d13e9ae68 100644 --- a/src/screens/transfer/screen/transferStyles.js +++ b/src/screens/transfer/screen/transferStyles.js @@ -7,15 +7,16 @@ export default EStyleSheet.create({ }, stepOneContainer: { zIndex: 2, - borderWidth: 1, - borderColor: '$borderColor', paddingVertical: 16, + borderRadius: 12, + backgroundColor: '$primaryLightBackground', }, stepTwoContainer: { paddingVertical: 12, - borderWidth: 1, - borderColor: '$borderColor', marginTop: 16, + + borderRadius: 12, + backgroundColor: '$primaryLightBackground', }, stepThreeContainer: { alignItems: 'center', @@ -232,6 +233,7 @@ export default EStyleSheet.create({ fillSpace: { flex: 1, padding: 16, + backgroundColor: '$primaryBackgroundColor', }, elevate: { zIndex: 1, From e11a6a0c25a2046ff311d928442848e1ddf366e8 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Sat, 12 Feb 2022 09:38:52 +0500 Subject: [PATCH 15/46] added to from avatars in action modal --- .../container/actionModalContainer.tsx | 1 + .../actionModal/view/actionModalView.tsx | 8 ++++- src/redux/actions/uiAction.ts | 3 +- src/screens/transfer/screen/delegateScreen.js | 34 ++++++++++--------- 4 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/components/actionModal/container/actionModalContainer.tsx b/src/components/actionModal/container/actionModalContainer.tsx index 29134b64c..2319e17ff 100644 --- a/src/components/actionModal/container/actionModalContainer.tsx +++ b/src/components/actionModal/container/actionModalContainer.tsx @@ -12,6 +12,7 @@ export interface ActionModalData { buttons:AlertButton[], headerImage?:Source, onClosed:()=>void, + headerContent?: React.ReactNode, } diff --git a/src/components/actionModal/view/actionModalView.tsx b/src/components/actionModal/view/actionModalView.tsx index a633fa90e..de2f45b0c 100644 --- a/src/components/actionModal/view/actionModalView.tsx +++ b/src/components/actionModal/view/actionModalView.tsx @@ -43,12 +43,18 @@ const ActionModalView = ({onClose, data}: ActionModalViewProps, ref) => { body, buttons, headerImage, - para + para, + headerContent } = data; const _renderContent = ( + { + headerContent && ( + headerContent + ) + } { headerImage && ( ({ type: TOAST_NOTIFICATION, }); -export const showActionModal = (title:string, body?:string, para?: string, buttons?:AlertButton[], headerImage?:any, onClosed?:()=>void) => ({ +export const showActionModal = (title:string, body?:string, para?: string, buttons?:AlertButton[], headerContent?:any, headerImage?:any, onClosed?:()=>void) => ({ payload: { actionModalVisible: new Date().getTime(), actionModalData: { @@ -31,6 +31,7 @@ export const showActionModal = (title:string, body?:string, para?: string, butto body, para, buttons, + headerContent, headerImage, onClosed, }, diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index e5437533b..9eb14cfcd 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -43,7 +43,7 @@ class DelegateScreen extends Component { this._setState(state, _amount); }, - 200, + 1000, { leading: true }, ); @@ -120,7 +120,7 @@ class DelegateScreen extends Component { isAmountValid: false, }); } else { - this.setState({ amount: vestsForHp, hp: parsedValue, step: 3, isAmountValid: true }); + this.setState({ amount: vestsForHp, hp: parsedValue, step: 2, isAmountValid: true }); } }; @@ -172,9 +172,9 @@ class DelegateScreen extends Component { if (value === availableVestingShares) { this.setState({ isAmountValid: false }); } - if (value !== 0 && value !== availableVestingShares) { + if (value !== availableVestingShares) { this.setState({ - step: 3, + step: 2, isAmountValid: true, amount: value, hp: vestsToHp(value, hivePerMVests).toFixed(3), @@ -197,7 +197,7 @@ class DelegateScreen extends Component { { id: 'transfer.confirm_summary' }, { hp: hp, - vests: amount, + vests: amount.toFixed(3), delegatee: from, delegator: destination, }, @@ -218,10 +218,8 @@ class DelegateScreen extends Component { onPress: () => console.log('confirm'), }, ], + this._renderToFromAvatars(), ), - - Header - , ); } }; @@ -318,6 +316,16 @@ class DelegateScreen extends Component { _renderInformationText = (text) => {text}; + _renderToFromAvatars = () => { + const { destination, from } = this.state; + return ( + + + + + + ); + }; render() { const { intl, @@ -363,13 +371,7 @@ class DelegateScreen extends Component { const spCalculated = vestsToHp(amount, hivePerMVests); const totalHP = vestsToHp(availableVestingShares, hivePerMVests); - const _renderToFromAvatars = () => ( - - - - - - ); + const _renderSlider = () => ( @@ -411,7 +413,7 @@ class DelegateScreen extends Component { } containerStyle={styles.elevate} /> - {_renderToFromAvatars()} + {this._renderToFromAvatars()} ); const _renderStepTwo = () => ( From d95b87ddbfb5929ef68e42e93da3f57d471ec56d Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Sat, 12 Feb 2022 09:45:23 +0500 Subject: [PATCH 16/46] fixed float values bug in input --- src/screens/transfer/screen/delegateScreen.js | 3 ++- src/screens/transfer/screen/transferStyles.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 9eb14cfcd..0b63444da 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -106,7 +106,8 @@ class DelegateScreen extends Component { this.setState({ step: 2, hp: 0, amount: 0, isAmountValid: false }); return; } - const parsedValue = parseFloat(Number(hp)); + const parsedValue = parseFloat(hp); + console.log(('parsedValue : ', parsedValue)); const { hivePerMVests } = this.props; const vestsForHp = hpToVests(hp, hivePerMVests); const totalHP = vestsToHp(availableVests, hivePerMVests).toFixed(3); diff --git a/src/screens/transfer/screen/transferStyles.js b/src/screens/transfer/screen/transferStyles.js index d13e9ae68..ad2f559e7 100644 --- a/src/screens/transfer/screen/transferStyles.js +++ b/src/screens/transfer/screen/transferStyles.js @@ -273,9 +273,9 @@ export default EStyleSheet.create({ borderRadius: 1, }, thumb: { - width: 16, - height: 16, - borderRadius: 16 / 2, + width: 20, + height: 20, + borderRadius: 20 / 2, backgroundColor: '$primaryLightBackground', shadowColor: 'black', shadowOffset: { width: 0, height: 2 }, From 6df1be8806f23603b55c38e87f89784201e733f8 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Sat, 12 Feb 2022 10:13:35 +0500 Subject: [PATCH 17/46] removed old commented code --- src/screens/transfer/screen/delegateScreen.js | 36 +++++-------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 0b63444da..5125311ef 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -22,16 +22,17 @@ import { Icon, Modal, } from '../../../components'; - +// Styles +import styles from './transferStyles'; +import { OptionsModal } from '../../../components/atoms'; +// Redux +import { showActionModal } from '../../../redux/actions/uiAction'; +// Utils +import { getReceivedVestingShares } from '../../../providers/ecency/ecency'; import parseToken from '../../../utils/parseToken'; import { isEmptyDate } from '../../../utils/time'; import { hpToVests, vestsToHp } from '../../../utils/conversions'; import parseAsset from '../../../utils/parseAsset'; -// Styles -import styles from './transferStyles'; -import { OptionsModal } from '../../../components/atoms'; -import { getReceivedVestingShares } from '../../../providers/ecency/ecency'; -import { showActionModal } from '../../../redux/actions/uiAction'; class DelegateScreen extends Component { _handleOnAmountChange = debounce( @@ -212,11 +213,11 @@ class DelegateScreen extends Component { [ { text: intl.formatMessage({ id: 'alert.cancel' }), - onPress: () => console.log('cancel'), + onPress: () => console.log('Cancel'), }, { text: intl.formatMessage({ id: 'alert.confirm' }), - onPress: () => console.log('confirm'), + onPress: () => this._handleTransferAction(), }, ], this._renderToFromAvatars(), @@ -369,10 +370,7 @@ class DelegateScreen extends Component { const path = `sign/delegate-vesting-shares?delegator=${from}&delegatee=${destination}&vesting_shares=${encodeURIComponent( fixedAmount, )}`; - - const spCalculated = vestsToHp(amount, hivePerMVests); const totalHP = vestsToHp(availableVestingShares, hivePerMVests); - const _renderSlider = () => ( @@ -443,22 +441,6 @@ class DelegateScreen extends Component { } containerStyle={styles.paddBottom} /> - {/* - - this._renderInformationText(`${(availableVestingShares - amount).toFixed(6)} VESTS`) - } - /> */} - {/* this._renderInformationText(`${delegatedHP} HP`)} - /> - - this._renderInformationText(`${(totalHP - spCalculated).toFixed(3)} HP`) - } - /> */} {_renderSlider()} ); From 0a9f0953427ca053425eb4e9c2913712eadff07c Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Sun, 13 Feb 2022 18:34:50 +0500 Subject: [PATCH 18/46] renamed source and mode prop --- ios/Podfile.lock | 5 +++++ .../postHtmlRenderer/postHtmlRenderer.tsx | 8 ++++---- src/components/videoPlayer/videoPlayerView.tsx | 14 +++++++------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 927c016bb..6451ba9a7 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -335,6 +335,11 @@ PODS: - React - react-native-version-number (0.3.6): - React + - react-native-video (5.2.0): + - React-Core + - react-native-video/Video (= 5.2.0) + - react-native-video/Video (5.2.0): + - React-Core - react-native-webview (11.17.1): - React-Core - React-RCTActionSheet (0.63.4): diff --git a/src/components/postHtmlRenderer/postHtmlRenderer.tsx b/src/components/postHtmlRenderer/postHtmlRenderer.tsx index 9b25eebf8..6ecda43fb 100644 --- a/src/components/postHtmlRenderer/postHtmlRenderer.tsx +++ b/src/components/postHtmlRenderer/postHtmlRenderer.tsx @@ -150,9 +150,9 @@ export const PostHtmlRenderer = memo( } else { return ( ); diff --git a/src/components/videoPlayer/videoPlayerView.tsx b/src/components/videoPlayer/videoPlayerView.tsx index 94b96fd97..1a5717ffd 100644 --- a/src/components/videoPlayer/videoPlayerView.tsx +++ b/src/components/videoPlayer/videoPlayerView.tsx @@ -6,11 +6,11 @@ import YoutubeIframe, { InitialPlayerParams } from 'react-native-youtube-iframe' import Video from 'react-native-video'; interface VideoPlayerProps { - mode: 'source' | 'youtube'; + mode: 'uri' | 'youtube'; contentWidth?: number; youtubeVideoId?: string; startTime?: number; - source?: string; + uri?: string; //prop for youtube player disableAutoplay?: boolean; } @@ -18,14 +18,14 @@ interface VideoPlayerProps { const VideoPlayer = ({ youtubeVideoId, startTime, - source, + uri, contentWidth = Dimensions.get('screen').width, mode, disableAutoplay, }: VideoPlayerProps) => { const PLAYER_HEIGHT = contentWidth * (9 / 16); const checkSrcRegex = /(.*?)\.(mp4|webm|ogg)$/gi; - const isExtensionType = mode === 'source' ? source.match(checkSrcRegex) : false; + const isExtensionType = mode === 'uri' ? uri.match(checkSrcRegex) : false; const [shouldPlay, setShouldPlay] = useState(false); const [loading, setLoading] = useState(true); @@ -65,11 +65,11 @@ const VideoPlayer = ({ /> )} - {mode === 'source' && source && ( + {mode === 'uri' && uri && ( {isExtensionType ? ( ); const _renderStepTwo = () => ( - - - {intl.formatMessage({ id: 'transfer.delegat_detail_head' })} - - - {intl.formatMessage({ id: 'transfer.delegat_detail_subhead' })} - - - - {`${intl.formatMessage({ id: 'transfer.already_delegated' })} @${destination}`} + + + + {intl.formatMessage({ id: 'transfer.delegat_detail_head' })} - {`${delegatedHP} HP`} + + {intl.formatMessage({ id: 'transfer.delegat_detail_subhead' })} + + + + {`${intl.formatMessage({ id: 'transfer.already_delegated' })} @${destination}`} + + {`${delegatedHP} HP`} + + + this._renderInput( + intl.formatMessage({ id: 'transfer.amount' }), + 'amount', + 'decimal-pad', + availableVestingShares, + ) + } + containerStyle={styles.paddBottom} + /> + {_renderSlider()} - - this._renderInput( - intl.formatMessage({ id: 'transfer.amount' }), - 'amount', - 'decimal-pad', - availableVestingShares, - ) - } - containerStyle={styles.paddBottom} - /> - {_renderSlider()} - + ); const _renderMainBtn = () => ( From 01f9bcbf9a527de9926996c70462b10ce3110909 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Sun, 13 Feb 2022 21:50:10 +0500 Subject: [PATCH 21/46] updated step one subheading --- src/config/locales/en-US.json | 3 ++- src/screens/transfer/screen/delegateScreen.js | 7 +++++-- src/screens/transfer/screen/transferStyles.js | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index c6951b731..c04359b2b 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -577,7 +577,8 @@ "address_view": "View address", "already_delegated": "Already Delegated to ", "remain_hp": "Remaining HP", - "add_account": "Add Account Details", + "account_detail_head": "Account Details", + "account_detail_subhead": "Enter account usernames for HIVE Power delegation", "delegat_detail_head": "Delegation Details", "delegat_detail_subhead": "New Amount overwrite the previous delegated HIVE Power ", "new_amount": "New Amount", diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 72f435586..603578542 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -391,7 +391,7 @@ class DelegateScreen extends Component { onValueChange={(value) => this._handleSliderValueChange(value, availableVestingShares)} /> - {`${totalHP.toFixed(3)} HP`} + {`MAX ${totalHP.toFixed(3)} HP`} @@ -399,7 +399,10 @@ class DelegateScreen extends Component { const _renderStepOne = () => ( - {intl.formatMessage({ id: 'transfer.add_account' })} + {intl.formatMessage({ id: 'transfer.account_detail_head' })} + + + {intl.formatMessage({ id: 'transfer.account_detail_subhead' })} Date: Sun, 13 Feb 2022 22:01:52 +0500 Subject: [PATCH 22/46] adjusted keyboard scroll height when focus --- src/screens/transfer/screen/delegateScreen.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 603578542..00954eeef 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -66,6 +66,7 @@ class DelegateScreen extends Component { this.startActionSheet = React.createRef(); this.destinationTextInput = React.createRef(); + this.amountTextInput = React.createRef(); } // Component Life Cycles @@ -192,8 +193,9 @@ class DelegateScreen extends Component { const { step, hp, amount, destination, from, delegatedHP } = this.state; const { dispatch, intl } = this.props; if (step === 1) { - this.setState({ step: 2 }); + // this.setState({ step: 2 }); } else { + // this.amountTextInput.current.blur(); dispatch( showActionModal( intl.formatMessage({ id: 'transfer.confirm' }), @@ -313,6 +315,8 @@ class DelegateScreen extends Component { multiline={isTextArea} numberOfLines={isTextArea ? 4 : 1} keyboardType={keyboardType} + innerRef={this.amountTextInput} + blurOnSubmit={false} /> ); default: @@ -473,7 +477,11 @@ class DelegateScreen extends Component { return ( - + {step >= 1 && _renderStepOne()} {step >= 2 && _renderStepTwo()} From 5b80af3904561434b37231ade41c5c9f35f1a130 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Sun, 13 Feb 2022 23:22:09 +0500 Subject: [PATCH 23/46] fixed the keyboard scroll issue on android --- .../mainButton/view/mainButtonStyles.js | 2 +- src/screens/transfer/screen/delegateScreen.js | 33 +++++++++++++------ src/screens/transfer/screen/transferStyles.js | 7 ++++ 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/components/mainButton/view/mainButtonStyles.js b/src/components/mainButton/view/mainButtonStyles.js index 859f2d35a..5fce4ec40 100644 --- a/src/components/mainButton/view/mainButtonStyles.js +++ b/src/components/mainButton/view/mainButtonStyles.js @@ -13,7 +13,7 @@ export default EStyleSheet.create({ }, shadowColor: '#5f5f5fbf', shadowOpacity: 0.1, - elevation: 3, + // elevation: 3, }, icon: { alignSelf: 'center', diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 00954eeef..f0425686c 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -1,11 +1,12 @@ import React, { Component, Fragment } from 'react'; -import { View, Text, FlatList, TouchableOpacity, Alert } from 'react-native'; +import { View, Text, Platform, ScrollView, KeyboardAvoidingView } from 'react-native'; import { WebView } from 'react-native-webview'; import { injectIntl } from 'react-intl'; import Slider from '@esteemapp/react-native-slider'; import get from 'lodash/get'; import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'; import { View as AnimatedView } from 'react-native-animatable'; +import { TouchableOpacity, FlatList } from 'react-native-gesture-handler'; // Constants import { debounce } from 'lodash'; @@ -477,17 +478,29 @@ class DelegateScreen extends Component { return ( - */} + - - {step >= 1 && _renderStepOne()} - {step >= 2 && _renderStepTwo()} - {_renderMainBtn()} - - + + + {step >= 1 && _renderStepOne()} + {step >= 2 && _renderStepTwo()} + + {_renderMainBtn()} + + + + {/* */} Date: Sun, 13 Feb 2022 23:25:13 +0500 Subject: [PATCH 24/46] removed keyboard aware scroll view --- src/screens/transfer/screen/delegateScreen.js | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index f0425686c..59f4aa39a 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -4,7 +4,6 @@ import { WebView } from 'react-native-webview'; import { injectIntl } from 'react-intl'; import Slider from '@esteemapp/react-native-slider'; import get from 'lodash/get'; -import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'; import { View as AnimatedView } from 'react-native-animatable'; import { TouchableOpacity, FlatList } from 'react-native-gesture-handler'; @@ -478,14 +477,6 @@ class DelegateScreen extends Component { return ( - {/* */} - {/* */} Date: Sun, 13 Feb 2022 23:42:40 +0500 Subject: [PATCH 25/46] fixed float value in input --- src/screens/transfer/screen/delegateScreen.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 59f4aa39a..e973a8a25 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -54,7 +54,7 @@ class DelegateScreen extends Component { this.state = { amount: 0, isAmountValid: true, - hp: 0, + hp: 0.0, isTransfering: false, from: props.currentAccountName, destination: '', @@ -93,7 +93,7 @@ class DelegateScreen extends Component { break; case 'amount': - if (parseFloat(Number(value)) <= parseFloat(balance)) { + if (parseFloat(value) <= parseFloat(balance)) { this.setState({ [key]: value }); } break; @@ -107,16 +107,15 @@ class DelegateScreen extends Component { _handleAmountChange = (hp, availableVests) => { if (!hp) { - this.setState({ step: 2, hp: 0, amount: 0, isAmountValid: false }); + this.setState({ step: 2, hp: 0.0, amount: 0, isAmountValid: false }); return; } const parsedValue = parseFloat(hp); - console.log(('parsedValue : ', parsedValue)); const { hivePerMVests } = this.props; const vestsForHp = hpToVests(hp, hivePerMVests); const totalHP = vestsToHp(availableVests, hivePerMVests).toFixed(3); if (Number.isNaN(parsedValue)) { - this.setState({ amount: 0, hp: 0, step: 2, isAmountValid: false }); + this.setState({ amount: 0, hp: 0.0, step: 2, isAmountValid: false }); } else if (parsedValue >= totalHP) { this.setState({ amount: hpToVests(totalHP, hivePerMVests), @@ -308,7 +307,7 @@ class DelegateScreen extends Component { onChangeText={(amount) => { this._handleAmountChange(amount, availableVestingShares); }} - value={this.state.hp.toString()} + value={this.state.hp} placeholder={placeholder} placeholderTextColor="#c1c5c7" autoCapitalize="none" @@ -359,7 +358,6 @@ class DelegateScreen extends Component { hp, isAmountValid, } = this.state; - console.log('actionModalVisible : ', this.props.actionModalVisible); let availableVestingShares = 0; if (!isEmptyDate(get(selectedAccount, 'next_vesting_withdrawal'))) { // powering down From 3442e12e241a61e4afeaf1681c8db060844929d1 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Mon, 14 Feb 2022 18:05:24 +0500 Subject: [PATCH 26/46] fixed already delegated amount not changing bug --- src/screens/transfer/screen/delegateScreen.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index e973a8a25..64d691682 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -69,13 +69,6 @@ class DelegateScreen extends Component { this.amountTextInput = React.createRef(); } - // Component Life Cycles - componentDidUpdate = (prevProps, prevState) => { - if (prevState.step !== this.state.step && this.state.step === 2) { - this._fetchReceivedVestingShare(); - } - }; - // Component Functions _setState = (key, value) => { const { getAccountsWithUsername, balance } = this.props; @@ -247,6 +240,7 @@ class DelegateScreen extends Component { return ( { + this._fetchReceivedVestingShare(); this.setState({ destination: username, usersResult: [], step: 2 }); this.destinationTextInput.current?.blur(); }} @@ -279,7 +273,7 @@ class DelegateScreen extends Component { { - this.setState({ destination: value }); + this.setState({ destination: value, step: 1 }); this._handleOnAmountChange(state, value); }} value={this.state[state]} From 93546c8d556ad2106339aa940df02a3f798ad325 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Mon, 14 Feb 2022 18:13:22 +0500 Subject: [PATCH 27/46] added alert for same username selection --- src/config/locales/en-US.json | 4 +++- src/screens/transfer/screen/delegateScreen.js | 11 ++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index c04359b2b..1bd72e95e 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -585,7 +585,9 @@ "review": "Review", "confirm": "Confirm Delegation", "confirm_summary": "Delegate {hp} HP ({vests} VESTS) To @{delegator} from @{delegatee} ", - "confirm_summary_para": "This will overwrite your previous delegation of {prev} HP to this user.
" + "confirm_summary_para": "This will overwrite your previous delegation of {prev} HP to this user.", + "username_alert": "Username Error!", + "username_alert_detail": "Please select different username" }, "boost": { "title": "Get Points", diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 64d691682..cd33f2077 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -1,5 +1,5 @@ import React, { Component, Fragment } from 'react'; -import { View, Text, Platform, ScrollView, KeyboardAvoidingView } from 'react-native'; +import { View, Text, Platform, ScrollView, KeyboardAvoidingView, Alert } from 'react-native'; import { WebView } from 'react-native-webview'; import { injectIntl } from 'react-intl'; import Slider from '@esteemapp/react-native-slider'; @@ -237,9 +237,18 @@ class DelegateScreen extends Component { _renderUsersDropdownItem = ({ item }) => { const username = item; + const { from } = this.state; + const { intl } = this.props; return ( { + if (username === from) { + Alert.alert( + intl.formatMessage({ id: 'transfer.username_alert' }), + intl.formatMessage({ id: 'transfer.username_alert_detail' }), + ); + return; + } this._fetchReceivedVestingShare(); this.setState({ destination: username, usersResult: [], step: 2 }); this.destinationTextInput.current?.blur(); From 3aa9fec9a61fed8118e1d5e5f2351cc3f5e02752 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Mon, 14 Feb 2022 18:49:51 +0500 Subject: [PATCH 28/46] changed actionModal params to options object --- src/redux/actions/uiAction.ts | 10 ++-------- src/screens/transfer/screen/delegateScreen.js | 14 +++++++------- 2 files changed, 9 insertions(+), 15 deletions(-) diff --git a/src/redux/actions/uiAction.ts b/src/redux/actions/uiAction.ts index 39a7750f2..171bb6f3f 100644 --- a/src/redux/actions/uiAction.ts +++ b/src/redux/actions/uiAction.ts @@ -23,17 +23,11 @@ export const toastNotification = (payload:string) => ({ type: TOAST_NOTIFICATION, }); -export const showActionModal = (title:string, body?:string, para?: string, buttons?:AlertButton[], headerContent?:any, headerImage?:any, onClosed?:()=>void) => ({ +export const showActionModal = (payload:any) => ({ payload: { actionModalVisible: new Date().getTime(), actionModalData: { - title, - body, - para, - buttons, - headerContent, - headerImage, - onClosed, + ...payload }, }, type: SHOW_ACTION_MODAL, diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index cd33f2077..f4099188a 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -189,9 +189,9 @@ class DelegateScreen extends Component { } else { // this.amountTextInput.current.blur(); dispatch( - showActionModal( - intl.formatMessage({ id: 'transfer.confirm' }), - intl.formatMessage( + showActionModal({ + title: intl.formatMessage({ id: 'transfer.confirm' }), + body: intl.formatMessage( { id: 'transfer.confirm_summary' }, { hp: hp, @@ -200,13 +200,13 @@ class DelegateScreen extends Component { delegator: destination, }, ), - intl.formatMessage( + para: intl.formatMessage( { id: 'transfer.confirm_summary_para' }, { prev: delegatedHP, }, ), - [ + buttons: [ { text: intl.formatMessage({ id: 'alert.cancel' }), onPress: () => console.log('Cancel'), @@ -216,8 +216,8 @@ class DelegateScreen extends Component { onPress: () => this._handleTransferAction(), }, ], - this._renderToFromAvatars(), - ), + headerContent: this._renderToFromAvatars(), + }), ); } }; From 2fbb8a0ec4667fe3977c11213cbdc18ec43ac07e Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Mon, 14 Feb 2022 19:01:26 +0500 Subject: [PATCH 29/46] changed actionModal implementation in other components --- .../container/postDropdownContainer.tsx | 27 +++++++++++-------- src/containers/profileContainer.js | 10 +++---- .../container/applicationContainer.js | 15 ++++++----- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/components/postDropdown/container/postDropdownContainer.tsx b/src/components/postDropdown/container/postDropdownContainer.tsx index fc958a5ca..cbc3aa07e 100644 --- a/src/components/postDropdown/container/postDropdownContainer.tsx +++ b/src/components/postDropdown/container/postDropdownContainer.tsx @@ -145,17 +145,22 @@ class PostDropdownContainer extends PureComponent { }); } - dispatch(showActionModal( - intl.formatMessage({id:'report.confirm_report_title'}), - intl.formatMessage({id:'report.confirm_report_body'}), - [{ - text:intl.formatMessage({id:'alert.cancel'}), - onPress:()=>{} - },{ - text:intl.formatMessage({id:'alert.confirm'}), - onPress:_onConfirm - }] - )) + dispatch( + showActionModal({ + title: intl.formatMessage({ id: 'report.confirm_report_title' }), + body: intl.formatMessage({ id: 'report.confirm_report_body' }), + buttons: [ + { + text: intl.formatMessage({ id: 'alert.cancel' }), + onPress: () => {}, + }, + { + text: intl.formatMessage({ id: 'alert.confirm' }), + onPress: _onConfirm, + }, + ], + }), + ); }; diff --git a/src/containers/profileContainer.js b/src/containers/profileContainer.js index 758ee5d4f..60e9a8fda 100644 --- a/src/containers/profileContainer.js +++ b/src/containers/profileContainer.js @@ -439,10 +439,10 @@ class ProfileContainer extends Component { }; dispatch( - showActionModal( - intl.formatMessage({ id: 'report.confirm_report_title' }), - intl.formatMessage({ id: 'report.confirm_report_body' }), - [ + showActionModal({ + title: intl.formatMessage({ id: 'report.confirm_report_title' }), + body: intl.formatMessage({ id: 'report.confirm_report_body' }), + buttons: [ { text: intl.formatMessage({ id: 'alert.cancel' }), onPress: () => {}, @@ -452,7 +452,7 @@ class ProfileContainer extends Component { onPress: _onConfirm, }, ], - ), + }), ); }; diff --git a/src/screens/application/container/applicationContainer.js b/src/screens/application/container/applicationContainer.js index 591a32f79..f40815d5a 100644 --- a/src/screens/application/container/applicationContainer.js +++ b/src/screens/application/container/applicationContainer.js @@ -377,10 +377,13 @@ class ApplicationContainer extends Component { if (parseVersionNumber(remoteVersion) > parseVersionNumber(VersionNumber.appVersion)) { dispatch( - showActionModal( - intl.formatMessage({ id: 'alert.update_available_title' }, { version: remoteVersion }), - intl.formatMessage({ id: 'alert.update_available_body' }), - [ + showActionModal({ + title: intl.formatMessage( + { id: 'alert.update_available_title' }, + { version: remoteVersion }, + ), + body: intl.formatMessage({ id: 'alert.update_available_body' }), + buttons: [ { text: intl.formatMessage({ id: 'alert.remind_later' }), onPress: () => { @@ -400,8 +403,8 @@ class ApplicationContainer extends Component { }, }, ], - require('../../../assets/phone-holding.png'), - ), + headerImage: require('../../../assets/phone-holding.png'), + }), ); } }; From 3300c1ec2f58e0d3fb51207eb75c39f180b2b372 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Mon, 14 Feb 2022 19:06:52 +0500 Subject: [PATCH 30/46] hide 2nd para when previousDelegation is 0 --- src/screens/transfer/screen/delegateScreen.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index f4099188a..bb184f136 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -200,12 +200,14 @@ class DelegateScreen extends Component { delegator: destination, }, ), - para: intl.formatMessage( - { id: 'transfer.confirm_summary_para' }, - { - prev: delegatedHP, - }, - ), + para: delegatedHP + ? intl.formatMessage( + { id: 'transfer.confirm_summary_para' }, + { + prev: delegatedHP, + }, + ) + : null, buttons: [ { text: intl.formatMessage({ id: 'alert.cancel' }), From 98b3378256889ddeb1738b8ec9cf090afca21051 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Mon, 14 Feb 2022 22:04:53 +0500 Subject: [PATCH 31/46] fine tuned delegation screen ui --- src/config/locales/en-US.json | 8 +++---- src/screens/transfer/screen/delegateScreen.js | 10 ++++++-- src/screens/transfer/screen/transferStyles.js | 24 +++++++++++++------ 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index 1bd72e95e..48f2c1040 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -575,14 +575,14 @@ "stop": "Stop", "sc_power_down_error": "This feature is not implemented for Hivesigner login, yet", "address_view": "View address", - "already_delegated": "Already Delegated to ", + "already_delegated": "Already delegated to ", "remain_hp": "Remaining HP", "account_detail_head": "Account Details", - "account_detail_subhead": "Enter account usernames for HIVE Power delegation", + "account_detail_subhead": "Enter account username for HIVE Power delegation", "delegat_detail_head": "Delegation Details", - "delegat_detail_subhead": "New Amount overwrite the previous delegated HIVE Power ", + "delegat_detail_subhead": "New mount overwrites already delegated HIVE Power ", "new_amount": "New Amount", - "review": "Review", + "review": "REVIEW", "confirm": "Confirm Delegation", "confirm_summary": "Delegate {hp} HP ({vests} VESTS) To @{delegator} from @{delegatee} ", "confirm_summary_para": "This will overwrite your previous delegation of {prev} HP to this user.", diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index bb184f136..05ddb2d83 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -308,7 +308,7 @@ class DelegateScreen extends Component { case 'amount': return ( { this._handleAmountChange(amount, availableVestingShares); }} @@ -403,6 +403,7 @@ class DelegateScreen extends Component { ); + const _renderStepOne = () => ( @@ -412,6 +413,7 @@ class DelegateScreen extends Component { {intl.formatMessage({ id: 'transfer.account_detail_subhead' })} this._renderDropdown(accounts, currentAccountName)} /> @@ -429,6 +431,7 @@ class DelegateScreen extends Component { {this._renderToFromAvatars()} ); + const _renderStepTwo = () => ( @@ -452,6 +455,9 @@ class DelegateScreen extends Component { 'amount', 'decimal-pad', availableVestingShares, + null, + null, + 200, ) } containerStyle={styles.paddBottom} @@ -466,7 +472,7 @@ class DelegateScreen extends Component { style={styles.button} onPress={this._handleNext} isLoading={isTransfering} - isDisable={!isAmountValid} + isDisable={!isAmountValid || step === 1} > {step === 2 diff --git a/src/screens/transfer/screen/transferStyles.js b/src/screens/transfer/screen/transferStyles.js index 33d052c7a..07e8e3c29 100644 --- a/src/screens/transfer/screen/transferStyles.js +++ b/src/screens/transfer/screen/transferStyles.js @@ -12,7 +12,7 @@ export default EStyleSheet.create({ backgroundColor: '$primaryLightBackground', }, stepTwoContainer: { - paddingVertical: 12, + paddingVertical: 16, marginTop: 16, borderRadius: 12, @@ -48,6 +48,15 @@ export default EStyleSheet.create({ width: 172, minHeight: 35, }, + amountInput: { + borderWidth: 1, + borderColor: '$borderColor', + borderRadius: 8, + paddingLeft: 10, + color: '$primaryBlack', + flex: 2, + minHeight: 35, + }, error: { borderWidth: 1, borderColor: 'red', @@ -244,16 +253,15 @@ export default EStyleSheet.create({ }, sectionHeading: { paddingHorizontal: 16, - marginBottom: 16, - fontSize: 16, + marginBottom: 0, + fontSize: 18, + fontWeight: '700', color: '$primaryBlack', - fontWeight: '600', textAlign: 'left', }, sectionSubheading: { paddingHorizontal: 16, - marginBottom: 16, - fontSize: 12, + fontSize: 14, color: '$primaryBlack', fontWeight: '600', textAlign: 'left', @@ -261,10 +269,12 @@ export default EStyleSheet.create({ alreadyDelegateRow: { flexDirection: 'row', justifyContent: 'space-between', + marginBottom: 32, }, sliderBox: { flexDirection: 'row', justifyContent: 'space-between', + marginHorizontal: 12, }, emptyBox: { flex: 1, @@ -288,7 +298,7 @@ export default EStyleSheet.create({ elevation: 3, }, slider: { - marginRight: 16, + marginRight: 12, marginLeft: 8, }, sliderAmountContainer: { From 569c3895c3774a2f6890ee5b330c4d0bace14e84 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Mon, 14 Feb 2022 22:15:56 +0500 Subject: [PATCH 32/46] removed the need for para prop.. --- src/screens/transfer/screen/delegateScreen.js | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 05ddb2d83..ee5ceeb81 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -188,26 +188,29 @@ class DelegateScreen extends Component { // this.setState({ step: 2 }); } else { // this.amountTextInput.current.blur(); + let body = + intl.formatMessage( + { id: 'transfer.confirm_summary' }, + { + hp: hp, + vests: amount.toFixed(3), + delegatee: from, + delegator: destination, + }, + ) + + (delegatedHP + ? `\n${intl.formatMessage( + { id: 'transfer.confirm_summary_para' }, + { + prev: delegatedHP, + }, + )}` + : ''); + dispatch( showActionModal({ title: intl.formatMessage({ id: 'transfer.confirm' }), - body: intl.formatMessage( - { id: 'transfer.confirm_summary' }, - { - hp: hp, - vests: amount.toFixed(3), - delegatee: from, - delegator: destination, - }, - ), - para: delegatedHP - ? intl.formatMessage( - { id: 'transfer.confirm_summary_para' }, - { - prev: delegatedHP, - }, - ) - : null, + body, buttons: [ { text: intl.formatMessage({ id: 'alert.cancel' }), From 176fa12a01cdb0c90694116f8361ac33582c8bb8 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Tue, 15 Feb 2022 10:03:24 +0500 Subject: [PATCH 33/46] added player controls and fixed on android --- package.json | 4 +- .../body/view/commentBodyView.tsx | 4 +- .../postElements/body/view/postBodyView.js | 4 +- .../videoPlayer/videoPlayerView.tsx | 150 +++++++++++++++--- yarn.lock | 12 ++ 5 files changed, 145 insertions(+), 29 deletions(-) diff --git a/package.json b/package.json index 7d0be85fd..a4ccdef19 100644 --- a/package.json +++ b/package.json @@ -100,9 +100,10 @@ "react-native-level-fs": "^3.0.0", "react-native-linear-gradient": "^2.4.2", "react-native-matomo-sdk": "feruzm/react-native-matomo-sdk", + "react-native-media-controls": "^2.3.0", "react-native-modal": "^11.5.6", - "react-native-modal-popover": "^2.1.0", "react-native-modal-dropdown": "^1.0.2", + "react-native-modal-popover": "^2.1.0", "react-native-modal-translucent": "^5.0.0", "react-native-navigation-bar-color": "^1.0.0", "react-native-os": "^1.0.1", @@ -118,6 +119,7 @@ "react-native-safe-area-context": "^3.1.9", "react-native-screens": "^2.9.0", "react-native-scrollable-tab-view": "ecency/react-native-scrollable-tab-view", + "react-native-slider": "^0.11.0", "react-native-snap-carousel": "^3.8.0", "react-native-splash-screen": "^3.2.0", "react-native-svg": "^12.1.1", diff --git a/src/components/postElements/body/view/commentBodyView.tsx b/src/components/postElements/body/view/commentBodyView.tsx index 730816e4d..5e0bdd7b5 100644 --- a/src/components/postElements/body/view/commentBodyView.tsx +++ b/src/components/postElements/body/view/commentBodyView.tsx @@ -368,9 +368,9 @@ const CommentBody = ({ }} > diff --git a/src/components/postElements/body/view/postBodyView.js b/src/components/postElements/body/view/postBodyView.js index 8979014ad..d760ce633 100644 --- a/src/components/postElements/body/view/postBodyView.js +++ b/src/components/postElements/body/view/postBodyView.js @@ -294,9 +294,9 @@ const PostBody = ({ navigation, body, dispatch, onLoadEnd }) => { }} > diff --git a/src/components/videoPlayer/videoPlayerView.tsx b/src/components/videoPlayer/videoPlayerView.tsx index 1a5717ffd..2296633d9 100644 --- a/src/components/videoPlayer/videoPlayerView.tsx +++ b/src/components/videoPlayer/videoPlayerView.tsx @@ -4,6 +4,7 @@ import { View, StyleSheet, ActivityIndicator } from 'react-native'; import WebView from 'react-native-webview'; import YoutubeIframe, { InitialPlayerParams } from 'react-native-youtube-iframe'; import Video from 'react-native-video'; +import MediaControls, { PLAYER_STATES } from 'react-native-media-controls'; interface VideoPlayerProps { mode: 'uri' | 'youtube'; @@ -27,11 +28,19 @@ const VideoPlayer = ({ const checkSrcRegex = /(.*?)\.(mp4|webm|ogg)$/gi; const isExtensionType = mode === 'uri' ? uri.match(checkSrcRegex) : false; + const videoPlayer = useRef(null); + const [currentTime, setCurrentTime] = useState(0); + const [duration, setDuration] = useState(0); + const [isFullScreen, setIsFullScreen] = useState(false); + const [isLoading, setIsLoading] = useState(true); + const [paused, setPaused] = useState(true); + const [playerState, setPlayerState] = useState(PLAYER_STATES.PAUSED); + const [screenType, setScreenType] = useState('contain'); + + // react-native-youtube-iframe handlers const [shouldPlay, setShouldPlay] = useState(false); - const [loading, setLoading] = useState(true); - const videoPlayerRef = useRef(null); const _onReady = () => { - setLoading(false); + setIsLoading(false); setShouldPlay(disableAutoplay ? false : true); console.log('ready'); }; @@ -43,13 +52,101 @@ const VideoPlayer = ({ const _onError = () => { console.log('error!'); - setLoading(false); + setIsLoading(false); }; const initialParams: InitialPlayerParams = { start: startTime, }; + // react-native-video player handlers + const onSeek = (seek) => { + videoPlayer.current.seek(seek); + }; + + const onPaused = (playerState) => { + setPaused(!paused); + setPlayerState(playerState); + }; + + const onReplay = () => { + setPlayerState(PLAYER_STATES.PLAYING); + videoPlayer.current.seek(0); + }; + + const onProgress = (data) => { + if (!isLoading && playerState !== PLAYER_STATES.ENDED) { + setCurrentTime(data.currentTime); + } + }; + + const onLoad = (data) => { + setDuration(data.duration); + videoPlayer.current.seek(0); + setIsLoading(false); + }; + + const onLoadStart = () => setIsLoading(true); + + const onEnd = () => setPlayerState(PLAYER_STATES.ENDED); + + const onError = () => alert('Error while playing'); + + const exitFullScreen = () => { + setIsFullScreen(false); + }; + + const enterFullScreen = () => { + setIsFullScreen(true); + }; + + const onFullScreen = () => { + setIsFullScreen(true); + if (screenType == 'contain') setScreenType('cover'); + else setScreenType('contain'); + }; + + const onSeeking = (currentTime) => setCurrentTime(currentTime); + + const _renderVideoplayerWithControls = () => { + return ( + + + ); + }; return ( {mode === 'youtube' && youtubeVideoId && ( @@ -66,20 +163,9 @@ const VideoPlayer = ({ )} {mode === 'uri' && uri && ( - + {isExtensionType ? ( - )} - {loading && } + {isLoading && ( + + )} ); }; @@ -117,16 +205,30 @@ const styles = StyleSheet.create({ position: 'absolute', alignItems: 'center', justifyContent: 'center', - top: 0, + top: 25, bottom: 0, left: 0, right: 0, }, - videoPlayer: { + toolbar: { + marginTop: 30, + backgroundColor: 'white', + padding: 10, + borderRadius: 5, + }, + playerWrapper: { + backgroundColor: 'black', + }, + mediaPlayer: { position: 'absolute', top: 0, - bottom: 0, left: 0, + bottom: 0, right: 0, + backgroundColor: 'black', + justifyContent: 'center', + }, + barkBackground: { + backgroundColor: 'black', }, }); diff --git a/yarn.lock b/yarn.lock index 9d7a467e8..5c8853eb6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8634,6 +8634,11 @@ react-native-matomo-sdk@feruzm/react-native-matomo-sdk: version "0.4.1" resolved "https://codeload.github.com/feruzm/react-native-matomo-sdk/tar.gz/392b1cfca771b28005821ef909ffb9a2082156d9" +react-native-media-controls@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/react-native-media-controls/-/react-native-media-controls-2.3.0.tgz#c36e876a14d12982b7c6fb759201ff439117cbd0" + integrity sha512-N10i12ZO+GIXjmdA9hQk/HuBm5u9xWPIOydG/2SvLEZcnY3xg3D8d2IJXRolzSm2jBRgEGSO4rMgRBU6MpdNMg== + react-native-modal-dropdown@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/react-native-modal-dropdown/-/react-native-modal-dropdown-1.0.2.tgz#3e1efae5a5eacc42f44ac96468ea2f1b5bb0d759" @@ -8769,6 +8774,13 @@ react-native-scrollable-tab-view@ecency/react-native-scrollable-tab-view: prop-types "^15.6.0" react-timer-mixin "^0.13.3" +react-native-slider@^0.11.0: + version "0.11.0" + resolved "https://registry.yarnpkg.com/react-native-slider/-/react-native-slider-0.11.0.tgz#b68a0bc43c8422b24cd57947cc5ac2bcdb58fadc" + integrity sha512-jV9K87eu9uWr0uJIyrSpBLnCKvVlOySC2wynq9TFCdV9oGgjt7Niq8Q1A8R8v+5GHsuBw/s8vEj1AAkkUi+u+w== + dependencies: + prop-types "^15.5.6" + react-native-snap-carousel@^3.8.0: version "3.9.1" resolved "https://registry.yarnpkg.com/react-native-snap-carousel/-/react-native-snap-carousel-3.9.1.tgz#6fd9bd8839546c2c6043a41d2035afbc6fe0443e" From d5bdf24905eb1ed8691185982b12d2b956bf5f32 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Tue, 15 Feb 2022 12:40:41 +0500 Subject: [PATCH 34/46] fixed from user account change loophole causing same user names selection --- src/screens/transfer/screen/delegateScreen.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index bb184f136..2b603a840 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -158,8 +158,16 @@ class DelegateScreen extends Component { }; _handleOnDropdownChange = (value) => { - const { fetchBalance } = this.props; - + const { fetchBalance, intl } = this.props; + const { destination } = this.state; + if (value === destination) { + Alert.alert( + intl.formatMessage({ id: 'transfer.username_alert' }), + intl.formatMessage({ id: 'transfer.username_alert_detail' }), + ); + this.setState({ step: 1, destination: '' }); + return; + } fetchBalance(value); this.setState({ from: value, amount: 0 }); }; From 1743139896d0d345bb08f4e6efed4a0c248eef88 Mon Sep 17 00:00:00 2001 From: Nouman Tahir Date: Tue, 15 Feb 2022 13:02:55 +0500 Subject: [PATCH 35/46] change media controls color and fadeoutdealy --- src/components/videoPlayer/videoPlayerView.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/videoPlayer/videoPlayerView.tsx b/src/components/videoPlayer/videoPlayerView.tsx index 2296633d9..844752d5c 100644 --- a/src/components/videoPlayer/videoPlayerView.tsx +++ b/src/components/videoPlayer/videoPlayerView.tsx @@ -5,6 +5,7 @@ import WebView from 'react-native-webview'; import YoutubeIframe, { InitialPlayerParams } from 'react-native-youtube-iframe'; import Video from 'react-native-video'; import MediaControls, { PLAYER_STATES } from 'react-native-media-controls'; +import EStyleSheet from 'react-native-extended-stylesheet'; interface VideoPlayerProps { mode: 'uri' | 'youtube'; @@ -132,7 +133,7 @@ const VideoPlayer = ({ From 2d43a4df3d496ef1028db0bb40df6b32dbe0a99a Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Tue, 15 Feb 2022 13:16:27 +0500 Subject: [PATCH 36/46] fixed delegated amount not changing bug when from changes --- src/screens/transfer/screen/delegateScreen.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 2b603a840..1774727dd 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -69,6 +69,13 @@ class DelegateScreen extends Component { this.amountTextInput = React.createRef(); } + // Component Lifecycles + componentDidUpdate(prevProps, prevState) { + if (prevState.from !== this.state.from) { + this._fetchReceivedVestingShare(); + } + } + // Component Functions _setState = (key, value) => { const { getAccountsWithUsername, balance } = this.props; @@ -146,6 +153,10 @@ class DelegateScreen extends Component { this.setState({ delegatedHP: vestsToHp(vest_shares.amount, hivePerMVests).toFixed(3), }); + } else { + this.setState({ + delegatedHP: 0, + }); } } else { this.setState({ From 418d9a630bd191da97c91d90a224369ac2f05d5a Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Tue, 15 Feb 2022 22:27:24 +0500 Subject: [PATCH 37/46] disabled account selection --- src/screens/transfer/screen/delegateScreen.js | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index 4e3242f3f..b3cc67770 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -245,6 +245,7 @@ class DelegateScreen extends Component { ); } }; + // Note: dropdown for user account selection. can be used in later implementaion _renderDropdown = (accounts, currentAccountName) => ( { const { isAmountValid } = this.state; switch (state) { + case 'from': + return ( + + ); case 'destination': return ( @@ -437,7 +453,9 @@ class DelegateScreen extends Component { this._renderDropdown(accounts, currentAccountName)} + rightComponent={() => + this._renderInput(intl.formatMessage({ id: 'transfer.from' }), 'from', 'default') + } /> Date: Wed, 16 Feb 2022 11:32:23 +0500 Subject: [PATCH 38/46] fetching vesting shares after state update --- src/screens/transfer/screen/delegateScreen.js | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/screens/transfer/screen/delegateScreen.js b/src/screens/transfer/screen/delegateScreen.js index b3cc67770..2c29ec6e5 100644 --- a/src/screens/transfer/screen/delegateScreen.js +++ b/src/screens/transfer/screen/delegateScreen.js @@ -264,22 +264,27 @@ class DelegateScreen extends Component { const username = item; const { from } = this.state; const { intl } = this.props; + + const _onItemPress = () => { + if (username === from) { + Alert.alert( + intl.formatMessage({ id: 'transfer.username_alert' }), + intl.formatMessage({ id: 'transfer.username_alert_detail' }), + ); + return; + } + + this.setState({ destination: username, usersResult: [], step: 2 }, () => { + //since method uses destination from state it sould be called + //after state has been updated successfully + this._fetchReceivedVestingShare(); + }); + + this.destinationTextInput.current?.blur(); + }; + return ( - { - if (username === from) { - Alert.alert( - intl.formatMessage({ id: 'transfer.username_alert' }), - intl.formatMessage({ id: 'transfer.username_alert_detail' }), - ); - return; - } - this._fetchReceivedVestingShare(); - this.setState({ destination: username, usersResult: [], step: 2 }); - this.destinationTextInput.current?.blur(); - }} - style={styles.usersDropItemRow} - > + {username} From 9857cd917b833be14dbf3f086ecc261ebecd85fa Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Wed, 16 Feb 2022 12:38:34 +0500 Subject: [PATCH 39/46] changed account_detail_subhead translation in delegation screen --- src/config/locales/en-US.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/locales/en-US.json b/src/config/locales/en-US.json index 48f2c1040..6ba8fcbac 100644 --- a/src/config/locales/en-US.json +++ b/src/config/locales/en-US.json @@ -578,7 +578,7 @@ "already_delegated": "Already delegated to ", "remain_hp": "Remaining HP", "account_detail_head": "Account Details", - "account_detail_subhead": "Enter account username for HIVE Power delegation", + "account_detail_subhead": "Enter username for HIVE Power delegation", "delegat_detail_head": "Delegation Details", "delegat_detail_subhead": "New mount overwrites already delegated HIVE Power ", "new_amount": "New Amount", From 916459f7a7024a2c7f98723bb21e575f08044cc5 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Wed, 16 Feb 2022 18:00:05 +0500 Subject: [PATCH 40/46] fixed image size in th tag inside table --- src/components/autoHeightImage/autoHeightImage.tsx | 2 +- src/components/postHtmlRenderer/postHtmlRenderer.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/autoHeightImage/autoHeightImage.tsx b/src/components/autoHeightImage/autoHeightImage.tsx index d222a43d2..904da9e21 100644 --- a/src/components/autoHeightImage/autoHeightImage.tsx +++ b/src/components/autoHeightImage/autoHeightImage.tsx @@ -37,7 +37,7 @@ import { TouchableWithoutFeedback } from "react-native-gesture-handler"; } const imgStyle = { - width:imgWidth, + width:imgWidth - 10, height:imgHeight, backgroundColor: onLoadCalled ? 'transparent' : EStyleSheet.value('$primaryGray') } diff --git a/src/components/postHtmlRenderer/postHtmlRenderer.tsx b/src/components/postHtmlRenderer/postHtmlRenderer.tsx index 6ecda43fb..9f30fcda0 100644 --- a/src/components/postHtmlRenderer/postHtmlRenderer.tsx +++ b/src/components/postHtmlRenderer/postHtmlRenderer.tsx @@ -176,7 +176,7 @@ export const PostHtmlRenderer = memo( } //return divided width based on number td tags - if (tnode.parent.tagName === 'td') { + if (tnode.parent.tagName === 'td' || tnode.parent.tagName === 'th') { const cols = tnode.parent.parent.children.length; return contentWidth / cols; } From 114368cec8b0aa6c4d5d9d7e253bdcbf2ce82ab8 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Wed, 16 Feb 2022 19:08:37 +0500 Subject: [PATCH 41/46] fixed users avatars alignment issue --- src/screens/transfer/screen/transferScreen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screens/transfer/screen/transferScreen.js b/src/screens/transfer/screen/transferScreen.js index f230fcd20..51415291b 100644 --- a/src/screens/transfer/screen/transferScreen.js +++ b/src/screens/transfer/screen/transferScreen.js @@ -194,7 +194,7 @@ const TransferView = ({ - + From 91fec8acb047809553b7ecbd9f80841887f63d78 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Wed, 16 Feb 2022 19:22:58 +0500 Subject: [PATCH 42/46] changed style of avatars container in transferToken screen --- src/screens/transfer/screen/transferTokenScreen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screens/transfer/screen/transferTokenScreen.js b/src/screens/transfer/screen/transferTokenScreen.js index 40ddb77df..bea1da243 100644 --- a/src/screens/transfer/screen/transferTokenScreen.js +++ b/src/screens/transfer/screen/transferTokenScreen.js @@ -177,7 +177,7 @@ class TransferTokenView extends Component { - + From 5574cb3979c963c24c138842c5feba460b71e47a Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Wed, 16 Feb 2022 19:26:22 +0500 Subject: [PATCH 43/46] fixed alignment in promote screen --- src/components/promote/promoteStyles.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/promote/promoteStyles.js b/src/components/promote/promoteStyles.js index a582cc8c5..3914406a0 100644 --- a/src/components/promote/promoteStyles.js +++ b/src/components/promote/promoteStyles.js @@ -47,7 +47,6 @@ export default EStyleSheet.create({ }, autocomplateLineContainer: { flexDirection: 'row', - paddingHorizontal: 20, zIndex: 999, }, autocomplateLabelText: { From 3ace89801fc80bf0c7dcb8918f11e5c69e515581 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Wed, 16 Feb 2022 19:34:56 +0500 Subject: [PATCH 44/46] fixed alignment in boostScreen --- src/components/postBoost/postBoostStyles.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/postBoost/postBoostStyles.js b/src/components/postBoost/postBoostStyles.js index a150a973b..12613c3af 100644 --- a/src/components/postBoost/postBoostStyles.js +++ b/src/components/postBoost/postBoostStyles.js @@ -49,7 +49,6 @@ export default EStyleSheet.create({ }, autocompleteLineContainer: { flexDirection: 'row', - paddingHorizontal: 20, zIndex: 999, }, autocompleteLabelText: { @@ -72,7 +71,8 @@ export default EStyleSheet.create({ }, autocompleteLabelContainer: { flex: 1, - padding: 10, + paddingVertical: 10, + paddingHorizontal: 16, justifyContent: 'center', color: '$primaryBlack', maxWidth: '$deviceWidth / 2.9', From b0fa13b414bca682a2ab80a5aea90552183d84d2 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Wed, 16 Feb 2022 19:36:44 +0500 Subject: [PATCH 45/46] fixed padding in promoteScreen --- src/components/promote/promoteStyles.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/promote/promoteStyles.js b/src/components/promote/promoteStyles.js index 3914406a0..dbf6d7630 100644 --- a/src/components/promote/promoteStyles.js +++ b/src/components/promote/promoteStyles.js @@ -69,7 +69,8 @@ export default EStyleSheet.create({ }, autocomplateLabelContainer: { flex: 1, - padding: 10, + paddingVertical: 10, + paddingHorizontal: 16, justifyContent: 'center', color: '$primaryBlack', maxWidth: '$deviceWidth / 2.9', From d9ba2c9ec4b31ac3555de64f71e4025dbf941734 Mon Sep 17 00:00:00 2001 From: Sadaqat Ali Date: Wed, 16 Feb 2022 19:40:48 +0500 Subject: [PATCH 46/46] fixed add account btn height in power down screen --- src/screens/transfer/screen/transferStyles.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/screens/transfer/screen/transferStyles.js b/src/screens/transfer/screen/transferStyles.js index 07e8e3c29..ad213cbbd 100644 --- a/src/screens/transfer/screen/transferStyles.js +++ b/src/screens/transfer/screen/transferStyles.js @@ -126,7 +126,7 @@ export default EStyleSheet.create({ }, formButton: { - padding: 12, + height: 44, borderRadius: 5, backgroundColor: '$primaryBlue', marginTop: 5,