From 754def28a5488fc93de543e7efeb10cc0bb68d86 Mon Sep 17 00:00:00 2001 From: AprilNEA Date: Sun, 2 Aug 2026 02:31:13 +0800 Subject: [PATCH] feat(mobile): add remote push notifications --- apps/mobile/src/app/_layout.tsx | 2 + apps/mobile/src/app/account.tsx | 5 +- apps/mobile/src/app/settings.tsx | 50 ++++++++++++++- .../components/shell/notification-observer.ts | 58 ++++++++++++++++++ .../__tests__/notification-route.test.ts | 16 +++++ apps/mobile/src/runtime/cloud/account.ts | 7 +++ apps/mobile/src/runtime/cloud/devices.ts | 15 +++++ apps/mobile/src/runtime/notification-route.ts | 23 +++++++ apps/mobile/src/runtime/notifications.ts | 61 +++++++++++++++++++ apps/mobile/src/stores/settings-store.ts | 16 ++++- packages/presentation/i18n/src/locales/en.ts | 10 +++ .../presentation/i18n/src/locales/zh-cn.ts | 10 +++ 12 files changed, 267 insertions(+), 6 deletions(-) create mode 100644 apps/mobile/src/components/shell/notification-observer.ts create mode 100644 apps/mobile/src/runtime/__tests__/notification-route.test.ts create mode 100644 apps/mobile/src/runtime/notification-route.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 c283471cc..11af1effc 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'; @@ -78,6 +79,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 {