refactor(electron): move electron-api to framework (#8601)

fix AF-1394
This commit is contained in:
pengx17
2024-10-30 09:16:20 +00:00
parent 50bae9c3e6
commit a791481ac8
81 changed files with 788 additions and 567 deletions

View File

@@ -5,7 +5,7 @@ import { appSettingAtom } from '@toeverything/infra';
import type { createStore } from 'jotai';
import type { useTheme } from 'next-themes';
import type { EditorSettingService } from '../modules/editor-settting';
import type { EditorSettingService } from '../modules/editor-setting';
import { registerAffineCommand } from './registry';
export function registerAffineSettingsCommands({

View File

@@ -1,6 +1,5 @@
import { notify } from '@affine/component';
import { updateReadyAtom } from '@affine/core/components/hooks/use-app-updater';
import { apis } from '@affine/electron-api';
import type { useI18n } from '@affine/i18n';
import { track } from '@affine/track';
import { ResetIcon } from '@blocksuite/icons/rc';
@@ -11,9 +10,11 @@ import { registerAffineCommand } from './registry';
export function registerAffineUpdatesCommands({
t,
store,
quitAndInstall,
}: {
t: ReturnType<typeof useI18n>;
store: ReturnType<typeof createStore>;
quitAndInstall: () => Promise<void>;
}) {
const unsubs: Array<() => void> = [];
@@ -27,7 +28,7 @@ export function registerAffineUpdatesCommands({
run() {
track.$.cmdk.updates.quitAndInstall();
apis?.updater.quitAndInstall().catch(err => {
quitAndInstall().catch(err => {
notify.error({
title: 'Failed to restart to upgrade',
message: 'Please restart the app manually to upgrade.',