mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-23 05:13:04 +03:00
added sc modal
This commit is contained in:
parent
8c3f5a0e36
commit
f37b1450f7
@ -23,6 +23,7 @@
|
||||
"dependencies": {
|
||||
"@babel/runtime": "^7.1.2",
|
||||
"@esteemapp/esteem-render-helpers": "^1.0.9",
|
||||
"@ptomasroos/react-native-multi-slider": "^1.0.0",
|
||||
"appcenter": "^1.10.0",
|
||||
"appcenter-analytics": "^1.10.0",
|
||||
"appcenter-crashes": "^1.10.0",
|
||||
|
@ -7,6 +7,7 @@ import { Text, View, WebView, ScrollView } from 'react-native';
|
||||
import get from 'lodash/get';
|
||||
import ActionSheet from 'react-native-actionsheet';
|
||||
import { ScaleSlider } from '../../../components';
|
||||
import { steemConnectOptions } from '../../../constants/steemConnectOptions';
|
||||
|
||||
// Container
|
||||
import { PointsContainer } from '../../../containers';
|
||||
@ -20,7 +21,7 @@ import { TextInput } from '../../../components/textInput';
|
||||
import { TransferFormItem } from '../../../components/transferFormItem';
|
||||
import { MainButton } from '../../../components/mainButton';
|
||||
import { DropdownButton } from '../../../components/dropdownButton';
|
||||
// import { Modal } from '../../../components/modal';
|
||||
import { Modal } from '../../../components/modal';
|
||||
|
||||
import { PROMOTE_PRICING, PROMOTE_DAYS } from '../../../constants/options/points';
|
||||
|
||||
@ -40,6 +41,8 @@ class PointsScreen extends PureComponent {
|
||||
selectedUser: '',
|
||||
balance: '',
|
||||
day: 1,
|
||||
isSCModalOpen: false,
|
||||
SCPath: '',
|
||||
};
|
||||
}
|
||||
|
||||
@ -91,15 +94,33 @@ class PointsScreen extends PureComponent {
|
||||
});
|
||||
};
|
||||
|
||||
_promote = promote => {
|
||||
_promote = (promote, currentAccount) => {
|
||||
const { day, permlink, author } = this.state;
|
||||
// @u-e/esteem-mobile-v2-guide
|
||||
if (promote) promote(day, permlink, 'u-e');
|
||||
if (get(currentAccount, 'local.authType') === 'steemConnect') {
|
||||
const user = get(currentAccount, 'name');
|
||||
|
||||
const json = JSON.stringify({
|
||||
user,
|
||||
author,
|
||||
permlink,
|
||||
duration: day,
|
||||
});
|
||||
|
||||
const uri = `sign/custom-json?authority=active&required_auths=%5B%22${user}%22%5D&required_posting_auths=%5B%5D&id=esteem_promote&json=${encodeURIComponent(
|
||||
json,
|
||||
)}`;
|
||||
|
||||
this.setState({
|
||||
isSCModalOpen: true,
|
||||
SCPath: uri,
|
||||
});
|
||||
} else if (promote) promote(day, permlink, 'u-e');
|
||||
};
|
||||
|
||||
render() {
|
||||
const { intl } = this.props;
|
||||
const { selectedUser, balance, day } = this.state;
|
||||
const { selectedUser, balance, day, SCPath, isSCModalOpen } = this.state;
|
||||
|
||||
return (
|
||||
<PointsContainer>
|
||||
@ -113,6 +134,7 @@ class PointsScreen extends PureComponent {
|
||||
currentAccountName,
|
||||
balance: _balance,
|
||||
promote,
|
||||
currentAccount,
|
||||
}) => (
|
||||
<Fragment>
|
||||
<BasicHeader title="Promote" />
|
||||
@ -176,18 +198,18 @@ class PointsScreen extends PureComponent {
|
||||
cancelButtonIndex={1}
|
||||
destructiveButtonIndex={0}
|
||||
onPress={index => {
|
||||
index === 0 ? this._promote(promote) : null;
|
||||
index === 0 ? this._promote(promote, currentAccount) : null;
|
||||
}}
|
||||
/>
|
||||
{/* <Modal
|
||||
isOpen={steemConnectTransfer}
|
||||
isFullScreen
|
||||
isCloseButton
|
||||
handleOnModalClose={handleOnModalClose}
|
||||
title={intl.formatMessage({ id: 'transfer.steemconnect_title' })}
|
||||
>
|
||||
<WebView source={{ uri: `${steemConnectOptions.base_url}${path}` }} />
|
||||
</Modal> */}
|
||||
<Modal
|
||||
isOpen={isSCModalOpen}
|
||||
isFullScreen
|
||||
isCloseButton
|
||||
handleOnModalClose={() => this.setState({ openSCModal: false })}
|
||||
title={intl.formatMessage({ id: 'transfer.steemconnect_title' })}
|
||||
>
|
||||
<WebView source={{ uri: `${steemConnectOptions.base_url}${SCPath}` }} />
|
||||
</Modal>
|
||||
</Fragment>
|
||||
)}
|
||||
</PointsContainer>
|
||||
|
@ -1256,6 +1256,11 @@
|
||||
"@types/istanbul-reports" "^1.1.1"
|
||||
"@types/yargs" "^12.0.9"
|
||||
|
||||
"@ptomasroos/react-native-multi-slider@^1.0.0":
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/@ptomasroos/react-native-multi-slider/-/react-native-multi-slider-1.0.0.tgz#a4ea27b1320b93a1db9f696c24789695df6c9f30"
|
||||
integrity sha512-NpX22rQLArg9widwMzGf7XsInTDf6mfY/D1XaDVjglNkVphj3NSN37+nF6MofArCxC++1P+jHv0SGWbmJQwy4g==
|
||||
|
||||
"@react-native-community/cli@^1.2.1":
|
||||
version "1.9.11"
|
||||
resolved "https://registry.yarnpkg.com/@react-native-community/cli/-/cli-1.9.11.tgz#b868b17201057b9cd16a3a20c30561176071f21a"
|
||||
|
Loading…
Reference in New Issue
Block a user