Skip to content

Commit

Permalink
Update checkupdate to ts
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvNC committed Jul 24, 2023
1 parent 99c47f6 commit abcbd06
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/utils/checkUpdate.js → src/utils/checkUpdate.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { app } = require('electron');
const axios = require('axios');
const Store = require('electron-store');
import ElectronStore from 'electron-store';

const version = app.getVersion();
const platform = process.platform;
Expand All @@ -12,14 +12,15 @@ const platform = process.platform;
* @param {Store} config
* @returns {Promise<string|null>} The version number of the latest release if there are updates available. Otherwise, returns null.
*/
async function checkUpdate(config) {

async function checkUpdate(config: ElectronStore) {
// Do not check if Windows
if (platform === 'win32') {
return null;
}

// Get last check update time
const lastCheckUpdateTime = config.get('lastCheckUpdateTime', new Date(0).valueOf());
const lastCheckUpdateTime = config.get('lastCheckUpdateTime', new Date(0).valueOf()) as number;
console.log(
`Last check update time: ${new Date(lastCheckUpdateTime).toLocaleString()} which was ${(
(Date.now() - lastCheckUpdateTime) /
Expand Down Expand Up @@ -56,7 +57,7 @@ async function checkUpdate(config) {
* @param {string} v1
* @param {string} v2
*/
function compareVersionString(v1, v2) {
function compareVersionString(v1: string, v2: string) {
const v1Parts = v1.split('.');
const v2Parts = v2.split('.');

Expand Down

0 comments on commit abcbd06

Please sign in to comment.