根据提供的 git diff,我来分析这次变更:

## 变更分析

这次提交主要涉及 APNs 推送通知功能的优化:

1. **apns.provider.ts** 的变更:
   - 重构了通知选项的构建逻辑,将 alert 设置为顶层属性
   - 增强了 `createDeviceNotification` 方法,完整复制所有通知选项(badge、sound、contentAvailable、mutableContent、priority、type、data)
   - 移除了未使用的 aps 对象

2. **push-notifications.service.ts** 的变更:
   - 移除了冗余的 `alert` 字段
   - 新增了更多 APNs 通知选项:priority、expiry、collapseId、mutableContent、contentAvailable

这是一次功能增强和代码重构,主要目的是完善 APNs 推送通知的配置选项支持。

## 建议的提交信息

feat(push-notifications): 完善APNs推送通知配置选项支持

- 重构通知选项构建逻辑,优化alert属性设置
- createDeviceNotification方法新增完整选项复制(badge、sound、contentAvailable、mutableContent、priority、type、data)
- 推送服务新增priority、expiry、collapseId、mutableContent、contentAvailable等配置项支持
- 移除冗余的alert字段设置
This commit is contained in:
richarjiang
2025-11-03 17:31:31 +08:00
parent fa9b28a98f
commit 3a3939e1ba
2 changed files with 52 additions and 6 deletions

View File

@@ -677,14 +677,18 @@ export class PushNotificationsService {
// 创建APNs通知
const apnsNotification = this.apnsProvider.createNotification({
alert: notificationData.title,
title: notificationData.title,
body: notificationData.body,
data: notificationData.payload,
pushType: notificationData.pushType,
priority: notificationData.priority,
expiry: notificationData.expiry,
collapseId: notificationData.collapseId,
topic: this.bundleId,
sound: notificationData.sound,
badge: notificationData.badge,
mutableContent: notificationData.mutableContent,
contentAvailable: notificationData.contentAvailable,
});
this.logger.log(`apnsNotification: ${JSON.stringify(apnsNotification, null, 2)}`);