更新 shenyan-app: APNs后台推送 + 通知点开进门 + cyberboss主动联系
- APNs: 修复AppDelegate推送回调转发(Bridging Header),设备token注册成功 - 通知: 点开系统通知直接进聊天屏, badge自动清零 - 主动联系: cyberboss守护进程, 3-60分钟随机判断, 按沈晏规则决定是否推送 - 气泡: 左右统一25%白色背景 - push-notification-ios包集成, Podfile更新 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -29,8 +29,23 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
||||
launchOptions: launchOptions
|
||||
)
|
||||
|
||||
// register for push notifications — bypasses broken Turbo Module impl
|
||||
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .badge, .sound]) { granted, _ in
|
||||
if granted {
|
||||
DispatchQueue.main.async { application.registerForRemoteNotifications() }
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
|
||||
RNCPushNotificationIOS.didRegisterForRemoteNotifications(withDeviceToken: deviceToken)
|
||||
}
|
||||
|
||||
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
|
||||
RNCPushNotificationIOS.didFailToRegisterForRemoteNotificationsWithError(error)
|
||||
}
|
||||
}
|
||||
|
||||
class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
|
||||
|
||||
1
shenyan-app/ios/ShenYanApp/ShenYanApp-Bridging-Header.h
Normal file
1
shenyan-app/ios/ShenYanApp/ShenYanApp-Bridging-Header.h
Normal file
@@ -0,0 +1 @@
|
||||
#import <RNCPushNotificationIOS/RNCPushNotificationIOS.h>
|
||||
8
shenyan-app/ios/ShenYanApp/ShenYanApp.entitlements
Normal file
8
shenyan-app/ios/ShenYanApp/ShenYanApp.entitlements
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>aps-environment</key>
|
||||
<string>development</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Reference in New Issue
Block a user