Skip to content

Commit 4e5c3d5

Browse files
author
wicked-tc130
authored
Merge pull request #674 from jpush/dev
更新版本号到2.5.9
2 parents 00eb100 + bc2b1bf commit 4e5c3d5

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

ios/RCTJPushModule/RCTJPushModule.m

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,17 @@ -(NSDictionary *)convertApnsMessage:(NSNotification *)data{
360360
NSNotificationName notificationName = data.name;
361361
NSDictionary *objectData = data.object;
362362
NSString *notificationType = ([notificationName isEqualToString:J_APNS_NOTIFICATION_OPENED_EVENT])?NOTIFICATION_OPENED:NOTIFICATION_ARRIVED;
363-
NSDictionary *apnsData = objectData[@"aps"][@"alert"];
363+
id alertData = objectData[@"aps"][@"alert"];
364+
NSString *title = @"";
365+
NSString *content = @"";
366+
367+
if([alertData isKindOfClass:[NSString class]]){
368+
content = alertData;
369+
}else if([alertData isKindOfClass:[NSDictionary class]]){
370+
title = alertData[@"title"]?alertData[@"title"]:@"";
371+
content = alertData[@"body"]?alertData[@"body"]:@"";
372+
}
373+
364374
NSDictionary *responseData;
365375
NSMutableDictionary * copyData = [[NSMutableDictionary alloc] initWithDictionary:objectData];
366376
if (copyData[@"_j_business"]) {
@@ -372,11 +382,6 @@ -(NSDictionary *)convertApnsMessage:(NSNotification *)data{
372382
[copyData removeObjectForKey:@"_j_msgid"];
373383
if (copyData[@"aps"]) {
374384
[copyData removeObjectForKey:@"aps"];
375-
}
376-
@try {
377-
378-
} @catch (NSException *exception) {
379-
380385
}
381386
NSMutableDictionary * extrasData = [[NSMutableDictionary alloc] init];
382387

@@ -387,11 +392,12 @@ -(NSDictionary *)convertApnsMessage:(NSNotification *)data{
387392
NSString *value = [copyData objectForKey:key];
388393
[extrasData setObject:value forKey:key];
389394
};
395+
390396
if (extrasData.count > 0) {
391-
responseData = @{MESSAGE_ID:objectData[@"_j_msgid"],TITLE:apnsData[@"title"],CONTENT:apnsData[@"body"],EXTRAS:extrasData,NOTIFICATION_TYPE:notificationType};
397+
responseData = @{MESSAGE_ID:objectData[@"_j_msgid"],TITLE:title,CONTENT:content,EXTRAS:extrasData,NOTIFICATION_TYPE:notificationType};
392398
}
393399
else {
394-
responseData = @{MESSAGE_ID:objectData[@"_j_msgid"],TITLE:apnsData[@"title"],CONTENT:apnsData[@"body"],NOTIFICATION_TYPE:notificationType};
400+
responseData = @{MESSAGE_ID:objectData[@"_j_msgid"],TITLE:title,CONTENT:content,NOTIFICATION_TYPE:notificationType};
395401
}
396402
return responseData;
397403
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
]
1515
],
1616
"_from": "..",
17-
"_id": "[email protected].8",
17+
"_id": "[email protected].9",
1818
"_inCache": true,
1919
"_installable": true,
2020
"_location": "/jpush-react-native",
@@ -103,5 +103,5 @@
103103
"ios/"
104104
]
105105
},
106-
"version": "2.5.8"
106+
"version": "2.5.9"
107107
}

0 commit comments

Comments
 (0)