mirror of
https://github.com/ecency/ecency-mobile.git
synced 2025-01-02 10:54:59 +03:00
Merge pull request #751 from esteemapp/feature/schedules-2
schedules [PART 2]
This commit is contained in:
commit
a1646bd1d0
@ -8,3 +8,4 @@ PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
USER_HEADER_SEARCH_PATHS = $(inherited) $(SRCROOT)/FLAnimatedImage/FLAnimatedImage
|
||||
|
@ -8,3 +8,4 @@ PODS_BUILD_DIR = ${BUILD_DIR}
|
||||
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
|
||||
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
|
||||
PODS_ROOT = ${SRCROOT}/Pods
|
||||
USER_HEADER_SEARCH_PATHS = $(inherited) $(SRCROOT)/FLAnimatedImage/FLAnimatedImage
|
||||
|
@ -44,6 +44,7 @@
|
||||
"react-native-actionsheet": "^2.4.2",
|
||||
"react-native-code-push": "^5.5.2",
|
||||
"react-native-config": "^0.11.5",
|
||||
"react-native-datepicker": "^1.7.2",
|
||||
"react-native-extended-stylesheet": "^0.10.0",
|
||||
"react-native-fast-image": "^4.0.14",
|
||||
"react-native-html-renderer": "^1.0.0",
|
||||
|
@ -49,6 +49,9 @@ export default EStyleSheet.create({
|
||||
justifyContent: 'center',
|
||||
alignSelf: 'center',
|
||||
},
|
||||
scheduleIcon: {
|
||||
color: '$iconColor',
|
||||
},
|
||||
textButton: {
|
||||
fontSize: 16,
|
||||
},
|
||||
|
@ -3,16 +3,20 @@ import {
|
||||
View, Text, ActivityIndicator, SafeAreaView,
|
||||
} from 'react-native';
|
||||
import { injectIntl } from 'react-intl';
|
||||
import DatePicker from 'react-native-datepicker';
|
||||
import moment from 'moment';
|
||||
|
||||
// Components
|
||||
import { TextButton } from '../..';
|
||||
import { IconButton } from '../../iconButton';
|
||||
import { DropdownButton } from '../../dropdownButton';
|
||||
import { TextInput } from '../../textInput';
|
||||
import { Icon } from '../../icon';
|
||||
|
||||
// Constants
|
||||
// Styles
|
||||
import styles from './basicHeaderStyles';
|
||||
import datePickerStyles from './datePickerStyles';
|
||||
|
||||
class BasicHeaderView extends Component {
|
||||
/* Props
|
||||
@ -25,6 +29,7 @@ class BasicHeaderView extends Component {
|
||||
super(props);
|
||||
this.state = {
|
||||
isInputVisible: false,
|
||||
datePickerValue: '',
|
||||
};
|
||||
}
|
||||
|
||||
@ -56,6 +61,16 @@ class BasicHeaderView extends Component {
|
||||
|
||||
_handleOnInputChange = () => {};
|
||||
|
||||
_handleDatePickerChange = (datePickerValue) => {
|
||||
const { handleDatePickerChange } = this.props;
|
||||
|
||||
this.setState({ datePickerValue });
|
||||
|
||||
if (handleDatePickerChange) {
|
||||
handleDatePickerChange(datePickerValue);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
dropdownComponent,
|
||||
@ -82,7 +97,7 @@ class BasicHeaderView extends Component {
|
||||
rightIconName,
|
||||
title,
|
||||
} = this.props;
|
||||
const { isInputVisible } = this.state;
|
||||
const { isInputVisible, datePickerValue } = this.state;
|
||||
return (
|
||||
<SafeAreaView style={styles.safeArea}>
|
||||
<View style={styles.container}>
|
||||
@ -174,13 +189,35 @@ class BasicHeaderView extends Component {
|
||||
|
||||
{isHasIcons && (
|
||||
<Fragment>
|
||||
{/* <IconButton
|
||||
style={styles.iconButton}
|
||||
iconStyle={styles.rightIcon}
|
||||
size={20}
|
||||
iconType="MaterialIcons"
|
||||
name="timer"
|
||||
/> */}
|
||||
{!isReply
|
||||
&& (
|
||||
<DatePicker
|
||||
style={{ width: 50 }}
|
||||
date={datePickerValue}
|
||||
mode="date"
|
||||
format="YYYY-MM-DD"
|
||||
minDate={moment()}
|
||||
maxDate="3000-06-01"
|
||||
confirmBtnText="Confirm"
|
||||
cancelBtnText="Cancel"
|
||||
onDateChange={(_datePickerValue) => { this._handleDatePickerChange(_datePickerValue); }}
|
||||
hideText
|
||||
disabled={!isFormValid}
|
||||
onPressDate
|
||||
customStyles={{
|
||||
...datePickerStyles,
|
||||
}}
|
||||
iconComponent={(
|
||||
<Icon
|
||||
style={{ ...styles.iconButton, ...styles.scheduleIcon }}
|
||||
size={20}
|
||||
iconType="MaterialIcons"
|
||||
name="timer"
|
||||
/>
|
||||
)}
|
||||
/>
|
||||
)
|
||||
}
|
||||
<IconButton
|
||||
style={styles.iconButton}
|
||||
size={25}
|
||||
|
31
src/components/basicHeader/view/datePickerStyles.js
Normal file
31
src/components/basicHeader/view/datePickerStyles.js
Normal file
@ -0,0 +1,31 @@
|
||||
import EStyleSheet from 'react-native-extended-stylesheet';
|
||||
|
||||
export default EStyleSheet.create({
|
||||
btnConfirm: {
|
||||
color: '$iconColor',
|
||||
},
|
||||
btnTextCancel: {
|
||||
color: '$iconColor',
|
||||
},
|
||||
datePicker: {
|
||||
marginTop: 42,
|
||||
borderTopColor: '$borderColor',
|
||||
borderTopWidth: 1,
|
||||
backgroundColor: '$primaryBackgroundColor',
|
||||
},
|
||||
dateText: {
|
||||
color: '$primaryDarkText',
|
||||
},
|
||||
btnText: {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
height: 42,
|
||||
paddingHorizontal: 20,
|
||||
flexDirection: 'row',
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
datePickerCon: {
|
||||
backgroundColor: '$primaryBackgroundColor',
|
||||
},
|
||||
});
|
@ -45,6 +45,7 @@ class PostListItemView extends Component {
|
||||
handleOnRemoveItem,
|
||||
id,
|
||||
intl,
|
||||
isFormatedDate,
|
||||
} = this.props;
|
||||
|
||||
return (
|
||||
@ -53,7 +54,7 @@ class PostListItemView extends Component {
|
||||
<View style={styles.header}>
|
||||
<PostHeaderDescription
|
||||
// date={intl.formatRelative(created)}
|
||||
date={getTimeFromNow(created, true)}
|
||||
date={isFormatedDate ? created : getTimeFromNow(created, true)}
|
||||
name={username}
|
||||
reputation={reputation}
|
||||
size={32}
|
||||
|
@ -150,7 +150,10 @@
|
||||
"allRead": "Marked all notifications as read",
|
||||
"claim_reward_balance_ok": "Reward balance claimed",
|
||||
"fail": "Fail!",
|
||||
"move": "Move",
|
||||
"move_question": "Are you sure to move to drafts?",
|
||||
"success_shared": "Your post succesfully shared",
|
||||
"success_moved": "Moved to draft",
|
||||
"permission_denied": "Permission denied",
|
||||
"permission_text": "Please, go to phone Settings and change eSteem app permissions.",
|
||||
"success_rebloged": "Reblogged!",
|
||||
|
@ -23,9 +23,9 @@ export const getDrafts = data => new Promise((resolve, reject) => {
|
||||
* @params username
|
||||
* @params draftID
|
||||
*/
|
||||
export const removeDraft = data => new Promise((resolve, reject) => {
|
||||
export const removeDraft = (username, id) => new Promise((resolve, reject) => {
|
||||
api
|
||||
.delete(`/drafts/${data.username}/${data.draftId}`)
|
||||
.delete(`/drafts/${username}/${id}`)
|
||||
.then((res) => {
|
||||
resolve(res.data);
|
||||
})
|
||||
@ -223,7 +223,7 @@ export const schedule = (
|
||||
upvote,
|
||||
scheduleDate,
|
||||
) => api
|
||||
.post('/api/schedules', {
|
||||
.post('/schedules', {
|
||||
username: user,
|
||||
category: tags[0],
|
||||
title,
|
||||
@ -238,18 +238,18 @@ export const schedule = (
|
||||
})
|
||||
.then(resp => resp.data);
|
||||
|
||||
export const getSchedules = user => api.get(`/api/schedules/${user}`).then(resp => resp.data);
|
||||
export const getSchedules = username => api.get(`/schedules/${username}`).then(resp => resp.data);
|
||||
|
||||
export const removeSchedule = (id, user) => api.delete(`/api/schedules/${user}/${id}`);
|
||||
export const removeSchedule = (username, id) => api.delete(`/schedules/${username}/${id}`);
|
||||
|
||||
export const moveSchedule = (id, user) => api.put(`/api/schedules/${user}/${id}`);
|
||||
export const moveSchedule = (id, username) => api.put(`/schedules/${username}/${id}`);
|
||||
|
||||
// Old image service
|
||||
// Images
|
||||
|
||||
export const getImages = user => api.get(`api/images/${user}`).then(resp => resp.data);
|
||||
export const getImages = username => api.get(`api/images/${username}`).then(resp => resp.data);
|
||||
|
||||
export const addMyImage = (user, url) => api.post('/api/image', { username: user, image_url: url });
|
||||
export const addMyImage = (user, url) => api.post('/image', { username: user, image_url: url });
|
||||
|
||||
export const uploadImage = (file) => {
|
||||
const fData = new FormData();
|
||||
|
@ -4,7 +4,10 @@ import { Alert } from 'react-native';
|
||||
import { injectIntl } from 'react-intl';
|
||||
|
||||
// Services and Actions
|
||||
import { getDrafts, removeDraft, getSchedules } from '../../../providers/esteem/esteem';
|
||||
import {
|
||||
getDrafts, removeDraft, getSchedules, removeSchedule, moveSchedule
|
||||
} from '../../../providers/esteem/esteem';
|
||||
import { toastNotification } from '../../../redux/actions/uiAction';
|
||||
|
||||
// Middleware
|
||||
|
||||
@ -35,6 +38,7 @@ class DraftsContainer extends Component {
|
||||
// Component Life Cycle Functions
|
||||
componentDidMount() {
|
||||
this._getDrafts();
|
||||
this._getSchedules();
|
||||
}
|
||||
|
||||
// Component Functions
|
||||
@ -45,7 +49,7 @@ class DraftsContainer extends Component {
|
||||
|
||||
getSchedules(currentAccount.name)
|
||||
.then((data) => {
|
||||
this.setState({ schedules: this._sortData(data), isLoading: false });
|
||||
this.setState({ schedules: this._sortData(data, true), isLoading: false });
|
||||
})
|
||||
.catch(() => {
|
||||
Alert.alert(intl.formatMessage({ id: 'drafts.load_error' }));
|
||||
@ -70,7 +74,7 @@ class DraftsContainer extends Component {
|
||||
_removeDraft = (id) => {
|
||||
const { currentAccount, intl } = this.props;
|
||||
|
||||
removeDraft({ username: currentAccount.name, draftId: id })
|
||||
removeDraft(currentAccount.name, id)
|
||||
.then(() => {
|
||||
const { drafts } = this.state;
|
||||
const newDrafts = [...drafts].filter(draft => draft._id !== id);
|
||||
@ -82,6 +86,49 @@ class DraftsContainer extends Component {
|
||||
});
|
||||
};
|
||||
|
||||
_removeSchedule = (id) => {
|
||||
const { currentAccount, intl } = this.props;
|
||||
|
||||
removeSchedule(currentAccount.name, id)
|
||||
.then((res) => {
|
||||
const { schedules } = this.state;
|
||||
const newSchedules = [...schedules].filter(schedule => schedule._id !== id);
|
||||
console.log(res);
|
||||
|
||||
this.setState({ schedules: this._sortData(newSchedules, true) });
|
||||
})
|
||||
.catch(() => {
|
||||
Alert.alert(intl.formatMessage({ id: 'alert.fail' }));
|
||||
});
|
||||
};
|
||||
|
||||
_moveScheduleToDraft = (id) => {
|
||||
const { currentAccount, dispatch, intl } = this.props;
|
||||
console.log(id);
|
||||
|
||||
moveSchedule(id, currentAccount.name)
|
||||
.then((res) => {
|
||||
console.log(res);
|
||||
dispatch(
|
||||
toastNotification(
|
||||
intl.formatMessage({
|
||||
id: 'alert.success_moved',
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
this._getDrafts();
|
||||
this._getSchedules();
|
||||
})
|
||||
.catch(() => {
|
||||
dispatch(
|
||||
toastNotification(
|
||||
intl.formatMessage({ id: 'alert.fail' })
|
||||
),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
_editDraft = (id) => {
|
||||
const { navigation } = this.props;
|
||||
const { drafts } = this.state;
|
||||
@ -96,9 +143,9 @@ class DraftsContainer extends Component {
|
||||
});
|
||||
};
|
||||
|
||||
_sortData = data => data.sort((a, b) => {
|
||||
const dateA = new Date(a.created).getTime();
|
||||
const dateB = new Date(b.created).getTime();
|
||||
_sortData = (data, isSchedule) => data.sort((a, b) => {
|
||||
const dateA = new Date(isSchedule ? a.schedule : a.created).getTime();
|
||||
const dateB = new Date(isSchedule ? a.schedule : b.created).getTime();
|
||||
|
||||
return dateB > dateA ? 1 : -1;
|
||||
});
|
||||
@ -115,6 +162,8 @@ class DraftsContainer extends Component {
|
||||
drafts={drafts}
|
||||
schedules={schedules}
|
||||
removeDraft={this._removeDraft}
|
||||
moveScheduleToDraft={this._moveScheduleToDraft}
|
||||
removeSchedule={this._removeSchedule}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -6,13 +6,14 @@ import ScrollableTabView from '@esteemapp/react-native-scrollable-tab-view';
|
||||
// Utils
|
||||
import { getPostSummary } from '../../../utils/formatter';
|
||||
import { catchDraftImage } from '../../../utils/image';
|
||||
// Constants
|
||||
import { getFormatedCreatedDate } from '../../../utils/time';
|
||||
|
||||
// Components
|
||||
import { BasicHeader } from '../../../components/basicHeader';
|
||||
import { PostListItem } from '../../../components/postListItem';
|
||||
import { PostCardPlaceHolder } from '../../../components/basicUIElements';
|
||||
import { TabBar } from '../../../components/tabBar';
|
||||
import ActionSheet from 'react-native-actionsheet';
|
||||
|
||||
// Styles
|
||||
import globalStyles from '../../../globalStyles';
|
||||
@ -26,32 +27,39 @@ class DraftsScreen extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {};
|
||||
this.state = {
|
||||
selectedId: null,
|
||||
}
|
||||
}
|
||||
|
||||
// Component Life Cycles
|
||||
|
||||
// Component Functions
|
||||
|
||||
_renderItem = (item) => {
|
||||
const { currentAccount, removeDraft, editDraft } = this.props;
|
||||
_renderItem = (item, type) => {
|
||||
const {
|
||||
currentAccount, removeDraft, editDraft, removeSchedule,
|
||||
} = this.props;
|
||||
const tags = item.tags ? item.tags.split(/[ ,]+/) : [];
|
||||
const tag = tags[0] || '';
|
||||
const image = catchDraftImage(item.body);
|
||||
const summary = getPostSummary(item.body, 100);
|
||||
const isSchedules = type === 'schedules';
|
||||
|
||||
return (
|
||||
<PostListItem
|
||||
created={item.created}
|
||||
created={isSchedules ? getFormatedCreatedDate(item.schedule) : item.created}
|
||||
mainTag={tag}
|
||||
title={item.title}
|
||||
isFormatedDate={isSchedules}
|
||||
summary={summary}
|
||||
image={image ? { uri: catchDraftImage(item.body) } : null}
|
||||
username={currentAccount.name}
|
||||
reputation={currentAccount.reputation}
|
||||
handleOnPressItem={editDraft}
|
||||
handleOnRemoveItem={removeDraft}
|
||||
handleOnPressItem={() => isSchedules ? this.setState({selectedId: item._id}, () => this.ActionSheet.show()) : editDraft}
|
||||
handleOnRemoveItem={isSchedules ? removeSchedule : removeDraft}
|
||||
id={item._id}
|
||||
key={item._id}
|
||||
/>
|
||||
);
|
||||
};
|
||||
@ -80,7 +88,7 @@ class DraftsScreen extends Component {
|
||||
data={data}
|
||||
keyExtractor={item => item._id}
|
||||
removeClippedSubviews={false}
|
||||
renderItem={({ item }) => this._renderItem(item)}
|
||||
renderItem={({ item }) => this._renderItem(item, type)}
|
||||
/>
|
||||
)
|
||||
)}
|
||||
@ -89,7 +97,8 @@ class DraftsScreen extends Component {
|
||||
};
|
||||
|
||||
render() {
|
||||
const { drafts, schedules, intl } = this.props;
|
||||
const { drafts, schedules, intl, moveScheduleToDraft } = this.props;
|
||||
const { selectedId } = this.state;
|
||||
|
||||
return (
|
||||
<View style={globalStyles.container}>
|
||||
@ -127,6 +136,24 @@ class DraftsScreen extends Component {
|
||||
{this._getTabItem(schedules, 'schedules')}
|
||||
</View>
|
||||
</ScrollableTabView>
|
||||
<ActionSheet
|
||||
ref={o => (this.ActionSheet = o)}
|
||||
title={intl.formatMessage({
|
||||
id: 'alert.move_question',
|
||||
})}
|
||||
options={[
|
||||
intl.formatMessage({
|
||||
id: 'alert.move',
|
||||
}),
|
||||
intl.formatMessage({
|
||||
id: 'alert.cancel',
|
||||
}),
|
||||
]}
|
||||
cancelButtonIndex={1}
|
||||
onPress={(index) => {
|
||||
index === 0 && moveScheduleToDraft(selectedId);
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
@ -6,7 +6,13 @@ import ImagePicker from 'react-native-image-crop-picker';
|
||||
|
||||
// Services and Actions
|
||||
import { Buffer } from 'buffer';
|
||||
import { uploadImage, addDraft, updateDraft } from '../../../providers/esteem/esteem';
|
||||
import {
|
||||
uploadImage,
|
||||
addDraft,
|
||||
updateDraft,
|
||||
schedule,
|
||||
} from '../../../providers/esteem/esteem';
|
||||
import { toastNotification } from '../../../redux/actions/uiAction';
|
||||
import { postContent, getPurePost } from '../../../providers/steem/dsteem';
|
||||
import { setDraftPost, getDraftPost } from '../../../realm/realm';
|
||||
|
||||
@ -69,7 +75,11 @@ class EditorContainer extends Component {
|
||||
_draft = navigationParams.draft;
|
||||
|
||||
this.setState({
|
||||
draftPost: { title: _draft.title, body: _draft.body, tags: _draft.tags.split(' ') },
|
||||
draftPost: {
|
||||
title: _draft.title,
|
||||
body: _draft.body,
|
||||
tags: _draft.tags.includes(' ') ? _draft.tags.split(' ') : _draft.tags.split(','),
|
||||
},
|
||||
draftId: _draft._id,
|
||||
isDraft: true,
|
||||
});
|
||||
@ -87,16 +97,14 @@ class EditorContainer extends Component {
|
||||
|
||||
if (navigationParams.isEdit) {
|
||||
({ isEdit } = navigationParams);
|
||||
this.setState(
|
||||
{
|
||||
isEdit,
|
||||
draftPost: {
|
||||
title: post.title,
|
||||
body: post.markdownBody,
|
||||
tags: post.json_metadata.tags,
|
||||
},
|
||||
this.setState({
|
||||
isEdit,
|
||||
draftPost: {
|
||||
title: post.title,
|
||||
body: post.markdownBody,
|
||||
tags: post.json_metadata.tags,
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
if (navigationParams.action) {
|
||||
@ -123,7 +131,11 @@ class EditorContainer extends Component {
|
||||
await getDraftPost(username)
|
||||
.then((result) => {
|
||||
this.setState({
|
||||
draftPost: { body: result.body, title: result.title, tags: result.tags.split(',') },
|
||||
draftPost: {
|
||||
body: result.body,
|
||||
title: result.title,
|
||||
tags: result.tags.split(','),
|
||||
},
|
||||
});
|
||||
})
|
||||
.catch(() => {
|
||||
@ -268,7 +280,8 @@ class EditorContainer extends Component {
|
||||
|
||||
const draftField = {
|
||||
...fields,
|
||||
tags: fields.tags && fields.tags.length > 0 ? fields.tags.toString() : '',
|
||||
tags:
|
||||
fields.tags && fields.tags.length > 0 ? fields.tags.toString() : '',
|
||||
};
|
||||
|
||||
if (isReply && draftField.body) {
|
||||
@ -279,9 +292,14 @@ class EditorContainer extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_submitPost = async (fields) => {
|
||||
_submitPost = async (fields, scheduleDate) => {
|
||||
const {
|
||||
navigation, currentAccount, pinCode, intl, isDefaultFooter,
|
||||
currentAccount,
|
||||
dispatch,
|
||||
intl,
|
||||
navigation,
|
||||
pinCode,
|
||||
// isDefaultFooter,
|
||||
} = this.props;
|
||||
|
||||
if (currentAccount) {
|
||||
@ -307,43 +325,63 @@ class EditorContainer extends Component {
|
||||
const options = makeOptions(author, permlink);
|
||||
const parentPermlink = fields.tags[0];
|
||||
|
||||
await postContent(
|
||||
currentAccount,
|
||||
pinCode,
|
||||
'',
|
||||
parentPermlink,
|
||||
permlink,
|
||||
fields.title,
|
||||
fields.body,
|
||||
jsonMeta,
|
||||
options,
|
||||
0,
|
||||
)
|
||||
.then(() => {
|
||||
Alert.alert(
|
||||
intl.formatMessage({
|
||||
id: 'alert.success',
|
||||
}),
|
||||
intl.formatMessage({
|
||||
id: 'alert.success_shared',
|
||||
}),
|
||||
);
|
||||
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.POST,
|
||||
params: {
|
||||
author: currentAccount.name,
|
||||
permlink,
|
||||
isNewPost: true,
|
||||
},
|
||||
key: permlink,
|
||||
});
|
||||
|
||||
setDraftPost({ title: '', body: '', tags: '' }, currentAccount.name);
|
||||
})
|
||||
.catch((error) => {
|
||||
this._handleSubmitFailure(error);
|
||||
if (scheduleDate) {
|
||||
await this._setScheduledPost({
|
||||
author,
|
||||
permlink,
|
||||
fields,
|
||||
scheduleDate,
|
||||
});
|
||||
} else {
|
||||
await postContent(
|
||||
currentAccount,
|
||||
pinCode,
|
||||
'',
|
||||
parentPermlink,
|
||||
permlink,
|
||||
fields.title,
|
||||
fields.body,
|
||||
jsonMeta,
|
||||
options,
|
||||
0,
|
||||
)
|
||||
.then(() => {
|
||||
// Alert.alert(
|
||||
// intl.formatMessage({
|
||||
// id: 'alert.success',
|
||||
// }),
|
||||
// intl.formatMessage({
|
||||
// id: 'alert.success_shared',
|
||||
// }),
|
||||
// );
|
||||
|
||||
dispatch(
|
||||
toastNotification(
|
||||
intl.formatMessage({
|
||||
id: 'alert.success_shared',
|
||||
}),
|
||||
),
|
||||
);
|
||||
|
||||
navigation.navigate({
|
||||
routeName: ROUTES.SCREENS.POST,
|
||||
params: {
|
||||
author: currentAccount.name,
|
||||
permlink,
|
||||
isNewPost: true,
|
||||
},
|
||||
key: permlink,
|
||||
});
|
||||
|
||||
setDraftPost(
|
||||
{ title: '', body: '', tags: '' },
|
||||
currentAccount.name,
|
||||
);
|
||||
})
|
||||
.catch((error) => {
|
||||
this._handleSubmitFailure(error);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -355,7 +393,9 @@ class EditorContainer extends Component {
|
||||
|
||||
const { post } = this.state;
|
||||
|
||||
const jsonMeta = makeJsonMetadataReply(post.json_metadata.tags || ['esteem']);
|
||||
const jsonMeta = makeJsonMetadataReply(
|
||||
post.json_metadata.tags || ['esteem'],
|
||||
);
|
||||
const permlink = generateReplyPermlink(post.author);
|
||||
const author = currentAccount.name;
|
||||
const options = makeOptions(author, permlink);
|
||||
@ -481,6 +521,38 @@ class EditorContainer extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_handleDatePickerChange = (datePickerValue, fields) => {
|
||||
this._submitPost(fields, datePickerValue);
|
||||
};
|
||||
|
||||
_setScheduledPost = (data) => {
|
||||
const { dispatch } = this.props;
|
||||
|
||||
schedule(
|
||||
data.author,
|
||||
data.fields.title,
|
||||
data.permlink,
|
||||
'',
|
||||
data.fields.tags,
|
||||
data.fields.body,
|
||||
'',
|
||||
'',
|
||||
data.scheduleDate,
|
||||
).then(() => {
|
||||
this.setState({ isPostSending: false });
|
||||
dispatch(
|
||||
toastNotification(
|
||||
// intl.formatMessage({
|
||||
// id: 'alert.copied',
|
||||
// }),
|
||||
'Scheduled',
|
||||
),
|
||||
);
|
||||
}).catch(() => {
|
||||
this.setState({ isPostSending: false });
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
const { isLoggedIn, isDarkTheme } = this.props;
|
||||
const {
|
||||
@ -502,11 +574,11 @@ class EditorContainer extends Component {
|
||||
<EditorScreen
|
||||
autoFocusText={autoFocusText}
|
||||
draftPost={draftPost}
|
||||
handleDatePickerChange={this._handleDatePickerChange}
|
||||
handleFormChanged={this._handleFormChanged}
|
||||
handleOnImagePicker={this._handleRoutingAction}
|
||||
saveDraftToDB={this._saveDraftToDB}
|
||||
handleOnSubmit={this._handleSubmit}
|
||||
handleOnBackPress={this._handleOnBackPress}
|
||||
handleOnImagePicker={this._handleRoutingAction}
|
||||
handleOnSubmit={this._handleSubmit}
|
||||
isCameraOrPickerOpen={isCameraOrPickerOpen}
|
||||
isDarkTheme={isDarkTheme}
|
||||
isDraftSaved={isDraftSaved}
|
||||
@ -519,6 +591,7 @@ class EditorContainer extends Component {
|
||||
isUploading={isUploading}
|
||||
post={post}
|
||||
saveCurrentDraft={this._saveCurrentDraft}
|
||||
saveDraftToDB={this._saveDraftToDB}
|
||||
uploadedImage={uploadedImage}
|
||||
/>
|
||||
);
|
||||
|
@ -174,6 +174,7 @@ class EditorScreen extends Component {
|
||||
post,
|
||||
uploadedImage,
|
||||
handleOnBackPress,
|
||||
handleDatePickerChange,
|
||||
} = this.props;
|
||||
const rightButtonText = intl.formatMessage({
|
||||
id: isEdit ? 'basic_header.update' : isReply ? 'basic_header.reply' : 'basic_header.publish',
|
||||
@ -182,19 +183,20 @@ class EditorScreen extends Component {
|
||||
return (
|
||||
<View style={globalStyles.defaultContainer}>
|
||||
<BasicHeader
|
||||
handleDatePickerChange={date => handleDatePickerChange(date, fields)}
|
||||
handleOnBackPress={handleOnBackPress}
|
||||
handleOnPressPreviewButton={this._handleOnPressPreviewButton}
|
||||
handleOnSaveButtonPress={this._handleOnSaveButtonPress}
|
||||
handleOnSubmit={this._handleOnSubmit}
|
||||
handleOnBackPress={handleOnBackPress}
|
||||
isDraftSaved={isDraftSaved}
|
||||
isDraftSaving={isDraftSaving}
|
||||
isEdit={isEdit}
|
||||
isFormValid={isFormValid}
|
||||
isHasIcons
|
||||
isEdit={isEdit}
|
||||
isLoggedIn={isLoggedIn}
|
||||
isReply={isReply}
|
||||
isLoading={isPostSending || isUploading}
|
||||
isLoggedIn={isLoggedIn}
|
||||
isPreviewActive={isPreviewActive}
|
||||
isReply={isReply}
|
||||
quickTitle={wordsCount > 0 && `${wordsCount} words`}
|
||||
rightButtonText={rightButtonText}
|
||||
/>
|
||||
|
62
yarn.lock
62
yarn.lock
@ -1127,17 +1127,17 @@
|
||||
integrity sha512-eItQyV43bj4rR3JPV0Skpl1SncRCdziTEK9/v8VwXmV6d/qOUO8/EuWeHBbCZcsfSHfzI5UyMJLCSXtxxznyZg==
|
||||
|
||||
"@types/react-native@>=0.50.0":
|
||||
version "0.57.42"
|
||||
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.57.42.tgz#06ad92cd1378146402b7667de13cb7b935d194d6"
|
||||
integrity sha512-Ms4RI8Oyi8HOIwlteFhgRE7TA9chP/mliLeJCzjKBOywYpile5TrXQF8lRDYzcC1zyTyoopu/u8VMlF+FS7VnA==
|
||||
version "0.57.43"
|
||||
resolved "https://registry.yarnpkg.com/@types/react-native/-/react-native-0.57.43.tgz#a4d3fa7be905a8e28b7682220335dacefffd816f"
|
||||
integrity sha512-hYt5a+Kj/Cy0102b+WZpNhnm1AWNz6HnVYwk41BSDZpDoJweo1BuJv1FStd6ClzCdTPJlfImF8ZqpM2xDoO2aA==
|
||||
dependencies:
|
||||
"@types/prop-types" "*"
|
||||
"@types/react" "*"
|
||||
|
||||
"@types/react@*":
|
||||
version "16.8.12"
|
||||
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.8.12.tgz#ffbdd7bcd2b7037c3f78e26c708922a2befbb71f"
|
||||
integrity sha512-MZZiv11BQhsxFp5DHDmRKBi6Nv3jwOhRiFFDE7ZJ1+rb52gdOd9y/qY0+5wyV/PQVK9926wFMjpQj3BJ18pb4Q==
|
||||
version "16.8.13"
|
||||
resolved "https://registry.yarnpkg.com/@types/react/-/react-16.8.13.tgz#a82b15aad9ab91c40edca0d6889b7745ae24f053"
|
||||
integrity sha512-otJ4ntMuHGrvm67CdDJMAls4WqotmAmW0g3HmWi9LCjSWXrxoXY/nHXrtmMfvPEEmGFNm6NdgMsJmnfH820Qaw==
|
||||
dependencies:
|
||||
"@types/prop-types" "*"
|
||||
csstype "^2.2.0"
|
||||
@ -2336,16 +2336,11 @@ command-line-args@^4.0.6:
|
||||
find-replace "^1.0.3"
|
||||
typical "^2.6.1"
|
||||
|
||||
commander@^2.11.0, commander@^2.14.1, commander@^2.9.0:
|
||||
commander@^2.11.0, commander@^2.14.1, commander@^2.9.0, commander@~2.20.0:
|
||||
version "2.20.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.0.tgz#d58bb2b5c1ee8f87b0d340027e9e94e222c5a422"
|
||||
integrity sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==
|
||||
|
||||
commander@~2.13.0:
|
||||
version "2.13.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.13.0.tgz#6964bca67685df7c1f1430c584f07d7597885b9c"
|
||||
integrity sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==
|
||||
|
||||
commander@~2.19.0:
|
||||
version "2.19.0"
|
||||
resolved "https://registry.yarnpkg.com/commander/-/commander-2.19.0.tgz#f6198aa84e5b83c46054b94ddedbfed5ee9ff12a"
|
||||
@ -2608,7 +2603,7 @@ date-fns@^1.27.2:
|
||||
resolved "https://registry.yarnpkg.com/date-fns/-/date-fns-1.30.1.tgz#2e71bf0b119153dbb4cc4e88d9ea5acfb50dc05c"
|
||||
integrity sha512-hBSVCvSmWC+QypYObzwGOd9wqdDpOt+0wl0KbU+R+uuZBS1jN8VsD1ss3irQDknRj5NvxiTF6oj/nDRnN/UQNw==
|
||||
|
||||
debug@2.6.9, debug@^2.1.2, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9:
|
||||
debug@2.6.9, debug@^2.2.0, debug@^2.3.3, debug@^2.6.8, debug@^2.6.9:
|
||||
version "2.6.9"
|
||||
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||
integrity sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==
|
||||
@ -2905,10 +2900,10 @@ dsteem@^0.11.2:
|
||||
bs58 "^4.0.1"
|
||||
bytebuffer "^5.0.1"
|
||||
core-js "^2.5.0"
|
||||
node-fetch "^2.3.0"
|
||||
secp256k1 "^3.5.2"
|
||||
node-fetch "^2.1.2"
|
||||
secp256k1 "^3.3.1"
|
||||
verror "^1.10.0"
|
||||
whatwg-fetch "^3.0.0"
|
||||
whatwg-fetch "^2.0.3"
|
||||
|
||||
ecc-jsbn@~0.1.1:
|
||||
version "0.1.2"
|
||||
@ -6227,7 +6222,7 @@ node-fetch@^1.0.1, node-fetch@^1.6.3:
|
||||
encoding "^0.1.11"
|
||||
is-stream "^1.0.1"
|
||||
|
||||
node-fetch@^2.2.0, node-fetch@^2.3.0:
|
||||
node-fetch@^2.1.2, node-fetch@^2.2.0:
|
||||
version "2.3.0"
|
||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.3.0.tgz#1a1d940bbfb916a1d3e0219f037e89e71f8c5fa5"
|
||||
integrity sha512-MOd8pV3fxENbryESLgVIeaGKrdl+uaYhCSSVkjeOb/31/njTpcis5aWfdqgNlHIrKOLRbMnfPINPOML2CIFeXA==
|
||||
@ -7158,6 +7153,13 @@ react-native-config@^0.11.5:
|
||||
resolved "https://registry.yarnpkg.com/react-native-config/-/react-native-config-0.11.7.tgz#a2b323f2ecd76a4df88cbb6bc86eaa2ef9febee7"
|
||||
integrity sha512-dn5s+zhwLyE25vRT/vaEtLk/j8ZL1UZKvejORNDWakSwpOnLmFurFeaZV83IqkPlfWHXHFdsYe2IRYG1WN4WkQ==
|
||||
|
||||
react-native-datepicker@^1.7.2:
|
||||
version "1.7.2"
|
||||
resolved "https://registry.yarnpkg.com/react-native-datepicker/-/react-native-datepicker-1.7.2.tgz#58d0822591a0ac9b32aba082650222a0ee29669d"
|
||||
integrity sha1-WNCCJZGgrJsyq6CCZQIioO4pZp0=
|
||||
dependencies:
|
||||
moment "^2.22.0"
|
||||
|
||||
react-native-dismiss-keyboard@1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/react-native-dismiss-keyboard/-/react-native-dismiss-keyboard-1.0.0.tgz#32886242b3f2317e121f3aeb9b0a585e2b879b49"
|
||||
@ -8264,9 +8266,9 @@ source-map-support@^0.4.15:
|
||||
source-map "^0.5.6"
|
||||
|
||||
source-map-support@^0.5.6, source-map-support@^0.5.9:
|
||||
version "0.5.11"
|
||||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.11.tgz#efac2ce0800355d026326a0ca23e162aeac9a4e2"
|
||||
integrity sha512-//sajEx/fGL3iw6fltKMdPvy8kL3kJ2O3iuYlRoT3k9Kb4BjOoZ+BZzaNHeuaruSt+Kf3Zk9tnfAQg9/AJqUVQ==
|
||||
version "0.5.12"
|
||||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.12.tgz#b4f3b10d51857a5af0138d3ce8003b201613d599"
|
||||
integrity sha512-4h2Pbvyy15EE02G+JOZpUCmqWJuqrs+sEkzewTm++BPi7Hvn/HwcqLAcNxYAyI0x13CpPPn+kMjl+hplXMHITQ==
|
||||
dependencies:
|
||||
buffer-from "^1.0.0"
|
||||
source-map "^0.6.0"
|
||||
@ -8842,11 +8844,9 @@ type-check@~0.3.2:
|
||||
dependencies:
|
||||
prelude-ls "~1.1.2"
|
||||
|
||||
type-fest@^0.3.0:
|
||||
version "0.3.0"
|
||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.3.0.tgz#1eb4a83c4ee233afd59d4db3faef44fecee0e9a2"
|
||||
integrity sha512-fg3sfdDdJDtdHLUpeGsf/fLyG1aapk6zgFiYG5+MDUPybGrJemH4SLk5tP7hGRe8ntxjg0q5LYW53b6YpJIQ9Q==
|
||||
|
||||
version "0.3.1"
|
||||
resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.3.1.tgz#63d00d204e059474fe5e1b7c011112bbd1dc29e1"
|
||||
integrity sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==
|
||||
typedarray@^0.0.6:
|
||||
version "0.0.6"
|
||||
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
|
||||
@ -8889,11 +8889,11 @@ uglify-es@^3.1.9:
|
||||
source-map "~0.6.1"
|
||||
|
||||
uglify-js@^3.1.4:
|
||||
version "3.5.3"
|
||||
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.5.3.tgz#d490bb5347f23025f0c1bc0dee901d98e4d6b063"
|
||||
integrity sha512-rIQPT2UMDnk4jRX+w4WO84/pebU2jiLsjgIyrCktYgSvx28enOE3iYQMr+BD1rHiitWnDmpu0cY/LfIEpKcjcw==
|
||||
version "3.5.4"
|
||||
resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.5.4.tgz#4a64d57f590e20a898ba057f838dcdfb67a939b9"
|
||||
integrity sha512-GpKo28q/7Bm5BcX9vOu4S46FwisbPbAmkkqPnGIpKvKTM96I85N6XHQV+k4I6FA2wxgLhcsSyHoNhzucwCflvA==
|
||||
dependencies:
|
||||
commander "~2.19.0"
|
||||
commander "~2.20.0"
|
||||
source-map "~0.6.1"
|
||||
|
||||
ultron@1.0.x:
|
||||
@ -9096,12 +9096,12 @@ whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3:
|
||||
dependencies:
|
||||
iconv-lite "0.4.24"
|
||||
|
||||
whatwg-fetch@2.0.4:
|
||||
whatwg-fetch@2.0.4, whatwg-fetch@^2.0.3:
|
||||
version "2.0.4"
|
||||
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f"
|
||||
integrity sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==
|
||||
|
||||
whatwg-fetch@>=0.10.0, whatwg-fetch@^3.0.0:
|
||||
whatwg-fetch@>=0.10.0:
|
||||
version "3.0.0"
|
||||
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.0.0.tgz#fc804e458cc460009b1a2b966bc8817d2578aefb"
|
||||
integrity sha512-9GSJUgz1D4MfyKU7KRqwOjXCXTqWdFNvEr7eUBYchQiVc744mqK/MzXPNR2WsPkmkOa4ywfg8C2n8h+13Bey1Q==
|
||||
|
Loading…
Reference in New Issue
Block a user