<commit_before>'use strict';
const electron = require('electron');
const { app } = require('electron');

const ConfigUtil = require(__dirname + '/../../utils/config-util.js');

class BadgeSettings {
	constructor(messageCount, mainWindow) {
		this.messageCount = messageCount;
		this.mainWindow = mainWindow;
	}

	showBadgeCount(messageCount, mainWindow) {
		if (process.platform === 'darwin') {
			app.setBadgeCount(messageCount);
		}
		if (process.platform === 'win32') {
			if (!mainWindow.isFocused()) {
				mainWindow.flashFrame(true);
			}
			if (messageCount === 0) {
				mainWindow.setOverlayIcon(null, '');
			} else {
				mainWindow.webContents.send('render-taskbar-icon', messageCount);
			}
		}
	}

	hideBadgeCount(mainWindow) {
		if (process.platform === 'darwin') {
			app.setBadgeCount(0);
		}
		if (process.platform === 'win32') {
			mainWindow.setOverlayIcon(null, '');
		}
	}

	updateBadge(badgeCount, mainWindow) {
		if (ConfigUtil.getConfigItem('badgeOption')) {
			this.showBadgeCount(badgeCount, mainWindow);
		} else {
			this.hideBadgeCount(mainWindow);
		}
	}

	updateTaskbarIcon(data, text, mainWindow) {
		const img = electron.nativeImage.createFromDataURL(data);
		mainWindow.setOverlayIcon(img, text);
	}
}

module.exports = new BadgeSettings();
<commit_msg>Show badge on app load by default<commit_after>'use strict';
const electron = require('electron');
const { app } = require('electron');

const ConfigUtil = require(__dirname + '/../../utils/config-util.js');

class BadgeSettings {
	constructor(messageCount, mainWindow) {
		this.messageCount = messageCount;
		this.mainWindow = mainWindow;
	}

	showBadgeCount(messageCount, mainWindow) {
		if (process.platform === 'darwin') {
			app.setBadgeCount(messageCount);
		}
		if (process.platform === 'win32') {
			if (!mainWindow.isFocused()) {
				mainWindow.flashFrame(true);
			}
			if (messageCount === 0) {
				mainWindow.setOverlayIcon(null, '');
			} else {
				mainWindow.webContents.send('render-taskbar-icon', messageCount);
			}
		}
	}

	hideBadgeCount(mainWindow) {
		if (process.platform === 'darwin') {
			app.setBadgeCount(0);
		}
		if (process.platform === 'win32') {
			mainWindow.setOverlayIcon(null, '');
		}
	}

	updateBadge(badgeCount, mainWindow) {
		if (ConfigUtil.getConfigItem('badgeOption', true)) {
			this.showBadgeCount(badgeCount, mainWindow);
		} else {
			this.hideBadgeCount(mainWindow);
		}
	}

	updateTaskbarIcon(data, text, mainWindow) {
		const img = electron.nativeImage.createFromDataURL(data);
		mainWindow.setOverlayIcon(img, text);
	}
}

module.exports = new BadgeSettings();

{'fraction_non_alphanumeric': 0.1535796766743649, 'fraction_numerical': 0.004618937644341801, 'mean_word_length': 4.414583333333334, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2396471', 'n_tokens_mistral': 972, 'n_tokens_neox': 870, 'n_words': 141}