Skip to content

Commit 79f826f

Browse files
committed
refactor(updater): remove update services and related files
This commit removes the update-related services and files for both macOS and Windows platforms. The functionality for checking and controlling updates has been eliminated, along with associated types and IPC handlers. This cleanup helps streamline the codebase and remove unused features. Closes #123
1 parent d684a34 commit 79f826f

92 files changed

Lines changed: 43 additions & 3488 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/app-preload/window.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { app } from "electron";
22
import path from "node:path";
33
import { WindowManager } from "@devisfuture/electron-modular";
4-
import { isDev } from "../$shared/utils.js";
4+
import { isDev } from "../@shared/utils.js";
55
import type { TWindowManager } from "../types.js";
66

77
@WindowManager<TWindows["preloadApp"]>({

src/main/app-version/ipc.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
IpcHandler,
44
type TIpcHandlerInterface,
55
} from "@devisfuture/electron-modular";
6-
import { ipcMainHandle } from "../$shared/utils.js";
6+
import { ipcMainHandle } from "../@shared/utils.js";
77

88
@IpcHandler()
99
export class AppVersionIpc implements TIpcHandlerInterface {

src/main/app.ts

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@ import { app, Menu } from "electron";
22
import dotenv from "dotenv";
33
import path from "node:path";
44
import { initSettings, bootstrapModules } from "@devisfuture/electron-modular";
5-
import { isDev } from "./$shared/utils.js";
5+
import { isDev } from "./@shared/utils.js";
66
import { AppModule } from "./app/module.js";
7-
import { AuthSocialNetworkModule } from "./auth-social-network/module.js";
8-
import { UpdaterModule } from "./updater/module.js";
97
import { MasterKeyModule } from "./master-key/module.js";
10-
import { TwoFactorModule } from "./two-factor/module.js";
118
import { AppPreloadModule } from "./app-preload/module.js";
12-
import { NotificationModule } from "./notification/module.js";
139
import { AppVersionModule } from "./app-version/module.js";
14-
import { UserModule } from "./user/module.js";
15-
import { ResourcesModule } from "./resources/module.js";
1610
import { folders } from "./config.js";
1711

1812
const envPath = path.join(process.resourcesPath, ".env");
@@ -33,15 +27,9 @@ initSettings({
3327

3428
app.on("ready", async () => {
3529
await bootstrapModules([
36-
AppPreloadModule,
3730
AppModule,
38-
AuthSocialNetworkModule,
39-
UpdaterModule,
40-
TwoFactorModule,
31+
AppPreloadModule,
4132
AppVersionModule,
42-
NotificationModule,
43-
UserModule,
44-
ResourcesModule,
4533
MasterKeyModule,
4634
]);
4735
});

src/main/app/ipc.ts

Lines changed: 2 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,14 @@
1-
import { app, dialog } from "electron";
21
import {
3-
Inject,
42
TParamOnInit,
53
TIpcHandlerInterface,
64
IpcHandler,
75
getWindow as getWindows,
86
} from "@devisfuture/electron-modular";
9-
import { ipcMainOn } from "../$shared/utils.js";
10-
import { AppService } from "./service.js";
11-
import { messages } from "../config.js";
12-
import { AUTH_PROVIDER } from "./tokens.js";
13-
import type { TAuthProvider, TDestroyProcess } from "./types.js";
7+
import { ipcMainOn } from "../@shared/utils.js";
148

159
@IpcHandler()
1610
export class AppIpc implements TIpcHandlerInterface {
17-
constructor(
18-
private appService: AppService,
19-
@Inject(AUTH_PROVIDER) private authProvider: TAuthProvider,
20-
) {
21-
process.on("uncaughtException", (error) => {
22-
this.destroyProcess({
23-
error,
24-
message: error.message,
25-
title: messages.crash.uncaughtException,
26-
});
27-
});
28-
29-
process.on("unhandledRejection", (reason) => {
30-
this.destroyProcess({
31-
error: reason,
32-
message: messages.crash.unhandledRejection,
33-
title: messages.crash.unhandledRejection,
34-
});
35-
});
36-
37-
app.on("render-process-gone", (_event, _webContents, details) => {
38-
this.destroyProcess({
39-
error: details,
40-
message: `Exit Code: ${details.exitCode}, Reason: ${details.reason}`,
41-
title: messages.crash.renderProcessGone,
42-
});
43-
});
44-
}
45-
46-
private destroyProcess({ error, message, title }: TDestroyProcess) {
47-
if (error !== undefined) {
48-
console.error(error);
49-
}
50-
51-
this.appService.destroyTrayAndWindows();
52-
this.appService.dockHide();
53-
54-
dialog.showMessageBox({
55-
title,
56-
message,
57-
});
58-
}
11+
constructor() {}
5912

6013
async onInit({ getWindow }: TParamOnInit<TWindows["main"]>) {
6114
const mainWindow = getWindow("window:main");
@@ -72,11 +25,5 @@ export class AppIpc implements TIpcHandlerInterface {
7225
window.show();
7326
}
7427
});
75-
76-
ipcMainOn("logout", async () => {
77-
if (window !== undefined) {
78-
this.authProvider.logout(window);
79-
}
80-
});
8128
}
8229
}

src/main/app/module.ts

Lines changed: 2 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,13 @@
11
import { RgModule } from "@devisfuture/electron-modular";
2-
import { MenuModule } from "../menu/module.js";
3-
import { TrayModule } from "../tray/module.js";
42
import { TrayService } from "../tray/service.js";
5-
6-
import { UpdaterModule } from "../updater/module.js";
7-
import { AuthModule } from "../auth/module.js";
8-
import { AuthService } from "../auth/service.js";
93
import { AppIpc } from "./ipc.js";
104
import { AppService } from "./service.js";
115
import { AppWindow } from "./window.js";
126
import { MenuService } from "../menu/service.js";
13-
import { CheckForUpdatesService } from "../updater/services/check-for-updates.js";
14-
import { ControlUpdateWindowsPlatformService } from "../updater/services/windows/control-update.js";
15-
import { SetFeedUrlService } from "../updater/services/windows/set-feed-url.js";
16-
import {
17-
AUTH_PROVIDER,
18-
MENU_PROVIDER,
19-
TRAY_PROVIDER,
20-
UPDATER_PROVIDER,
21-
} from "./tokens.js";
22-
import type {
23-
TAuthProvider,
24-
TMenuProvider,
25-
TTrayProvider,
26-
TUpdaterProvider,
27-
} from "./types.js";
7+
import { MENU_PROVIDER, TRAY_PROVIDER } from "./tokens.js";
8+
import type { TMenuProvider, TTrayProvider } from "./types.js";
289

2910
@RgModule({
30-
imports: [MenuModule, TrayModule, UpdaterModule, AuthModule],
3111
ipc: [AppIpc],
3212
windows: [AppWindow],
3313
providers: [
@@ -49,34 +29,6 @@ import type {
4929
}),
5030
inject: [TrayService],
5131
},
52-
{
53-
provide: AUTH_PROVIDER,
54-
useFactory: (authService: AuthService): TAuthProvider => ({
55-
checkAuthenticated: (window) => authService.checkAuthenticated(window),
56-
setCheckAccessInterval: (window) =>
57-
authService.setCheckAccessInterval(window),
58-
logout: (window) => authService.logout(window),
59-
}),
60-
inject: [AuthService],
61-
},
62-
{
63-
provide: UPDATER_PROVIDER,
64-
useFactory: (
65-
setFeedUrlService: SetFeedUrlService,
66-
checkForUpdatesService: CheckForUpdatesService,
67-
controlUpdateWindowsPlatformService: ControlUpdateWindowsPlatformService,
68-
): TUpdaterProvider => ({
69-
setFeedUrl: () => setFeedUrlService.setFeedURL(),
70-
checkForUpdates: () => checkForUpdatesService.checkForUpdates(),
71-
controlUpdateWindowsPlatform: () =>
72-
controlUpdateWindowsPlatformService.controlUpdate(),
73-
}),
74-
inject: [
75-
SetFeedUrlService,
76-
CheckForUpdatesService,
77-
ControlUpdateWindowsPlatformService,
78-
],
79-
},
8032
],
8133
})
8234
export class AppModule {}

src/main/app/tokens.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
export const MENU_PROVIDER = Symbol("MENU_PROVIDER");
22
export const TRAY_PROVIDER = Symbol("TRAY_PROVIDER");
3-
export const AUTH_PROVIDER = Symbol("AUTH_PROVIDER");
4-
export const UPDATER_PROVIDER = Symbol("UPDATER_PROVIDER");

src/main/app/types.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { BrowserWindow } from "electron";
21
import type { TItem } from "../menu/types.js";
32
import type { TItem as TItemTray } from "../tray/types.js";
43

@@ -18,17 +17,3 @@ export type TTrayProvider = {
1817
buildTray: (items?: TItemTray[]) => void;
1918
destroyTray: () => void;
2019
};
21-
22-
export type TAuthProvider = {
23-
checkAuthenticated: (
24-
window: BrowserWindow,
25-
) => { isAuthenticated: boolean } | undefined;
26-
setCheckAccessInterval: (window: BrowserWindow) => void;
27-
logout: (window: BrowserWindow) => void;
28-
};
29-
30-
export type TUpdaterProvider = {
31-
setFeedUrl: () => void;
32-
checkForUpdates: () => void;
33-
controlUpdateWindowsPlatform: () => void;
34-
};

0 commit comments

Comments
 (0)