Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(mobile): 移除 expo-observe,修复无 EAS projectId 的安卓包启动必崩 (#364)

Lizi09971745e234
diff --git a/apps/mobile/app/(auth)/login.tsx b/apps/mobile/app/(auth)/login.tsx
index 9415fe2fd5..deaefc31d6 100644
--- a/apps/mobile/app/(auth)/login.tsx
+++ b/apps/mobile/app/(auth)/login.tsx
@@ -17,7 +17,6 @@ import { canResumePendingConsent, makeConsentStamp, type ConsentStamp } from '@/
import { isNativeSocialProviderSupported } from '@/auth/nativeSocial';
import { Text, TextInput } from '@/components/AppText';
import { MainWindowActionButton } from '@/components/MobilePrimitives';
-import { useObserve } from '@/observability/observe';
import { useTheme, useThemedStyles, type ThemeColors } from '@/theme';
import {
LOGIN_HANDOFF_EASING,
@@ -81,7 +80,6 @@ export default function LoginScreen() {
// 手动语言 override 恢复/切换时本屏跟着重渲(P2-a:不依赖 auth 重渲兜底)。
useTranslation();
const auth = useAuth();
- const { markInteractive } = useObserve();
const stage = useLoginSurface();
const insets = useSafeAreaInsets();
const handoff = useLoginHandoffOptional();
@@ -284,11 +282,6 @@ export default function LoginScreen() {
auth.isAuthenticated,
]);
- // EAS Observe: the stable login surface is ready before network actions complete.
- useEffect(() => {
- if (auth.initialized) markInteractive();
- }, [auth.initialized, markInteractive]);
-
const reset = () => {
auth.clearAuthError();
setIdentifierFormatError(null);
diff --git a/apps/mobile/app/_layout.tsx b/apps/mobile/app/_layout.tsx
index 010469bb91..43265a0a7a 100644
--- a/apps/mobile/app/_layout.tsx
+++ b/apps/mobile/app/_layout.tsx
@@ -47,11 +47,6 @@ import { useStartupOtaGate } from '@/update/useStartupOtaGate';
import { useCanaryChannelGate } from '@/update/useCanaryChannelGate';
import { useStartupEndpointGate } from '@/config/useStartupEndpointGate';
import { IS_OTA_SELFHOST } from '@/config/env';
-import { Observe, ObserveRoot } from '@/observability/observe';
-
-// EAS Observe:启用 expo-router 集成,采集 per-route 导航指标(cold_ttr / warm_ttr / tti)。
-// 必须在挂载前的模块作用域调用;否则 useObserve().markInteractive 会退化为全局兜底、不记 per-route。
-Observe.configure({ integrations: { 'expo-router': true } });
function NavigationGate() {
const auth = useAuth();
@@ -335,6 +330,4 @@ const styles = StyleSheet.create({
},
});
-// EAS Observe:包裹根布局以采集启动 / 首屏 / OTA 等性能与采用数据。
-// 入口屏(首页 / 会话 / 登录)各自用 useObserve().markInteractive 标记可交互时刻。
-export default ObserveRoot.wrap(RootLayout);
+export default RootLayout;
diff --git a/apps/mobile/app/devices/index.tsx b/apps/mobile/app/devices/index.tsx
index 1882cefc5b..85ec3d797e 100644
--- a/apps/mobile/app/devices/index.tsx
+++ b/apps/mobile/app/devices/index.tsx
@@ -55,7 +55,6 @@ import { buildMainWindowLayout } from '@/components/mainWindowLayout';
import { useScreenEdgePadding } from '@/components/screenEdgeInsets';
import { isAccessRevokedError } from '@/device-link/accessRevoked';
import { useDeviceLink } from '@/device-link/DeviceLinkContext';
-import { useObserve } from '@/observability/observe';
import {
createEmptyDeviceIdentityCache,
loadDeviceIdentityCache,
@@ -796,11 +795,6 @@ export default function HomeScreen() {
const initialHomeSettled = deviceIdentityCacheReady && lastSyncedAt !== null;
const initialHomeLoading = !initialHomeSettled && !connectionError;
const initialHomeError = !initialHomeSettled && !!connectionError;
- // EAS Observe:首页设备 / 会话首次加载完成即标记可交互(markInteractive 每 route 仅记首次)。
- const { markInteractive } = useObserve();
- useEffect(() => {
- if (initialHomeSettled) markInteractive();
- }, [initialHomeSettled, markInteractive]);
// 首次同步完成后校验恢复/当前选中的设备,不成立时回退「所有对话」并同步持久化:
// - 设备已不存在(解绑):home.selectedDeviceId 是归一化后的口径,查不到会变 null,
// 若不回退,表头显示旧设备名而列表实际展示全部会话,两者口径不一致。
diff --git a/apps/mobile/app/sessions/[sessionId].tsx b/apps/mobile/app/sessions/[sessionId].tsx
index e97eaef5cf..eaab4ada15 100644
--- a/apps/mobile/app/sessions/[sessionId].tsx
+++ b/apps/mobile/app/sessions/[sessionId].tsx
@@ -77,7 +77,6 @@ import { useRemoteSyncTask } from '@/device-link/remoteSyncTask';
import { useMobileMakerTransport } from '@/device-link/useMobileMakerTransport';
import { createMobileMakerTransport } from '@/device-link/mobileMakerTransport';
import { startFocusedTopicSubscription } from '@/device-link/focusedTopicSubscription';
-import { useObserve } from '@/observability/observe';
import { InteractionPanel, type MobilePlanViewerState } from '@/session/InteractionPanel';
import { MessageRenderer, type MobileMessageDraft } from '@/session/MessageRenderer';
import { ComposerRichInput, type ComposerRichInputHandle } from '@/session/ComposerRichInput';
@@ -660,11 +659,6 @@ export default function SessionScreen() {
const makerTurnRunning = useSessionMakerTurnRunning(sessionId);
const remoteSessionRunStatus = useSessionRunStatus(sessionId);
const taskUpdates = useSessionTaskUpdates(sessionId);
- // EAS Observe:会话消息首次渲染即标记可交互(覆盖冷启 deep-link;markInteractive 每 route 仅记首次)。
- const { markInteractive } = useObserve();
- useEffect(() => {
- if (messages.length > 0) markInteractive();
- }, [messages.length, markInteractive]);
const [draft, setDraft] = useState('');
const [composerDocument, setComposerDocumentState] = useState<ComposerDocument>(emptyComposerDocument);
const [composerDraftHydrated, setComposerDraftHydrated] = useState(false);
diff --git a/apps/mobile/package.json b/apps/mobile/package.json
index 58732ccb88..13be6e1237 100644
--- a/apps/mobile/package.json
+++ b/apps/mobile/package.json
@@ -35,7 +35,6 @@
"expo-localization": "~56.0.6",
"expo-media-library": "~56.0.8",
"expo-notifications": "~56.0.22",
- "expo-observe": "~56.0.21",
"expo-paste-input": "0.2.2",
"expo-router": "^56.2.11",
"expo-secure-store": "^56.0.4",
diff --git a/apps/mobile/src/observability/observe.ts b/apps/mobile/src/observability/observe.ts
deleted file mode 100644
index c5bd2a56a3..0000000000
--- a/apps/mobile/src/observability/observe.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import Constants, { ExecutionEnvironment } from 'expo-constants';
-import React, { type ComponentType, type ReactNode } from 'react';
-import type { ObserveConfig } from 'expo-observe';
-
-type ExpoObserveModule = typeof import('expo-observe');
-type ObserveApi = ExpoObserveModule['Observe'];
-type ObserveRootApi = ExpoObserveModule['ObserveRoot'];
-
-const isStoreClient =
- Constants.executionEnvironment === ExecutionEnvironment.StoreClient;
-
-let expoObserveModule: ExpoObserveModule | null | undefined;
-
-function loadExpoObserve(): ExpoObserveModule | null {
- if (isStoreClient) return null;
- if (expoObserveModule === undefined) {
- expoObserveModule = require('expo-observe') as ExpoObserveModule;
- }
- return expoObserveModule;
-}
-
-const noopObserve = {
- configure(_config: ObserveConfig) {},
- setBundleDefaults() {},
- markInteractive() {},
-} as unknown as ObserveApi;
-
-const NoopObserveRoot = (({ children }: { children: ReactNode }) =>
- React.createElement(React.Fragment, null, children)) as ObserveRootApi;
-
-NoopObserveRoot.wrap = function wrap<P extends Record<string, unknown>>(
- Component: ComponentType<P>,
-): ComponentType<P> {
- const Wrapped = (props: P) => React.createElement(Component, props);
- Wrapped.displayName = `ObserveRoot(${
- Component.displayName || Component.name || 'Component'
- })`;
- return Wrapped;
-};
-
-export const Observe = loadExpoObserve()?.Observe ?? noopObserve;
-export const ObserveRoot = loadExpoObserve()?.ObserveRoot ?? NoopObserveRoot;
-export const observeDisabledForExpoGo = isStoreClient;
-
-const noopObserveHookValue = {
- markInteractive() {},
-};
-
-export function useObserve(): ReturnType<ExpoObserveModule['useObserve']> {
- const observeModule = loadExpoObserve();
- if (observeModule) return observeModule.useObserve();
- return noopObserveHookValue;
-}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index abe3cd06ed..aea2084941 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -598,9 +598,6 @@ importers:
expo-notifications:
specifier: ~56.0.22
version: 56.0.22([email protected])([email protected](patch_hash=9442031604caa9cd185e0b2be6867055459fc3a6d2781296027989db098f972d)(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])([email protected])
- expo-observe:
- specifier: ~56.0.21
- version: 56.0.25([email protected])([email protected])([email protected](patch_hash=9442031604caa9cd185e0b2be6867055459fc3a6d2781296027989db098f972d)(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
expo-paste-input:
specifier: 0.2.2
version: 0.2.2(patch_hash=53be555646735a171c1624f074ef30e5ca897a7b8893724bc2d0d51682f769d8)([email protected])([email protected](patch_hash=9442031604caa9cd185e0b2be6867055459fc3a6d2781296027989db098f972d)(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
@@ -6584,13 +6581,6 @@ packages:
resolution: {integrity: sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==}
engines: {node: '>=12.0.0'}
- resolution: {integrity: sha512-xgpTuQ6uDRqgP0N0XNM5IfyWJRkuVqiwmm61Rp1JGUI/6ZXnlDtyhCZFTluvaiEsaKhF88Q+6TLjOw3+9V0RJA==}
- peerDependencies:
- expo: '*'
- react: '*'
- react-native: '*'
-
resolution: {integrity: sha512-y9cIfulRCKyWrbWBx6lV172dnJZ+aNHdyEPC7tIlGJAO2zn3J1Vq6/mcKr2eynzjdt3e5Z02qeZWQN2R7rcbrg==}
peerDependencies:
@@ -6772,20 +6762,6 @@ packages:
react: '*'
react-native: '*'
- resolution: {integrity: sha512-IXjKwu34NGdDl6lemL0z65roqeKUyg4MsP+KdXxrbVxwv4Rjs7rWt2FBYsXM5Lu/4Un44y6S2AuROs0yLodv/A==}
- peerDependencies:
- '@react-navigation/native': ^7.0.0
- expo: '*'
- expo-router: '*'
- react: '*'
- react-native: '*'
- peerDependenciesMeta:
- '@react-navigation/native':
- optional: true
- expo-router:
- optional: true
-
resolution: {integrity: sha512-uDv5qi+/FRsEYwVF0Y9MJE7k9pxTNpI77jOnNqS1TQDQlqSfj11O5yvd+G8e7Hi8fDVBZx/BhyImG0b9sK/zIQ==}
peerDependencies:
@@ -16845,13 +16821,6 @@ snapshots:
- [email protected]([email protected])([email protected](patch_hash=9442031604caa9cd185e0b2be6867055459fc3a6d2781296027989db098f972d)(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected]):
- dependencies:
- expo: 56.0.16(bedb3dfb85b4bb5081482612eab0a2c6)
- expo-updates-interface: 56.0.2([email protected])
- react: 19.2.3
- react-native: 0.85.3(patch_hash=9442031604caa9cd185e0b2be6867055459fc3a6d2781296027989db098f972d)(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])
-
[email protected]([email protected])([email protected](patch_hash=9442031604caa9cd185e0b2be6867055459fc3a6d2781296027989db098f972d)(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected]):
dependencies:
expo: 56.0.16(bedb3dfb85b4bb5081482612eab0a2c6)
@@ -17051,16 +17020,6 @@ snapshots:
- supports-color
- typescript
- [email protected]([email protected])([email protected])([email protected](patch_hash=9442031604caa9cd185e0b2be6867055459fc3a6d2781296027989db098f972d)(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected]):
- dependencies:
- expo: 56.0.16(bedb3dfb85b4bb5081482612eab0a2c6)
- expo-app-metrics: 56.0.22([email protected])([email protected](patch_hash=9442031604caa9cd185e0b2be6867055459fc3a6d2781296027989db098f972d)(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected])
- expo-eas-client: 56.0.1
- react: 19.2.3
- react-native: 0.85.3(patch_hash=9442031604caa9cd185e0b2be6867055459fc3a6d2781296027989db098f972d)(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected])
- optionalDependencies:
- expo-router: 56.2.15(600de089274a49ab6ec9549ee6c8284a)
-
[email protected](patch_hash=53be555646735a171c1624f074ef30e5ca897a7b8893724bc2d0d51682f769d8)([email protected])([email protected](patch_hash=9442031604caa9cd185e0b2be6867055459fc3a6d2781296027989db098f972d)(@babel/[email protected])(@react-native/[email protected](@babel/[email protected]))(@types/[email protected])([email protected]))([email protected]):
dependencies:
expo: 56.0.16(bedb3dfb85b4bb5081482612eab0a2c6)