Skip to content

Commit

Permalink
Finished asset update fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rer145 committed May 4, 2020
1 parent c455d6d commit f516374
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 46 deletions.
85 changes: 44 additions & 41 deletions assets/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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');
}

Expand Down Expand Up @@ -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();
}
});

Expand Down
31 changes: 31 additions & 0 deletions assets/js/modules/setup.js
Original file line number Diff line number Diff line change
@@ -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 = {

};
6 changes: 5 additions & 1 deletion assets/js/updater_assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});
}

Expand Down
Empty file added assets/views/app-setup.html
Empty file.
Empty file added assets/views/app.html
Empty file.
Empty file added assets/views/asset-update.html
Empty file.
Empty file added assets/views/data-consent.html
Empty file.
9 changes: 9 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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",
{
Expand Down
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@
}
]
},
"nsis": {
"oneClick": false,
"perMachine": true
},
"mac": {
"category": "public.app-category.education",
"darkModeSupport": false,
Expand Down

0 comments on commit f516374

Please sign in to comment.