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