diff --git a/assets/js/app.js b/assets/js/app.js index 8f0dc80..3d49b12 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -67,10 +67,6 @@ function app_install() { function app_init() { show_welcome_screen(); - window.appdb = load_database(); - window.current_file = ""; - window.is_dirty = false; - populate_settings(); wire_event_handlers(); } @@ -109,6 +105,44 @@ function populate_settings() { } function wire_global_events() { + + $("body").on("click", "#install-asset-update-button", function(e) { + e.preventDefault(); + + log.log_debug( + "verbose", + { + "event_level": "verbose", + "event_category": "user-action", + "event_action": "button-click", + "event_label": "install-asset-update-button", + "event_value": "" + }, + store.get("settings.opt_in_debug") + ); + + + ipcRenderer.send("update-asset-install", files_to_update); + }); + + $("body").on("click", "#dismiss-asset-update-button", function(e) { + e.preventDefault(); + + log.log_debug( + "verbose", + { + "event_level": "verbose", + "event_category": "user-action", + "event_action": "button-click", + "event_label": "dismiss-asset-update-button", + "event_value": "" + }, + store.get("settings.opt_in_debug") + ); + + show_welcome_screen(); + }); + $('#settings-modal').on('show.bs.modal', function (e) { log.log_debug( "verbose", @@ -762,42 +796,6 @@ function wire_event_handlers() { $("#generic-alert").hide(); }); - $("body").on("click", "#install-asset-update-button", function(e) { - e.preventDefault(); - - log.log_debug( - "verbose", - { - "event_level": "verbose", - "event_category": "user-action", - "event_action": "button-click", - "event_label": "install-asset-update-button", - "event_value": "" - }, - store.get("settings.opt_in_debug") - ); - - - ipcRenderer.send("update-asset-install", files_to_update); - }); - - $("body").on("click", "#dismiss-asset-update-button", function(e) { - e.preventDefault(); - - log.log_debug( - "verbose", - { - "event_level": "verbose", - "event_category": "user-action", - "event_action": "button-click", - "event_label": "dismiss-asset-update-button", - "event_value": "" - }, - store.get("settings.opt_in_debug") - ); - - show_welcome_screen(); - }); $("body").on("click", "#install-update-button", function(e) { e.preventDefault(); @@ -876,6 +874,10 @@ function show_setup_screen() { } function show_welcome_screen() { + window.appdb = load_database(); + window.current_file = ""; + window.is_dirty = false; + show_screen('welcome-screen'); } @@ -2206,7 +2208,8 @@ ipcRenderer.on('end-asset-progress', (event, arg) => { if (arg.code != 0) { console.error(arg.msg); } else { - show_welcome_screen(); + app_init(); + //show_welcome_screen(); } }); diff --git a/assets/js/modules/setup.js b/assets/js/modules/setup.js new file mode 100644 index 0000000..b1b5724 --- /dev/null +++ b/assets/js/modules/setup.js @@ -0,0 +1,31 @@ +'use strict'; + +const path = require('path'); +const {is} = require('electron-util'); +const https = require('https'); +const fs = require('fs'); +const async = require('async'); +const axios = require('axios').default; +const now = require('performance-now'); + +const Store = require('electron-store'); +const store = new Store(); + +const exec = require('./exec'); +const log = require('./logger'); + +let scripts_path = path.join(store.get("app.resources_path"), "setup"); + + +function check_app_install() {} +function check_assets() {} + +function install_assets() {} +function install_rportable() {} +function install_packages() {} + + + +module.exports = { + +}; diff --git a/assets/js/updater_assets.js b/assets/js/updater_assets.js index 4aecd29..5a3c5c8 100644 --- a/assets/js/updater_assets.js +++ b/assets/js/updater_assets.js @@ -73,10 +73,14 @@ function checkForUpdates() { updates.push({ "versions_key": "versions.database", "path": "database/db.min.json", "latest": latest_versions.database }); - if (updates.length > 0) + if (updates.length > 0) { win.getFocusedWindow().webContents.send('asset-update-new', updates); + return true; + } + return false; }).catch(function(error) { console.error(error); + return false; }); } diff --git a/assets/views/app-setup.html b/assets/views/app-setup.html new file mode 100644 index 0000000..e69de29 diff --git a/assets/views/app.html b/assets/views/app.html new file mode 100644 index 0000000..e69de29 diff --git a/assets/views/asset-update.html b/assets/views/asset-update.html new file mode 100644 index 0000000..e69de29 diff --git a/assets/views/data-consent.html b/assets/views/data-consent.html new file mode 100644 index 0000000..e69de29 diff --git a/index.js b/index.js index 1e1452a..dd8aa99 100644 --- a/index.js +++ b/index.js @@ -20,6 +20,9 @@ const cla = require('./assets/js/cla'); const log = require('./assets/js/logger'); const { v4: uuidv4 } = require('uuid'); +// const setup = require('./assets/js/setup'); + const updater_assets = require('./assets/js/updater_assets'); + unhandled({ reportButton: error => { log.log_debug( @@ -146,6 +149,12 @@ app.on('activate', async () => { Menu.setApplicationMenu(menu); mainWindow = await createMainWindow(); + + // console.log('forced install', cla.options.forceInstall); + // console.log('setup install', setup.check_installation(false)); + console.log('asset update', updater_assets.checkForUpdates()); + + log.log_debug( "verbose", { diff --git a/package.json b/package.json index 559e1fc..cbec4f1 100644 --- a/package.json +++ b/package.json @@ -89,10 +89,6 @@ } ] }, - "nsis": { - "oneClick": false, - "perMachine": true - }, "mac": { "category": "public.app-category.education", "darkModeSupport": false,