...
 
Commits (23)
......@@ -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",
......
......@@ -371,13 +371,13 @@ export default class CapturePoster extends Component {
Alert.alert(i18n.t('capture.pleaseTryAgain'));
return false;
}
if (
!attachment.hasAttachment &&
!text &&
(!this.props.capture.embed.meta || !this.props.capture.embed.meta.perma_url)
(!this.props.capture.embed.meta || !this.props.capture.embed.meta.url)
) {
Alert.alert(i18n.t('capture.nothingToPosts'));
Alert.alert(i18n.t('capture.nothingToPost'));
return false;
}
......
......@@ -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')}
/>
......
......@@ -330,4 +330,19 @@ export default class BaseModel {
return allowed;
}
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
......@@ -6,7 +6,6 @@ import React, {
import {
Text,
View,
} from 'react-native';
import colors from '../../styles/Colors';
......@@ -128,7 +127,7 @@ export default class Tags extends PureComponent {
* Navigate to discovery
*/
navToDiscovery = (q) => {
this.props.navigation.navigate('Discovery', {q});
this.props.navigation.navigate('Discovery', {query : q});
}
/**
......
......@@ -32,16 +32,14 @@ import DiscoveryTile from './DiscoveryTile';
import DiscoveryUser from './DiscoveryUser';
import Activity from '../newsfeed/activity/Activity';
import SearchView from '../common/components/SearchView';
import CenteredLoading from '../common/components/CenteredLoading';
import { CommonStyle as CS } from '../styles/Common';
import { ComponentsStyle } from '../styles/Components';
import colors from '../styles/Colors';
import BlogCard from '../blogs/BlogCard';
import stores from '../../AppStores';
import CaptureFab from '../capture/CaptureFab';
import { MINDS_CDN_URI, GOOGLE_PLAY_STORE } from '../config/Config';
import { GOOGLE_PLAY_STORE } from '../config/Config';
import ErrorLoading from '../common/components/ErrorLoading';
import TagsSubBar from '../newsfeed/topbar/TagsSubBar';
import GroupsListItem from '../groups/GroupsListItem'
import DiscoveryFilters from './NewsfeedFilters';
import ErrorBoundary from '../common/components/ErrorBoundary';
......@@ -49,8 +47,6 @@ import testID from '../common/helpers/testID';
import i18n from '../common/services/i18n.service';
import { FLAG_VIEW } from '../common/Permissions';
const isIos = Platform.OS === 'ios';
/**
* Discovery screen
*/
......@@ -111,6 +107,11 @@ export default class DiscoveryScreen extends Component {
this.disposeEnter = this.props.navigation.addListener('didFocus', (s) => {
setTimeout(() => {
this.setState({active: true});
const params = this.props.navigation.state.params;
if (params && params.query) {
this.setQ(params.query);
params.query = null; //clean query
}
}, 50);
});
......
......@@ -268,6 +268,7 @@ export default class ActivityModel extends BaseModel {
this.message = message
this.edited = 1;
}
}
/**
......
......@@ -58,7 +58,7 @@ export default class NewsfeedScreen extends Component {
/**
* Load data on mount
*/
componentWillMount() {
componentDidMount() {
this.loadFeed();
// this.props.newsfeed.loadBoosts();
......
......@@ -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>
);
......
......@@ -32,6 +32,7 @@ import { CommonStyle } from '../../styles/Common';
import Pinned from '../../common/components/Pinned';
import blockListService from '../../common/services/block-list.service';
import i18n from '../../common/services/i18n.service';
import ActivityModel from '../ActivityModel';
/**
* Activity
......@@ -69,7 +70,7 @@ export default class Activity extends Component {
* Render
*/
render() {
const entity = this.props.entity;
const entity = ActivityModel.checkOrCreate(this.props.entity);
const hasText = !!entity.text;
const lock = (entity.paywall && entity.paywall !== '0')? <Lock entity={entity} navigation={this.props.navigation}/> : null;
......@@ -109,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>
);
}
......@@ -313,5 +322,9 @@ const styles = StyleSheet.create({
},
blockedNoticeDesc: {
opacity: 0.7,
},
scheduledText: {
fontSize: 11,
color: '#000',
}
});
......@@ -154,6 +154,9 @@ class NotificationsStore {
this.list.setList(feed, refresh);
this.persist();
}
} catch (err) {
const myError = new Error(`loadList Error: ${err}.`)
logService.exception('[NotificationStore]', myError);
} finally {
this.loading = false;
}
......