收紧移动壳角标真实结果
移动 iOS 角标改为请求 badge 权限后调用 Expo Notifications 角标设置以 setBadgeCountAsync 返回值作为成功依据 测试和门禁覆盖权限拒绝与系统拒绝设置失败 文档和项目记忆同步角标能力边界
This commit is contained in:
@@ -2718,8 +2718,12 @@ for (const snippet of [
|
||||
'HOST_BRIDGE_BADGE_COUNT_MAX',
|
||||
'request: HostBridgeRequest',
|
||||
'normalizeHostBridgeBadgeCount',
|
||||
'PushNotificationIOS.setApplicationIconBadgeNumber(count)',
|
||||
'ok(request, true)',
|
||||
'Notifications.getPermissionsAsync',
|
||||
'Notifications.requestPermissionsAsync',
|
||||
'Notifications.setBadgeCountAsync(count)',
|
||||
'allowBadge: true',
|
||||
'app badge permission denied',
|
||||
'app badge update unavailable',
|
||||
'app badge count is only supported on iOS mobile shell',
|
||||
]) {
|
||||
if (!badgeSource.includes(snippet)) {
|
||||
@@ -2728,10 +2732,11 @@ for (const snippet of [
|
||||
}
|
||||
for (const snippet of [
|
||||
"test('app.setBadgeCount 拒绝非法数量并在 Android 返回 unsupported'",
|
||||
"test('app.setBadgeCount 在 iOS 角标权限拒绝时不返回成功'",
|
||||
"setPlatformOS('android')",
|
||||
"request('app.setBadgeCount',",
|
||||
"expect(expectFailed(unsupported).error.code).toBe('unsupported_capability')",
|
||||
'expect(PushNotificationIOS.setApplicationIconBadgeNumber).not.toHaveBeenCalled()',
|
||||
'expect(Notifications.setBadgeCountAsync).not.toHaveBeenCalled()',
|
||||
]) {
|
||||
if (!bridgeTestSource.includes(snippet)) {
|
||||
throw new Error(
|
||||
@@ -2740,10 +2745,16 @@ for (const snippet of [
|
||||
}
|
||||
}
|
||||
for (const snippet of [
|
||||
'sets and clears the iOS app badge count through PushNotificationIOS',
|
||||
'sets and clears the iOS app badge count through Expo Notifications',
|
||||
'requests iOS badge permission before updating when it is missing',
|
||||
'rejects denied iOS badge permission before touching the system badge',
|
||||
'maps native badge update false results to a stable HostBridge error',
|
||||
'maps native badge update rejections to a stable HostBridge error',
|
||||
'rejects invalid badge counts before touching the system badge',
|
||||
'rejects missing badge payload before touching the system badge',
|
||||
'returns unsupported on Android before validating payload or touching badge APIs',
|
||||
'allowBadge: true',
|
||||
'app badge permission denied',
|
||||
'HOST_BRIDGE_BADGE_COUNT_MAX + 1',
|
||||
"setPlatformOS('android')",
|
||||
'not.toHaveBeenCalled()',
|
||||
|
||||
Reference in New Issue
Block a user