Skip to content

Commit eca58d0

Browse files
refactor(desktop): keep electron helpers private
1 parent d12e01b commit eca58d0

10 files changed

Lines changed: 14 additions & 5 deletions

‎apps/desktop/src/electron/ElectronApp.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ const addScopedAppListener = <Args extends ReadonlyArray<unknown>>(
9898
}),
9999
).pipe(Effect.asVoid);
100100

101+
/** @public Service construction is part of the canonical Effect module API. */
101102
export const make = ElectronApp.of({
102103
metadata: Effect.gen(function* () {
103104
const appVersion = yield* Effect.try({

‎apps/desktop/src/electron/ElectronDialog.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export class ElectronDialog extends Context.Service<
102102
}
103103
>()("@t3tools/desktop/electron/ElectronDialog") {}
104104

105+
/** @public Service construction is part of the canonical Effect module API. */
105106
export const make = ElectronDialog.of({
106107
pickFolder: Effect.fn("desktop.electron.dialog.pickFolder")(function* (input) {
107108
const ownerWindowId = Option.match(input.owner, {

‎apps/desktop/src/electron/ElectronMenu.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ const normalizePosition = (
110110
Option.map(({ x, y }) => ({ x: Math.floor(x * zoomFactor), y: Math.floor(y * zoomFactor) })),
111111
);
112112

113+
/** @public Service construction is part of the canonical Effect module API. */
113114
export const make = Effect.gen(function* () {
114115
const platform = yield* HostProcessPlatform;
115116
let destructiveMenuIconCache: Option.Option<Electron.NativeImage> | undefined;

‎apps/desktop/src/electron/ElectronPowerMonitor.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const onSpeedLimitChange: ElectronPowerMonitor["Service"]["onSpeedLimitChange"]
7575
).pipe(Effect.asVoid);
7676
};
7777

78+
/** @public Service construction is part of the canonical Effect module API. */
7879
export const make = ElectronPowerMonitor.of({
7980
isOnBatteryPower: Effect.sync(() => Electron.powerMonitor.isOnBatteryPower()),
8081
getSystemIdleTime: Effect.sync(() => Electron.powerMonitor.getSystemIdleTime()),

‎apps/desktop/src/electron/ElectronProtocol.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ import * as Scope from "effect/Scope";
99
import * as Electron from "electron";
1010

1111
export const DESKTOP_HOST = "app";
12-
export const DESKTOP_PRODUCTION_SCHEME = "t3code";
13-
export const DESKTOP_DEVELOPMENT_SCHEME = "t3code-dev";
12+
const DESKTOP_PRODUCTION_SCHEME = "t3code";
13+
const DESKTOP_DEVELOPMENT_SCHEME = "t3code-dev";
1414

1515
export function getDesktopScheme(isDevelopment: boolean): string {
1616
return isDevelopment ? DESKTOP_DEVELOPMENT_SCHEME : DESKTOP_PRODUCTION_SCHEME;
1717
}
1818

19-
export function getDesktopOrigin(isDevelopment: boolean): string {
19+
function getDesktopOrigin(isDevelopment: boolean): string {
2020
return `${getDesktopScheme(isDevelopment)}://${DESKTOP_HOST}`;
2121
}
2222

@@ -109,7 +109,7 @@ function withContentSecurityPolicy(response: Response, policy: string): Response
109109
/**
110110
* Must run synchronously during process bootstrap, before Electron emits `ready`.
111111
*/
112-
export function registerDesktopSchemePrivilegesSync(): void {
112+
function registerDesktopSchemePrivilegesSync(): void {
113113
Electron.protocol.registerSchemesAsPrivileged([
114114
{
115115
scheme: DESKTOP_PRODUCTION_SCHEME,
@@ -205,6 +205,7 @@ async function fetchWithTransientRetry(url: string, init: RequestInit): Promise<
205205
throw lastError;
206206
}
207207

208+
/** @public Service construction is part of the canonical Effect module API. */
208209
export const make = Effect.gen(function* () {
209210
const registered = yield* Ref.make(false);
210211

‎apps/desktop/src/electron/ElectronSafeStorage.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ export const ElectronSafeStorageError = Schema.Union([
5050
ElectronSafeStorageDecryptError,
5151
]);
5252
export type ElectronSafeStorageError = typeof ElectronSafeStorageError.Type;
53-
export const isElectronSafeStorageError = Schema.is(ElectronSafeStorageError);
5453

5554
export class ElectronSafeStorage extends Context.Service<
5655
ElectronSafeStorage,
@@ -66,6 +65,7 @@ export class ElectronSafeStorage extends Context.Service<
6665
}
6766
>()("@t3tools/desktop/electron/ElectronSafeStorage") {}
6867

68+
/** @public Service construction is part of the canonical Effect module API. */
6969
export const make = Effect.gen(function* () {
7070
const platform = yield* HostProcessPlatform;
7171

‎apps/desktop/src/electron/ElectronShell.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export class ElectronShell extends Context.Service<
6767
}
6868
>()("@t3tools/desktop/electron/ElectronShell") {}
6969

70+
/** @public Service construction is part of the canonical Effect module API. */
7071
export const make = ElectronShell.of({
7172
openExternal: (rawUrl) =>
7273
Option.match(parseSafeExternalUrl(rawUrl), {

‎apps/desktop/src/electron/ElectronTheme.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export class ElectronTheme extends Context.Service<
2828
}
2929
>()("@t3tools/desktop/electron/ElectronTheme") {}
3030

31+
/** @public Service construction is part of the canonical Effect module API. */
3132
export const make = ElectronTheme.of({
3233
shouldUseDarkColors: Effect.sync(() => Electron.nativeTheme.shouldUseDarkColors),
3334
setSource: (theme) =>

‎apps/desktop/src/electron/ElectronUpdater.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ export class ElectronUpdater extends Context.Service<
8080
}
8181
>()("@t3tools/desktop/electron/ElectronUpdater") {}
8282

83+
/** @public Service construction is part of the canonical Effect module API. */
8384
export const make = ElectronUpdater.of({
8485
setFeedURL: (options) =>
8586
Effect.suspend(() => {

‎apps/desktop/src/electron/ElectronWindow.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export class ElectronWindow extends Context.Service<
9595
}
9696
>()("@t3tools/desktop/electron/ElectronWindow") {}
9797

98+
/** @public Service construction is part of the canonical Effect module API. */
9899
export const make = Effect.gen(function* () {
99100
const platform = yield* HostProcessPlatform;
100101
const mainWindowRef = yield* Ref.make<Option.Option<Electron.BrowserWindow>>(Option.none());

0 commit comments

Comments
 (0)