mirror of
https://github.com/ecency/ecency-mobile.git
synced 2025-01-05 12:36:31 +03:00
removed time out
This commit is contained in:
parent
2d546be528
commit
112fd86dba
@ -100,10 +100,6 @@ class ProfileContainer extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
|
||||||
clearInterval(this.fetchProfileTimer);
|
|
||||||
}
|
|
||||||
|
|
||||||
_getReplies = async (user) => {
|
_getReplies = async (user) => {
|
||||||
const { isReverseHeader } = this.state;
|
const { isReverseHeader } = this.state;
|
||||||
if (isReverseHeader) {
|
if (isReverseHeader) {
|
||||||
@ -122,34 +118,37 @@ class ProfileContainer extends Component {
|
|||||||
};
|
};
|
||||||
|
|
||||||
_handleFollowUnfollowUser = async (isFollowAction) => {
|
_handleFollowUnfollowUser = async (isFollowAction) => {
|
||||||
const { username, isFollowing } = this.state;
|
const { isFollowing } = this.state;
|
||||||
const { currentAccount, pinCode } = this.props;
|
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
isProfileLoading: true,
|
isProfileLoading: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isFollowAction && !isFollowing) {
|
if (isFollowAction && !isFollowing) {
|
||||||
this._followUser(currentAccount, pinCode, currentAccount.name, username);
|
this._followUser();
|
||||||
} else {
|
} else {
|
||||||
this._unfollowUser(currentAccount, pinCode, currentAccount.name, username);
|
this._unfollowUser();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_handleMuteUnmuteUser = async (isMuteAction) => {
|
_handleMuteUnmuteUser = (isMuteAction) => {
|
||||||
const { username } = this.state;
|
|
||||||
const { currentAccount, pinCode } = this.props;
|
|
||||||
|
|
||||||
this.setState({
|
this.setState({
|
||||||
isProfileLoading: true,
|
isProfileLoading: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (isMuteAction) {
|
if (isMuteAction) {
|
||||||
this._muteUser(currentAccount, pinCode, currentAccount.name, username);
|
this._muteUser();
|
||||||
|
} else {
|
||||||
|
this._unfollowUser();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
_unfollowUser = (currentAccount, pinCode, follower, following) => {
|
_unfollowUser = () => {
|
||||||
|
const { username } = this.state;
|
||||||
|
const { currentAccount, pinCode } = this.props;
|
||||||
|
const follower = currentAccount.name;
|
||||||
|
const following = username;
|
||||||
|
|
||||||
unfollowUser(currentAccount, pinCode, {
|
unfollowUser(currentAccount, pinCode, {
|
||||||
follower,
|
follower,
|
||||||
following,
|
following,
|
||||||
@ -162,7 +161,12 @@ class ProfileContainer extends Component {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
_followUser = (currentAccount, pinCode, follower, following) => {
|
_followUser = () => {
|
||||||
|
const { username } = this.state;
|
||||||
|
const { currentAccount, pinCode } = this.props;
|
||||||
|
const follower = currentAccount.name;
|
||||||
|
const following = username;
|
||||||
|
|
||||||
followUser(currentAccount, pinCode, {
|
followUser(currentAccount, pinCode, {
|
||||||
follower,
|
follower,
|
||||||
following,
|
following,
|
||||||
@ -175,7 +179,12 @@ class ProfileContainer extends Component {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
_muteUser = async (currentAccount, pinCode, follower, following) => {
|
_muteUser = () => {
|
||||||
|
const { username } = this.state;
|
||||||
|
const { currentAccount, pinCode } = this.props;
|
||||||
|
const follower = currentAccount.name;
|
||||||
|
const following = username;
|
||||||
|
|
||||||
ignoreUser(currentAccount, pinCode, {
|
ignoreUser(currentAccount, pinCode, {
|
||||||
follower,
|
follower,
|
||||||
following,
|
following,
|
||||||
@ -194,33 +203,29 @@ class ProfileContainer extends Component {
|
|||||||
if (error) {
|
if (error) {
|
||||||
this.setState({
|
this.setState({
|
||||||
error,
|
error,
|
||||||
});
|
}, () => alert(error));
|
||||||
alert(error);
|
|
||||||
} else {
|
} else {
|
||||||
/**
|
this._fetchProfile(username, true);
|
||||||
* This follow code totally a work arround
|
|
||||||
* Ceated for server response delay.
|
|
||||||
*/
|
|
||||||
this.fetchProfileTimer = setTimeout(() => {
|
|
||||||
this._fetchProfile(username);
|
|
||||||
}, 8000);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
_fetchProfile = async (username = null) => {
|
_fetchProfile = async (username = null, isProfileAction = false) => {
|
||||||
const { isProfileLoading } = this.state;
|
const {
|
||||||
|
username: _username, isFollowing, isMuted,
|
||||||
|
} = this.state;
|
||||||
|
|
||||||
if (username) {
|
if (username) {
|
||||||
const { isLoggedIn, currentAccount } = this.props;
|
const { isLoggedIn, currentAccount } = this.props;
|
||||||
let isFollowing;
|
let _isFollowing;
|
||||||
let isMuted;
|
let _isMuted;
|
||||||
let isFavorite;
|
let isFavorite;
|
||||||
let follows;
|
let follows;
|
||||||
|
|
||||||
if (isLoggedIn && currentAccount.name !== username) {
|
if (isLoggedIn && currentAccount.name !== username) {
|
||||||
isFollowing = await getIsFollowing(username, currentAccount.name);
|
_isFollowing = await getIsFollowing(username, currentAccount.name);
|
||||||
|
|
||||||
isMuted = isFollowing ? false : await getIsMuted(username, currentAccount.name);
|
_isMuted = _isFollowing ? false : await getIsMuted(username, currentAccount.name);
|
||||||
|
|
||||||
getIsFavorite(username, currentAccount.name).then((isFav) => {
|
getIsFavorite(username, currentAccount.name).then((isFav) => {
|
||||||
isFavorite = isFav;
|
isFavorite = isFav;
|
||||||
@ -233,19 +238,22 @@ class ProfileContainer extends Component {
|
|||||||
follows = null;
|
follows = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isProfileLoading) {
|
/**
|
||||||
|
* This follow code totally a work arround
|
||||||
|
* Ceated for server response delay.
|
||||||
|
*/
|
||||||
|
if (isProfileAction && (isFollowing === _isFollowing && isMuted === _isMuted)) {
|
||||||
|
this._fetchProfile(_username, true);
|
||||||
|
} else {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
follows,
|
||||||
|
isFollowing: _isFollowing,
|
||||||
|
isMuted: _isMuted,
|
||||||
|
isFavorite,
|
||||||
|
isReady: true,
|
||||||
isProfileLoading: false,
|
isProfileLoading: false,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
this.setState({
|
|
||||||
follows,
|
|
||||||
isFollowing,
|
|
||||||
isMuted,
|
|
||||||
isFavorite,
|
|
||||||
isReady: true,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -354,6 +362,7 @@ class ProfileContainer extends Component {
|
|||||||
return (
|
return (
|
||||||
<ProfileScreen
|
<ProfileScreen
|
||||||
about={user && user.about && user.about.profile}
|
about={user && user.about && user.about.profile}
|
||||||
|
activePage={activePage}
|
||||||
avatar={avatar}
|
avatar={avatar}
|
||||||
comments={comments}
|
comments={comments}
|
||||||
currency={currency}
|
currency={currency}
|
||||||
@ -376,7 +385,6 @@ class ProfileContainer extends Component {
|
|||||||
selectedQuickProfile={selectedQuickProfile}
|
selectedQuickProfile={selectedQuickProfile}
|
||||||
selectedUser={user}
|
selectedUser={user}
|
||||||
username={username}
|
username={username}
|
||||||
activePage={activePage}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user