<commit_before>import { app, BrowserWindow, Menu, shell, ipcMain } from 'electron';
import _ from 'lodash';
import * as authenticationHandler from './app/utils/authenticationHandler'
import loadEvents from './events'
import { config } from './config'
import { SPOTIFY } from './constants';

loadEvents(config, ipcMain);

let menu;
let template;
let mainWindow = null;

if (process.env.NODE_ENV === 'development') {
  require('electron-debug')(); // eslint-disable-line global-require
}

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') app.quit();
});

const installExtensions = async () => {
  if (process.env.NODE_ENV === 'development') {
    const installer = require('electron-devtools-installer'); // eslint-disable-line global-require

    const extensions = [
      'REACT_DEVELOPER_TOOLS',
      'REDUX_DEVTOOLS'
    ];
    const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
    for (const name of extensions) {
      try {
        await installer.default(installer[name], forceDownload);
      } catch (e) {} // eslint-disable-line
    }
  }
};

function loadApp(window){
  window.loadURL(`file://${__dirname}/app/app.html`);
  window.show();
}

function abortApp(window, error){
  console.log(error);
  alert(`Oops! Something went wrong. Error message: ${error}`);
  window.destroy();
}

app.on('ready', async () => {
  await installExtensions();

  mainWindow = new BrowserWindow({ width: 1024, height: 768, show: false, 'node-integration': false });
  mainWindow.userConfig = config;

  authenticationHandler.getStoredAuthData()
    .then((authenticationData) => {
      if (_.isEmpty(authenticationData)){
        let spotifyUrl = 'https://accounts.spotify.com/authorize';
        let authUrl = `${spotifyUrl}?client_id=${SPOTIFY.CLIENT_ID}&scope=${SPOTIFY.SCOPES.join(' ')}&redirect_uri=${SPOTIFY.REDIRECT_URI}&response_type=code`;
        mainWindow.loadURL(authUrl);
        mainWindow.show();<commit_msg>Show window maximized by default.<commit_after>import { app, BrowserWindow, Menu, shell, ipcMain } from 'electron';
import _ from 'lodash';
import * as authenticationHandler from './app/utils/authenticationHandler'
import loadEvents from './events'
import { config } from './config'
import { SPOTIFY } from './constants';

loadEvents(config, ipcMain);

let menu;
let template;
let mainWindow = null;

if (process.env.NODE_ENV === 'development') {
  require('electron-debug')(); // eslint-disable-line global-require
}

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') app.quit();
});

const installExtensions = async () => {
  if (process.env.NODE_ENV === 'development') {
    const installer = require('electron-devtools-installer'); // eslint-disable-line global-require

    const extensions = [
      'REACT_DEVELOPER_TOOLS',
      'REDUX_DEVTOOLS'
    ];
    const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
    for (const name of extensions) {
      try {
        await installer.default(installer[name], forceDownload);
      } catch (e) {} // eslint-disable-line
    }
  }
};

function loadApp(window){
  window.loadURL(`file://${__dirname}/app/app.html`);
  window.show();
}

function abortApp(window, error){
  console.log(error);
  alert(`Oops! Something went wrong. Error message: ${error}`);
  window.destroy();
}

app.on('ready', async () => {
  await installExtensions();

  mainWindow = new BrowserWindow({ width: 1024, height: 768, show: false, 'node-integration': false });
  mainWindow.userConfig = config;
  mainWindow.maximize();

  authenticationHandler.getStoredAuthData()
    .then((authenticationData) => {
      if (_.isEmpty(authenticationData)){
        let spotifyUrl = 'https://accounts.spotify.com/authorize';
        let authUrl = `${spotifyUrl}?client_id=${SPOTIFY.CLIENT_ID}&scope=${SPOTIFY.SCOPES.join(' ')}&redirect_uri=${SPOTIFY.REDIRECT_URI}&response_type=code`;
        mainWindow.loadURL(authUrl);
        mainWindow.show();
{'fraction_non_alphanumeric': 0.15893536121673005, 'fraction_numerical': 0.003548795944233207, 'mean_word_length': 4.205804749340369, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3699262', 'n_tokens_mistral': 1265, 'n_tokens_neox': 1222, 'n_words': 252}