<commit_before>/**
 * Author:  <NAME> http://github.com/0xor1
 */

library sandbox.purity.view;

import 'package:sandbox_purity/interface/sandbox_purity_interface.dart';
import 'package:controls_and_panels/controls_and_panels.dart' as cnp;
import 'package:purity/purity.dart';

class GoogleLoginView extends Consumer{

  dynamic get googleLogin => source;

  cnp.DivElement get html => _cmdLn.html;

  final cnp.CommandLine _cmdLn = new cnp.CommandLine()..fill();
  cnp.CommandLineInputBinder _binder;

  GoogleLoginView(src)
  : super(src){
    registerSandboxTranTypes();
    _binder = new cnp.CommandLineInputBinder(_cmdLn);
    _addCommandBindings();
    _hookUpEvents();
  }

  void _addCommandBindings(){
    _binder.addAll([
      new cnp.CommandLineBinding(
        'g-login',
        'logs in using google oauth 2',
        (cnp.CommandLine cmdLn, List<String> posArgs, Map<String, String> namArgs){
          googleLogin.login();
        }),
    ]);
  }

  void _hookUpEvents(){
    listen(googleLogin, OAuth2LoginUrlRedirection, (Event<OAuth2LoginUrlRedirection> event){
      cnp.window.open(event.data.url, 'google-login');
    });
    listen(googleLogin, OAuth2LoginTimeOut, (Event<OAuth2LoginTimeOut> event){
      _cmdLn.enterText('login attempt timed out, please try again.');
    });
    listen(googleLogin, OAuth2LoginComplete, (Event<OAuth2LoginComplete> event){
      _cmdLn.enterText('login success!!.');
    });
  }

}
<commit_msg>close login window<commit_after>/**
 * Author:  <NAME> http://github.com/0xor1
 */

library sandbox.purity.view;

import 'package:sandbox_purity/interface/sandbox_purity_interface.dart';
import 'package:controls_and_panels/controls_and_panels.dart' as cnp;
import 'package:purity/purity.dart';

class GoogleLoginView extends Consumer{

  dynamic get googleLogin => source;

  cnp.DivElement get html => _cmdLn.html;

  final cnp.CommandLine _cmdLn = new cnp.CommandLine()..fill();
  cnp.CommandLineInputBinder _binder;
  cnp.WindowBase _loginWindow;

  GoogleLoginView(src)
  : super(src){
    registerSandboxTranTypes();
    _binder = new cnp.CommandLineInputBinder(_cmdLn);
    _addCommandBindings();
    _hookUpEvents();
  }

  void _addCommandBindings(){
    _binder.addAll([
      new cnp.CommandLineBinding(
        'g-login',
        'logs in using google oauth 2',
        (cnp.CommandLine cmdLn, List<String> posArgs, Map<String, String> namArgs){
          googleLogin.login();
        }),
    ]);
  }

  void _hookUpEvents(){
    listen(googleLogin, OAuth2LoginUrlRedirection, (Event<OAuth2LoginUrlRedirection> event){
      _loginWindow = cnp.window.open(event.data.url, 'google-login');
    });
    listen(googleLogin, OAuth2LoginTimeOut, (Event<OAuth2LoginTimeOut> event){
      _cmdLn.enterText('login attempt timed out, please try again.');
      _loginWindow.close();
    });
    listen(googleLogin, OAuth2LoginComplete, (Event<OAuth2LoginComplete> event){
      _cmdLn.enterText('login success!!.');
      _loginWindow.close();
    });
  }

}

{'fraction_non_alphanumeric': 0.12570480928689884, 'fraction_numerical': 0.005970149253731343, 'mean_word_length': 4.009966777408638, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 19, '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': '2210859', 'n_tokens_mistral': 1026, 'n_tokens_neox': 1003, 'n_words': 179}