This commit is contained in:
Nouman Tahir 2021-07-06 16:10:02 +05:00
parent 1cc4795ef3
commit e14c8459ce
8 changed files with 56 additions and 54 deletions

View File

@ -464,9 +464,7 @@ const MarkdownEditorView = ({
animationType="slide"
style={styles.modalStyle}
>
<SnippetsModal
handleOnSelect={_handleOnSnippetReceived}
/>
<SnippetsModal handleOnSelect={_handleOnSnippetReceived} />
</Modal>
<UploadsGalleryModal

View File

@ -274,7 +274,7 @@ class ProfileContainer extends Component {
const res = await getRelationship(currentAccount.name, username);
_isFollowing = res && res.follows;
_isMuted = res && res.ignores;
isFavorite = await checkFavorite(username)
isFavorite = await checkFavorite(username);
}
try {
@ -296,12 +296,14 @@ class ProfileContainer extends Component {
});
}
}
}
catch(error){
console.warn("Failed to fetch complete profile data", error);
Alert.alert(intl.formatMessage({
} catch (error) {
console.warn('Failed to fetch complete profile data', error);
Alert.alert(
intl.formatMessage({
id: 'alert.fail',
}), error.message || error.toString())
}),
error.message || error.toString(),
);
}
};
@ -359,25 +361,26 @@ class ProfileContainer extends Component {
favoriteAction = addFavorite;
}
favoriteAction(username).then(() => {
dispatch(
toastNotification(
favoriteAction(username)
.then(() => {
dispatch(
toastNotification(
intl.formatMessage({
id: isFavorite ? 'alert.success_unfavorite' : 'alert.success_favorite',
}),
),
);
this.setState({ isFavorite: !isFavorite, isProfileLoading: false });
})
.catch((error) => {
console.warn('Failed to perform favorite action');
Alert.alert(
intl.formatMessage({
id: isFavorite ? 'alert.success_unfavorite' : 'alert.success_favorite',
id: 'alert.fail',
}),
),
);
this.setState({ isFavorite: !isFavorite, isProfileLoading: false });
})
.catch((error)=>{
console.warn("Failed to perform favorite action")
Alert.alert(
intl.formatMessage({
id: 'alert.fail',
}),
error.message || error.toString()
)
});
error.message || error.toString(),
);
});
};
_handleOnBackPress = () => {

View File

@ -43,7 +43,11 @@ import {
} from '../../../realm/realm';
import { getUser, getPost } from '../../../providers/hive/dhive';
import { migrateToMasterKeyWithAccessToken, switchAccount } from '../../../providers/hive/auth';
import { setPushToken, markActivityAsRead, markNotifications } from '../../../providers/ecency/ecency';
import {
setPushToken,
markActivityAsRead,
markNotifications,
} from '../../../providers/ecency/ecency';
import { navigate } from '../../../navigation/service';
// Actions

View File

@ -101,7 +101,7 @@ const DraftsContainer = ({ currentAccount, intl, navigation, dispatch }) => {
_getSchedules();
})
.catch((error) => {
console.warn("Failed to move scheduled post to drafts")
console.warn('Failed to move scheduled post to drafts');
dispatch(toastNotification(intl.formatMessage({ id: 'alert.fail' })));
});
};

View File

@ -945,7 +945,8 @@ class EditorContainer extends Component {
data.jsonMeta,
options,
data.scheduleDate,
) .then(() => {
)
.then(() => {
this.setState({
isPostSending: false,
});
@ -973,7 +974,7 @@ class EditorContainer extends Component {
}, 3000);
})
.catch((error) => {
console.warn("Failed to schedule post", error);
console.warn('Failed to schedule post', error);
this.setState({
isPostSending: false,
});

View File

@ -42,7 +42,7 @@ class NotificationContainer extends Component {
if (!endOfNotification || !loadMore) {
this.setState({ isNotificationRefreshing: true });
getNotifications({ filter:type, since:since })
getNotifications({ filter: type, since: since })
.then((res) => {
console.log(res);
const lastId = res.length > 0 ? [...res].pop().id : null;
@ -73,7 +73,7 @@ class NotificationContainer extends Component {
let params;
let key;
markNotifications(data.id).then((result) => {
const {unread} = result;
const { unread } = result;
dispatch(updateUnreadActivityCount(unread));
});
@ -150,9 +150,7 @@ class NotificationContainer extends Component {
(nextProps.activeBottomTab === ROUTES.TABBAR.NOTIFICATION && nextProps.username) ||
(nextProps.username !== username && nextProps.username)
) {
this.setState({ endOfNotification: false }, () =>
this._getActivities(selectedFilter),
);
this.setState({ endOfNotification: false }, () => this._getActivities(selectedFilter));
}
}

View File

@ -49,19 +49,17 @@ const RegisterContainer = ({ children, navigation }) => {
})
.catch((err) => {
if (get(err, 'response.status') === 500) {
Alert.alert(intl.formatMessage(
{ id: 'alert.fail'}),
intl.formatMessage({ id: 'register.500_error' }));
}
else if (get(err, 'response.data.message')) {
Alert.alert(intl.formatMessage(
{ id: 'alert.fail'}),
err.response.data.message);
}
else {
Alert.alert(intl.formatMessage(
{ id: 'alert.fail'}),
intl.formatMessage({ id: 'alert.unknow_error' }));
Alert.alert(
intl.formatMessage({ id: 'alert.fail' }),
intl.formatMessage({ id: 'register.500_error' }),
);
} else if (get(err, 'response.data.message')) {
Alert.alert(intl.formatMessage({ id: 'alert.fail' }), err.response.data.message);
} else {
Alert.alert(
intl.formatMessage({ id: 'alert.fail' }),
intl.formatMessage({ id: 'alert.unknow_error' }),
);
}
setIsLoading(false);
});

View File

@ -100,12 +100,12 @@ const PostsResultsContainer = ({ children, navigation, searchValue }) => {
const _loadMore = (index, value) => {
if (scrollId && searchValue) {
search({ q: `${searchValue} type:post`, sort, scroll_id: scrollId })
.then((res) => {
setData([...data, ...res.results]);
})
.catch(()=>{
console.warn("Search Failed");
})
.then((res) => {
setData([...data, ...res.results]);
})
.catch(() => {
console.warn('Search Failed');
});
}
};