mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-28 07:55:08 +03:00
implement login fixed bugs
This commit is contained in:
parent
e919c566aa
commit
e795d70336
@ -76,7 +76,7 @@ class PostDisplayContainer extends Component {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {
|
const {
|
||||||
currentAccount, isLoggedIn, parentPost, post,
|
currentAccount, isLoggedIn, isNewPost, parentPost, post,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -87,6 +87,7 @@ class PostDisplayContainer extends Component {
|
|||||||
handleOnReplyPress={this._handleOnReplyPress}
|
handleOnReplyPress={this._handleOnReplyPress}
|
||||||
handleOnVotersPress={this._handleOnVotersPress}
|
handleOnVotersPress={this._handleOnVotersPress}
|
||||||
isLoggedIn={isLoggedIn}
|
isLoggedIn={isLoggedIn}
|
||||||
|
isNewPost={isNewPost}
|
||||||
parentPost={parentPost}
|
parentPost={parentPost}
|
||||||
post={post}
|
post={post}
|
||||||
/>
|
/>
|
||||||
|
@ -40,9 +40,9 @@ class PostDisplayView extends PureComponent {
|
|||||||
|
|
||||||
// Component Life Cycles
|
// Component Life Cycles
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { currentAccount, isLoggedIn } = this.props;
|
const { currentAccount, isLoggedIn, isNewPost } = this.props;
|
||||||
|
|
||||||
if (isLoggedIn && currentAccount && currentAccount.name) {
|
if (isLoggedIn && currentAccount && currentAccount.name && !isNewPost) {
|
||||||
userActivity(currentAccount.name, 10);
|
userActivity(currentAccount.name, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,29 +1,26 @@
|
|||||||
import ePointApi from '../../config/ePoint';
|
import ePointApi from '../../config/ePoint';
|
||||||
|
|
||||||
export const userActivity = (username, type, blockNumber = '', transactionNumber = '') => {
|
export const userActivity = (us, ty, bl = '', tx = '') => new Promise((resolve, reject) => {
|
||||||
const params = { username, type };
|
const params = { us, ty };
|
||||||
|
|
||||||
if (blockNumber) {
|
if (bl) {
|
||||||
params.blockNumber = blockNumber;
|
params.bl = bl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (transactionNumber) {
|
if (tx) {
|
||||||
params.transactionNumber = transactionNumber;
|
params.tx = tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
ePointApi
|
||||||
return ePointApi
|
.post('/usr-activity', params)
|
||||||
.post('/usr-activity', {
|
.then((res) => {
|
||||||
us: username,
|
console.log(res);
|
||||||
ty: type,
|
resolve(res.data);
|
||||||
bn: blockNumber,
|
|
||||||
tn: transactionNumber,
|
|
||||||
})
|
})
|
||||||
.then(res => res.data);
|
.catch((error) => {
|
||||||
} catch (error) {
|
reject(error);
|
||||||
return null;
|
});
|
||||||
}
|
});
|
||||||
};
|
|
||||||
|
|
||||||
export const transfer = (sender, receiver, amount) => new Promise((resolve, reject) => {
|
export const transfer = (sender, receiver, amount) => new Promise((resolve, reject) => {
|
||||||
ePointApi
|
ePointApi
|
||||||
|
@ -6,6 +6,7 @@ import { injectIntl } from 'react-intl';
|
|||||||
// Services and Actions
|
// Services and Actions
|
||||||
import { login } from '../../../providers/steem/auth';
|
import { login } from '../../../providers/steem/auth';
|
||||||
import { lookupAccounts } from '../../../providers/steem/dsteem';
|
import { lookupAccounts } from '../../../providers/steem/dsteem';
|
||||||
|
import { userActivity } from '../../../providers/esteem/ePoint';
|
||||||
import {
|
import {
|
||||||
failedAccount,
|
failedAccount,
|
||||||
addOtherAccount,
|
addOtherAccount,
|
||||||
@ -55,13 +56,16 @@ class LoginContainer extends PureComponent {
|
|||||||
dispatch(openPinCodeModal());
|
dispatch(openPinCodeModal());
|
||||||
setPinCodeState({ navigateTo: ROUTES.DRAWER.MAIN });
|
setPinCodeState({ navigateTo: ROUTES.DRAWER.MAIN });
|
||||||
dispatch(loginAction(true));
|
dispatch(loginAction(true));
|
||||||
|
userActivity(result.name, 20);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
Alert.alert('Error',
|
Alert.alert(
|
||||||
|
'Error',
|
||||||
intl.formatMessage({
|
intl.formatMessage({
|
||||||
id: err.message,
|
id: err.message,
|
||||||
}));
|
}),
|
||||||
|
);
|
||||||
dispatch(failedAccount(err.message));
|
dispatch(failedAccount(err.message));
|
||||||
this.setState({ isLoading: false });
|
this.setState({ isLoading: false });
|
||||||
});
|
});
|
||||||
|
@ -47,6 +47,7 @@ class PostScreen extends PureComponent {
|
|||||||
fetchPost={fetchPost}
|
fetchPost={fetchPost}
|
||||||
isFetchComments={isFetchComments}
|
isFetchComments={isFetchComments}
|
||||||
isLoggedIn={isLoggedIn}
|
isLoggedIn={isLoggedIn}
|
||||||
|
isNewPost={isNewPost}
|
||||||
parentPost={parentPost}
|
parentPost={parentPost}
|
||||||
post={post}
|
post={post}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user