From 8a7fe45da20ad20daa2ceb3d0fb1a16d177849ea Mon Sep 17 00:00:00 2001 From: tiddlygit-test Date: Sat, 20 Mar 2021 19:10:22 +0800 Subject: [PATCH] fix: bind missing theme and wiki service --- src/services/libs/bindServiceAndProxy.ts | 21 +++++++++++++-------- src/services/wiki/index.ts | 3 ++- src/services/wiki/interface.ts | 8 ++++---- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/services/libs/bindServiceAndProxy.ts b/src/services/libs/bindServiceAndProxy.ts index dfd41038..61b1b3b5 100644 --- a/src/services/libs/bindServiceAndProxy.ts +++ b/src/services/libs/bindServiceAndProxy.ts @@ -1,5 +1,5 @@ /** - * Don't forget to edit ./src/preload/common/services.ts to export service to renderer process + * Don't forget to edit src/preload/common/services.ts to export service to renderer process */ import { registerProxy } from '@/helpers/electron-ipc-proxy/server'; @@ -14,6 +14,7 @@ import { NativeService } from '@services/native'; import { NotificationService } from '@services/notifications'; import { Preference } from '@services/preferences'; import { SystemPreference } from '@services/systemPreferences'; +import { ThemeService } from '@services/theme'; import { Updater } from '@services/updater'; import { View } from '@services/view'; import { Wiki } from '@services/wiki'; @@ -30,15 +31,16 @@ import { INativeService, NativeServiceIPCDescriptor } from '@services/native/int import { INotificationService, NotificationServiceIPCDescriptor } from '@services/notifications/interface'; import { IPreferenceService, PreferenceServiceIPCDescriptor } from '@services/preferences/interface'; import { ISystemPreferenceService, SystemPreferenceServiceIPCDescriptor } from '@services/systemPreferences/interface'; +import { IThemeService, ThemeServiceIPCDescriptor } from '@services/theme/interface'; import { IUpdaterService, UpdaterServiceIPCDescriptor } from '@services/updater/interface'; import { IViewService, ViewServiceIPCDescriptor } from '@services/view/interface'; -import { IWikiService, WikiServiceIPCDescriptor } from '@services/wiki/interface'; import { IWikiGitWorkspaceService, WikiGitWorkspaceServiceIPCDescriptor } from '@services/wikiGitWorkspace/interface'; +import { IWikiService, WikiServiceIPCDescriptor } from '@services/wiki/interface'; import { IWindowService, WindowServiceIPCDescriptor } from '@services/windows/interface'; import { IWorkspaceService, WorkspaceServiceIPCDescriptor } from '@services/workspaces/interface'; import { IWorkspaceViewService, WorkspaceViewServiceIPCDescriptor } from '@services/workspacesView/interface'; -export function bindServiceAndProxy() { +export function bindServiceAndProxy(): void { container.bind(serviceIdentifier.Authentication).to(Authentication).inSingletonScope(); container.bind(serviceIdentifier.Context).to(ContextService).inSingletonScope(); container.bind(serviceIdentifier.Git).to(Git).inSingletonScope(); @@ -47,10 +49,11 @@ export function bindServiceAndProxy() { container.bind(serviceIdentifier.NotificationService).to(NotificationService).inSingletonScope(); container.bind(serviceIdentifier.Preference).to(Preference).inSingletonScope(); container.bind(serviceIdentifier.SystemPreference).to(SystemPreference).inSingletonScope(); + container.bind(serviceIdentifier.ThemeService).to(ThemeService).inSingletonScope(); container.bind(serviceIdentifier.Updater).to(Updater).inSingletonScope(); container.bind(serviceIdentifier.View).to(View).inSingletonScope(); - container.bind(serviceIdentifier.Wiki).to(Wiki).inSingletonScope(); container.bind(serviceIdentifier.WikiGitWorkspace).to(WikiGitWorkspace).inSingletonScope(); + container.bind(serviceIdentifier.Wiki).to(Wiki).inSingletonScope(); container.bind(serviceIdentifier.Window).to(Window).inSingletonScope(); container.bind(serviceIdentifier.Workspace).to(Workspace).inSingletonScope(); container.bind(serviceIdentifier.WorkspaceView).to(WorkspaceView).inSingletonScope(); @@ -63,10 +66,11 @@ export function bindServiceAndProxy() { const notificationService = container.get(serviceIdentifier.NotificationService); const preferenceService = container.get(serviceIdentifier.Preference); const systemPreferenceService = container.get(serviceIdentifier.SystemPreference); - const viewService = container.get(serviceIdentifier.View); + const themeService = container.get(serviceIdentifier.ThemeService); const updaterService = container.get(serviceIdentifier.Updater); - const wikiService = container.get(serviceIdentifier.Wiki); + const viewService = container.get(serviceIdentifier.View); const wikiGitWorkspaceService = container.get(serviceIdentifier.WikiGitWorkspace); + const wikiService = container.get(serviceIdentifier.Wiki); const windowService = container.get(serviceIdentifier.Window); const workspaceService = container.get(serviceIdentifier.Workspace); const workspaceViewService = container.get(serviceIdentifier.WorkspaceView); @@ -79,10 +83,11 @@ export function bindServiceAndProxy() { registerProxy(notificationService, NotificationServiceIPCDescriptor); registerProxy(preferenceService, PreferenceServiceIPCDescriptor); registerProxy(systemPreferenceService, SystemPreferenceServiceIPCDescriptor); - registerProxy(viewService, ViewServiceIPCDescriptor); + registerProxy(themeService, ThemeServiceIPCDescriptor); registerProxy(updaterService, UpdaterServiceIPCDescriptor); - registerProxy(wikiService, WikiServiceIPCDescriptor); + registerProxy(viewService, ViewServiceIPCDescriptor); registerProxy(wikiGitWorkspaceService, WikiGitWorkspaceServiceIPCDescriptor); + registerProxy(wikiService, WikiServiceIPCDescriptor); registerProxy(windowService, WindowServiceIPCDescriptor); registerProxy(workspaceService, WorkspaceServiceIPCDescriptor); registerProxy(workspaceViewService, WorkspaceViewServiceIPCDescriptor); diff --git a/src/services/wiki/index.ts b/src/services/wiki/index.ts index 1f7bb9d1..ead01156 100644 --- a/src/services/wiki/index.ts +++ b/src/services/wiki/index.ts @@ -22,9 +22,10 @@ import i18n from '@services/libs/i18n'; import { lazyInject } from '@services/container'; import { TIDDLYWIKI_TEMPLATE_FOLDER_PATH, TIDDLERS_PATH } from '@services/constants/paths'; import { updateSubWikiPluginContent, getSubWikiPluginContent, ISubWikiPluginContent } from './update-plugin-content'; +import { IWikiService } from './interface'; @injectable() -export class Wiki { +export class Wiki implements IWikiService { @lazyInject(serviceIdentifier.Authentication) private readonly authService!: IAuthenticationService; @lazyInject(serviceIdentifier.Window) private readonly windowService!: IWindowService; @lazyInject(serviceIdentifier.Git) private readonly gitService!: IGitService; diff --git a/src/services/wiki/interface.ts b/src/services/wiki/interface.ts index 01faffca..cf81729a 100644 --- a/src/services/wiki/interface.ts +++ b/src/services/wiki/interface.ts @@ -1,7 +1,7 @@ import { ProxyPropertyType } from '@/helpers/electron-ipc-proxy/common'; import { WikiChannel } from '@/constants/channels'; import { IWorkspace } from '@services/workspaces/interface'; -import { IAuthingUserInfo } from '@services/types'; +import { IGitUserInfos } from '@services/git/interface'; import type { ISubWikiPluginContent } from './update-plugin-content'; /** @@ -21,18 +21,18 @@ export interface IWikiService { createSubWiki(newFolderPath: string, folderName: string, mainWikiPath: string, tagName?: string, onlyLink?: boolean): Promise; removeWiki(wikiPath: string, mainWikiToUnLink?: string, onlyRemoveLink?: boolean): Promise; ensureWikiExist(wikiPath: string, shouldBeMainWiki: boolean): Promise; - cloneWiki(parentFolderLocation: string, wikiFolderName: string, githubWikiUrl: string, userInfo: IAuthingUserInfo): Promise; + cloneWiki(parentFolderLocation: string, wikiFolderName: string, githubWikiUrl: string, userInfo: IGitUserInfos): Promise; cloneSubWiki( parentFolderLocation: string, wikiFolderName: string, mainWikiPath: string, githubWikiUrl: string, - userInfo: IAuthingUserInfo, + userInfo: IGitUserInfos, tagName?: string, ): Promise; wikiStartup(workspace: IWorkspace): Promise; startNodeJSWiki(homePath: string, port: number, userName: string, workspaceID: string): Promise; - watchWiki(wikiRepoPath: string, githubRepoUrl: string, userInfo: IAuthingUserInfo, wikiFolderPath?: string): Promise; + watchWiki(wikiRepoPath: string, githubRepoUrl: string, userInfo: IGitUserInfos, wikiFolderPath?: string): Promise; stopWatchWiki(wikiRepoPath: string): Promise; stopWatchAllWiki(): Promise; }