feat(ios): ai button feature flag (#13280)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **New Features**
  * Added a global API to check the AI button feature flag status.

* **Bug Fixes**
* Improved handling for the AI button feature: the app now checks the
feature flag before proceeding and provides a clear error if the feature
is disabled.

* **Refactor**
  * Removed all AI button presentation and dismissal logic from the app.
* Deleted unused plugin interfaces and registration related to the AI
button feature.

* **Chores**
  * Updated project metadata and build configuration for iOS.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
EYHN
2025-07-21 18:07:32 +08:00
committed by GitHub
parent 06eb17387a
commit 43f8d852d8
8 changed files with 27 additions and 31 deletions
+5 -10
View File
@@ -7,7 +7,6 @@ import { NavigationGestureProvider } from '@affine/core/mobile/modules/navigatio
import { VirtualKeyboardProvider } from '@affine/core/mobile/modules/virtual-keyboard';
import { router } from '@affine/core/mobile/router';
import { configureCommonModules } from '@affine/core/modules';
import { AIButtonProvider } from '@affine/core/modules/ai-button';
import {
AuthProvider,
AuthService,
@@ -18,6 +17,7 @@ import {
ValidatorProvider,
} from '@affine/core/modules/cloud';
import { DocsService } from '@affine/core/modules/doc';
import { FeatureFlagService } from '@affine/core/modules/feature-flag';
import { GlobalContextService } from '@affine/core/modules/global-context';
import { I18nProvider } from '@affine/core/modules/i18n';
import { LifecycleService } from '@affine/core/modules/lifecycle';
@@ -62,7 +62,6 @@ import { BlocksuiteMenuConfigProvider } from './bs-menu-config';
import { ModalConfigProvider } from './modal-config';
import { Auth } from './plugins/auth';
import { Hashcash } from './plugins/hashcash';
import { Intelligents } from './plugins/intelligents';
import { NbStoreNativeDBApis } from './plugins/nbstore';
import { writeEndpointToken } from './proxy';
import { enableNavigationGesture$ } from './web-navigation-control';
@@ -162,14 +161,6 @@ framework.impl(HapticProvider, {
selectionChanged: () => Haptics.selectionChanged(),
selectionEnd: () => Haptics.selectionEnd(),
});
framework.impl(AIButtonProvider, {
presentAIButton: () => {
return Intelligents.presentIntelligentsButton();
},
dismissAIButton: () => {
return Intelligents.dismissIntelligentsButton();
},
});
framework.scope(ServerScope).override(AuthProvider, resolver => {
const serverService = resolver.get(ServerService);
const endpoint = serverService.server.baseUrl;
@@ -224,6 +215,10 @@ const frameworkProvider = framework.provider();
(window as any).getCurrentI18nLocale = () => {
return I18n.language;
};
(window as any).getAiButtonFeatureFlag = () => {
const featureFlagService = frameworkProvider.get(FeatureFlagService);
return featureFlagService.flags.enable_mobile_ai_button.value;
};
(window as any).getCurrentWorkspaceId = () => {
const globalContextService = frameworkProvider.get(GlobalContextService);
return globalContextService.globalContext.workspaceId.get();
@@ -1,4 +0,0 @@
export interface IntelligentsPlugin {
presentIntelligentsButton(): Promise<void>;
dismissIntelligentsButton(): Promise<void>;
}
@@ -1,8 +0,0 @@
import { registerPlugin } from '@capacitor/core';
import type { IntelligentsPlugin } from './definitions';
const Intelligents = registerPlugin<IntelligentsPlugin>('Intelligents');
export * from './definitions';
export { Intelligents };