<commit_before>var app = angular.module('geoChat', ['ui.router', 'ngCookies', 'ngResource', 'ngSanitize','btford.socket-io', 'ngMap'])
    .value('nickName', username);
var username;

app.factory('User', ['$http', function( $http) {
    return {
        addUser: function (user) {
            console.log(user);
            return $http({
                method: 'POST',
                url: '/api/add',
                data:user
            })
                .then(function (resp) {
                    return resp;
                });
        },

        getUser: function(){
            return $http({
                method: 'GET',
                url: '/api/add'
            })
                .then(function (resp) {
                    console.log(resp);
                    return resp.data;
                });
        }
    }
}]);

function statusChangeCallback(response) {
    if (response.status === 'connected') {
        FB.api('/me', function (response) {
            username = response.name;
        });
    }
}

function checkLoginState() {
    FB.getLoginStatus(function(response) {
      statusChangeCallback(response);
    });
  }

window.fbAsyncInit = function () {
  FB.init({
    appId      : '438180583036734',
    status     : true,
    xfbml      : true,  // parse social plugins on this page
    version    : 'v2.2'
  });

  FB.getLoginStatus(function (response) {
    statusChangeCallback(response);
  });

  FB.Event.subscribe('auth.login', function (resp) {
    window.location = 'https://chat-geo.herokuapp.com/#/home';
  });
  FB.Event.subscribe('auth.logout', function (resp) {
    window.location = 'https://chat-geo.herokuapp.com/';
  });
};
// Load the SDK asynchronously
(function (d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) {
    return;
  }
  js = d.createElement(s);
  js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

app.controller('AuthCtrl', ["$scope", "User", function ($scope, User) {
    $scope.username = [];
    $scope.FBLogin = function(){
        FB.login(function(response) {
            if (response.authResponse) {
                console.log('Welcome! Fetching your information... ');
                FB.api('/me', function(response) {
                    console.log('Good to see you, ' + response.name + '.');
                    username = response.name;
                    var accessToken = FB.getAuthResponse().accessToken;
                    console.log(accessToken);
                    $scope.username.push({user:response.name});
                    console.log($scope.username);
                    User.addUser($scope.username)
                        .catch(function (error) {
                            console.log(error);
                        });

                    User.getUser()
                         .then(function (resData){
                             console.log(resData[1].user);
                             //username = resData[1].user;
                        })
                        .catch(function (error){
                            console.log(error);
                        });
                });
     // $scope.$apply();
            } else {
                console.log('User cancelled login or did not fully authorize.');
            }
        }, {scope: ''});
    };
}]);


app.controller('SocketCtrl', function ($log, $scope, chatSocket, messageFormatter, nickName, $http) {
    $interval(function () {
       console.log('userName: ',username);
   }, 1000);
    
    $scope.newMessages = [];
    $scope.nickName = username;
    $scope.messageLog = 'Ready to chat!';

    $scope.FBLogout = function(){
        FB.logout(function(response) {
            console.log("You are logged out");
        });
    };
<commit_msg>working on styling<commit_after>var app = angular.module('geoChat', ['ui.router', 'ngCookies', 'ngResource', 'ngSanitize','btford.socket-io', 'ngMap'])
    .value('nickName', username);
var username;

app.factory('User', ['$http', function( $http) {
    return {
        addUser: function (user) {
            console.log(user);
            return $http({
                method: 'POST',
                url: '/api/add',
                data:user
            })
                .then(function (resp) {
                    return resp;
                });
        },

        getUser: function(){
            return $http({
                method: 'GET',
                url: '/api/add'
            })
                .then(function (resp) {
                    console.log(resp);
                    return resp.data;
                });
        }
    }
}]);

function statusChangeCallback(response) {
    if (response.status === 'connected') {
        FB.api('/me', function (response) {
            username = response.name;
        });
    }
}

function checkLoginState() {
    FB.getLoginStatus(function(response) {
      statusChangeCallback(response);
    });
  }

window.fbAsyncInit = function () {
  FB.init({
    appId      : '438180583036734',
    status     : true,
    xfbml      : true,  // parse social plugins on this page
    version    : 'v2.2'
  });

  FB.getLoginStatus(function (response) {
    statusChangeCallback(response);
  });

  FB.Event.subscribe('auth.login', function (resp) {
    window.location = 'https://chat-geo.herokuapp.com/#/home';
  });
  FB.Event.subscribe('auth.logout', function (resp) {
    window.location = 'https://chat-geo.herokuapp.com/';
  });
};
// Load the SDK asynchronously
(function (d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) {
    return;
  }
  js = d.createElement(s);
  js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

app.controller('AuthCtrl', ["$scope", "User", function ($scope, User) {
    $scope.username = [];
    $scope.FBLogin = function(){
        FB.login(function(response) {
            if (response.authResponse) {
                console.log('Welcome! Fetching your information... ');
                FB.api('/me', function(response) {
                    console.log('Good to see you, ' + response.name + '.');
                    username = response.name;
                    var accessToken = FB.getAuthResponse().accessToken;
                    console.log(accessToken);
                    $scope.username.push({user:response.name});
                    console.log($scope.username);
                    User.addUser($scope.username)
                        .catch(function (error) {
                            console.log(error);
                        });

                    User.getUser()
                         .then(function (resData){
                             console.log(resData[1].user);
                             //username = resData[1].user;
                        })
                        .catch(function (error){
                            console.log(error);
                        });
                });
     // $scope.$apply();
            } else {
                console.log('User cancelled login or did not fully authorize.');
            }
        }, {scope: ''});
    };
}]);


app.controller('SocketCtrl', function ($log, $scope, chatSocket, messageFormatter, nickName, $http) {
    
    $scope.newMessages = [];
    $scope.nickName = username;
    $scope.messageLog = 'Ready to chat!';

    $scope.FBLogout = function(){
        FB.logout(function(response) {
            console.log("You are logged out");
        });
    };

{'fraction_non_alphanumeric': 0.1507386586481893, 'fraction_numerical': 0.005752385932801673, 'mean_word_length': 1.6153846153846154, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '184114', 'n_tokens_mistral': 2217, 'n_tokens_neox': 2105, 'n_words': 390}