<commit_before>import React, { Component } from 'react';
import { Button, Text, View } from 'react-native';

import { Header } from '../components';

class ActiveTrip extends Component {
  state = { id: 0, results: {} };

  constructor(props) {
    super(props);
  }

  componentWillMount() {
    this.fetchID();
  }

  fetchID = () => {
    fetch('http://localhost:8000/v1/keygen')
      .then(response => response.json())
      .then(responseJSON => {
        this.setState({ id: responseJSON.id });
      })
      .catch(error => {
        console.log('Failed to fetch response.', error);
      });
  };

  fetchResults = () => {
    fetch('http://localhost:8000/v1/results?id=' + this.state.id)
      .then(response => response.json())
      .then(responseJSON => {
        this.setState({ results: responseJSON });
      })
      .catch(error => {
        console.log('Failed to fetch response.', error);
      });
  };

  render() {
    return (
      <View>
        <Header>Active Trip</Header>
        <Text>
          {this.state.id === 0 ? '' : this.state.id}
        </Text>
        <View style={styles.buttonStyle}>
          <Button
            onPress={this.fetchID}
            title="Generate ID"
            color={this.state.id == 0 ? '#007aff' : '#' + this.state.id}
          />
          <Button onPress={this.fetchResults} title="Done" color="#007aff" />
          <Text>
            {' '}{JSON.stringify(this.state.results)}{' '}
          </Text>
          <Text> Head on over to your mail app </Text>
        </View>
      </View>
    );
  }
}

const styles = {
  buttonStyle: {
    borderWidth: 1,
    padding: 5,
  },
};<commit_msg>basic clipboard implementation<commit_after>import React, { Component } from 'react';
import { Button, Clipboard, Text, View } from 'react-native';

import { Header } from '../components';

class ActiveTrip extends Component {
  state = { id: '', results: {} };

  constructor(props) {
    super(props);
  }

  componentWillMount() {
    this.fetchID();
  }

  copyID = id => {
    Clipboard.setString(id);
  };

  fetchID = () => {
    fetch('http://localhost:8000/v1/keygen')
      .then(response => response.json())
      .then(responseJSON => {
        this.setState({ id: responseJSON.id });
      })
      .catch(error => {
        console.log('Failed to fetch response.', error);
      });
  };

  fetchResults = () => {
    fetch('http://localhost:8000/v1/results?id=' + this.state.id)
      .then(response => response.json())
      .then(responseJSON => {
        this.setState({ results: responseJSON });
      })
      .catch(error => {
        console.log('Failed to fetch response.', error);
      });
  };

  render() {
    return (
      <View>
        <Header>Active Trip</Header>
        <Text>
          {this.state.id}
        </Text>
        <View style={styles.buttonStyle}>
          <Button
            onPress={this.copyID(this.state.id)}
            title="Copy"
            color="#007aff"
          />
          <Button onPress={this.fetchResults} title="Done" color="#007aff" />
          <Text>
            {' '}{JSON.stringify(this.state.results)}{' '}
          </Text>
          <Text> Head on over to your mail app </Text>
        </View>
      </View>
    );
  }
}

const styles = {
  buttonStyle: {
    borderWidth: 1,
    padding: 5,
  },
};
{'fraction_non_alphanumeric': 0.17326139088729017, 'fraction_numerical': 0.011690647482014389, 'mean_word_length': 2.0558608058608057, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 48, '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': '744128', 'n_tokens_mistral': 1055, 'n_tokens_neox': 1017, 'n_words': 201}