diff --git a/.gitignore b/.gitignore index 492607686..eb8a3413d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .vscode/ -node_modules/ \ No newline at end of file +node_modules/ +dist/ +release/ \ No newline at end of file diff --git a/main.js b/main.js index 76cde9e41..2110753c8 100644 --- a/main.js +++ b/main.js @@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true }); var electron_1 = require("electron"); var path = require("path"); var url = require("url"); -var constants_1 = require("./src/app/core/constants"); // Logging needs to be imported in main.ts also. Otherwise it just doesn't work anywhere else. // See post by megahertz: https://github.com/megahertz/electron-log/issues/60 // "You need to import electron-log in the main process. Without it, electron-log doesn't works in a renderer process." @@ -48,12 +47,9 @@ function createWindow() { // when you should delete the corresponding element. win = null; }); - // 'ready-to-show' doesn't fire on Windows. See: https://github.com/electron/electron/issues/7779 - // win.on('ready-to-show', function () { - // win.show(); - // win.focus(); - // }); - win.webContents.on('dom-ready', function () { + // 'ready-to-show' doesn't fire on Windows in dev mode. In prod it seems to work. + // See: https://github.com/electron/electron/issues/7779 + win.on('ready-to-show', function () { win.show(); win.focus(); }); @@ -67,14 +63,14 @@ function createWindow() { }); } try { - electron_log_1.default.info("+++ Starting " + constants_1.Constants.applicationName + " (" + constants_1.Constants.applicationVersion + ") +++"); + electron_log_1.default.info("+++ Starting +++"); // This method will be called when Electron has finished // initialization and is ready to create browser windows. // Some APIs can only be used after this event occurs. electron_1.app.on('ready', createWindow); // Quit when all windows are closed. electron_1.app.on('window-all-closed', function () { - electron_log_1.default.info("+++ Stopping " + constants_1.Constants.applicationName + " (" + constants_1.Constants.applicationVersion + ") +++"); + electron_log_1.default.info("+++ Stopping +++"); // On OS X it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (process.platform !== 'darwin') { diff --git a/main.js.map b/main.js.map index 4d7c16c1e..36d8f15a3 100644 --- a/main.js.map +++ b/main.js.map @@ -1 +1 @@ -{"version":3,"file":"main.js","sourceRoot":"","sources":["main.ts"],"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QAC9D,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE;YACjC,cAAG,CAAC,IAAI,EAAE,CAAC;SACZ;IACH,CAAC,CAAC,CAAC;IAEH,cAAG,CAAC,EAAE,CAAC,UAAU,EAAE;QACjB,gEAAgE;QAChE,4DAA4D;QAC5D,IAAI,GAAG,KAAK,IAAI,EAAE;YAChB,YAAY,EAAE,CAAC;SAChB;IACH,CAAC,CAAC,CAAC;CAEJ;AAAC,OAAO,CAAC,EAAE;IACV,cAAc;IACd,WAAW;CACZ"} \ No newline at end of file diff --git a/main.ts b/main.ts index 96f34757e..4467b0e6d 100644 --- a/main.ts +++ b/main.ts @@ -1,7 +1,6 @@ import { app, BrowserWindow, screen } from 'electron'; import * as path from 'path'; import * as url from 'url'; -import { Constants } from './src/app/core/constants'; // Logging needs to be imported in main.ts also. Otherwise it just doesn't work anywhere else. // See post by megahertz: https://github.com/megahertz/electron-log/issues/60 @@ -54,12 +53,9 @@ function createWindow() { win = null; }); - // 'ready-to-show' doesn't fire on Windows. See: https://github.com/electron/electron/issues/7779 - // win.on('ready-to-show', function () { - // win.show(); - // win.focus(); - // }); - win.webContents.on('dom-ready', function () { + // 'ready-to-show' doesn't fire on Windows in dev mode. In prod it seems to work. + // See: https://github.com/electron/electron/issues/7779 + win.on('ready-to-show', function () { win.show(); win.focus(); }); @@ -75,7 +71,7 @@ function createWindow() { } try { - log.info(`+++ Starting ${Constants.applicationName} (${Constants.applicationVersion}) +++`); + log.info(`+++ Starting +++`); // This method will be called when Electron has finished // initialization and is ready to create browser windows. @@ -84,7 +80,7 @@ try { // Quit when all windows are closed. app.on('window-all-closed', () => { - log.info(`+++ Stopping ${Constants.applicationName} (${Constants.applicationVersion}) +++`); + log.info(`+++ Stopping +++`); // On OS X it is common for applications and their menu bar // to stay active until the user quits explicitly with Cmd + Q if (process.platform !== 'darwin') { diff --git a/src/app/components/main/main.component.ts b/src/app/components/main/main.component.ts index 04c40f8bb..ae92bf8cf 100644 --- a/src/app/components/main/main.component.ts +++ b/src/app/components/main/main.component.ts @@ -1,6 +1,8 @@ import { Component, OnInit } from '@angular/core'; import { CollectionService } from '../../services/collection.service'; import { Subscription } from "rxjs"; +import log from 'electron-log'; +import { Constants } from '../../core/constants'; @Component({ selector: 'main-page', @@ -13,6 +15,7 @@ export class MainComponent implements OnInit { constructor(private collectionService: CollectionService) { this.subscription = collectionService.storageDirectoryInitialized$.subscribe((hasCollections) => this.hasCollections = hasCollections); this.hasCollections = collectionService.hasCollections; + log.info(`+++ Showing ${Constants.applicationName} (${Constants.applicationVersion}) main page +++`); } public hasCollections: boolean; diff --git a/src/app/components/notes/notes.component.ts b/src/app/components/notes/notes.component.ts index ad5fdc4d7..cfd28060a 100644 --- a/src/app/components/notes/notes.component.ts +++ b/src/app/components/notes/notes.component.ts @@ -10,7 +10,7 @@ import log from 'electron-log'; }) export class NotesComponent implements OnInit { constructor(private collectionService: CollectionService) { - log.info("Showing main screen"); + log.info("Showing notes page"); } public allNotesCount: number = 0; diff --git a/src/app/components/welcome/welcome.component.ts b/src/app/components/welcome/welcome.component.ts index ad1dea102..eb602ab7e 100644 --- a/src/app/components/welcome/welcome.component.ts +++ b/src/app/components/welcome/welcome.component.ts @@ -16,7 +16,7 @@ import { OperationResult } from '../../services/operationResult'; export class WelcomeComponent implements OnInit { constructor(private translate: TranslateService, private collectionService: CollectionService, private dialog: MatDialog, private zone: NgZone) { - log.info("Showing welcome screen"); + log.info("Showing welcome page"); } public applicationName: string = Constants.applicationName.toUpperCase(); diff --git a/src/app/core/constants.ts b/src/app/core/constants.ts index 2c068e7b8..c48b9caff 100644 --- a/src/app/core/constants.ts +++ b/src/app/core/constants.ts @@ -1,6 +1,6 @@ export class Constants { - static readonly applicationName: string = "Knowte"; - static readonly applicationVersion: any = require("../../../package.json").version; + static readonly applicationName: string = require("../../../package.json").name; + static readonly applicationVersion: string = require("../../../package.json").version; static readonly applicationCopyright: string = "Copyright Digimezzo Ⓒ 2013 - 2018"; static readonly donateUrl = "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=MQALEWTEZ7HX8"; static readonly websiteUrl = "https://www.digimezzo.com";