<commit_before>import {ChangeDetectorRef, Component} from '@angular/core';
import {SettingsService} from '../../core/settings/settings-service';

const ipcRenderer = require('electron').ipcRenderer;


@Component({
    moduleId: module.id,
    selector: 'taskbar-update',
    templateUrl: './taskbar-update.html'
})
/**
 * @author <NAME>
 */
export class TaskbarUpdateComponent {

    public version: string;
    public progressPercent: number = -1;
    public downloadComplete: boolean = false;
    public downloadInterrupted: boolean = false;
    public downloadError: boolean = false;

    private errorTimeout: any = undefined;


    constructor(private settingsService: SettingsService,
        changeDetectorRef: ChangeDetectorRef) {

        ipcRenderer.on('downloadProgress', (event: any, downloadInfo: any) => {
            this.progressPercent = Math.round(downloadInfo.progressPercent);
            this.version = downloadInfo.version;
            if (this.progressPercent === 100) this.waitForError();
            changeDetectorRef.detectChanges();
        });

        ipcRenderer.on('updateDownloaded', () => {
            this.stopWaitingForError();
            this.downloadComplete = true;
            changeDetectorRef.detectChanges();
        });

        ipcRenderer.on('downloadInterrupted', () => {
            if (this.progressPercent > -1) {
                this.stopWaitingForError();
                this.downloadInterrupted = true;
                changeDetectorRef.detectChanges();
            }
        });
    }


    public isAutoUpdateActive = () => this.settingsService.isAutoUpdateActive();


    public waitForError() {

        this.errorTimeout = setTimeout(() => {
            this.downloadError = true;
        }, 5000);
    }


    private stopWaitingForError() {

        if (this.errorTimeout) clearTimeout(this.errorTimeout);
        this.errorTimeout = undefined;
    }
}<commit_msg>call detectChanges when setting error state<commit_after>import {ChangeDetectorRef, Component} from '@angular/core';
import {SettingsService} from '../../core/settings/settings-service';

const ipcRenderer = require('electron').ipcRenderer;


@Component({
    moduleId: module.id,
    selector: 'taskbar-update',
    templateUrl: './taskbar-update.html'
})
/**
 * @author <NAME>
 */
export class TaskbarUpdateComponent {

    public version: string;
    public progressPercent: number = -1;
    public downloadComplete: boolean = false;
    public downloadInterrupted: boolean = false;
    public downloadError: boolean = false;

    private errorTimeout: any = undefined;


    constructor(private settingsService: SettingsService, changeDetectorRef: ChangeDetectorRef) {

        ipcRenderer.on('downloadProgress', (event: any, downloadInfo: any) => {
            this.progressPercent = Math.round(downloadInfo.progressPercent);
            this.version = downloadInfo.version;
            if (this.progressPercent === 100) this.waitForError(changeDetectorRef);
            changeDetectorRef.detectChanges();
        });

        ipcRenderer.on('updateDownloaded', () => {
            this.stopWaitingForError();
            this.downloadComplete = true;
            changeDetectorRef.detectChanges();
        });

        ipcRenderer.on('downloadInterrupted', () => {
            if (this.progressPercent > -1) {
                this.stopWaitingForError();
                this.downloadInterrupted = true;
                changeDetectorRef.detectChanges();
            }
        });
    }


    public isAutoUpdateActive = () => this.settingsService.isAutoUpdateActive();


    public waitForError(changeDetectorRef: ChangeDetectorRef) {

        this.errorTimeout = setTimeout(() => {
            this.downloadError = true;
            changeDetectorRef.detectChanges();
        }, 5000);
    }


    private stopWaitingForError() {

        if (this.errorTimeout) clearTimeout(this.errorTimeout);
        this.errorTimeout = undefined;
    }
}
{'fraction_non_alphanumeric': 0.11550075490689482, 'fraction_numerical': 0.004529441368897836, 'mean_word_length': 2.725398313027179, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2488144', 'n_tokens_mistral': 1058, 'n_tokens_neox': 1012, 'n_words': 199}