fix(native): split application & tappable application (#10491)

A listening tappable app's info should inherit from its group process's name/icon. However the group process may not be listed as a tappable application.
This commit is contained in:
pengx17
2025-02-27 15:02:38 +00:00
parent c50184bee6
commit 9e0cae58d7
22 changed files with 975 additions and 313 deletions

View File

@@ -19,6 +19,7 @@ import {
import { configureFindInPageModule } from '@affine/core/modules/find-in-page';
import { GlobalContextService } from '@affine/core/modules/global-context';
import { I18nProvider } from '@affine/core/modules/i18n';
import { JournalService } from '@affine/core/modules/journal';
import { LifecycleService } from '@affine/core/modules/lifecycle';
import {
configureElectronStateStorageImpls,
@@ -146,7 +147,8 @@ events?.applicationMenu.openAboutPageInSettingModal(() =>
activeTab: 'about',
})
);
events?.applicationMenu.onNewPageAction(() => {
function getCurrentWorkspace() {
const currentWorkspaceId = frameworkProvider
.get(GlobalContextService)
.globalContext.workspaceId.get();
@@ -158,6 +160,19 @@ events?.applicationMenu.onNewPageAction(() => {
return;
}
const { workspace, dispose } = workspaceRef;
return {
workspace,
dispose,
};
}
events?.applicationMenu.onNewPageAction(type => {
const currentWorkspace = getCurrentWorkspace();
if (!currentWorkspace) {
return;
}
const { workspace, dispose } = currentWorkspace;
const editorSettingService = frameworkProvider.get(EditorSettingService);
const docsService = workspace.scope.get(DocsService);
const editorSetting = editorSettingService.editorSetting;
@@ -171,7 +186,7 @@ events?.applicationMenu.onNewPageAction(() => {
if (!isActive) {
return;
}
const page = docsService.createDoc({ docProps });
const page = docsService.createDoc({ docProps, primaryMode: type });
workspace.scope.get(WorkbenchService).workbench.openDoc(page.id);
})
.catch(err => {
@@ -181,6 +196,21 @@ events?.applicationMenu.onNewPageAction(() => {
dispose();
});
events?.applicationMenu.onOpenJournal(() => {
const currentWorkspace = getCurrentWorkspace();
if (!currentWorkspace) {
return;
}
const { workspace, dispose } = currentWorkspace;
const workbench = workspace.scope.get(WorkbenchService).workbench;
const journalService = workspace.scope.get(JournalService);
const docId = journalService.ensureJournalByDate(new Date()).id;
workbench.openDoc(docId);
dispose();
});
export function App() {
return (
<Suspense>