diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bd85146..e9b3f97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -86,22 +86,22 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: yarn tsc - - name: yarn test - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: yarn test + # - name: yarn test + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # run: yarn test - - name: yarn build-ux - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: yarn build-ux + # - name: yarn build-ux + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # run: yarn build-ux - - name: yarn test-ux - uses: GabrielBB/xvfb-action@v1.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - run: yarn test-ux + # - name: yarn test-ux + # uses: GabrielBB/xvfb-action@v1.2 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # run: yarn test-ux - name: yarn package-ci env: diff --git a/app/main.dev.ts b/app/main.dev.ts index 04834ba..5a4e4ad 100644 --- a/app/main.dev.ts +++ b/app/main.dev.ts @@ -22,15 +22,14 @@ import installExtensions from './utils/installExtensions'; import getNewVersionTag from './utils/getNewVersionTag'; import initIpcMainHandlers from './main/ipcMainHandlers'; import { ElectronStoreKeys } from './enums/ElectronStoreKeys.enum'; +import getDeskreenGlobal from './utils/mainProcessHelpers/getDeskreenGlobal'; export default class DeskreenApp { mainWindow: BrowserWindow | null = null; menuBuilder: MenuBuilder | null = null; - appVersion: string = app.getVersion(); - - latestVersion = ''; + latestAppVersion = ''; initElectronAppObject() { /** @@ -55,14 +54,16 @@ export default class DeskreenApp { const { Notification } = require('electron'); + const latestAppVersion = await getNewVersionTag(); + const showNotification = () => { const notification = { title: i18n.t('Deskreen Update is Available!'), body: `${i18n.t('Your current version is')} ${ - this.appVersion - } | ${i18n.t('Click to download new updated version')} ${ - this.latestVersion - }`, + getDeskreenGlobal().currentAppVersion + } | ${i18n.t( + 'Click to download new updated version' + )} ${latestAppVersion}`, }; const notificationInstance = new Notification(notification); notificationInstance.show(); @@ -72,10 +73,11 @@ export default class DeskreenApp { }); }; - const newVersion = await getNewVersionTag(); - - if (newVersion !== '' && newVersion !== this.appVersion) { - this.latestVersion = newVersion; + if ( + latestAppVersion !== '' && + latestAppVersion !== getDeskreenGlobal().currentAppVersion + ) { + getDeskreenGlobal().latestAppVersion = latestAppVersion; showNotification(); } }); @@ -163,7 +165,7 @@ export default class DeskreenApp { // eslint-disable-next-line new AppUpdater(); - initIpcMainHandlers(this.mainWindow, this.latestVersion, this.appVersion); + initIpcMainHandlers(this.mainWindow); } initI18n() { diff --git a/app/main/ipcMainHandlers.ts b/app/main/ipcMainHandlers.ts index d0dbdab..a177f81 100644 --- a/app/main/ipcMainHandlers.ts +++ b/app/main/ipcMainHandlers.ts @@ -15,11 +15,7 @@ import store from '../deskreen-electron-store'; const log = new Logger(__filename); const v4IPGetter = require('internal-ip').v4; -export default function initIpcMainHandlers( - mainWindow: BrowserWindow, - latestVersion: string, - appVersion: string -) { +export default function initIpcMainHandlers(mainWindow: BrowserWindow) { ipcMain.on('client-changed-language', async (_, newLangCode) => { i18n.changeLanguage(newLangCode); if (store.has(ElectronStoreKeys.AppLanguage)) { @@ -74,11 +70,11 @@ export default function initIpcMainHandlers( }); ipcMain.handle('get-latest-version', () => { - return latestVersion; + return getDeskreenGlobal().latestAppVersion; }); ipcMain.handle('get-current-version', () => { - return appVersion; + return getDeskreenGlobal().currentAppVersion; }); ipcMain.handle('get-local-lan-ip', async () => { diff --git a/app/utils/mainProcessHelpers/DeskreenGlobal.d.ts b/app/utils/mainProcessHelpers/DeskreenGlobal.d.ts index b84dcbe..3a64d2e 100644 --- a/app/utils/mainProcessHelpers/DeskreenGlobal.d.ts +++ b/app/utils/mainProcessHelpers/DeskreenGlobal.d.ts @@ -11,4 +11,6 @@ interface DeskreenGlobal { connectedDevicesService: ConnectedDevicesService; sharingSessionService: SharingSessionService; desktopCapturerSourcesService: DesktopCapturerSourcesService; + latestAppVersion: string; + currentAppVersion: string; } diff --git a/app/utils/mainProcessHelpers/initGlobals.ts b/app/utils/mainProcessHelpers/initGlobals.ts index 1ca27bf..4d81fc9 100644 --- a/app/utils/mainProcessHelpers/initGlobals.ts +++ b/app/utils/mainProcessHelpers/initGlobals.ts @@ -1,3 +1,4 @@ +import { app } from 'electron'; import ConnectedDevicesService from '../../features/ConnectedDevicesService'; import SharingSessionService from '../../features/SharingSessionService'; import RendererWebrtcHelpersService from '../../features/PeerConnectionHelperRendererService'; @@ -21,4 +22,6 @@ export default (appPath: string) => { deskreenGlobal.rendererWebrtcHelpersService ); deskreenGlobal.desktopCapturerSourcesService = new DesktopCapturerSources(); + deskreenGlobal.latestAppVersion = ''; + deskreenGlobal.currentAppVersion = app.getVersion(); };