File tree Expand file tree Collapse file tree 4 files changed +6
-20
lines changed
Expand file tree Collapse file tree 4 files changed +6
-20
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " electron-modular-boilerplate" ,
33 "private" : true ,
4- "version" : " 0.1.3 " ,
4+ "version" : " 0.1.4 " ,
55 "type" : " module" ,
66 "main" : " dist-main/app.js" ,
77 "author" : " traeop" ,
Original file line number Diff line number Diff line change @@ -9,8 +9,6 @@ import { isDev } from "#shared/utils.js";
99
1010import { menu } from "#main/config.js" ;
1111
12- import { getElectronStorage } from "#main/@shared/store.js" ;
13-
1412import type { TWindowManager } from "../types.js" ;
1513import { MENU_PROVIDER , TRAY_PROVIDER , UPDATER_PROVIDER } from "./tokens.js" ;
1614import type {
@@ -86,12 +84,7 @@ export class AppWindow implements TWindowManager {
8684
8785 onShow ( ) : void {
8886 this . isWillClose = false ;
89- const userId = getElectronStorage ( "userId" ) ;
90- const authToken = getElectronStorage ( "authToken" ) ;
91-
92- if ( userId && authToken ) {
93- this . updaterProvider . checkForUpdates ( ) ;
94- }
87+ this . updaterProvider . checkForUpdates ( ) ;
9588 }
9689
9790 onClose ( event : Event , window : BrowserWindow ) : void {
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ vi.mock("@devisfuture/electron-modular", () => ({
55} ) ) ;
66
77describe ( "UpdaterWindow" , ( ) => {
8- it ( "checks for updates on first load only once " , async ( ) => {
8+ it ( "calls checkForUpdates each time the load finishes " , async ( ) => {
99 const { UpdaterWindow } = await import ( "./window.js" ) ;
1010
1111 const checkForUpdatesService = {
@@ -17,7 +17,7 @@ describe("UpdaterWindow", () => {
1717 window . onWebContentsDidFinishLoad ( ) ;
1818 window . onWebContentsDidFinishLoad ( ) ;
1919
20- expect ( checkForUpdatesService . checkForUpdates ) . toHaveBeenCalledTimes ( 1 ) ;
20+ expect ( checkForUpdatesService . checkForUpdates ) . toHaveBeenCalledTimes ( 2 ) ;
2121 } ) ;
2222
2323 it ( "checks for updates when window is shown after first" , async ( ) => {
Original file line number Diff line number Diff line change @@ -16,20 +16,13 @@ import { CheckForUpdatesService } from "./services/check-for-updates.js";
1616 } ,
1717} )
1818export class UpdaterWindow implements TWindowManager {
19- private isCheckFirst = true ;
2019 constructor ( private checkForUpdatesService : CheckForUpdatesService ) { }
2120
2221 onWebContentsDidFinishLoad ( ) : void {
23- if ( this . isCheckFirst ) {
24- this . checkForUpdatesService . checkForUpdates ( ) ;
25- this . isCheckFirst = false ;
26- }
22+ this . checkForUpdatesService . checkForUpdates ( ) ;
2723 }
2824
2925 onShow ( ) {
30- console . log ( "UpdaterWindow onShowed" ) ;
31- if ( ! this . isCheckFirst ) {
32- this . checkForUpdatesService . checkForUpdates ( ) ;
33- }
26+ this . checkForUpdatesService . checkForUpdates ( ) ;
3427 }
3528}
You can’t perform that action at this time.
0 commit comments