<commit_before>// react
import React, { Component } from "react";

// react-native
import { View, WebView } from "react-native";

// config
import Config from "react-native-config";

import styles from "./styles";

const INITIAL_URI = `https://www.strava.com/oauth/authorize?client_id=${Config.CLIENT_ID}&response_type=code&redirect_uri=strava://localhost&scope=public`;

export default class Login extends Component {
  constructor(props) {
    super(props);
    this.state = {
      visible: true
    };
  }

  onShouldStartLoadWithRequest = url => {
    if (this.webView != null) {
      if (!url.startsWith("strava://localhost")) {
        this.setState(() => ({ visible: true }));
      } else {
        this.setState(() => ({ visible: false }));
      }
    }
    return true;
  };

  render() {
    const currentStyles = [styles.login];
    if (!this.state.visible) {
      currentStyles.push(styles.hide);
    }

    return (
      <View style={currentStyles}>
        <WebView
          ref={ref => {
            this.webView = ref;
          }}
          source={{ uri: INITIAL_URI }}
          onNavigationStateChange={event =>
            this.onShouldStartLoadWithRequest(event.url)}<commit_msg>warning fixed.<commit_after>// react
import React, { Component } from "react";

// react-native
import { View, WebView } from "react-native";

// config
import Config from "react-native-config";

import styles from "./styles";

const INITIAL_URI = `https://www.strava.com/oauth/authorize?client_id=${Config.CLIENT_ID}&response_type=code&redirect_uri=strava://localhost&scope=public`;

export default class Login extends Component {
  constructor(props) {
    super(props);
    this.state = {
      visible: true
    };
  }

  onShouldStartLoadWithRequest = url => {
    if (this.webView !== null) {
      if (!url.startsWith("strava://localhost")) {
        this.setState(() => ({ visible: true }));
      } else {
        this.setState(() => ({ visible: false }));
      }
    }
    return true;
  };

  render() {
    const currentStyles = [styles.login];
    if (!this.state.visible) {
      currentStyles.push(styles.hide);
    }

    return (
      <View style={currentStyles}>
        <WebView
          ref={ref => {
            this.webView = ref;
          }}
          source={{ uri: INITIAL_URI }}
          onNavigationStateChange={event =>
            this.onShouldStartLoadWithRequest(event.url)}
{'fraction_non_alphanumeric': 0.14971050454921422, 'fraction_numerical': 0.0, 'mean_word_length': 2.6596066565809378, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, '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': '6323584', 'n_tokens_mistral': 718, 'n_tokens_neox': 737, 'n_words': 142}