mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-18 02:41:39 +03:00
removed support for unfollow
This commit is contained in:
parent
62ecaf24da
commit
82f19fe45b
@ -19,6 +19,7 @@ export const ActionPanel = ({isFollowing, isFavourite, onFavouritePress, onFollo
|
||||
name={isFollowing?'user-following':'user-follow'}
|
||||
size={20}
|
||||
color={EStyleSheet.value('$primaryBlack')}
|
||||
disabled={isFollowing}
|
||||
onPress={onFollowPress}
|
||||
/>
|
||||
<IconButton
|
||||
|
@ -15,6 +15,7 @@ import moment from 'moment'
|
||||
import { getTimeFromNow, getTimeFromNowNative } from '../../../../utils/time'
|
||||
import { useAppDispatch, useAppSelector } from '../../../../hooks'
|
||||
import { toastNotification } from '../../../../redux/actions/uiAction'
|
||||
import Bugsnag from '@bugsnag/react-native'
|
||||
|
||||
interface QuickProfileContentProps {
|
||||
username:string,
|
||||
@ -107,26 +108,19 @@ export const QuickProfileContent = ({
|
||||
};
|
||||
|
||||
|
||||
const _handleFollowUnfollowUser = async (isFollowAction:boolean) => {
|
||||
const _handleFollowUser = async () => {
|
||||
try{
|
||||
const follower = currentAccountName
|
||||
const following = username;
|
||||
|
||||
let followAction;
|
||||
|
||||
if (isFollowAction && !isFollowing) {
|
||||
followAction = followUser;
|
||||
} else {
|
||||
followAction = unfollowUser;
|
||||
}
|
||||
|
||||
setIsLoading(true);
|
||||
followAction(currentAccount, pinCode, {
|
||||
await followUser(currentAccount, pinCode, {
|
||||
follower,
|
||||
following,
|
||||
})
|
||||
.then(() => {
|
||||
|
||||
setIsLoading(false);
|
||||
setIsFollowing(isFollowAction)
|
||||
setIsFollowing(true)
|
||||
dispatch(
|
||||
toastNotification(
|
||||
intl.formatMessage({
|
||||
@ -134,17 +128,20 @@ export const QuickProfileContent = ({
|
||||
}),
|
||||
),
|
||||
);
|
||||
})
|
||||
.catch((err) => {
|
||||
}
|
||||
catch(err){
|
||||
setIsLoading(false);
|
||||
console.warn("Failed to follow user", err)
|
||||
Bugsnag.notify(err);
|
||||
Alert.alert(intl.formatMessage({id:'alert.fail'}), err.message)
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//UI CALLBACKS
|
||||
const _onFollowPress = () => {
|
||||
_handleFollowUnfollowUser(!isFollowing)
|
||||
_handleFollowUser()
|
||||
}
|
||||
|
||||
const _onFavouritePress = () => {
|
||||
|
Loading…
Reference in New Issue
Block a user