<commit_before>'use strict';
//
// code here adapted from https://www.npmjs.com/package/electron-notify
// made following changes:
// - place notification in corner of screen
// - notification color
// - notification flash/blink
// - custom design for symphony notification style
// - if screen added/removed or size change then close all notifications
//
const path = require('path');
const fs = require('fs');
const electron = require('electron');
const asyncMap = require('async.map');
const asyncMapSeries = require('async.mapseries');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const ipc = electron.ipcMain;
const { isMac, isNodeEnv } = require('../utils/misc');
const log = require('../log.js');
const logLevels = require('../enums/logLevels.js');
const i18n = require('../translation/i18n');
// maximum number of notifications that can be queued, after limit is
// reached then error func callback will be invoked.
const MAX_QUEUE_SIZE = 30;

let AnimationQueue = require('./AnimationQueue.js');

// Array of windows with currently showing notifications
let activeNotifications = [];

// Recycle windows
let inactiveWindows = [];

// If we cannot show all notifications, queue them
let notificationQueue = [];

// To prevent executing mutliple animations at once
let animationQueue = new AnimationQueue();

// To prevent double-close notification window
let closedNotifications = {};

// Give each notification a unique id
let latestID = 0;

let nextInsertPos = {};
let externalDisplay;
// user selected display id for notification
let displayId;

let sandboxed = false;

let config = {
    // corner to put notifications
    // upper-right, upper-left, lower-right, lower-left
    startCorner: 'upper-right',
    width: 380,
    height: 100,
    borderRadius: 5,
    displayTime: 5000,
    animationSteps: 5,
    animationStepMs: 5,
    animateInParallel: true,
    pathToModule: '',
    logging: true,
    defaultStyleContainer: {
        display: 'flex',
        justifyContent: 'center',
        backgroundColor: '#f0f0f0',
        overflow: 'hidden',
        position: 'relative',
        lineHeight: '15px',
        boxSizing: 'border-box'
    },
    defaultStyleHeader: {
        width: 245,
        minWidth: 230,
        margin: 'auto',
        display: 'flex',
        flexDirection: 'column',
        alignItems: 'flex-start',
    },
    defaultStyleImageContainer: {
        alignItems: 'center',
        display: 'flex',
    },
    defaultStyleImage: {
        height: 43,
        borderRadius: 4,
        width: 43
    },
    defaultStyleClose: {
        width: 16,
        height: 80,
        display: 'flex',
        margin: 'auto',
        opacity: 0.54,
        fontSize: 12,
        color: '#CCC'
    },
    defaultStyleTitle: {
        fontFamily: 'sans-serif',
        fontSize: 14,
        fontWeight: 700,
        color: '#4a4a4a',
        overflow: 'hidden',
        display: '-webkit-box',
        webkitLineClamp: 1,
        webkitBoxOrient: 'vertical',
    },
    defaultStyleCompany: {
        fontFamily: 'sans-serif',
        fontSize: 11,
        color: '#adadad',
        overflow: 'hidden',
        filter: 'brightness(70%)',
        display: '-webkit-box',
        webkitLineClamp: 1,
        webkitBoxOrient: 'vertical',
    },
    defaultStyleText: {
        fontFamily: 'sans-serif',
        fontSize: 12,
        color: '#4a4a4a',
        marginTop: 5,
        overflow: 'hidden',
        display: '-webkit-box',
        webkitLineClamp: 3,
        webkitBoxOrient: 'vertical',
        cursor: 'default',
        textOverflow: 'ellipsis',
    },
    defaultStyleLogoContainer: {
        display: 'flex',
        alignItems: 'center',
    },
    defaultStyleLogo: {
        marginLeft: '5px',
        opacity: 0.6,
        width: '43px',
    },
    defaultWindow: {
        alwaysOnTop: true,
        skipTaskbar: true,
        resizable: false,
        show: false,
        frame: false,
        transparent: true,
        acceptFirstMouse: true,
        webPreferences: {
            preload: path.join(__dirname, 'electron-notify-preload.js'),
            sandbox: sandboxed,
            nodeIntegration: isNodeEnv,
            devTools: false
        }
    }
};

if (app.isReady()) {
    setup();
} else {
    app.on('ready', setup);<commit_msg>ELECTRON-903: fixing the notification text overflowing under user avatar (#548)<commit_after>'use strict';
//
// code here adapted from https://www.npmjs.com/package/electron-notify
// made following changes:
// - place notification in corner of screen
// - notification color
// - notification flash/blink
// - custom design for symphony notification style
// - if screen added/removed or size change then close all notifications
//
const path = require('path');
const fs = require('fs');
const electron = require('electron');
const asyncMap = require('async.map');
const asyncMapSeries = require('async.mapseries');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const ipc = electron.ipcMain;
const { isMac, isNodeEnv } = require('../utils/misc');
const log = require('../log.js');
const logLevels = require('../enums/logLevels.js');
const i18n = require('../translation/i18n');
// maximum number of notifications that can be queued, after limit is
// reached then error func callback will be invoked.
const MAX_QUEUE_SIZE = 30;

let AnimationQueue = require('./AnimationQueue.js');

// Array of windows with currently showing notifications
let activeNotifications = [];

// Recycle windows
let inactiveWindows = [];

// If we cannot show all notifications, queue them
let notificationQueue = [];

// To prevent executing mutliple animations at once
let animationQueue = new AnimationQueue();

// To prevent double-close notification window
let closedNotifications = {};

// Give each notification a unique id
let latestID = 0;

let nextInsertPos = {};
let externalDisplay;
// user selected display id for notification
let displayId;

let sandboxed = false;

let config = {
    // corner to put notifications
    // upper-right, upper-left, lower-right, lower-left
    startCorner: 'upper-right',
    width: 380,
    height: 100,
    borderRadius: 5,
    displayTime: 5000,
    animationSteps: 5,
    animationStepMs: 5,
    animateInParallel: true,
    pathToModule: '',
    logging: true,
    defaultStyleContainer: {
        display: 'flex',
        justifyContent: 'center',
        backgroundColor: '#f0f0f0',
        overflow: 'hidden',
        position: 'relative',
        lineHeight: '15px',
        boxSizing: 'border-box'
    },
    defaultStyleHeader: {
        width: 245,
        minWidth: 230,
        margin: 'auto',
        display: 'flex',
        flexDirection: 'column',
        alignItems: 'flex-start',
    },
    defaultStyleImageContainer: {
        alignItems: 'center',
        display: 'flex',
    },
    defaultStyleImage: {
        height: 43,
        borderRadius: 4,
        width: 43
    },
    defaultStyleClose: {
        width: 16,
        height: 80,
        display: 'flex',
        margin: 'auto',
        opacity: 0.54,
        fontSize: 12,
        color: '#CCC'
    },
    defaultStyleTitle: {
        fontFamily: 'sans-serif',
        fontSize: 14,
        fontWeight: 700,
        color: '#4a4a4a',
        overflow: 'hidden',
        display: '-webkit-box',
        webkitLineClamp: 1,
        webkitBoxOrient: 'vertical',
    },
    defaultStyleCompany: {
        fontFamily: 'sans-serif',
        fontSize: 11,
        color: '#adadad',
        overflow: 'hidden',
        filter: 'brightness(70%)',
        display: '-webkit-box',
        webkitLineClamp: 1,
        webkitBoxOrient: 'vertical',
    },
    defaultStyleText: {
        fontFamily: 'sans-serif',
        fontSize: 12,
        color: '#4a4a4a',
        marginTop: 5,
        overflow: 'hidden',
        display: '-webkit-box',
        webkitLineClamp: 3,
        webkitBoxOrient: 'vertical',
        cursor: 'default',
        textOverflow: 'ellipsis',
        width: '100%',
        overflowWrap: 'break-word',
    },
    defaultStyleLogoContainer: {
        display: 'flex',
        alignItems: 'center',
    },
    defaultStyleLogo: {
        marginLeft: '5px',
        opacity: 0.6,
        width: '43px',
    },
    defaultWindow: {
        alwaysOnTop: true,
        skipTaskbar: true,
        resizable: false,
        show: false,
        frame: false,
        transparent: true,
        acceptFirstMouse: true,
        webPreferences: {
            preload: path.join(__dirname, 'electron-notify-preload.js'),
            sandbox: sandboxed,
            nodeIntegration: isNodeEnv,
            devTools: false
        }
    }
};

if (app.isReady()) {
    setup();
} else {
    app.on('ready', setup);
{'fraction_non_alphanumeric': 0.12213479302086896, 'fraction_numerical': 0.017219751396966586, 'mean_word_length': 2.4446190102120973, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2333911', 'n_tokens_mistral': 2667, 'n_tokens_neox': 2494, 'n_words': 704}