<commit_before>import React, { Component } from 'react'
import {
    StyleSheet,
    View,
    ListView,
    ActivityIndicatorIOS,
} from 'react-native'

var MnmPublicadasRow = require('./MnmPublicadasRow');
var screen = require('Dimensions').get('window');
var moment = require('moment');
var ThumborURLBuilder = require('thumbor-url-builder');

import { THUMBOR_KEY, THUMBOR_URL} from './ThumborConfig'


class MnmPublicadas extends Component {
    constructor(props) {
        super(props);
        var dataSource = new ListView.DataSource({
            rowHasChanged: (r1, r2) => r1.id !== r2.id
        });
        this.state = {
            dataSource: dataSource.cloneWithRows([]),
            published: []
        };
        this._getPublicadas();
    }

    _getPublicadas() {
        var url = 'https://www.meneame.net/api/list';
        if (this.props.section === 'Nuevas') {
            url = url + '/?status=queued';
        } else if (this.props.section === 'Destacadas') {
            url = url + '/?active';
        } else if (this.props.section === 'Populares') {
            url = url + '/?popular';
        } else if (this.props.section === 'Más visitadas') {
            url = url + '/?top_visited';
        }
        fetch(url)
        .then(response => response.json())
        .then(response => {
            var thumborURL = new ThumborURLBuilder(THUMBOR_KEY, THUMBOR_URL);
            var entries = response.objects.map((entry) => {
                entry.dateFromNow = moment.unix(entry.date).fromNow();
                if (entry.thumb) {
                    var imagePath = entry.thumb.substr(8, entry.thumb.length);
                    entry.mediaPublished = thumborURL.setImagePath(imagePath).resize(screen.width * screen.scale, 310).smartCrop(true).buildUrl();
                }
                return entry;
            });
            this.setState({
                dataSource: this.state.dataSource.cloneWithRows(entries),
                published: entries
            });
        });
    }

    renderRow(rowData) {
        return (
            <MnmPublicadasRow entry={rowData} navigator={this.props.navigator} />
        );
    }

    _renderList() {
        if (this.state.published.length > 0) {
            return <ListView style={styles.list}
                        dataSource={this.state.dataSource}
                        renderRow={this.renderRow.bind(this)}
                        automaticallyAdjustContentInsets={false}
                    />;
        } else {
          return (
            <ActivityIndicatorIOS
              style={styles.centering}
              animating={true}
              color="#262626"
              size="large" />
          );
        }
    }

    render() {
        return (
            <View style={styles.container}>
                {this._renderList()}
            </View>
        );
    }
}

var styles = StyleSheet.create({
    centering: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
    },
    container: {
        flex: 1,
        backgroundColor: '#FAFAFA',
    },
    list: {
        flex: 1,
        backgroundColor: '#FAFAFA',
    }
});

module.exports = MnmPublicadas;
<commit_msg>Dates in spanish in Android<commit_after>import React, { Component } from 'react'
import {
    StyleSheet,
    View,
    ListView,
    ActivityIndicatorIOS,
} from 'react-native'

var MnmPublicadasRow = require('./MnmPublicadasRow');

var screen = require('Dimensions').get('window');

var moment = require('moment');
require('moment/locale/es');
moment.locale('es');

var ThumborURLBuilder = require('thumbor-url-builder');
import { THUMBOR_KEY, THUMBOR_URL} from './ThumborConfig'


class MnmPublicadas extends Component {
    constructor(props) {
        super(props);
        var dataSource = new ListView.DataSource({
            rowHasChanged: (r1, r2) => r1.id !== r2.id
        });
        this.state = {
            dataSource: dataSource.cloneWithRows([]),
            published: []
        };
        this._getPublicadas();
    }

    _getPublicadas() {
        var url = 'https://www.meneame.net/api/list';
        if (this.props.section === 'Nuevas') {
            url = url + '/?status=queued';
        } else if (this.props.section === 'Destacadas') {
            url = url + '/?active';
        } else if (this.props.section === 'Populares') {
            url = url + '/?popular';
        } else if (this.props.section === 'Más visitadas') {
            url = url + '/?top_visited';
        }
        fetch(url)
        .then(response => response.json())
        .then(response => {
            var thumborURL = new ThumborURLBuilder(THUMBOR_KEY, THUMBOR_URL);
            var entries = response.objects.map((entry) => {
                entry.dateFromNow = moment.unix(entry.date).fromNow();
                if (entry.thumb) {
                    var imagePath = entry.thumb.substr(8, entry.thumb.length);
                    entry.mediaPublished = thumborURL.setImagePath(imagePath).resize(screen.width * screen.scale, 310).smartCrop(true).buildUrl();
                }
                return entry;
            });
            this.setState({
                dataSource: this.state.dataSource.cloneWithRows(entries),
                published: entries
            });
        });
    }

    renderRow(rowData) {
        return (
            <MnmPublicadasRow entry={rowData} navigator={this.props.navigator} />
        );
    }

    _renderList() {
        if (this.state.published.length > 0) {
            return <ListView style={styles.list}
                        dataSource={this.state.dataSource}
                        renderRow={this.renderRow.bind(this)}
                        automaticallyAdjustContentInsets={false}
                    />;
        } else {
          return (
            <ActivityIndicatorIOS
              style={styles.centering}
              animating={true}
              color="#262626"
              size="large" />
          );
        }
    }

    render() {
        return (
            <View style={styles.container}>
                {this._renderList()}
            </View>
        );
    }
}

var styles = StyleSheet.create({
    centering: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
    },
    container: {
        flex: 1,
        backgroundColor: '#FAFAFA',
    },
    list: {
        flex: 1,
        backgroundColor: '#FAFAFA',
    }
});

module.exports = MnmPublicadas;

{'fraction_non_alphanumeric': 0.1329328404189772, 'fraction_numerical': 0.005545286506469501, 'mean_word_length': 1.7350463352990733, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 23, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5680379', 'n_tokens_mistral': 1881, 'n_tokens_neox': 1836, 'n_words': 330}