From 79754fff6f912bc359c075f216d053120ec12f55 Mon Sep 17 00:00:00 2001 From: AprilNEA Date: Thu, 27 Aug 2026 21:52:14 +0800 Subject: [PATCH 1/5] feat(mobile): add remote push notifications --- apps/mobile/src/app/_layout.tsx | 2 + apps/mobile/src/app/account.tsx | 5 +- .../components/account/devices-section.tsx | 13 +- .../components/settings/settings-screen.tsx | 49 ++++++- .../components/shell/notification-observer.ts | 70 ++++++++++ apps/mobile/src/runtime/cloud/account.ts | 15 ++- apps/mobile/src/runtime/cloud/devices.ts | 15 +++ apps/mobile/src/runtime/notification-route.ts | 27 ++++ .../runtime/notification-token-coordinator.ts | 39 ++++++ apps/mobile/src/runtime/notifications.ts | 120 ++++++++++++++++++ apps/mobile/src/stores/settings-store.ts | 11 +- packages/presentation/i18n/src/locales/en.ts | 10 ++ .../presentation/i18n/src/locales/zh-cn.ts | 10 ++ 13 files changed, 365 insertions(+), 21 deletions(-) create mode 100644 apps/mobile/src/components/shell/notification-observer.ts create mode 100644 apps/mobile/src/runtime/notification-route.ts create mode 100644 apps/mobile/src/runtime/notification-token-coordinator.ts create mode 100644 apps/mobile/src/runtime/notifications.ts diff --git a/apps/mobile/src/app/_layout.tsx b/apps/mobile/src/app/_layout.tsx index dbb5caa31..9fbf824d1 100644 --- a/apps/mobile/src/app/_layout.tsx +++ b/apps/mobile/src/app/_layout.tsx @@ -10,6 +10,7 @@ import { AppKeyboardProvider, AppThemeProvider, } from '@mobile/components/shell/app-providers'; +import { NotificationObserver } from '@mobile/components/shell/notification-observer'; import { MobileProductAnalyticsProvider } from '@mobile/components/shell/product-analytics-provider'; import { RootNavigator } from '@mobile/components/shell/root-navigator'; import { ThemeController } from '@mobile/components/shell/theme-controller'; @@ -84,6 +85,7 @@ function RootLayout() { ]} > + diff --git a/apps/mobile/src/app/account.tsx b/apps/mobile/src/app/account.tsx index aeaa5770c..f42306ea2 100644 --- a/apps/mobile/src/app/account.tsx +++ b/apps/mobile/src/app/account.tsx @@ -3,6 +3,7 @@ import { DevicesSection } from '@mobile/components/account/devices-section'; import { ProfileRow } from '@mobile/components/account/profile-row'; import { signOutOfCloud, useCloudAccount } from '@mobile/runtime/cloud/account'; import { Redirect, Stack } from 'expo-router'; +import { Alert } from 'react-native'; import { useTranslations } from 'use-intl'; /** Account screen: profile, the account's device registry, and sign-out. */ @@ -30,9 +31,7 @@ export default function AccountScreen(): React.ReactNode {