diff --git a/changelog.txt b/changelog.txt index 0f98c44d6..95916c0df 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Change software licensing to LGPLv3 RPC - New commands verifyproofoffunds, generateproofoffunds UI - Add functionality to export transaction history +UI - Add a basic about dialog diaplying licensing information diff --git a/src/frontend/electron_vue/src/App.vue b/src/frontend/electron_vue/src/App.vue index ed8b12b12..efe39942b 100644 --- a/src/frontend/electron_vue/src/App.vue +++ b/src/frontend/electron_vue/src/App.vue @@ -32,6 +32,8 @@ export default { switch (window.location.hash.toLowerCase()) { case "#/debug": return false; + case "#/about": + return false; default: return true; } diff --git a/src/frontend/electron_vue/src/background.js b/src/frontend/electron_vue/src/background.js index 5e055324c..3bfdb83f1 100644 --- a/src/frontend/electron_vue/src/background.js +++ b/src/frontend/electron_vue/src/background.js @@ -24,6 +24,7 @@ import axios from "axios"; // be closed automatically when the JavaScript object is garbage collected. let winMain; let winDebug; +let winAbout; let libUnity = new LibUnity({ walletPath }); // Handle URI links (florin: florin://) @@ -112,6 +113,12 @@ function createMainWindow() { click() { createDebugWindow(); } + }, + { + label: "About", + click() { + createAboutWindow(); + } } ] } @@ -221,6 +228,64 @@ function createDebugWindow() { }); } +function createAboutWindow() { + if (winAbout) { + return winAbout.show(); + } + + let options = { + width: 600, + minWidth: 400, + height: 600, + minHeight: 400, + show: false, + parent: winMain, + title: "About Florin", + skipTaskBar: true, + autoHideMenuBar: true, + webPreferences: { + // Use pluginOptions.nodeIntegration, leave this alone + // See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info + nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION, + contextIsolation: false + } + }; + if (os.platform() === "linux") { + options = Object.assign({}, options, { + icon: path.join(__static, "icon.png") + }); + } + winAbout = new BrowserWindow(options); + + let url = process.env.WEBPACK_DEV_SERVER_URL ? `${process.env.WEBPACK_DEV_SERVER_URL}#/about` : `app://./index.html#/about`; + + if (process.env.WEBPACK_DEV_SERVER_URL) { + // Load the url of the dev server if in development mode + winAbout.loadURL(url); + //if (!process.env.IS_TEST) win.webContents.openDevTools(); + } else { + createProtocol("app"); + // Load the index.html when not in development + winAbout.loadURL(url); + } + + winAbout.on("ready-to-show", () => { + winAbout.show(); + }); + + winAbout.on("close", event => { + console.log("winAbout.on:close"); + if (libUnity === null || libUnity.isTerminated) return; + event.preventDefault(); + winAbout.hide(); + }); + + winAbout.on("closed", () => { + console.log("winAbout.on:closed"); + winAbout = null; + }); +} + app.on("will-quit", event => { console.log("app.on:will-quit"); if (libUnity === null || libUnity.isTerminated) return; diff --git a/src/frontend/electron_vue/src/router/index.js b/src/frontend/electron_vue/src/router/index.js index 8d794f14f..f7f2ad4af 100644 --- a/src/frontend/electron_vue/src/router/index.js +++ b/src/frontend/electron_vue/src/router/index.js @@ -94,6 +94,11 @@ const routes = [ path: "/debug", name: "debug", component: () => import(/* webpackChunkName: "debug-dialog" */ "../views/DebugDialog") + }, + { + path: "/about", + name: "about", + component: () => import(/* webpackChunkName: "about-dialog" */ "../views/AboutDialog") } ]; diff --git a/src/frontend/electron_vue/src/views/AboutDialog/index.vue b/src/frontend/electron_vue/src/views/AboutDialog/index.vue new file mode 100644 index 000000000..921c5fa87 --- /dev/null +++ b/src/frontend/electron_vue/src/views/AboutDialog/index.vue @@ -0,0 +1,137 @@ + + + + + diff --git a/src/frontend/electron_vue/vue.config.js b/src/frontend/electron_vue/vue.config.js index 08c5378cc..15729f7fd 100644 --- a/src/frontend/electron_vue/vue.config.js +++ b/src/frontend/electron_vue/vue.config.js @@ -42,7 +42,7 @@ module.exports = { } }, // HACK! Work around issues with electron-vue-builder being too old and new webpack... (files not loading without this) - customFileProtocol: './' + customFileProtocol: "./" }, i18n: { locale: "en", @@ -53,8 +53,7 @@ module.exports = { }, css: { loaderOptions: { - less: { - }, + less: {}, postcss: { postcssOptions: { config: false } } } }