Skip to content

Commit

Permalink
add setbadge api
Browse files Browse the repository at this point in the history
  • Loading branch information
huangminlinux committed Jan 31, 2018
1 parent 458e864 commit 3ffb97a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ios/Plugins/JMessagePlugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,5 @@
- (void)getChatRoomConversationList:(CDVInvokedUrlCommand *)command;
- (void)getChatRoomOwner:(CDVInvokedUrlCommand *)command;

- (void)setBadge:(CDVInvokedUrlCommand *)command;
@end
8 changes: 8 additions & 0 deletions src/ios/Plugins/JMessagePlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -2343,4 +2343,12 @@ - (void)getChatRoomOwner:(CDVInvokedUrlCommand *)command {
}];
}


- (void)setBadge:(CDVInvokedUrlCommand *)command {
NSDictionary * param = [command argumentAtIndex:0];

if (param[@"badge"]) {
[JMessage setBadge:[param[@"badge"] integerValue]];
}
}
@end
12 changes: 12 additions & 0 deletions www/JMessagePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,18 @@ var JMessagePlugin = {
logout: function () {
exec(null, null, PLUGIN_NAME, 'userLogout', [])
},
/**
* 设置 JMessage 服务器角标。
* @param {object} params = {
* badge: number
* }
*/
setBadge: function (params) {
if (device.platform !== 'Android') {
exec(null, null, PLUGIN_NAME, 'setBadge', [params])
}

},
/**
* 登录成功则返回用户信息,未登录则对应用户信息为空对象。
*
Expand Down

0 comments on commit 3ffb97a

Please sign in to comment.