<commit_before>import { Location, Permissions } from 'expo';
import React, { Component } from 'react';
import { StatusBar, StyleSheet, Text, View } from 'react-native';

import { Compass } from './compass';
import { GEOLOCATION_OPTIONS } from '../config/config';
import PropTypes from 'prop-types';
import { Speedometer } from './speedometer';
import { Variables } from '../assets/styles/variables';
import { connect } from 'react-redux';
import { toggleSpeedMeasurement } from '../ducks/speed-measurement';

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: Variables.colors.primary
    }
});

class App extends Component {

    constructor(props) {
        super(props);
        this.state = {
            heading: 0,
            speed: 0,
            topSpeed: 0
        };

        this.updateSpeed = this.updateSpeed.bind(this);
    }

    componentWillMount() {
        Permissions.askAsync(Permissions.LOCATION).then(response => {
            const { status } = response;
            if (status === 'granted') Location.watchPositionAsync(GEOLOCATION_OPTIONS, this.updateSpeed);
        });
    }

    updateSpeed(response) {
        const { coords } = response;
        const { heading, speed } = coords;
        const { topSpeed } = this.state;

        this.setState({
            heading,
            speed,
            topSpeed: topSpeed < speed ? speed : topSpeed
        });
    }

    render() {
        const { speedMeasurement, toggleSpeedMeasurement } = this.props;
        const { speed, topSpeed, heading } = this.state;

        return (
            <View style={styles.container}>
                <StatusBar barStyle={'light-content'} />
                <Compass
                    style={{ flex: 1 }}
                    heading={heading}
                />
                <Speedometer
                    speed={speed}
                    speedMeasurement={speedMeasurement}
                    style={{ flex: 4 }}
                    toggleSpeedMeasurement={toggleSpeedMeasurement}
                    topSpeed={topSpeed}
                />
            </View>
        );
    }
}

App.propTypes = {
    geolocation: PropTypes.object,
    requestGeolocation: PropTypes.func,
    speedMeasurement: PropTypes.number,
    toggleSpeedMeasurement: PropTypes.func
};

export default connect(
    state => Object.assign({},
        state.speedMeasurementDuck
    ),
    Object.assign({}, {
        toggleSpeedMeasurement
    })
)(App);
<commit_msg>Added keepAwake to the main app screen;<commit_after>import { KeepAwake, Location, Permissions } from 'expo';
import React, { Component } from 'react';
import { StatusBar, StyleSheet, View } from 'react-native';

import { Compass } from './compass';
import { GEOLOCATION_OPTIONS } from '../config/config';
import PropTypes from 'prop-types';
import { Speedometer } from './speedometer';
import { Variables } from '../assets/styles/variables';
import { connect } from 'react-redux';
import { toggleSpeedMeasurement } from '../ducks/speed-measurement';

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: Variables.colors.primary
    }
});

class App extends Component {

    constructor(props) {
        super(props);
        this.state = {
            heading: 0,
            speed: 0,
            topSpeed: 0
        };

        this.updateSpeed = this.updateSpeed.bind(this);
    }

    componentWillMount() {
        Permissions.askAsync(Permissions.LOCATION).then(response => {
            const { status } = response;
            if (status === 'granted') Location.watchPositionAsync(GEOLOCATION_OPTIONS, this.updateSpeed);
        });
    }

    updateSpeed(response) {
        const { coords } = response;
        const { heading, speed } = coords;
        const { topSpeed } = this.state;

        this.setState({
            heading,
            speed,
            topSpeed: topSpeed < speed ? speed : topSpeed
        });
    }

    render() {
        const { speedMeasurement, toggleSpeedMeasurement } = this.props;
        const { speed, topSpeed, heading } = this.state;

        return (
            <View style={styles.container}>
                <StatusBar barStyle={'light-content'} />
                <KeepAwake />
                <Compass
                    style={{ flex: 1 }}
                    heading={heading}
                />
                <Speedometer
                    speed={speed}
                    speedMeasurement={speedMeasurement}
                    style={{ flex: 4 }}
                    toggleSpeedMeasurement={toggleSpeedMeasurement}
                    topSpeed={topSpeed}
                />
            </View>
        );
    }
}

App.propTypes = {
    geolocation: PropTypes.object,
    requestGeolocation: PropTypes.func,
    speedMeasurement: PropTypes.number,
    toggleSpeedMeasurement: PropTypes.func
};

export default connect(
    state => Object.assign({},
        state.speedMeasurementDuck
    ),
    Object.assign({}, {
        toggleSpeedMeasurement
    })
)(App);

{'fraction_non_alphanumeric': 0.11533162763235584, 'fraction_numerical': 0.002361739814997048, 'mean_word_length': 1.9546511627906977, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3059676', 'n_tokens_mistral': 1358, 'n_tokens_neox': 1327, 'n_words': 295}