Skip to content

Commit

Permalink
Add Button to check for updates
Browse files Browse the repository at this point in the history
  • Loading branch information
hulxv committed Jan 6, 2022
1 parent 8fdf285 commit 3d3dfbe
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
8 changes: 7 additions & 1 deletion main/Communication/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ipcMain, app, shell } from "electron";
import { mainWindow } from "../background";
import log from "electron-log";

import Updates from "../updates";
// Channels
import ConfigChannelClass from "./Channels/Config";
import ExportingChannelClass from "./Channels/Exporting";
Expand All @@ -22,6 +22,7 @@ export default class Communication {
async Init() {
this.getInfos();
this.OpenURL();
this.checkUpdates();
// this.getVnStatInterfaces();
ConfigChannel.Init();
ExportingChannel.Init();
Expand Down Expand Up @@ -67,4 +68,9 @@ export default class Communication {
send(channel, args) {
mainWindow.webContents.send(channel, args);
}
checkUpdates() {
ipcMain.on("check-for-updates", () => {
new Updates().check();
});
}
}
15 changes: 13 additions & 2 deletions renderer/components/Settings/Info.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Stack, Box, Heading } from "@chakra-ui/react";
import { Stack, Button, Heading } from "@chakra-ui/react";
import { ipcRenderer } from "electron";
import { useEffect, useState } from "react";

import { useConfig } from "@Context/configration";
function Info() {
const [infos, setInfos] = useState([]);
const { config } = useConfig();
useEffect(() => {
ipcRenderer.send("get-infos");
ipcRenderer.on("send-infos", (e, result) => {
Expand All @@ -20,6 +21,16 @@ function Info() {
<Heading size='sm'>{info?.value}</Heading>
</Stack>
))}
<Button
colorScheme={config?.apperance?.globalTheme ?? "green"}
maxW={300}
alignSelf='center'
onClick={() => {
console.log("h");
if (ipcRenderer) ipcRenderer.send("check-for-updates");
}}>
Check for updates
</Button>
</Stack>
);
}
Expand Down

0 comments on commit 3d3dfbe

Please sign in to comment.