...
 
Commits (6)
......@@ -16,7 +16,8 @@
"typeComment":"Type your comment...",
"error":"SORRY, WE COULDN'T LOAD THE ACTIVITY",
"tryAgain":"PLEASE TRY AGAIN LATER",
"remindBlocked":"This remind is not available because you blocked"
"remindBlocked":"This remind is not available because you blocked",
"scheduled":"This activity is scheduled to be shown on"
},
"permissions": {
"externalStorage":"Minds needs access to your external storage so you can upload awesome pictures.",
......
......@@ -16,7 +16,8 @@
"error": "PERDÓN, NO SE PUEDE CARGAR LA ACTIVIDAD",
"tryAgain": "POR FAVOR INTENTA MAS TARDE",
"loadLater": "CARGAR SIGUIENTES",
"remindBlocked": "Este remind no esta disponible porque bloqueaste a"
"remindBlocked": "Este remind no esta disponible porque bloqueaste a",
"scheduled":"Esta actividad esta agendada para mostrarse en"
},
"auth": {
"login": "INGRESAR",
......
......@@ -7,7 +7,6 @@ import MdIcon from 'react-native-vector-icons/MaterialIcons';
import Colors from '../styles/Colors';
import Touchable from '../common/components/Touchable';
import Modal from 'react-native-modal';
import { CheckBox } from 'react-native-elements'
import TransparentButton from '../common/components/TransparentButton';
import LicensePicker from '../common/components/LicensePicker';
import TagInput from '../common/components/TagInput';
......@@ -19,6 +18,7 @@ import { GOOGLE_PLAY_STORE } from '../config/Config';
import testID from '../common/helpers/testID';
import i18n from '../common/services/i18n.service';
import DateTimePicker from 'react-native-modal-datetime-picker';
import BaseModel from '../common/BaseModel';
@inject('capture')
......@@ -211,22 +211,10 @@ export default class CapturePosterFlags extends Component {
this.setState({ datePickerVisible: false });
}
/**
* Is considered scheduled when time_created is setted and is gt current time
*/
isScheduled = () => {
let response = false;
if (this.props.timeCreatedValue) {
const timeCreatedValue = new Date(this.props.timeCreatedValue);
response = timeCreatedValue.getTime() > Date.now();
}
return response;
}
shouldRenderScheduler = () => {
const hasFeature = featuresService.has('post-scheduler');
return hasFeature && (this.isScheduled() || !this.timeCreatedValue);
const timeCreatedValue = this.props.timeCreatedValue;
return hasFeature && (!timeCreatedValue || BaseModel.isScheduled(timeCreatedValue));
}
// Locking (Wire Threshold)
......@@ -430,7 +418,7 @@ export default class CapturePosterFlags extends Component {
{this.shouldRenderScheduler() && <Touchable style={[styles.cell, styles.cell__last]} onPress={this.showDatePicker}>
<IonIcon
name="md-calendar"
color={this.isScheduled() ? Colors.primary : Colors.darkGreyed}
color={BaseModel.isScheduled(this.props.timeCreatedValue) ? Colors.primary : Colors.darkGreyed}
size={30}
{...testID('Post scheduler button')}
/>
......
import {
extendObservable,
decorate,
observable,
action,
computed,
runInAction,
toJS,
} from 'mobx';
import _ from 'lodash';
import sessionService from './services/session.service';
import { vote } from './services/votes.service';
import { toggleExplicit, toggleUserBlock, update } from '../newsfeed/NewsfeedService';
import { toggleExplicit } from '../newsfeed/NewsfeedService';
import logService from './services/log.service';
import channelService from '../channel/ChannelService';
import { revokeBoost, acceptBoost, rejectBoost } from '../boost/BoostService';
......@@ -284,4 +281,19 @@ export default class BaseModel {
const data = await toggleAllow(this.guid, !this.allow_comments);
this.allow_comments = !this.allow_comments;
}
isScheduled() {
return this.time_created * 1000 > Date.now();
}
static isScheduled(timeCreatedValue) {
let response = false;
if (timeCreatedValue) {
timeCreatedValue = new Date(timeCreatedValue);
response = timeCreatedValue.getTime() > Date.now();
}
return response;
}
}
\ No newline at end of file
......@@ -18,6 +18,7 @@ import BoostAction from './actions/BoostAction';
import { CommonStyle } from '../../styles/Common';
import featuresService from '../../common/services/features.service';
import BaseModel from '../../common/BaseModel';
@inject('user')
export default class Actions extends PureComponent {
......@@ -28,16 +29,17 @@ export default class Actions extends PureComponent {
render() {
const entity = this.props.entity;
const isOwner = this.props.user.me.guid === entity.owner_guid;
const hasCrypto = featuresService.has('crypto');
const isScheduled = BaseModel.isScheduled(entity.time_created * 1000);
return (
<View style={CommonStyle.flexContainer}>
{ entity && <View style={styles.container}>
<ThumbUpAction entity={entity} me={this.props.user.me}/>
<ThumbDownAction entity={entity} me={this.props.user.me}/>
{!isOwner && featuresService.has('crypto') && <WireAction owner={entity.ownerObj} navigation={this.props.navigation}/>}
{!isOwner && hasCrypto && <WireAction owner={entity.ownerObj} navigation={this.props.navigation}/>}
<CommentsAction entity={entity} navigation={this.props.navigation}/>
<RemindAction entity={entity} navigation={this.props.navigation}/>
{isOwner && featuresService.has('crypto') && <BoostAction entity={entity} navigation={this.props.navigation}/>}
{isOwner && hasCrypto && !isScheduled && <BoostAction entity={entity} navigation={this.props.navigation}/>}
</View> }
</View>
);
......
......@@ -110,8 +110,16 @@ export default class Activity extends Component {
{ overlay }
</View>
{ this.showActions() }
{ this.props.entity.isScheduled() &&
<View style={[{backgroundColor: '#ffecb3'}, CommonStyle.padding]}>
<Text style={[styles.scheduledText, CommonStyle.paddingLeft]}>
{`${i18n.t('activity.scheduled')} ${formatDate(this.props.entity.time_created)}.`}
</Text>
</View> }
{ this.props.isLast ? <View style={styles.activitySpacer}></View> : null}
{ !this.props.hideTabs && <ActivityMetrics entity={this.props.entity}/> }
{ !this.props.hideTabs &&
!this.props.entity.isScheduled() &&
<ActivityMetrics entity={this.props.entity}/> }
</View>
);
}
......@@ -314,5 +322,9 @@ const styles = StyleSheet.create({
},
blockedNoticeDesc: {
opacity: 0.7,
},
scheduledText: {
fontSize: 11,
color: '#000',
}
});