<commit_before>/**
 * 一简微博
 *
 * @author FantasyShao <<EMAIL>>
 */

'use strict';

// Module dependencies
var React = require('react-native');
var url = require('url');

var config = require('./app/config');
var api = require('./app/api');
var common = require('./app/common');
var HomeView = require('./app/Home');

var {
  AppRegistry,
  View,
  WebView
} = React;

var OAUTH_URL = [
  'https://api.weibo.com/oauth2/authorize',
  '?client_id=' + config.app_key,
  '&response_type=code',
  '&redirect_uri=' + config.redirect_uri
].join('');

var Yijian = React.createClass({

  getInitialState () {
    return {
      login: false
    }
  },

  render () {
    if (this.state.login) {
      return (
        <HomeView />
      );
    }

    return (
      <View style={{flex: 1, marginTop: 20 }}>
        <WebView
          ref={'webview'}
          url={OAUTH_URL}
          automaticallyAdjustContentInsets={false}
          onNavigationStateChange={this.onNavigationStateChange}
          startInLoadingState={true}
          scalesPageToFit={true} />
      </View>);
  },

  onNavigationStateChange (navState) {
    var urlObj = url.parse(navState.url, true);

    if (urlObj.pathname === url.parse(config.redirect_uri).pathname && navState.loading) {<commit_msg>use `const` in index.ios.js<commit_after>/**
 * 一简微博
 *
 * @author FantasyShao <<EMAIL>>
 */

// Module dependencies
const React = require('react-native');
const url = require('url');

const config = require('./app/config');
const api = require('./app/api');
const common = require('./app/common');
const HomeView = require('./app/Home');

const {
  AppRegistry,
  View,
  WebView
} = React;

const OAUTH_URL = [
  'https://api.weibo.com/oauth2/authorize',
  '?client_id=' + config.app_key,
  '&response_type=code',
  '&redirect_uri=' + config.redirect_uri
].join('');

const Yijian = React.createClass({

  getInitialState () {
    return {
      login: false
    }
  },

  render () {
    if (this.state.login) {
      return (
        <HomeView />
      );
    }

    return (
      <View style={{flex: 1, marginTop: 20 }}>
        <WebView
          ref={'webview'}
          url={OAUTH_URL}
          automaticallyAdjustContentInsets={false}
          onNavigationStateChange={this.onNavigationStateChange}
          startInLoadingState={true}
          scalesPageToFit={true} />
      </View>);
  },

  onNavigationStateChange (navState) {
    var urlObj = url.parse(navState.url, true);

    if (urlObj.pathname === url.parse(config.redirect_uri).pathname && navState.loading) {
{'fraction_non_alphanumeric': 0.16255385820603213, 'fraction_numerical': 0.003133568350959655, 'mean_word_length': 2.863842662632375, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 2, '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': '7166683', 'n_tokens_mistral': 850, 'n_tokens_neox': 837, 'n_words': 155}