Skip to content

Commit 8314fcf

Browse files
guangyaoguangyao
authored andcommitted
增加两个点击推送消息启动的监听
1 parent c2c16fb commit 8314fcf

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

ios/RNNeteaseIm/RNNeteaseIm/RNNeteaseIm.m

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,30 @@
1212

1313
@implementation RNNeteaseIm
1414

15+
- (void)dealloc{
16+
[[NSNotificationCenter defaultCenter]removeObserver:self];
17+
}
18+
1519
- (instancetype)init{
1620
if (self = [super init]) {
1721

1822
}
1923
[self initController];
24+
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(clickObserveNotification:) name:@"ObservePushNotification" object:nil];
2025
return self;
2126
}
2227

28+
- (void)clickObserveNotification:(NSNotification *)noti{
29+
NSDictionary *dict = noti.object;
30+
NSDictionary *param = [dict objectForKey:@"dict"];
31+
if ([[dict objectForKey:@"type"] isEqualToString:@"launch"]) {
32+
[_bridge.eventDispatcher sendDeviceEventWithName:@"observeLaunchPushEvent" body:param];
33+
}else{
34+
[_bridge.eventDispatcher sendDeviceEventWithName:@"observeBackgroundPushEvent" body:param];
35+
}
36+
}
37+
38+
2339
@synthesize bridge = _bridge;
2440
- (dispatch_queue_t)methodQueue
2541
{

0 commit comments

Comments
 (0)