merging
This commit is contained in:
commit
c3be798dda
9 changed files with 198 additions and 44 deletions
27
src/App.vue
27
src/App.vue
|
|
@ -6,19 +6,19 @@
|
|||
|
||||
<!-- Minimize and exit buttons. -->
|
||||
<span class="menu">
|
||||
<button
|
||||
class="menuButton exitButton"
|
||||
@click.prevent="post('nav-bar', 'close')"
|
||||
<button
|
||||
class="menuButton exitButton"
|
||||
@click.prevent="post('nav-bar', 'close')"
|
||||
/>
|
||||
<button
|
||||
class="menuButton minimizeButton"
|
||||
@click.prevent="post('nav-bar', 'min')"
|
||||
<button
|
||||
class="menuButton minimizeButton"
|
||||
@click.prevent="post('nav-bar', 'min')"
|
||||
/>
|
||||
</span>
|
||||
|
||||
<!-- Main Pages -->
|
||||
<Messenger
|
||||
v-if="profile"
|
||||
<Messenger
|
||||
v-if="profile"
|
||||
:profile="profile"
|
||||
:newMessages="newMessages"
|
||||
/>
|
||||
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
<!-- Show spash screen if ready is false -->
|
||||
<Splash v-else />
|
||||
|
||||
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
|
|
@ -41,7 +41,7 @@ import Messenger from "@/components/messenger.vue";
|
|||
import Login from "@/components/login.vue";
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
components: {
|
||||
Splash,
|
||||
Messenger,
|
||||
Login
|
||||
|
|
@ -82,6 +82,13 @@ export default defineComponent({
|
|||
onMounted(() => {
|
||||
console.log("APP:mounted.")
|
||||
window.ipcRenderer.on("update-state", updateState)
|
||||
window.ipcRenderer.on("update_available", () => {
|
||||
console.log('testing auto update');
|
||||
})
|
||||
|
||||
window.ipcRenderer.on("update_downloaded", () => {
|
||||
console.log('testing update download');
|
||||
})
|
||||
post("app-mounted", "")
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -5,8 +5,11 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
import { protocol, autoUpdater, dialog } from "electron";
|
||||
const log = require("electron-log")
|
||||
const { autoUpdater } = require('electron-updater')
|
||||
|
||||
import { initApp } from './background/init';
|
||||
import { protocol, dialog } from "electron";
|
||||
|
||||
// Scheme must be registered before the app is ready
|
||||
protocol.registerSchemesAsPrivileged([
|
||||
|
|
@ -18,36 +21,20 @@ const isDev = require('electron-is-dev');
|
|||
|
||||
// NOTE Program Begins Here
|
||||
(async () => {
|
||||
autoUpdater.requestHeaders = { 'PRIVATE-TOKEN': 'seMF_apn237iUw8puG9a' }
|
||||
autoUpdater.logger = log;
|
||||
|
||||
// Check for an update 10sec after Program Starts
|
||||
setTimeout(function () {
|
||||
autoUpdater.checkForUpdatesAndNotify()
|
||||
}, 10000)
|
||||
|
||||
// Check for an update every 2min.
|
||||
setInterval(() => {
|
||||
autoUpdater.checkForUpdatesAndNotify()
|
||||
}, 120000)
|
||||
|
||||
console.log('Starting Crimata electron app.');
|
||||
initApp(isDev);
|
||||
|
||||
})();
|
||||
|
||||
// Code for auto app updates.
|
||||
if (!isDev) {
|
||||
|
||||
autoUpdater.setFeedURL({
|
||||
url: "https://gitlab.com/api/v4/projects/25637892/releases",
|
||||
headers: {"PRIVATE-TOKEN": "fSCN8xr4EgccV7z1UNaw"},
|
||||
serverType: "default"
|
||||
})
|
||||
|
||||
autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => {
|
||||
const dialogOpts = {
|
||||
type: 'info',
|
||||
buttons: ['Restart', 'Later'],
|
||||
title: 'Application Update',
|
||||
message: process.platform === 'win32' ? releaseNotes : releaseName,
|
||||
detail: 'A new version has been downloaded. Restart the application to apply the updates.'
|
||||
}
|
||||
|
||||
dialog.showMessageBox(dialogOpts).then((returnValue) => {
|
||||
if (returnValue.response === 0) autoUpdater.quitAndInstall()
|
||||
})
|
||||
})
|
||||
|
||||
setInterval(() => {
|
||||
autoUpdater.checkForUpdates()
|
||||
}, 5000)
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import { createWindow } from './window';
|
|||
import { initSession } from './session';
|
||||
import { initAudioIO } from './audio';
|
||||
import { backgroundMitt } from '@/modules/emitter';
|
||||
const { autoUpdater } = require('electron-updater');
|
||||
|
||||
let win: boolean;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import { backgroundMitt } from '@/modules/emitter';
|
|||
import { RenderMessage, WindowState } from "@/types";
|
||||
import { loadWinState, saveToJson } from "./helpers";
|
||||
import * as path from "path";
|
||||
const { autoUpdater } = require('electron-updater');
|
||||
|
||||
interface IpcRendererPayload {
|
||||
endpoint: string;
|
||||
|
|
@ -64,7 +65,7 @@ const onWindowMount = (): void => {
|
|||
// Handle win nav-bar event.
|
||||
ipcMain.removeAllListeners("nav-bar") // avoid setting duplicate handlers
|
||||
ipcMain.on("nav-bar", onNavBar);
|
||||
|
||||
|
||||
// Gateway for messages to the frontend.
|
||||
backgroundMitt.removeAllListeners("ipc-renderer")
|
||||
backgroundMitt.on("ipc-renderer", renderMessage);
|
||||
|
|
@ -109,7 +110,7 @@ export async function createWindow(): Promise<void> {
|
|||
// Load the URL.
|
||||
if (process.env.WEBPACK_DEV_SERVER_URL) {
|
||||
win.loadURL(process.env.WEBPACK_DEV_SERVER_URL as string); // dev
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
createProtocol("app");
|
||||
|
|
@ -124,6 +125,7 @@ export async function createWindow(): Promise<void> {
|
|||
win.on("resize", saveWindowState);
|
||||
|
||||
win.once('ready-to-show', () => {
|
||||
autoUpdater.checkForUpdatesAndNotify();
|
||||
if (win) win.show()
|
||||
})
|
||||
|
||||
|
|
@ -139,3 +141,11 @@ export async function createWindow(): Promise<void> {
|
|||
|
||||
});
|
||||
}
|
||||
|
||||
autoUpdater.on('update-available', () => {
|
||||
if (win) win.webContents.send('update_available');
|
||||
});
|
||||
|
||||
autoUpdater.on('update-downloaded', () => {
|
||||
if (win) win.webContents.send('update_downloaded');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue