mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-25 14:22:14 +03:00
ignoring post edits for local save, fixed toastNotification cache issue
This commit is contained in:
parent
0d8cb3106e
commit
c71a59b041
src/screens
@ -621,7 +621,10 @@ class ApplicationContainer extends Component {
|
||||
_getSettings = async () => {
|
||||
const { dispatch } = this.props;
|
||||
|
||||
//reset certain properties
|
||||
dispatch(hideActionModal());
|
||||
dispatch(toastNotification(''));
|
||||
|
||||
const settings = await getSettings();
|
||||
|
||||
if (settings) {
|
||||
|
@ -594,6 +594,11 @@ class EditorContainer extends Component {
|
||||
_saveCurrentDraft = async (fields) => {
|
||||
const { draftId, isReply, isEdit, isPostSending } = this.state;
|
||||
|
||||
//skip draft save in case post is sending or is post beign edited
|
||||
if (isPostSending || isEdit) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { currentAccount } = this.props;
|
||||
const username = currentAccount && currentAccount.name ? currentAccount.name : '';
|
||||
|
||||
@ -602,20 +607,18 @@ class EditorContainer extends Component {
|
||||
tags: fields.tags && fields.tags.length > 0 ? fields.tags.toString() : '',
|
||||
};
|
||||
|
||||
if (!isPostSending) {
|
||||
//save reply data
|
||||
if (isReply && draftField.body !== null) {
|
||||
await AsyncStorage.setItem('temp-reply', draftField.body);
|
||||
//save reply data
|
||||
if (isReply && draftField.body !== null) {
|
||||
await AsyncStorage.setItem('temp-reply', draftField.body);
|
||||
|
||||
//save existing draft data locally
|
||||
} else if (draftId) {
|
||||
setDraftPost(draftField, username, draftId);
|
||||
}
|
||||
//save existing draft data locally
|
||||
} else if (draftId) {
|
||||
setDraftPost(draftField, username, draftId);
|
||||
}
|
||||
|
||||
//update editor data locally
|
||||
else if (!isReply) {
|
||||
setDraftPost(draftField, username);
|
||||
}
|
||||
//update editor data locally
|
||||
else if (!isReply) {
|
||||
setDraftPost(draftField, username);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -66,8 +66,8 @@ class EditorScreen extends Component {
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
const { isReply } = this.props;
|
||||
if (!isReply) {
|
||||
const { isReply, isEdit } = this.props;
|
||||
if (!isReply && !isEdit) {
|
||||
this._saveDraftToDB();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user