removed support for unfollow

This commit is contained in:
Nouman Tahir 2021-09-16 12:53:37 +05:00
parent 62ecaf24da
commit 82f19fe45b
2 changed files with 25 additions and 27 deletions

View File

@ -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

View File

@ -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 = () => {