├── .gitignore ├── .npmignore ├── LICENSE ├── README.md ├── doc └── api.md ├── example ├── css │ ├── index.css │ ├── jquery.mobile-1.1.1.css │ ├── mobiscroll.core-2.0.1.css │ ├── mobiscroll.jqm-2.0.1.css │ └── themes │ │ └── default │ │ ├── images │ │ ├── ajax-loader.gif │ │ ├── icons-18-black.png │ │ ├── icons-18-white.png │ │ ├── icons-36-black.png │ │ └── icons-36-white.png │ │ ├── jquery.mobile-1.3.2.css │ │ ├── jquery.mobile-1.3.2.min.css │ │ ├── jquery.mobile.structure-1.3.2.css │ │ ├── jquery.mobile.structure-1.3.2.min.css │ │ ├── jquery.mobile.theme-1.3.2.css │ │ └── jquery.mobile.theme-1.3.2.min.css ├── index.html └── js │ ├── jquery.js │ ├── jquery.mobile-1.3.2.js │ ├── jquery.mobile-1.3.2.min.js │ └── jquery.mobile-1.3.2.min.map ├── ionic ├── example │ ├── README.md │ ├── config.xml │ ├── ionic.config.json │ ├── package-lock.json │ ├── package.json │ ├── resources │ │ ├── README.md │ │ ├── android │ │ │ ├── icon │ │ │ │ ├── drawable-hdpi-icon.png │ │ │ │ ├── drawable-ldpi-icon.png │ │ │ │ ├── drawable-mdpi-icon.png │ │ │ │ ├── drawable-xhdpi-icon.png │ │ │ │ ├── drawable-xxhdpi-icon.png │ │ │ │ └── drawable-xxxhdpi-icon.png │ │ │ └── splash │ │ │ │ ├── drawable-land-hdpi-screen.png │ │ │ │ ├── drawable-land-ldpi-screen.png │ │ │ │ ├── drawable-land-mdpi-screen.png │ │ │ │ ├── drawable-land-xhdpi-screen.png │ │ │ │ ├── drawable-land-xxhdpi-screen.png │ │ │ │ ├── drawable-land-xxxhdpi-screen.png │ │ │ │ ├── drawable-port-hdpi-screen.png │ │ │ │ ├── drawable-port-ldpi-screen.png │ │ │ │ ├── drawable-port-mdpi-screen.png │ │ │ │ ├── drawable-port-xhdpi-screen.png │ │ │ │ ├── drawable-port-xxhdpi-screen.png │ │ │ │ └── drawable-port-xxxhdpi-screen.png │ │ ├── icon.png │ │ ├── ios │ │ │ ├── icon │ │ │ │ ├── icon-1024.png │ │ │ │ ├── icon-40.png │ │ │ │ ├── icon-40@2x.png │ │ │ │ ├── icon-40@3x.png │ │ │ │ ├── icon-50.png │ │ │ │ ├── icon-50@2x.png │ │ │ │ ├── icon-60.png │ │ │ │ ├── icon-60@2x.png │ │ │ │ ├── icon-60@3x.png │ │ │ │ ├── icon-72.png │ │ │ │ ├── icon-72@2x.png │ │ │ │ ├── icon-76.png │ │ │ │ ├── icon-76@2x.png │ │ │ │ ├── icon-83.5@2x.png │ │ │ │ ├── icon-small.png │ │ │ │ ├── icon-small@2x.png │ │ │ │ ├── icon-small@3x.png │ │ │ │ ├── icon.png │ │ │ │ └── icon@2x.png │ │ │ └── splash │ │ │ │ ├── Default-568h@2x~iphone.png │ │ │ │ ├── Default-667h.png │ │ │ │ ├── Default-736h.png │ │ │ │ ├── Default-Landscape-736h.png │ │ │ │ ├── Default-Landscape@2x~ipad.png │ │ │ │ ├── Default-Landscape@~ipadpro.png │ │ │ │ ├── Default-Landscape~ipad.png │ │ │ │ ├── Default-Portrait@2x~ipad.png │ │ │ │ ├── Default-Portrait@~ipadpro.png │ │ │ │ ├── Default-Portrait~ipad.png │ │ │ │ ├── Default@2x~iphone.png │ │ │ │ ├── Default@2x~universal~anyany.png │ │ │ │ └── Default~iphone.png │ │ └── splash.png │ ├── src │ │ ├── app │ │ │ ├── app.component.ts │ │ │ ├── app.html │ │ │ ├── app.module.ts │ │ │ ├── app.scss │ │ │ └── main.ts │ │ ├── assets │ │ │ ├── icon │ │ │ │ └── favicon.ico │ │ │ └── imgs │ │ │ │ ├── Translations.json │ │ │ │ ├── alert-icon.png │ │ │ │ ├── camera.png │ │ │ │ ├── chat-icon.png │ │ │ │ ├── friend-icon.png │ │ │ │ ├── group-icon.png │ │ │ │ ├── logo.png │ │ │ │ ├── logout-icon.png │ │ │ │ ├── myinfo-icon.png │ │ │ │ ├── setting-icon.png │ │ │ │ ├── setting.png │ │ │ │ ├── singgle-icon.png │ │ │ │ └── user-icon.png │ │ ├── index.html │ │ ├── manifest.json │ │ ├── pages │ │ │ ├── chat │ │ │ │ ├── chat.html │ │ │ │ ├── chat.scss │ │ │ │ └── chat.ts │ │ │ ├── home │ │ │ │ ├── home.html │ │ │ │ ├── home.scss │ │ │ │ └── home.ts │ │ │ ├── login │ │ │ │ ├── login.html │ │ │ │ ├── login.scss │ │ │ │ └── login.ts │ │ │ ├── register │ │ │ │ ├── register.html │ │ │ │ └── register.ts │ │ │ ├── tabbar │ │ │ │ ├── contact │ │ │ │ │ ├── contact.html │ │ │ │ │ └── contact.ts │ │ │ │ ├── conversationList │ │ │ │ │ ├── conversationList.html │ │ │ │ │ └── conversationList.ts │ │ │ │ ├── myAccount │ │ │ │ │ ├── myAccount.html │ │ │ │ │ ├── myAccount.scss │ │ │ │ │ └── myAccount.ts │ │ │ │ ├── tabbar.html │ │ │ │ └── tabbar.ts │ │ │ └── userDetail │ │ │ │ ├── userDetail.html │ │ │ │ └── userDetail.ts │ │ ├── service-worker.js │ │ └── theme │ │ │ └── variables.scss │ ├── tsconfig.json │ └── tslint.json ├── index.ts └── jmessage │ ├── index.d.ts │ ├── index.js │ ├── ngx │ ├── index.d.ts │ ├── index.js │ └── index.metadata.json │ └── package.json ├── issue_template.md ├── package.json ├── plugin.xml ├── src ├── android │ ├── ChatroomHandler.java │ ├── EventUtils.java │ ├── JMessagePlugin.java │ ├── JMessageUtils.java │ ├── JsonUtils.java │ ├── Logger.java │ └── libs │ │ └── jmessage-sdk-android-2.7.1.jar └── ios │ ├── JMessageConfig.plist │ ├── Plugins │ ├── AppDelegate+JMessage.h │ ├── AppDelegate+JMessage.m │ ├── JMessageDefine.h │ ├── JMessageHelper.h │ ├── JMessageHelper.m │ ├── JMessagePlugin.h │ └── JMessagePlugin.m │ └── lib │ └── JMessage.framework │ ├── Headers │ ├── JMSGAbstractContent.h │ ├── JMSGChatRoom.h │ ├── JMSGConstants.h │ ├── JMSGConversation.h │ ├── JMSGConversationDelegate.h │ ├── JMSGCustomContent.h │ ├── JMSGDBMigrateDelegate.h │ ├── JMSGEventContent.h │ ├── JMSGEventDelegate.h │ ├── JMSGFileContent.h │ ├── JMSGFriendManager.h │ ├── JMSGFriendNotificationEvent.h │ ├── JMSGGroup.h │ ├── JMSGGroupDelegate.h │ ├── JMSGImageContent.h │ ├── JMSGLocationContent.h │ ├── JMSGMediaAbstractContent.h │ ├── JMSGMessage.h │ ├── JMSGMessageDelegate.h │ ├── JMSGNotificationEvent.h │ ├── JMSGOptionalContent.h │ ├── JMSGPromptContent.h │ ├── JMSGTextContent.h │ ├── JMSGUser.h │ ├── JMSGUserDelegate.h │ ├── JMSGVideoContent.h │ ├── JMSGVoiceContent.h │ ├── JMessage.h │ └── JMessageDelegate.h │ ├── Info.plist │ ├── JMessage │ └── Modules │ └── module.modulemap └── www └── JMessagePlugin.js /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | \.DS_Store 3 | 4 | ./ionic/example/platforms 5 | ./ionic/example/plugins 6 | ./ionic/example/node_modules -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | doc/ 2 | ionic/ 3 | example/ 4 | README.md -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) JiGuang (jiguang.cn) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JMessage PhoneGap / Cordova Plugin 2 | 3 | [![release](https://img.shields.io/badge/release-3.4.4-blue.svg)](https://github.com/jpush/jmessage-phonegap-plugin/releases) 4 | [![platforms](https://img.shields.io/badge/platforms-iOS%7CAndroid-green.svg)](https://github.com/jpush/jmessage-phonegap-plugin) 5 | [![Code Triagers Badge](https://www.codetriage.com/jpush/jmessage-phonegap-plugin/badges/users.svg)](https://www.codetriage.com/jpush/jmessage-phonegap-plugin) 6 | [![weibo](https://img.shields.io/badge/weibo-JPush-blue.svg)](http://weibo.com/jpush?refer_flag=1001030101_&is_all=1) 7 | 8 | 极光官方开发的[极光 IM](https://docs.jiguang.cn/jmessage/guideline/jmessage_guide/) cordova 插件,目前支持 iOS 和 Android 平台。 9 | 10 | 若只需要简单的聊天功能,可优先考虑使用 [JMessage Web SDK](https://docs.jiguang.cn/jmessage/client/im_sdk_js_v2/)。 11 | 12 | >注意:从 v3.4.0 开始支持 cordova-android 7.0.0,因 cordova-android 7.0.0 修改了 Android 项目结构,因此不兼容之前的版本,升级前请务必注意。 13 | > 14 | >如果需要在cordova-android 7.0.0之前版本集成最新插件,参照[这篇文章](https://www.jianshu.com/p/23b117ca27a6) 15 | > 16 | >如果需要安装之前版本的插件,请先安装 v1.2.0 以下版本(建议安装 v1.1.12)的 [cordova-plugin-jcore](https://github.com/jpush/cordova-plugin-jcore),再安装旧版插件(建议v3.2.0),否则运行会报错。 17 | > 18 | >[Cordova Android版本与原生版本对应表](http://cordova.apache.org/docs/en/latest/guide/platforms/android/index.html#requirements-and-support) 19 | 20 | ## Full Documentation 21 | 22 | 完整文档请查阅 [wiki](https://github.com/jpush/jmessage-phonegap-plugin/wiki),包括[安装指南](https://github.com/jpush/jmessage-phonegap-plugin/wiki/Installation-Guide)、[API 说明](https://github.com/jpush/jmessage-phonegap-plugin/wiki/APIs)等。 23 | 24 | ## Contribute 25 | 26 | Please contribute! [Look at the issues](https://github.com/jpush/jmessage-phonegap-plugin/issues). 27 | 28 | ## Support 29 | 30 | - QQ 群:413602425 / 524248013 31 | - [极光官网文档](http://docs.jiguang.cn/guideline/jmessage_guide/) 32 | - 有问题可访问[极光社区](http://community.jiguang.cn/)搜索和提问。 33 | -------------------------------------------------------------------------------- /doc/api.md: -------------------------------------------------------------------------------- 1 | # API 2 | 3 | API 使用文档可以直接参考 [JMessagePlugin.js](../www/JMessagePlugin.js) 中的注释。 4 | 5 | 这里列出插件中会返回的各对象组成: 6 | 7 | ```js 8 | UserInfo: { 9 | type: 'user', 10 | username: string, // 用户名。 11 | appKey: string, // 用户所属应用的 appKey。可与 username 共同作为用户的唯一标志。 12 | nickname: string, // 昵称。 13 | gender: string, // 'male' / 'female' / 'unknown' 14 | avatarThumbPath: string, // 头像的缩略图地址。 15 | birthday: number, // 日期的毫秒数。 16 | region: string, // 地区。 17 | signature: string, // 个性签名。 18 | address: string, // 具体地址。 19 | noteName: string, // 备注名。 20 | noteText: string, // 备注信息。 21 | isNoDisturb: boolean, // 是否免打扰。 22 | isInBlackList: boolean, // 是否在黑名单中。 23 | isFriend:boolean // 是否为好友。 24 | } 25 | ``` 26 | 27 | ```js 28 | GroupInfo: { 29 | type: 'group', 30 | id: string, // 群组 id, 31 | name: string, // 群组名称。 32 | desc: string, // 群组描述。 33 | level: number, // 群组等级,默认等级 4。 34 | owner: string, // 群主的 username。 35 | ownerAppKey: string, // 群主的 appKey。 36 | maxMemberCount: number, // 最大成员数。 37 | isNoDisturb: boolean, // 是否免打扰。 38 | isBlocked: boolean // 是否屏蔽群消息。 39 | } 40 | ``` 41 | 42 | ```js 43 | Conversation: { 44 | /** 45 | * 会话对象标题。 46 | * 如果为群聊: 47 | * - 未设置群名称:自动使用群成员中前五个人的名称拼接成 title。 48 | * - 设置了群名称,则显示群名称。 49 | * 如果为单聊:如果用户有昵称,显示昵称。否则显示 username。 50 | */ 51 | title: string, 52 | latestMessage: Message, // 最近的一条消息对象。 53 | unreadCount: number, // 未读消息数。 54 | conversationType: 'single' / 'group', 55 | target: UserInfo / GroupInfo // 聊天对象信息。 56 | } 57 | ``` 58 | 59 | ## Message 60 | 61 | ```js 62 | TextMessage: { 63 | id: string, // 消息 id。 64 | type: 'text', // 消息类型。 65 | from: UserInfo, // 消息发送者对象。 66 | target: UserInfo / GroupInfo, // 消息接收者对象。可能是用户或群组。 67 | createTime: number, // 发送消息时间。 68 | text: string, // 消息内容。 69 | extras: object // 附带的键值对对象。 70 | } 71 | ``` 72 | 73 | ```js 74 | ImageMessage: { 75 | id: string, 76 | type: 'image', 77 | from: UserInfo, 78 | target: UserInfo / GroupInfo, 79 | extras: object, 80 | thumbPath: string // 图片的缩略图路径。要下载原图需要调用 `downloadOriginalImage` 方法。 81 | } 82 | ``` 83 | 84 | ```js 85 | VoiceMessage: { 86 | id: string, 87 | type: 'image', 88 | from: UserInfo, 89 | target: UserInfo / GroupInfo, 90 | extras: object, 91 | path: string, // 语音文件路径。 92 | duration: number // 语音时长 93 | } 94 | ``` 95 | 96 | ```js 97 | LocationMessage: { 98 | id: string, 99 | type: 'voice', 100 | from: UserInfo, 101 | target: UserInfo / GroupInfo, 102 | extras: object, 103 | address: string, // 详细地址。 104 | longitude: number, // 经度。 105 | latitude: number, // 纬度。 106 | scale:number // 地图缩放比例。 107 | } 108 | ``` 109 | 110 | ```js 111 | FileMessage: { 112 | id: string, 113 | type: 'file', 114 | from: UserInfo, 115 | target: UserInfo / GroupInfo, 116 | extras: object, 117 | fileName: string // 文件名。要下载完整文件需要调用 `downloadFile` 方法。 118 | } 119 | ``` 120 | 121 | ```js 122 | CustomMessage: { 123 | id: string, 124 | type: 'file', 125 | from: UserInfo, 126 | target: UserInfo / GroupInfo, 127 | extras: object, 128 | customObject: object // 自定义键值对对象。 129 | } 130 | ``` 131 | 132 | ```js 133 | Event: { 134 | type: 'event', 135 | eventType: string, // 'group_member_added' / 'group_member_removed' / 'group_member_exit' / 'group_info_updated' / 'group_dissolved' / 'group_type_changed' 136 | usernames: Array // 该事件涉及到的用户 username 数组。 137 | } 138 | ``` -------------------------------------------------------------------------------- /example/css/index.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one 3 | * or more contributor license agreements. See the NOTICE file 4 | * distributed with this work for additional information 5 | * regarding copyright ownership. The ASF licenses this file 6 | * to you under the Apache License, Version 2.0 (the 7 | * "License"); you may not use this file except in compliance 8 | * with the License. You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, 13 | * software distributed under the License is distributed on an 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | * KIND, either express or implied. See the License for the 16 | * specific language governing permissions and limitations 17 | * under the License. 18 | */ 19 | * { 20 | -webkit-tap-highlight-color: rgba(0,0,0,0); /* make transparent link selection, adjust last value opacity 0 to 1.0 */ 21 | } 22 | 23 | body { 24 | -webkit-touch-callout: none; /* prevent callout to copy image, etc when tap to hold */ 25 | -webkit-text-size-adjust: none; /* prevent webkit from resizing text to fit */ 26 | -webkit-user-select: none; /* prevent copy paste, to allow, change 'none' to 'text' */ 27 | background-color:#E4E4E4; 28 | background-image:linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 29 | background-image:-webkit-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 30 | background-image:-ms-linear-gradient(top, #A7A7A7 0%, #E4E4E4 51%); 31 | background-image:-webkit-gradient( 32 | linear, 33 | left top, 34 | left bottom, 35 | color-stop(0, #A7A7A7), 36 | color-stop(0.51, #E4E4E4) 37 | ); 38 | background-attachment:fixed; 39 | font-family:'HelveticaNeue-Light', 'HelveticaNeue', Helvetica, Arial, sans-serif; 40 | font-size:12px; 41 | height:100%; 42 | margin:0px; 43 | padding:0px; 44 | text-transform:uppercase; 45 | width:100%; 46 | } 47 | 48 | /* Portrait layout (default) */ 49 | .app { 50 | background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */ 51 | position:absolute; /* position in the center of the screen */ 52 | left:50%; 53 | top:50%; 54 | height:50px; /* text area height */ 55 | width:225px; /* text area width */ 56 | text-align:center; 57 | padding:180px 0px 0px 0px; /* image height is 200px (bottom 20px are overlapped with text) */ 58 | margin:-115px 0px 0px -112px; /* offset vertical: half of image height and text area height */ 59 | /* offset horizontal: half of text area width */ 60 | } 61 | 62 | /* Landscape layout (with min-width) */ 63 | @media screen and (min-aspect-ratio: 1/1) and (min-width:400px) { 64 | .app { 65 | background-position:left center; 66 | padding:75px 0px 75px 170px; /* padding-top + padding-bottom + text area = image height */ 67 | margin:-90px 0px 0px -198px; /* offset vertical: half of image height */ 68 | /* offset horizontal: half of image width and text area width */ 69 | } 70 | } 71 | 72 | h1 { 73 | font-size:24px; 74 | font-weight:normal; 75 | margin:0px; 76 | overflow:visible; 77 | padding:0px; 78 | text-align:center; 79 | } 80 | 81 | .event { 82 | border-radius:4px; 83 | -webkit-border-radius:4px; 84 | color:#FFFFFF; 85 | font-size:12px; 86 | margin:0px 30px; 87 | padding:2px 0px; 88 | } 89 | 90 | .event.listening { 91 | background-color:#333333; 92 | display:block; 93 | } 94 | 95 | .event.received { 96 | background-color:#4B946A; 97 | display:none; 98 | } 99 | 100 | @keyframes fade { 101 | from { opacity: 1.0; } 102 | 50% { opacity: 0.4; } 103 | to { opacity: 1.0; } 104 | } 105 | 106 | @-webkit-keyframes fade { 107 | from { opacity: 1.0; } 108 | 50% { opacity: 0.4; } 109 | to { opacity: 1.0; } 110 | } 111 | 112 | .blink { 113 | animation:fade 3000ms infinite; 114 | -webkit-animation:fade 3000ms infinite; 115 | } 116 | -------------------------------------------------------------------------------- /example/css/mobiscroll.core-2.0.1.css: -------------------------------------------------------------------------------- 1 | /* Datewheel overlay */ 2 | .dw { 3 | min-width:170px; 4 | padding: 0 10px; 5 | position: absolute; 6 | top: 5%; 7 | left: 0; 8 | z-index: 1001; 9 | color: #000; 10 | font-family: arial, verdana, sans-serif; 11 | font-size: 12px; 12 | text-shadow: none; 13 | } 14 | .dwi { 15 | position: static; 16 | margin: 5px; 17 | display: inline-block; 18 | } 19 | .dwwr { 20 | zoom: 1; 21 | } 22 | /* Datewheel overlay background */ 23 | .dwo { 24 | width: 100%; 25 | background: #000; 26 | position: absolute; 27 | top: 0; 28 | left: 0; 29 | z-index: 1000; 30 | opacity: .7; 31 | filter:Alpha(Opacity=70); 32 | } 33 | /* Datewheel wheel container wrapper */ 34 | .dwc { 35 | float: left; 36 | margin: 0 2px 5px 2px; 37 | padding-top: 30px; 38 | } 39 | .dwcc { 40 | clear: both; 41 | } 42 | /* Datewheel label */ 43 | .dwl { 44 | /*margin: 0 2px;*/ 45 | text-align: center; 46 | line-height: 30px; 47 | height: 30px; 48 | white-space: nowrap; 49 | position: absolute; 50 | top: -30px; 51 | width: 100%; 52 | } 53 | /* Datewheel value */ 54 | .dwv { 55 | padding: 10px 0; 56 | border-bottom: 1px solid #000; 57 | } 58 | /* Datewheel wheel container */ 59 | .dwrc { 60 | -webkit-border-radius: 3px; 61 | -moz-border-radius: 3px; 62 | border-radius: 3px; 63 | } 64 | .dwwc { 65 | margin: 0; 66 | padding: 0 2px; 67 | position: relative; 68 | background: #000; 69 | zoom:1; 70 | } 71 | /* Datewheel wheels */ 72 | .dwwl { 73 | margin: 4px 2px; 74 | position: relative; 75 | background: #888; 76 | background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #000),color-stop(0.35, #333),color-stop(0.50, #888),color-stop(0.65, #333),color-stop(1, #000)); 77 | background: -moz-linear-gradient(#000 0%,#333 35%, #888 50%,#333 65%,#000 100%); 78 | background: -ms-linear-gradient(#000 0%,#333 35%, #888 50%,#333 65%,#000 100%); 79 | background: -o-linear-gradient(#000 0%,#333 35%, #888 50%,#333 65%,#000 100%); 80 | } 81 | .dww { 82 | margin: 0 2px; 83 | overflow: hidden; 84 | position: relative; 85 | /*top: -30px;*/ 86 | } 87 | .dwsc .dww { 88 | color: #fff; 89 | background: #444; 90 | background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #000),color-stop(0.45, #444),color-stop(0.55, #444),color-stop(1, #000)); 91 | background: -moz-linear-gradient(#000 0%,#444 45%, #444 55%, #000 100%); 92 | background: -ms-linear-gradient(#000 0%,#444 45%, #444 55%, #000 100%); 93 | background: -o-linear-gradient(#000 0%,#444 45%, #444 55%, #000 100%); 94 | } 95 | .dww ul { 96 | list-style: none; 97 | margin: 0; 98 | padding: 0; 99 | /*display: block; 100 | width: 100%;*/ 101 | position: relative; 102 | z-index: 2; 103 | } 104 | .dww li { 105 | list-style: none; 106 | margin: 0; 107 | padding: 0 5px; 108 | display: block; 109 | text-align: center; 110 | line-height: 40px; 111 | font-size: 26px; 112 | white-space: nowrap; 113 | text-shadow: 0 1px 1px #000; 114 | opacity: .3; 115 | filter: Alpha(Opacity=30); 116 | } 117 | /* Valid entry */ 118 | .dww li.dw-v { 119 | opacity: 1; 120 | filter: Alpha(Opacity=100); 121 | } 122 | /* Hidden entry */ 123 | .dww li.dw-h { 124 | visibility: hidden; 125 | } 126 | /* Wheel +/- buttons */ 127 | .dwwb { 128 | position: absolute; 129 | z-index: 4; 130 | left: 0; 131 | cursor: pointer; 132 | width: 100%; 133 | height: 40px; 134 | text-align: center; 135 | } 136 | .dwwbp { 137 | top: 0; 138 | -webkit-border-radius: 3px 3px 0 0; 139 | -moz-border-radius: 3px 3px 0 0; 140 | border-radius: 3px 3px 0 0; 141 | font-size: 40px; 142 | } 143 | .dwwbm { 144 | bottom: 0; 145 | -webkit-border-radius: 0 0 3px 3px; 146 | -moz-border-radius: 0 0 3px 3px; 147 | border-radius: 0 0 3px 3px; 148 | font-size: 32px; 149 | font-weight: bold; 150 | } 151 | .dwpm .dwwc { 152 | background: transparent; 153 | } 154 | .dwpm .dww { 155 | margin: -1px; 156 | } 157 | .dwpm .dww li { 158 | text-shadow: none; 159 | } 160 | .dwpm .dwwol { 161 | display: none; 162 | } 163 | /* Datewheel wheel overlay */ 164 | .dwwo { 165 | position: absolute; 166 | z-index: 3; 167 | top: 0; 168 | left: 0; 169 | width: 100%; 170 | height: 100%; 171 | background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #000),color-stop(0.52, rgba(44,44,44,0)),color-stop(0.48, rgba(44,44,44,0)),color-stop(1, #000)); 172 | background: -moz-linear-gradient(#000 0%,rgba(44,44,44,0) 52%, rgba(44,44,44,0) 48%, #000 100%); 173 | background: -ms-linear-gradient(#000 0%,rgba(44,44,44,0) 52%, rgba(44,44,44,0) 48%, #000 100%); 174 | background: -o-linear-gradient(#000 0%,rgba(44,44,44,0) 52%, rgba(44,44,44,0) 48%, #000 100%); 175 | } 176 | /* Background line */ 177 | .dwwol { 178 | position: absolute; 179 | z-index: 1; 180 | top: 50%; 181 | left: 0; 182 | width: 100%; 183 | height: 0; 184 | margin-top: -1px; 185 | border-top: 1px solid #333; 186 | border-bottom: 1px solid #555; 187 | } 188 | /* Datewheel button */ 189 | .dwbg .dwb { 190 | display: block; 191 | height: 40px; 192 | line-height: 40px; 193 | padding: 0 15px; 194 | margin: 0 2px; 195 | font-size: 14px; 196 | font-weight: bold; 197 | text-decoration: none; 198 | text-shadow:0 -1px 1px #000; 199 | border-radius: 5px; 200 | -moz-border-radius: 5px; 201 | -webkit-border-radius:5px; 202 | box-shadow:0 1px 3px rgba(0,0,0,0.5); 203 | -moz-box-shadow:0 1px 3px rgba(0,0,0,0.5); 204 | -webkit-box-shadow:0 1px 3px rgba(0,0,0,0.5); 205 | color: #fff; 206 | background:#000; 207 | background:-webkit-gradient(linear,left bottom,left top,color-stop(0.5, #000),color-stop(0.5, #6e6e6e)); 208 | background:-moz-linear-gradient(#6e6e6e 50%,#000 50%); 209 | background:-ms-linear-gradient(#6e6e6e 50%,#000 50%); 210 | background:-o-linear-gradient(#6e6e6e 50%,#000 50%); 211 | } 212 | /* Datewheel button container */ 213 | .dwbc { 214 | /*margin-top: 5px;*/ 215 | padding: 5px 0; 216 | text-align: center; 217 | clear: both; 218 | } 219 | /* Datewheel button wrapper */ 220 | .dwbw { 221 | display: inline-block; 222 | width: 50%; 223 | } 224 | /* Hidden label */ 225 | .dwhl { 226 | padding-top: 10px; 227 | } 228 | .dwhl .dwl { 229 | display: none; 230 | } 231 | /* Backgrounds */ 232 | .dwbg { 233 | background: #fff; 234 | border-radius: 3px; 235 | -webkit-border-radius: 3px; 236 | -moz-border-radius: 3px; 237 | } 238 | .dwbg .dwpm .dww { 239 | color: #000; 240 | background: #fff; 241 | border: 1px solid #AAA; 242 | } 243 | .dwbg .dwwb { 244 | background: #ccc; 245 | color: #888; 246 | text-shadow: 0 -1px 1px #333; 247 | box-shadow: 0 0 5px #333; 248 | -webkit-box-shadow: 0 0 5px #333; 249 | -moz-box-shadow: 0 0 5px #333; 250 | } 251 | .dwbg .dwwbp { 252 | background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #bdbdbd),color-stop(1, #f7f7f7)); 253 | background: -moz-linear-gradient(#f7f7f7,#bdbdbd); 254 | background: -ms-linear-gradient(#f7f7f7,#bdbdbd); 255 | background: -o-linear-gradient(#f7f7f7,#bdbdbd); 256 | } 257 | .dwbg .dwwbm { 258 | background: -webkit-gradient(linear,left bottom,left top,color-stop(0, #f7f7f7),color-stop(1, #bdbdbd)); 259 | background: -moz-linear-gradient(#bdbdbd,#f7f7f7); 260 | background: -ms-linear-gradient(#bdbdbd,#f7f7f7); 261 | background: -o-linear-gradient(#bdbdbd,#f7f7f7); 262 | } 263 | .dwbg .dwb-a { 264 | background:#3c7500; 265 | background:-webkit-gradient(linear,left bottom,left top,color-stop(0.5, #3c7500),color-stop(0.5, #94c840)); 266 | background:-moz-linear-gradient(#94c840 50%,#3c7500 50%); 267 | background:-ms-linear-gradient(#94c840 50%,#3c7500 50%); 268 | background:-o-linear-gradient(#94c840 50%,#3c7500 50%); 269 | } 270 | .dwbg .dwwl .dwb-a { 271 | background:#3c7500; 272 | background:-webkit-gradient(linear,left bottom,left top,color-stop(0, #3c7500),color-stop(1, #94c840)); 273 | background:-moz-linear-gradient(#94c840,#3c7500); 274 | background:-ms-linear-gradient(#94c840,#3c7500); 275 | background:-o-linear-gradient(#94c840,#3c7500); 276 | } 277 | -------------------------------------------------------------------------------- /example/css/mobiscroll.jqm-2.0.1.css: -------------------------------------------------------------------------------- 1 | /* jQuery Mobile Theme */ 2 | .jqm .dwo { 3 | background: none; 4 | } 5 | .jqm .dw { 6 | padding: 6px; 7 | z-index: 1003; 8 | } 9 | .jqm .dwv { 10 | position: static; 11 | width: auto; 12 | padding: .7em 15px .7em 15px; 13 | border: 0; 14 | } 15 | .jqm .dwwr { 16 | border: 0; 17 | } 18 | .jqm .dwpm .dwwo { 19 | background: none; 20 | } 21 | .jqm .dwc { 22 | margin: 0; 23 | padding: 30px 5px 5px 5px; 24 | } 25 | .jqm .dwhl { 26 | padding: 5px; 27 | } 28 | .jqm .dwwb { 29 | margin: 0; 30 | border: 0; 31 | } 32 | .jqm .dwwb span { 33 | padding: 0; 34 | } 35 | .jqm .dwwbp .ui-btn-inner { 36 | -webkit-border-radius: 3px 3px 0 0; 37 | -moz-border-radius: 3px 3px 0 0; 38 | border-radius: 3px 3px 0 0; 39 | } 40 | .jqm .dwwbm .ui-btn-inner { 41 | -webkit-border-radius: 0 0 3px 3px; 42 | -moz-border-radius: 0 0 3px 3px; 43 | border-radius: 0 0 3px 3px; 44 | } 45 | .jqm .dwwbp span { 46 | font-weight: normal; 47 | } 48 | -------------------------------------------------------------------------------- /example/css/themes/default/images/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/example/css/themes/default/images/ajax-loader.gif -------------------------------------------------------------------------------- /example/css/themes/default/images/icons-18-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/example/css/themes/default/images/icons-18-black.png -------------------------------------------------------------------------------- /example/css/themes/default/images/icons-18-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/example/css/themes/default/images/icons-18-white.png -------------------------------------------------------------------------------- /example/css/themes/default/images/icons-36-black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/example/css/themes/default/images/icons-36-black.png -------------------------------------------------------------------------------- /example/css/themes/default/images/icons-36-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/example/css/themes/default/images/icons-36-white.png -------------------------------------------------------------------------------- /ionic/example/README.md: -------------------------------------------------------------------------------- 1 | ## JMessage-Ionic demo 2 | 3 | ### Usage 4 | 5 | 在终端下执行如下指令: 6 | 7 | ``` 8 | ionic cordova platform add android@7.0.0 # 注意如果 jmessage-phonegap-plugin@3.4.0+ 需要指定 android-platform 到 7.0.0+ (因为项目结构有所改变) 9 | ionic cordova platform add ios 10 | 11 | ionic cordova run ios 12 | # or ionic cordova run ios --device 13 | ``` 14 | 15 | -------------------------------------------------------------------------------- /ionic/example/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | MyApp 4 | An awesome Ionic/Cordova app. 5 | Ionic Framework Team 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /ionic/example/ionic.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jmessageIonic", 3 | "integrations": { 4 | "cordova": {} 5 | }, 6 | "type": "ionic-angular" 7 | } -------------------------------------------------------------------------------- /ionic/example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jmessageIonic", 3 | "version": "0.0.1", 4 | "author": "Ionic Framework", 5 | "homepage": "http://ionicframework.com/", 6 | "private": true, 7 | "scripts": { 8 | "clean": "ionic-app-scripts clean", 9 | "build": "ionic-app-scripts build", 10 | "lint": "ionic-app-scripts lint", 11 | "ionic:build": "ionic-app-scripts build", 12 | "ionic:serve": "ionic-app-scripts serve" 13 | }, 14 | "dependencies": { 15 | "@angular/common": "5.0.0", 16 | "@angular/compiler": "5.0.0", 17 | "@angular/compiler-cli": "5.0.0", 18 | "@angular/core": "5.0.0", 19 | "@angular/forms": "5.0.0", 20 | "@angular/http": "5.0.0", 21 | "@angular/platform-browser": "5.0.0", 22 | "@angular/platform-browser-dynamic": "5.0.0", 23 | "@ionic-native/camera": "^4.7.0", 24 | "@ionic-native/core": "4.3.2", 25 | "@ionic-native/file": "^4.7.0", 26 | "@ionic-native/media": "^4.7.0", 27 | "@ionic-native/splash-screen": "4.3.2", 28 | "@ionic-native/status-bar": "4.3.2", 29 | "@ionic/storage": "2.1.3", 30 | "@jiguang-ionic/jmessage": "^1.0.2", 31 | "cordova-android": "^7.0.0", 32 | "cordova-ios": "^4.5.4", 33 | "cordova-plugin-camera": "^4.0.3", 34 | "cordova-plugin-device": "^2.0.2", 35 | "cordova-plugin-file": "^6.0.1", 36 | "cordova-plugin-ionic-webview": "^1.2.1", 37 | "cordova-plugin-jcore": "^1.2.6", 38 | "cordova-plugin-media": "^5.0.2", 39 | "cordova-plugin-splashscreen": "^4.0.3", 40 | "cordova-plugin-whitelist": "^1.3.1", 41 | "ionic-angular": "3.9.2", 42 | "ionic-plugin-keyboard": "^2.2.1", 43 | "ionicons": "3.0.0", 44 | "jmessage-phonegap-plugin": "file:///Users/HuminiOS/Desktop/workproject/jmessage-phonegap-plugin", 45 | "rxjs": "5.5.2", 46 | "sw-toolbox": "3.6.0", 47 | "zone.js": "0.8.18" 48 | }, 49 | "devDependencies": { 50 | "@ionic/app-scripts": "3.1.0", 51 | "typescript": "2.4.2" 52 | }, 53 | "description": "An Ionic project", 54 | "cordova": { 55 | "plugins": { 56 | "cordova-plugin-device": {}, 57 | "cordova-plugin-ionic-webview": {}, 58 | "cordova-plugin-splashscreen": {}, 59 | "cordova-plugin-whitelist": {}, 60 | "ionic-plugin-keyboard": {}, 61 | "cordova-plugin-camera": {}, 62 | "cordova-plugin-file": {}, 63 | "cordova-plugin-media": { 64 | "KEEP_AVAUDIOSESSION_ALWAYS_ACTIVE": "NO" 65 | }, 66 | "jmessage-phonegap-plugin": { 67 | "APP_KEY": "a1703c14b186a68a66ef86c1" 68 | } 69 | }, 70 | "platforms": [ 71 | "android", 72 | "ios" 73 | ] 74 | } 75 | } -------------------------------------------------------------------------------- /ionic/example/resources/README.md: -------------------------------------------------------------------------------- 1 | These are Cordova resources. You can replace icon.png and splash.png and run 2 | `ionic cordova resources` to generate custom icons and splash screens for your 3 | app. See `ionic cordova resources --help` for details. 4 | 5 | Cordova reference documentation: 6 | 7 | - Icons: https://cordova.apache.org/docs/en/latest/config_ref/images.html 8 | - Splash Screens: https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-splashscreen/ 9 | -------------------------------------------------------------------------------- /ionic/example/resources/android/icon/drawable-hdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/icon/drawable-hdpi-icon.png -------------------------------------------------------------------------------- /ionic/example/resources/android/icon/drawable-ldpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/icon/drawable-ldpi-icon.png -------------------------------------------------------------------------------- /ionic/example/resources/android/icon/drawable-mdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/icon/drawable-mdpi-icon.png -------------------------------------------------------------------------------- /ionic/example/resources/android/icon/drawable-xhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/icon/drawable-xhdpi-icon.png -------------------------------------------------------------------------------- /ionic/example/resources/android/icon/drawable-xxhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/icon/drawable-xxhdpi-icon.png -------------------------------------------------------------------------------- /ionic/example/resources/android/icon/drawable-xxxhdpi-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/icon/drawable-xxxhdpi-icon.png -------------------------------------------------------------------------------- /ionic/example/resources/android/splash/drawable-land-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/splash/drawable-land-hdpi-screen.png -------------------------------------------------------------------------------- /ionic/example/resources/android/splash/drawable-land-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/splash/drawable-land-ldpi-screen.png -------------------------------------------------------------------------------- /ionic/example/resources/android/splash/drawable-land-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/splash/drawable-land-mdpi-screen.png -------------------------------------------------------------------------------- /ionic/example/resources/android/splash/drawable-land-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/splash/drawable-land-xhdpi-screen.png -------------------------------------------------------------------------------- /ionic/example/resources/android/splash/drawable-land-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/splash/drawable-land-xxhdpi-screen.png -------------------------------------------------------------------------------- /ionic/example/resources/android/splash/drawable-land-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/splash/drawable-land-xxxhdpi-screen.png -------------------------------------------------------------------------------- /ionic/example/resources/android/splash/drawable-port-hdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/splash/drawable-port-hdpi-screen.png -------------------------------------------------------------------------------- /ionic/example/resources/android/splash/drawable-port-ldpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/splash/drawable-port-ldpi-screen.png -------------------------------------------------------------------------------- /ionic/example/resources/android/splash/drawable-port-mdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/splash/drawable-port-mdpi-screen.png -------------------------------------------------------------------------------- /ionic/example/resources/android/splash/drawable-port-xhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/splash/drawable-port-xhdpi-screen.png -------------------------------------------------------------------------------- /ionic/example/resources/android/splash/drawable-port-xxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/splash/drawable-port-xxhdpi-screen.png -------------------------------------------------------------------------------- /ionic/example/resources/android/splash/drawable-port-xxxhdpi-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/android/splash/drawable-port-xxxhdpi-screen.png -------------------------------------------------------------------------------- /ionic/example/resources/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/icon.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-1024.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-40.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-40@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-40@2x.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-40@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-40@3x.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-50.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-50@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-50@2x.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-60.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-60@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-60@2x.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-60@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-60@3x.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-72.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-72@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-72@2x.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-76.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-76@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-76@2x.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-83.5@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-83.5@2x.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-small.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-small@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-small@2x.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon-small@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon-small@3x.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/icon/icon@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/icon/icon@2x.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/splash/Default-568h@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/splash/Default-568h@2x~iphone.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/splash/Default-667h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/splash/Default-667h.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/splash/Default-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/splash/Default-736h.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/splash/Default-Landscape-736h.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/splash/Default-Landscape-736h.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/splash/Default-Landscape@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/splash/Default-Landscape@2x~ipad.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/splash/Default-Landscape@~ipadpro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/splash/Default-Landscape@~ipadpro.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/splash/Default-Landscape~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/splash/Default-Landscape~ipad.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/splash/Default-Portrait@2x~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/splash/Default-Portrait@2x~ipad.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/splash/Default-Portrait@~ipadpro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/splash/Default-Portrait@~ipadpro.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/splash/Default-Portrait~ipad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/splash/Default-Portrait~ipad.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/splash/Default@2x~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/splash/Default@2x~iphone.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/splash/Default@2x~universal~anyany.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/splash/Default@2x~universal~anyany.png -------------------------------------------------------------------------------- /ionic/example/resources/ios/splash/Default~iphone.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/ios/splash/Default~iphone.png -------------------------------------------------------------------------------- /ionic/example/resources/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/resources/splash.png -------------------------------------------------------------------------------- /ionic/example/src/app/app.component.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { Platform } from 'ionic-angular'; 3 | import { StatusBar } from '@ionic-native/status-bar'; 4 | import { SplashScreen } from '@ionic-native/splash-screen'; 5 | import { JMessagePlugin, JMUserInfo, JMError } from '@jiguang-ionic/jmessage'; 6 | import { JsonPipe } from '@angular/common'; 7 | 8 | import { HomePage } from '../pages/home/home'; 9 | import { LoginPage } from '../pages/login/login'; 10 | import { TabbarPage } from '../pages/tabbar/tabbar'; 11 | 12 | @Component({ 13 | templateUrl: 'app.html' 14 | }) 15 | 16 | export class MyApp { 17 | rootPage:any = LoginPage; 18 | 19 | constructor(private jmessage: JMessagePlugin,platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) { 20 | platform.ready().then(() => { 21 | statusBar.styleDefault(); 22 | splashScreen.hide(); 23 | 24 | this.jmessage.getMyInfo().then( (user:JMUserInfo) => { 25 | if (user.username != undefined && user.username != null) { 26 | this.rootPage = TabbarPage; 27 | } else { 28 | this.rootPage = LoginPage; 29 | } 30 | }).catch( err => { 31 | alert(JSON.stringify(err)); 32 | }); 33 | 34 | 35 | this.jmessage.init({ isOpenMessageRoaming: true }); 36 | // const username = '0001'; 37 | // const password = '1111'; 38 | 39 | // this.jmessage.login({ username, password }).then( 40 | // () => alert('login success') 41 | // ).catch( (error) => { 42 | // alert('login error' + JSON.stringify(error)); 43 | // }); 44 | 45 | 46 | // this.jmessage.updateMyInfo({ 47 | // birthday: 2423423, 48 | // gender: 'male', 49 | // extras: { 50 | // key1: 'value1', 51 | // key2: 'value2' 52 | // } 53 | // }).then( (result) => { 54 | // alert('updateMyInfo success' + JSON.stringify(result)); 55 | // }); 56 | 57 | // this.jmessage.updateMyInfo({ 58 | // birthday: 2423423, 59 | // gender: 'male', 60 | // extras: { 61 | // key1: 'value1', 62 | // key2: 'value2' 63 | // } 64 | // }).then( (result) => { 65 | // alert('updateMyInfo success' + JSON.stringify(result)); 66 | // }); 67 | 68 | // this.jmessage.createGroup({}).then( (gid:string) => { 69 | // this.jmessage.getGroupInfo({ 70 | // id: gid 71 | // }).then( (groupInfo: JMGroupInfo) => { 72 | // alert('createGroup: ' + JSON.stringify(groupInfo)); 73 | // }); 74 | 75 | // this.jmessage.createConversation({ 76 | // type: 'group', 77 | // groupId: gid 78 | // }).then( (group) => { 79 | // alert('createConversation: ' + JSON.stringify(group)) 80 | // }) ; 81 | // }) 82 | 83 | 84 | // this.jmessage.ChatRoom.enterChatRoom({roomId: '12503299'}, () => { 85 | // alert('success'); 86 | // }, (error: JMError) => { 87 | // alert(error.code); 88 | // }) 89 | 90 | // this.jmessage.addReceiveMessageListener( (message) => { 91 | // alert('recive message: ' + JSON.stringify(message)); 92 | // }); 93 | 94 | // this.jmessage.addReceiveChatRoomMessageListener( (message) => { 95 | // alert('recive chat room message: ' + JSON.stringify(message)); 96 | // }); 97 | 98 | 99 | 100 | }); 101 | } 102 | } 103 | 104 | -------------------------------------------------------------------------------- /ionic/example/src/app/app.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /ionic/example/src/app/app.module.ts: -------------------------------------------------------------------------------- 1 | import { BrowserModule } from '@angular/platform-browser'; 2 | import { ErrorHandler, NgModule } from '@angular/core'; 3 | import { IonicApp, IonicErrorHandler, IonicModule, Content } from 'ionic-angular'; 4 | import { SplashScreen } from '@ionic-native/splash-screen'; 5 | import { StatusBar } from '@ionic-native/status-bar'; 6 | import { JMessagePlugin } from '@jiguang-ionic/jmessage'; 7 | import { MyApp } from './app.component'; 8 | import { HomePage } from '../pages/home/home'; 9 | 10 | import { LoginPage } from '../pages/login/login'; 11 | import { RegisterPage } from '../pages/register/register'; 12 | import { TabbarPage } from '../pages/tabbar/tabbar'; 13 | 14 | import { ChatPage } from '../pages/chat/chat'; 15 | import { UserDetailPage } from '../pages/userDetail/userDetail' 16 | 17 | import { ConversationListPage } from '../pages/tabbar/conversationList/conversationList'; 18 | import { MyAccountPage } from '../pages/tabbar/myAccount/myAccount'; 19 | import { ContactPage } from '../pages/tabbar/contact/contact'; 20 | 21 | import { Camera } from '@ionic-native/camera'; 22 | import { File } from '@ionic-native/file'; 23 | import { Media, MediaObject } from '@ionic-native/media'; 24 | 25 | @NgModule({ 26 | declarations: [ 27 | MyApp, 28 | HomePage, 29 | LoginPage, 30 | RegisterPage, 31 | TabbarPage, 32 | ConversationListPage, 33 | MyAccountPage, 34 | ContactPage, 35 | ChatPage, 36 | UserDetailPage 37 | ], 38 | imports: [ 39 | BrowserModule, 40 | IonicModule.forRoot(MyApp,{ 41 | tabsHideOnSubPages:true 42 | }) 43 | ], 44 | bootstrap: [IonicApp], 45 | entryComponents: [ 46 | MyApp, 47 | HomePage, 48 | LoginPage, 49 | RegisterPage, 50 | TabbarPage, 51 | ConversationListPage, 52 | MyAccountPage, 53 | ContactPage, 54 | ChatPage, 55 | UserDetailPage 56 | ], 57 | providers: [ 58 | StatusBar, 59 | SplashScreen, 60 | JMessagePlugin, 61 | Camera, 62 | File, 63 | Media, 64 | {provide: ErrorHandler, useClass: IonicErrorHandler} 65 | ] 66 | }) 67 | export class AppModule {} 68 | -------------------------------------------------------------------------------- /ionic/example/src/app/app.scss: -------------------------------------------------------------------------------- 1 | // http://ionicframework.com/docs/theming/ 2 | 3 | 4 | // App Global Sass 5 | // -------------------------------------------------- 6 | // Put style rules here that you want to apply globally. These 7 | // styles are for the entire app and not just one component. 8 | // Additionally, this file can be also used as an entry point 9 | // to import other Sass files to be included in the output CSS. 10 | // 11 | // Shared Sass variables, which can be used to adjust Ionic's 12 | // default Sass variables, belong in "theme/variables.scss". 13 | // 14 | // To declare rules for a specific mode, create a child rule 15 | // for the .md, .ios, or .wp mode classes. The mode class is 16 | // automatically applied to the element in the app. 17 | -------------------------------------------------------------------------------- /ionic/example/src/app/main.ts: -------------------------------------------------------------------------------- 1 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 2 | 3 | import { AppModule } from './app.module'; 4 | 5 | platformBrowserDynamic().bootstrapModule(AppModule); 6 | -------------------------------------------------------------------------------- /ionic/example/src/assets/icon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/src/assets/icon/favicon.ico -------------------------------------------------------------------------------- /ionic/example/src/assets/imgs/Translations.json: -------------------------------------------------------------------------------- 1 | { 2 | "zh": { 3 | "Home": { 4 | "tilte": "首页" 5 | }, 6 | "Chat": { 7 | "tilte": "聊天" 8 | }, 9 | "Login": { 10 | "tilte": "登录", 11 | "username": "用户名", 12 | "password": "密码" 13 | }, 14 | "Register": { 15 | "tilte": "注册", 16 | "username": "用户名", 17 | "password": "密码" 18 | 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /ionic/example/src/assets/imgs/alert-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/src/assets/imgs/alert-icon.png -------------------------------------------------------------------------------- /ionic/example/src/assets/imgs/camera.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/src/assets/imgs/camera.png -------------------------------------------------------------------------------- /ionic/example/src/assets/imgs/chat-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/src/assets/imgs/chat-icon.png -------------------------------------------------------------------------------- /ionic/example/src/assets/imgs/friend-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/src/assets/imgs/friend-icon.png -------------------------------------------------------------------------------- /ionic/example/src/assets/imgs/group-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/src/assets/imgs/group-icon.png -------------------------------------------------------------------------------- /ionic/example/src/assets/imgs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/src/assets/imgs/logo.png -------------------------------------------------------------------------------- /ionic/example/src/assets/imgs/logout-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/src/assets/imgs/logout-icon.png -------------------------------------------------------------------------------- /ionic/example/src/assets/imgs/myinfo-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/src/assets/imgs/myinfo-icon.png -------------------------------------------------------------------------------- /ionic/example/src/assets/imgs/setting-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/src/assets/imgs/setting-icon.png -------------------------------------------------------------------------------- /ionic/example/src/assets/imgs/setting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/src/assets/imgs/setting.png -------------------------------------------------------------------------------- /ionic/example/src/assets/imgs/singgle-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/src/assets/imgs/singgle-icon.png -------------------------------------------------------------------------------- /ionic/example/src/assets/imgs/user-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/ionic/example/src/assets/imgs/user-icon.png -------------------------------------------------------------------------------- /ionic/example/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ionic App 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /ionic/example/src/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Ionic", 3 | "short_name": "Ionic", 4 | "start_url": "index.html", 5 | "display": "standalone", 6 | "icons": [{ 7 | "src": "assets/imgs/logo.png", 8 | "sizes": "512x512", 9 | "type": "image/png" 10 | }], 11 | "background_color": "#4e8ef7", 12 | "theme_color": "#4e8ef7" 13 | } -------------------------------------------------------------------------------- /ionic/example/src/pages/chat/chat.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Chat 5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 |
17 | 18 | 19 | 20 |
21 |

{{ message.from.nickname }}

22 |
23 |

{{ message.text }}

24 | 25 |

[voice]

26 |

[file]

27 |

[custom]

28 |
29 | 30 |
31 | 32 |
33 |
34 | 35 |
36 | 37 | 38 | 39 | 40 | 41 |
42 | 43 | 47 |
48 |
49 | 50 | -------------------------------------------------------------------------------- /ionic/example/src/pages/chat/chat.scss: -------------------------------------------------------------------------------- 1 | chat-page { 2 | 3 | $userBackgroundColor: #387ef5; 4 | $toUserBackgroundColor: #fff; 5 | 6 | ion-content { 7 | background-color: #387ef5; 8 | 9 | .message-item { 10 | display: block; 11 | min-height: 60px; 12 | 13 | .user-avatar { 14 | position: absolute; 15 | width: 40px; 16 | height: 40px; 17 | } 18 | 19 | .message-detail { 20 | display: block; 21 | margin-left: 60px; 22 | 23 | .username { 24 | height: 0px; 25 | color: #cbcbcb 26 | } 27 | 28 | .message-content p { 29 | display: inline-block; 30 | background-color: #387ef5; 31 | padding: 4px 8px; 32 | color: white; 33 | border-radius: 8px; 34 | word-wrap: break-word; 35 | max-width: 200px; 36 | 37 | } 38 | .message-content { 39 | .image-content { 40 | margin-top: 8px; 41 | max-width: 150px; 42 | max-height: 150px; 43 | border-radius: 8px; 44 | } 45 | 46 | .voice-content { 47 | padding: 4px 8px; 48 | } 49 | } 50 | } 51 | } 52 | 53 | .message-item.right { 54 | 55 | .user-avatar { 56 | position: absolute; 57 | right: 8px; 58 | width: 40px; 59 | height: 40px; 60 | } 61 | 62 | .message-detail { 63 | display: block; 64 | margin-right: 40px; 65 | text-align: right; 66 | 67 | .message-content p { 68 | display: inline-block; 69 | 70 | } 71 | } 72 | } 73 | } 74 | 75 | ion-footer { 76 | box-shadow: 0 0 4px rgba(0, 0, 0, 0.11); 77 | background-color: #fff; 78 | align-content: center; 79 | text-align: center; 80 | padding: 0px; 81 | height: 94px; 82 | 83 | 84 | .text-input { 85 | width: auto; 86 | margin: 8px 4px; 87 | display: inline-block; 88 | } 89 | 90 | .send-btn { 91 | display: inline-block; 92 | height: 30px; 93 | margin-left: 0%; 94 | padding: 4px 8px; 95 | } 96 | 97 | .more-container { 98 | .camera-btn { 99 | display: inline-block; 100 | widows: 30px; 101 | height: 30px; 102 | padding: 4px 8px; 103 | margin-left: 0; 104 | } 105 | .voice-btn { 106 | display: inline-block; 107 | widows: 30px; 108 | height: 30px; 109 | padding: 4px 8px; 110 | margin-left: 0; 111 | } 112 | 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /ionic/example/src/pages/home/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Ionic Blank 5 | 6 | 7 | 8 | 9 | 10 | The world is your oyster. 11 |

12 | If you get lost, the docs will be your guide. 13 |

14 |
15 | -------------------------------------------------------------------------------- /ionic/example/src/pages/home/home.scss: -------------------------------------------------------------------------------- 1 | page-home { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /ionic/example/src/pages/home/home.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { NavController } from 'ionic-angular'; 3 | 4 | @Component({ 5 | selector: 'page-home', 6 | templateUrl: 'home.html' 7 | }) 8 | export class HomePage { 9 | 10 | constructor(public navCtrl: NavController) { 11 | 12 | } 13 | 14 | } 15 | -------------------------------------------------------------------------------- /ionic/example/src/pages/login/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Login 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /ionic/example/src/pages/login/login.scss: -------------------------------------------------------------------------------- 1 | page-login { 2 | 3 | } -------------------------------------------------------------------------------- /ionic/example/src/pages/login/login.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { NavController, LoadingController, Loading } from 'ionic-angular'; 3 | import { JMessagePlugin, JMError } from '@jiguang-ionic/jmessage'; 4 | 5 | import { TabbarPage } from '../tabbar/tabbar'; 6 | import { RegisterPage } from '../register/register'; 7 | 8 | @Component({ 9 | selector: 'page-login', 10 | templateUrl: 'login.html' 11 | }) 12 | export class LoginPage { 13 | 14 | username = ''; 15 | password = ''; 16 | private loader: Loading; 17 | 18 | constructor(private jmessage: JMessagePlugin, 19 | public navCtrl: NavController, 20 | public loadingCtrl: LoadingController) { 21 | 22 | } 23 | 24 | Login() { 25 | 26 | if ( 27 | this.username == '' || 28 | this.password == '' 29 | ) { return; } 30 | 31 | let username = this.username; 32 | let password = this.password; 33 | 34 | this.loader = this.loadingCtrl.create({ 35 | content: '正在登录' 36 | }); 37 | 38 | this.loader.present(); 39 | 40 | this.jmessage.login({ 41 | username, 42 | password 43 | }).then( () => { 44 | this.navCtrl.push(TabbarPage); 45 | this.loader.dismiss(); 46 | }).catch( (error: JMError) => { 47 | alert(`error: ${JSON.stringify(error)}`); 48 | this.loader.dismiss(); 49 | }) 50 | } 51 | 52 | Register() { 53 | this.navCtrl.push(RegisterPage); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /ionic/example/src/pages/register/register.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Register 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /ionic/example/src/pages/register/register.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { NavController } from 'ionic-angular'; 3 | 4 | import { JMessagePlugin, JMError } from '@jiguang-ionic/jmessage'; 5 | import { LoginPage } from '../login/login'; 6 | @Component({ 7 | templateUrl: 'register.html' 8 | }) 9 | 10 | export class RegisterPage { 11 | 12 | username = ''; 13 | password = ''; 14 | 15 | constructor(private jmessage: JMessagePlugin, public navCtrl: NavController) { 16 | 17 | } 18 | 19 | Register() { 20 | if ( 21 | this.username == '' || 22 | this.password == '' 23 | ) { return; } 24 | 25 | let username = this.username; 26 | let password = this.password; 27 | 28 | this.jmessage.register({ 29 | username, 30 | password, 31 | nickname: username 32 | }) 33 | .then( () => { 34 | this.navCtrl.push(LoginPage); 35 | }) 36 | .catch( err => { 37 | alert(JSON.stringify(err)); 38 | }); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /ionic/example/src/pages/tabbar/contact/contact.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Contact 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 15 | 16 | 17 |

{{ friend.username }}

18 |
19 | 20 |
21 |
-------------------------------------------------------------------------------- /ionic/example/src/pages/tabbar/contact/contact.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { NavController } from 'ionic-angular'; 3 | import { JMessagePlugin, JMUserInfo } from '@jiguang-ionic/jmessage'; 4 | 5 | import { UserDetailPage } from '../../userDetail/userDetail'; 6 | @Component({ 7 | templateUrl: 'contact.html' 8 | }) 9 | export class ContactPage { 10 | 11 | friendList: JMUserInfo[]; 12 | 13 | constructor(private jmessage: JMessagePlugin, public navCtrl: NavController) { 14 | this.jmessage.getFriends() 15 | .then( (friends) => { 16 | this.friendList = friends; 17 | }) 18 | .catch(err => { 19 | alert(JSON.stringify(err)); 20 | }); 21 | } 22 | 23 | enterUser(friend: JMUserInfo) { 24 | this.navCtrl.push(UserDetailPage, friend); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ionic/example/src/pages/tabbar/conversationList/conversationList.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Conversation List 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 15 | 16 | 17 | 18 |

{{ conversationInfo.target.nickname }}

19 |

{{ conversationInfo.target.name }}

20 | 21 |
22 |

{{ conversationInfo.latestMessage.text }}

23 |

[语言]

24 |

[图片]

25 |

[文件]

26 |
27 | 28 | {{ conversationInfo.unreadCount }} 29 |
30 | 31 |
32 | 33 |
-------------------------------------------------------------------------------- /ionic/example/src/pages/tabbar/conversationList/conversationList.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { NavController } from 'ionic-angular'; 3 | 4 | import { JMessagePlugin, JMConversationInfo, JMError } from '@jiguang-ionic/jmessage'; 5 | import { ChatPage } from '../../chat/chat' 6 | 7 | @Component({ 8 | templateUrl: 'conversationList.html' 9 | }) 10 | export class ConversationListPage { 11 | 12 | conversationList: JMConversationInfo[]; 13 | 14 | constructor(private jmessage: JMessagePlugin,public navCtrl: NavController) { 15 | 16 | this.jmessage.getConversations() 17 | .then( (conversationList: JMConversationInfo[]) => { 18 | this.conversationList = conversationList; 19 | }) 20 | .catch( (error: JMError ) => { 21 | alert(JSON.stringify(error)); 22 | }); 23 | } 24 | 25 | enterChat(conversationInfo: JMConversationInfo) { 26 | this.navCtrl.push(ChatPage, conversationInfo); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ionic/example/src/pages/tabbar/myAccount/myAccount.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | My Account 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 |
14 | 15 | 16 | 22 | 23 | 24 | 25 |
-------------------------------------------------------------------------------- /ionic/example/src/pages/tabbar/myAccount/myAccount.scss: -------------------------------------------------------------------------------- 1 | account-page { 2 | 3 | .avatar-content { 4 | 5 | display: block; 6 | width: 60px; 7 | height: 60px; 8 | margin: 0 auto; 9 | margin-top: 30px; 10 | 11 | .avatar { 12 | display: block; 13 | background-color: aqua; 14 | } 15 | } 16 | 17 | .user-info { 18 | margin-top: 30px; 19 | border-color: rgb(205, 205, 205); 20 | border-width: 0px; 21 | 22 | border-style:solid; 23 | border-top-width: 1px; 24 | } 25 | .logout { 26 | display: block; 27 | margin: 30px auto; 28 | } 29 | } -------------------------------------------------------------------------------- /ionic/example/src/pages/tabbar/myAccount/myAccount.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { NavController, Platform, LoadingController, Loading } from 'ionic-angular'; 3 | import { JMessagePlugin, JMUserInfo } from '@jiguang-ionic/jmessage'; 4 | import { App } from 'ionic-angular'; 5 | 6 | import { LoginPage } from '../../login/login'; 7 | import { JsonPipe } from '@angular/common'; 8 | 9 | import { Camera, CameraOptions } from '@ionic-native/camera'; 10 | import { File, IWriteOptions } from '@ionic-native/file'; 11 | 12 | @Component({ 13 | selector: 'account-page', 14 | templateUrl: 'myAccount.html' 15 | }) 16 | export class MyAccountPage { 17 | myInfo: JMUserInfo; 18 | avatarData: string; 19 | 20 | loader: Loading; 21 | 22 | constructor(private jmessage: JMessagePlugin, 23 | public navCtrl: NavController, 24 | public app: App, 25 | public loadingCtrl: LoadingController, 26 | public platform: Platform, 27 | private camera: Camera, 28 | private file: File 29 | ) { 30 | 31 | this.myInfo = { 32 | type: 'user', 33 | username: '', 34 | appKey: '', 35 | gender: 'male', 36 | avatarThumbPath: '', 37 | isNoDisturb: false, 38 | isInBlackList: false, 39 | isFriend: false, 40 | }; 41 | 42 | this.jmessage.getMyInfo() 43 | .then( (myInfo:JMUserInfo) => { 44 | if (myInfo.avatarThumbPath != "" && myInfo.avatarThumbPath != undefined ) { 45 | if (this.platform.is('ios')) { 46 | alert(`file://${myInfo.avatarThumbPath}`) 47 | this.getImageDataFromPath(`file://${myInfo.avatarThumbPath}`).then(res => { 48 | this.avatarData = res; 49 | }); 50 | 51 | } else { 52 | this.getImageDataFromPath(`file://${myInfo.avatarThumbPath}`).then(res => { 53 | this.avatarData = res; 54 | }); 55 | } 56 | } else { 57 | this.avatarData = ''; 58 | } 59 | this.myInfo = myInfo; 60 | }) 61 | .catch(err => { 62 | alert(JSON.stringify(err)); 63 | }); 64 | } 65 | 66 | uploadAvatar() { 67 | const options: CameraOptions = { 68 | quality: 40, 69 | destinationType: this.camera.DestinationType.FILE_URI, 70 | encodingType: this.camera.EncodingType.JPEG, 71 | mediaType: this.camera.MediaType.PICTURE 72 | } 73 | 74 | let date = new Date(); 75 | let name = date.getTime(); 76 | 77 | this.camera.getPicture(options) 78 | .then((imagePath) => { 79 | 80 | let dir = imagePath.split( '/' ).slice( 0, -1 ).join( '/' ); 81 | let name = imagePath.split( '/' ).slice(-1)[0]; 82 | 83 | 84 | let imgPath = imagePath.replace('file://',''); 85 | alert(imgPath); 86 | this.showLoading(); 87 | this.jmessage.updateMyAvatar( { imgPath } ).then(res => { 88 | this.getImageDataFromPath(imagePath).then(res => { 89 | this.avatarData = res; 90 | }); 91 | this.loader.dismiss(); 92 | }).catch(err => { 93 | this.loader.dismiss(); 94 | }); 95 | }, (err) => { 96 | }) 97 | .catch(err => { 98 | alert('err: ' + JSON.stringify(err)); 99 | }); 100 | } 101 | 102 | 103 | private showLoading() { 104 | this.loader = this.loadingCtrl.create({ 105 | content: 'Uploading Avatar' 106 | }); 107 | 108 | this.loader.present(); 109 | } 110 | 111 | private async getImageDataFromPath(path: string): Promise { 112 | let dir = path.split( '/' ).slice( 0, -1 ).join( '/' ); 113 | let name = path.split( '/' ).slice(-1)[0]; 114 | const promise = new Promise(resolve => { 115 | this.file.readAsDataURL(dir, name).then(res => { 116 | resolve(res); 117 | }); 118 | }); 119 | return promise; 120 | } 121 | 122 | logout() { 123 | this.jmessage.logout(); 124 | this.app.getRootNav().setRoot(LoginPage); 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /ionic/example/src/pages/tabbar/tabbar.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ionic/example/src/pages/tabbar/tabbar.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | 3 | import { ConversationListPage } from './conversationList/conversationList'; 4 | import { MyAccountPage } from './myAccount/myAccount'; 5 | import { ContactPage } from './contact/contact'; 6 | 7 | @Component({ 8 | templateUrl: 'tabbar.html' 9 | }) 10 | export class TabbarPage { 11 | 12 | tab1 = ConversationListPage; 13 | tab2 = MyAccountPage; 14 | tab3 = ContactPage; 15 | 16 | constructor() { 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /ionic/example/src/pages/userDetail/userDetail.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | UserDetail 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /ionic/example/src/pages/userDetail/userDetail.ts: -------------------------------------------------------------------------------- 1 | import { Component } from '@angular/core'; 2 | import { NavController, NavParams } from 'ionic-angular'; 3 | import { JMessagePlugin, JMUserInfo, } from '@jiguang-ionic/jmessage'; 4 | 5 | import { ChatPage } from '../chat/chat'; 6 | 7 | @Component({ 8 | templateUrl: 'userDetail.html' 9 | }) 10 | export class UserDetailPage { 11 | 12 | user: JMUserInfo; 13 | constructor(public navParams: NavParams, 14 | private jmessage: JMessagePlugin, 15 | public navCtrl: NavController) { 16 | 17 | this.user = this.navParams['data']; 18 | } 19 | 20 | createConversation() { 21 | this.jmessage.createConversation({ 22 | type: 'single', 23 | username: this.user.username, 24 | appKey: 'a1703c14b186a68a66ef86c1' 25 | }) 26 | .then( (conversation) => { 27 | this.navCtrl.push(ChatPage,conversation); 28 | }) 29 | .catch(err => { 30 | alert(JSON.stringify(err)); 31 | }); 32 | } 33 | } 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /ionic/example/src/service-worker.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Check out https://googlechromelabs.github.io/sw-toolbox/ for 3 | * more info on how to use sw-toolbox to custom configure your service worker. 4 | */ 5 | 6 | 7 | 'use strict'; 8 | importScripts('./build/sw-toolbox.js'); 9 | 10 | self.toolbox.options.cache = { 11 | name: 'ionic-cache' 12 | }; 13 | 14 | // pre-cache our key assets 15 | self.toolbox.precache( 16 | [ 17 | './build/main.js', 18 | './build/vendor.js', 19 | './build/main.css', 20 | './build/polyfills.js', 21 | 'index.html', 22 | 'manifest.json' 23 | ] 24 | ); 25 | 26 | // dynamically cache any other local assets 27 | self.toolbox.router.any('/*', self.toolbox.fastest); 28 | 29 | // for any other requests go to the network, cache, 30 | // and then only use that cached resource if your user goes offline 31 | self.toolbox.router.default = self.toolbox.networkFirst; 32 | -------------------------------------------------------------------------------- /ionic/example/src/theme/variables.scss: -------------------------------------------------------------------------------- 1 | // Ionic Variables and Theming. For more info, please see: 2 | // http://ionicframework.com/docs/theming/ 3 | 4 | // Font path is used to include ionicons, 5 | // roboto, and noto sans fonts 6 | $font-path: "../assets/fonts"; 7 | 8 | 9 | // The app direction is used to include 10 | // rtl styles in your app. For more info, please see: 11 | // http://ionicframework.com/docs/theming/rtl-support/ 12 | $app-direction: ltr; 13 | 14 | 15 | @import "ionic.globals"; 16 | 17 | 18 | // Shared Variables 19 | // -------------------------------------------------- 20 | // To customize the look and feel of this app, you can override 21 | // the Sass variables found in Ionic's source scss files. 22 | // To view all the possible Ionic variables, see: 23 | // http://ionicframework.com/docs/theming/overriding-ionic-variables/ 24 | 25 | 26 | 27 | 28 | // Named Color Variables 29 | // -------------------------------------------------- 30 | // Named colors makes it easy to reuse colors on various components. 31 | // It's highly recommended to change the default colors 32 | // to match your app's branding. Ionic uses a Sass map of 33 | // colors so you can add, rename and remove colors as needed. 34 | // The "primary" color is the only required color in the map. 35 | 36 | $colors: ( 37 | primary: #488aff, 38 | secondary: #32db64, 39 | danger: #f53d3d, 40 | light: #f4f4f4, 41 | dark: #222 42 | ); 43 | 44 | 45 | // App iOS Variables 46 | // -------------------------------------------------- 47 | // iOS only Sass variables can go here 48 | 49 | 50 | 51 | 52 | // App Material Design Variables 53 | // -------------------------------------------------- 54 | // Material Design only Sass variables can go here 55 | 56 | 57 | 58 | 59 | // App Windows Variables 60 | // -------------------------------------------------- 61 | // Windows only Sass variables can go here 62 | 63 | 64 | 65 | 66 | // App Theme 67 | // -------------------------------------------------- 68 | // Ionic apps can have different themes applied, which can 69 | // then be future customized. This import comes last 70 | // so that the above variables are used and Ionic's 71 | // default are overridden. 72 | 73 | @import "ionic.theme.default"; 74 | 75 | 76 | // Ionicons 77 | // -------------------------------------------------- 78 | // The premium icon font for Ionic. For more info, please see: 79 | // http://ionicframework.com/docs/ionicons/ 80 | 81 | @import "ionic.ionicons"; 82 | 83 | 84 | // Fonts 85 | // -------------------------------------------------- 86 | 87 | @import "roboto"; 88 | @import "noto-sans"; 89 | -------------------------------------------------------------------------------- /ionic/example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "allowSyntheticDefaultImports": true, 4 | "declaration": false, 5 | "emitDecoratorMetadata": true, 6 | "experimentalDecorators": true, 7 | "lib": [ 8 | "dom", 9 | "es2015" 10 | ], 11 | "module": "es2015", 12 | "moduleResolution": "node", 13 | "sourceMap": true, 14 | "target": "es5" 15 | }, 16 | "include": [ 17 | "src/**/*.ts" 18 | ], 19 | "exclude": [ 20 | "node_modules" 21 | ], 22 | "compileOnSave": false, 23 | "atom": { 24 | "rewriteTsconfig": false 25 | } 26 | } -------------------------------------------------------------------------------- /ionic/example/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "no-duplicate-variable": true, 4 | "no-unused-variable": [ 5 | true 6 | ] 7 | }, 8 | "rulesDirectory": [ 9 | "node_modules/tslint-eslint-rules/dist/rules" 10 | ] 11 | } 12 | -------------------------------------------------------------------------------- /ionic/jmessage/ngx/index.metadata.json: -------------------------------------------------------------------------------- 1 | [{"__symbolic":"module","version":4,"metadata":{"JMSingleType":{"__symbolic":"interface"},"JMGroupType":{"__symbolic":"interface"},"JMChatRoomType":{"__symbolic":"interface"},"JMAllType":{"__symbolic":"interface"},"JMMessageOptions":{"__symbolic":"interface"},"JMConfig":{"__symbolic":"interface"},"JMError":{"__symbolic":"interface"},"JMNormalMessage":{"__symbolic":"interface"},"JMTextMessage":{"__symbolic":"interface"},"JMVoiceMessage":{"__symbolic":"interface"},"JMImageMessage":{"__symbolic":"interface"},"JMFileMessage":{"__symbolic":"interface"},"JMLocationMessage":{"__symbolic":"interface"},"JMCustomMessage":{"__symbolic":"interface"},"JMEventMessage":{"__symbolic":"interface"},"JMAllMessage":{"__symbolic":"interface"},"JMMessageEventListener":{"__symbolic":"interface"},"JMSyncOfflineMessageListener":{"__symbolic":"interface"},"JMSyncRoamingMessageListener":{"__symbolic":"interface"},"JMLoginStateChangedListener":{"__symbolic":"interface"},"JMContactNotifyListener":{"__symbolic":"interface"},"JMMessageRetractListener":{"__symbolic":"interface"},"JMReceiveTransCommandListener":{"__symbolic":"interface"},"JMReceiveChatRoomMessageListener":{"__symbolic":"interface"},"JMReceiveApplyJoinGroupApprovalListener":{"__symbolic":"interface"},"JMReceiveGroupAdminRejectListener":{"__symbolic":"interface"},"JMReceiveGroupAdminApprovalListener":{"__symbolic":"interface"},"JMUserInfo":{"__symbolic":"interface"},"JMGroupMemberInfo":{"__symbolic":"interface"},"JMGroupInfo":{"__symbolic":"interface"},"JMChatRoomInfo":{"__symbolic":"interface"},"JMConversationInfo":{"__symbolic":"interface"},"JMMessageSendOptions":{"__symbolic":"interface"},"JMChatRoom":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":283,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"getChatRoomInfoListOfApp":[{"__symbolic":"method"}],"getChatRoomInfoListOfUser":[{"__symbolic":"method"}],"getChatRoomInfoListById":[{"__symbolic":"method"}],"getChatRoomOwner":[{"__symbolic":"method"}],"enterChatRoom":[{"__symbolic":"method"}],"exitChatRoom":[{"__symbolic":"method"}],"getChatRoomConversation":[{"__symbolic":"method"}],"getChatRoomConversationList":[{"__symbolic":"method"}]}},"JMessagePlugin":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"@ionic-native/core","name":"IonicNativePlugin","line":341,"character":36},"decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":338,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"functionName":[{"__symbolic":"method"}],"init":[{"__symbolic":"method"}],"setDebugMode":[{"__symbolic":"method"}],"register":[{"__symbolic":"method"}],"login":[{"__symbolic":"method"}],"logout":[{"__symbolic":"method"}],"setBadge":[{"__symbolic":"method"}],"getMyInfo":[{"__symbolic":"method"}],"getUserInfo":[{"__symbolic":"method"}],"updateMyPassword":[{"__symbolic":"method"}],"updateMyAvatar":[{"__symbolic":"method"}],"updateMyInfo":[{"__symbolic":"method"}],"updateGroupAvatar":[{"__symbolic":"method"}],"downloadThumbGroupAvatar":[{"__symbolic":"method"}],"downloadOriginalGroupAvatar":[{"__symbolic":"method"}],"setConversationExtras":[{"__symbolic":"method"}],"sendTextMessage":[{"__symbolic":"method"}],"sendImageMessage":[{"__symbolic":"method"}],"sendVoiceMessage":[{"__symbolic":"method"}],"sendCustomMessage":[{"__symbolic":"method"}],"sendLocationMessage":[{"__symbolic":"method"}],"sendFileMessage":[{"__symbolic":"method"}],"retractMessage":[{"__symbolic":"method"}],"getHistoryMessages":[{"__symbolic":"method"}],"getMessageById":[{"__symbolic":"method"}],"deleteMessageById":[{"__symbolic":"method"}],"sendInvitationRequest":[{"__symbolic":"method"}],"acceptInvitation":[{"__symbolic":"method"}],"declineInvitation":[{"__symbolic":"method"}],"removeFromFriendList":[{"__symbolic":"method"}],"updateFriendNoteName":[{"__symbolic":"method"}],"updateFriendNoteText":[{"__symbolic":"method"}],"getFriends":[{"__symbolic":"method"}],"createGroup":[{"__symbolic":"method"}],"getGroupIds":[{"__symbolic":"method"}],"getGroupInfo":[{"__symbolic":"method"}],"updateGroupInfo":[{"__symbolic":"method"}],"addGroupMembers":[{"__symbolic":"method"}],"removeGroupMembers":[{"__symbolic":"method"}],"exitGroup":[{"__symbolic":"method"}],"getGroupMembers":[{"__symbolic":"method"}],"addUsersToBlacklist":[{"__symbolic":"method"}],"removeUsersFromBlacklist":[{"__symbolic":"method"}],"getBlacklist":[{"__symbolic":"method"}],"setNoDisturb":[{"__symbolic":"method"}],"getNoDisturbList":[{"__symbolic":"method"}],"setNoDisturbGlobal":[{"__symbolic":"method"}],"isNoDisturbGlobal":[{"__symbolic":"method"}],"blockGroupMessage":[{"__symbolic":"method"}],"isGroupBlocked":[{"__symbolic":"method"}],"getBlockedGroupList":[{"__symbolic":"method"}],"downloadThumbUserAvatar":[{"__symbolic":"method"}],"downloadOriginalUserAvatar":[{"__symbolic":"method"}],"downloadThumbImage":[{"__symbolic":"method"}],"downloadOriginalImage":[{"__symbolic":"method"}],"downloadVoiceFile":[{"__symbolic":"method"}],"downloadFile":[{"__symbolic":"method"}],"createConversation":[{"__symbolic":"method"}],"deleteConversation":[{"__symbolic":"method"}],"enterConversation":[{"__symbolic":"method"}],"exitConversation":[{"__symbolic":"method"}],"getConversation":[{"__symbolic":"method"}],"getConversations":[{"__symbolic":"method"}],"resetUnreadMessageCount":[{"__symbolic":"method"}],"transferGroupOwner":[{"__symbolic":"method"}],"setGroupMemberSilence":[{"__symbolic":"method"}],"isSilenceMember":[{"__symbolic":"method"}],"groupSilenceMembers":[{"__symbolic":"method"}],"setGroupNickname":[{"__symbolic":"method"}],"ChatRoom":[{"__symbolic":"property"}],"enterChatRoom":[{"__symbolic":"method"}],"exitChatRoom":[{"__symbolic":"method"}],"getChatRoomConversation":[{"__symbolic":"method"}],"getChatRoomConversationList":[{"__symbolic":"method"}],"getAllUnreadCount":[{"__symbolic":"method"}],"addGroupAdmins":[{"__symbolic":"method"}],"removeGroupAdmins":[{"__symbolic":"method"}],"changeGroupType":[{"__symbolic":"method"}],"getPublicGroupInfos":[{"__symbolic":"method"}],"applyJoinGroup":[{"__symbolic":"method"}],"processApplyJoinGroup":[{"__symbolic":"method"}],"dissolveGroup":[{"__symbolic":"method"}],"addReceiveMessageListener":[{"__symbolic":"method"}],"removeReceiveMessageListener":[{"__symbolic":"method"}],"addClickMessageNotificationListener":[{"__symbolic":"method"}],"removeClickMessageNotificationListener":[{"__symbolic":"method"}],"addSyncOfflineMessageListener":[{"__symbolic":"method"}],"removeSyncOfflineMessageListener":[{"__symbolic":"method"}],"addSyncRoamingMessageListener":[{"__symbolic":"method"}],"removeSyncRoamingMessageListener":[{"__symbolic":"method"}],"addLoginStateChangedListener":[{"__symbolic":"method"}],"removeLoginStateChangedListener":[{"__symbolic":"method"}],"addContactNotifyListener":[{"__symbolic":"method"}],"removeContactNotifyListener":[{"__symbolic":"method"}],"addMessageRetractListener":[{"__symbolic":"method"}],"removeMessageRetractListener":[{"__symbolic":"method"}],"addReceiveTransCommandListener":[{"__symbolic":"method"}],"removeReceiveTransCommandListener":[{"__symbolic":"method"}],"addReceiveChatRoomMessageListener":[{"__symbolic":"method"}],"removeReceiveChatRoomMessageListener":[{"__symbolic":"method"}],"addReceiveApplyJoinGroupApprovalListener":[{"__symbolic":"method"}],"removeReceiveApplyJoinGroupApprovalListener":[{"__symbolic":"method"}],"addReceiveGroupAdminRejectListener":[{"__symbolic":"method"}],"removeReceiveGroupAdminRejectListener":[{"__symbolic":"method"}],"addReceiveGroupAdminApprovalListener":[{"__symbolic":"method"}],"removeReceiveGroupAdminApprovalListener":[{"__symbolic":"method"}]}}}}] 2 | -------------------------------------------------------------------------------- /ionic/jmessage/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@jiguang-ionic/jmessage", 3 | "version": "3.0.0", 4 | "description": "Ionic Native - Native plugins for ionic apps", 5 | "module": "index.js", 6 | "typings": "index.d.ts", 7 | "author": "ionic", 8 | "license": "MIT", 9 | "peerDependencies": { 10 | "@ionic-native/core": "^5.0.0", 11 | "@angular/core": "*", 12 | "rxjs": "^6.0.1", 13 | "jmessage-phonegap-plugin": ">= 4.0.0" 14 | }, 15 | "repository": { 16 | "type": "git", 17 | "url": "https://github.com/ionic-team/ionic-native.git" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /issue_template.md: -------------------------------------------------------------------------------- 1 | **WARNING: 如果不按照这个表格,我们将无法帮助你,并将忽略你的问题。** 2 | 3 | ## 你的运行环境 4 | 5 | * 插件版本: 6 | * 平台(Android / iOS): 7 | * Cordova version (```cordova -v```): 8 | * Cordova platform version (```cordova platform ls```): 9 | * Ionic Version (if using Ionic) 10 | 11 | ## 期望效果 12 | 13 | 告诉我们你希望达到什么效果。 14 | 15 | ## 实际效果 16 | 17 | 告诉我们实际是什么效果。 18 | 19 | ## 重现步骤 20 | 21 | 1. ... 22 | 2. ... 23 | 3. ... 24 | 4. ... 25 | 26 | ## 背景 27 | 28 | 你尝试做过些什么? 29 | 30 | ## Debug logs 31 | 32 | 包括 Android 或 iOS 的日志: 33 | 34 | * iOS: XCode logs 35 | * Android: $ adb logcat / Android Studio logcat 36 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jmessage-phonegap-plugin", 3 | "version": "4.1.4", 4 | "description": "JMessage Cordova Plugin.", 5 | "cordova": { 6 | "id": "jmessage-phonegap-plugin", 7 | "platforms": [ 8 | "ios", 9 | "android" 10 | ] 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/jpush/jmessage-phonegap-plugin.git" 15 | }, 16 | "keywords": [ 17 | "JMessage", 18 | "IM", 19 | "im", 20 | "JPush", 21 | "cordova-plugin", 22 | "JiGuang", 23 | "Jiguang" 24 | ], 25 | "devDependencies": { 26 | "cordova-plugin-device": "*", 27 | "cordova-plugin-jcore": ">=1.2.5" 28 | }, 29 | "author": "JiGuang", 30 | "license": "MIT", 31 | "bugs": { 32 | "url": "https://github.com/jpush/jmessage-phonegap-plugin/issues" 33 | }, 34 | "homepage": "https://github.com/jpush/jmessage-phonegap-plugin#readme" 35 | } 36 | -------------------------------------------------------------------------------- /plugin.xml: -------------------------------------------------------------------------------- 1 | 2 | 6 | 7 | JMessage 8 | 集成极光 IM 和推送功能 9 | JPush 10 | JMessage, JPush 11 | Apache 2.0 License 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | $APP_KEY 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 153 | 154 | 155 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | -------------------------------------------------------------------------------- /src/android/ChatroomHandler.java: -------------------------------------------------------------------------------- 1 | package cn.jiguang.cordova.im; 2 | 3 | import org.apache.cordova.CallbackContext; 4 | import org.json.JSONArray; 5 | import org.json.JSONException; 6 | import org.json.JSONObject; 7 | 8 | import java.util.HashSet; 9 | import java.util.List; 10 | import java.util.Set; 11 | 12 | import cn.jpush.im.android.api.ChatRoomManager; 13 | import cn.jpush.im.android.api.JMessageClient; 14 | import cn.jpush.im.android.api.callback.RequestCallback; 15 | import cn.jpush.im.android.api.model.ChatRoomInfo; 16 | import cn.jpush.im.android.api.model.Conversation; 17 | import cn.jpush.im.api.BasicCallback; 18 | 19 | import static cn.jiguang.cordova.im.JMessagePlugin.ERR_CODE_PARAMETER; 20 | import static cn.jiguang.cordova.im.JMessagePlugin.ERR_MSG_PARAMETER; 21 | import static cn.jiguang.cordova.im.JMessageUtils.handleResult; 22 | import static cn.jiguang.cordova.im.JsonUtils.toJson; 23 | 24 | /** 25 | * 处理聊天室相关 API。 26 | */ 27 | 28 | class ChatRoomHandler { 29 | 30 | static void getChatRoomInfoListOfApp(JSONArray data, final CallbackContext callback) { 31 | int start, count; 32 | try { 33 | JSONObject params = data.getJSONObject(0); 34 | start = params.getInt("start"); 35 | count = params.getInt("count"); 36 | } catch (JSONException e) { 37 | e.printStackTrace(); 38 | handleResult(ERR_CODE_PARAMETER, ERR_MSG_PARAMETER, callback); 39 | return; 40 | } 41 | 42 | ChatRoomManager.getChatRoomListByApp(start, count, new RequestCallback>() { 43 | @Override 44 | public void gotResult(int status, String desc, List chatRoomInfos) { 45 | if (status != 0) { 46 | handleResult(status, desc, callback); 47 | return; 48 | } 49 | 50 | JSONArray jsonArr = new JSONArray(); 51 | try { 52 | for (ChatRoomInfo chatroomInfo : chatRoomInfos) { 53 | jsonArr.put(toJson(chatroomInfo)); 54 | } 55 | } catch (JSONException e) { // 因为转 json 的操作一定没有问题,所以这里不做多余处理。 56 | e.printStackTrace(); 57 | } 58 | callback.success(jsonArr); 59 | } 60 | }); 61 | } 62 | 63 | static void getChatRoomInfoListOfUser(JSONArray data, final CallbackContext callback) { 64 | ChatRoomManager.getChatRoomListByUser(new RequestCallback>() { 65 | @Override 66 | public void gotResult(int status, String desc, List chatRoomInfoList) { 67 | if (status != 0) { 68 | handleResult(status, desc, callback); 69 | return; 70 | } 71 | 72 | JSONArray jsonArr = new JSONArray(); 73 | try { 74 | for (ChatRoomInfo chatroomInfo : chatRoomInfoList) { 75 | jsonArr.put(toJson(chatroomInfo)); 76 | } 77 | } catch (JSONException e) { // 因为转 json 的操作一定没有问题,所以这里不做多余处理。 78 | e.printStackTrace(); 79 | } 80 | callback.success(jsonArr); 81 | } 82 | }); 83 | } 84 | 85 | static void getChatRoomInfoListById(JSONArray data, final CallbackContext callback) { 86 | Set roomIds = new HashSet(); // JS 层为了和 iOS 统一,因此 roomId 类型为 String,在原生做转换。 87 | 88 | try { 89 | JSONObject params = data.getJSONObject(0); 90 | JSONArray roomIdArr = params.getJSONArray("roomIds"); 91 | 92 | for (int i = 0; i < roomIdArr.length(); i++) { 93 | roomIds.add(Long.valueOf(roomIdArr.getString(i))); 94 | } 95 | } catch (JSONException e) { 96 | e.printStackTrace(); 97 | handleResult(ERR_CODE_PARAMETER, ERR_MSG_PARAMETER, callback); 98 | return; 99 | } 100 | 101 | ChatRoomManager.getChatRoomInfos(roomIds, new RequestCallback>() { 102 | @Override 103 | public void gotResult(int status, String desc, List chatRoomInfos) { 104 | if (status != 0) { 105 | handleResult(status, desc, callback); 106 | return; 107 | } 108 | 109 | JSONArray jsonArr = new JSONArray(); 110 | try { 111 | for (ChatRoomInfo chatroomInfo : chatRoomInfos) { 112 | jsonArr.put(toJson(chatroomInfo)); 113 | } 114 | } catch (JSONException e) { // 因为转 json 的操作一定没有问题,所以这里不做多余处理。 115 | e.printStackTrace(); 116 | } 117 | callback.success(jsonArr); 118 | } 119 | }); 120 | } 121 | 122 | static void getChatRoomOwner(JSONArray data, final CallbackContext callback) { 123 | final long roomId; 124 | 125 | try { 126 | JSONObject params = data.getJSONObject(0); 127 | roomId = Long.parseLong(params.getString("roomId")); 128 | } catch (JSONException e) { 129 | e.printStackTrace(); 130 | handleResult(ERR_CODE_PARAMETER, ERR_MSG_PARAMETER, callback); 131 | return; 132 | } 133 | 134 | Set roomIds = new HashSet(); 135 | roomIds.add(roomId); 136 | 137 | ChatRoomManager.getChatRoomInfos(roomIds, new RequestCallback>() { 138 | @Override 139 | public void gotResult(int status, String desc, List chatRoomInfoList) { 140 | if (status != 0) { 141 | handleResult(status, desc, callback); 142 | return; 143 | } 144 | 145 | try { 146 | JSONObject chatroomInfoJson = toJson(chatRoomInfoList.get(0)); 147 | callback.success(chatroomInfoJson); 148 | } catch (JSONException e) { 149 | e.printStackTrace(); 150 | } 151 | } 152 | }); 153 | } 154 | 155 | static void enterChatRoom(JSONArray data, final CallbackContext callback) { 156 | final long roomId; 157 | 158 | try { 159 | JSONObject params = data.getJSONObject(0); 160 | roomId = Long.parseLong(params.getString("roomId")); 161 | } catch (JSONException e) { 162 | e.printStackTrace(); 163 | handleResult(ERR_CODE_PARAMETER, ERR_MSG_PARAMETER, callback); 164 | return; 165 | } 166 | 167 | ChatRoomManager.enterChatRoom(roomId, new RequestCallback() { 168 | @Override 169 | public void gotResult(int status, String desc, Conversation conversation) { 170 | if (status != 0) { 171 | handleResult(status, desc, callback); 172 | return; 173 | } 174 | 175 | JSONObject result = new JSONObject(); 176 | try { 177 | result.put("roomId", roomId); 178 | result.put("conversation", toJson(conversation)); 179 | } catch (JSONException e) { 180 | e.printStackTrace(); 181 | } 182 | callback.success(result); 183 | } 184 | }); 185 | } 186 | 187 | static void exitChatRoom(JSONArray data, final CallbackContext callback) { 188 | final long roomId; 189 | 190 | try { 191 | JSONObject params = data.getJSONObject(0); 192 | roomId = Long.parseLong(params.getString("roomId")); 193 | } catch (JSONException e) { 194 | e.printStackTrace(); 195 | handleResult(ERR_CODE_PARAMETER, ERR_MSG_PARAMETER, callback); 196 | return; 197 | } 198 | 199 | ChatRoomManager.leaveChatRoom(roomId, new BasicCallback() { 200 | @Override 201 | public void gotResult(int status, String desc) { 202 | if (status == 0) { // success 203 | callback.success(); 204 | } else { 205 | handleResult(status, desc, callback); 206 | } 207 | } 208 | }); 209 | } 210 | 211 | static void getChatRoomConversationList(JSONArray data, final CallbackContext callback) { 212 | List conversations = JMessageClient.getChatRoomConversationList(); 213 | JSONArray result = new JSONArray(); 214 | 215 | for (Conversation con : conversations) { 216 | result.put(toJson(con)); 217 | } 218 | callback.success(result); 219 | } 220 | 221 | } 222 | -------------------------------------------------------------------------------- /src/android/EventUtils.java: -------------------------------------------------------------------------------- 1 | package cn.jiguang.cordova.im; 2 | 3 | import android.content.Context; 4 | 5 | import com.google.gson.Gson; 6 | 7 | import java.io.File; 8 | import java.io.FileInputStream; 9 | import java.io.FileOutputStream; 10 | import java.util.HashMap; 11 | import java.util.List; 12 | 13 | import cn.jpush.im.android.api.event.GroupApprovalEvent; 14 | 15 | 16 | class EventUtils { 17 | 18 | private static final String TAG = EventUtils.class.getSimpleName(); 19 | 20 | private static Gson gson = new Gson(); 21 | 22 | private static final String GROUP_APPROVAL_EVENT_NAME = "/jpush_event/group_approval/"; 23 | private static HashMap events = new HashMap<>(); 24 | 25 | 26 | public static void saveGroupApprovalEvent(Context context, GroupApprovalEvent event) { 27 | events.put(event.getEventId() + "", event); 28 | String s = gson.toJson(event); 29 | Logger.i(TAG, "Save group approval event:" + s); 30 | FileOutputStream outputStream; 31 | try { 32 | // outputStream = context.openFileOutput(GROUP_APPROVAL_EVENT_NAME+event.getEventId(), Context.MODE_PRIVATE); 33 | File file = new File(context.getFilesDir() + GROUP_APPROVAL_EVENT_NAME, event.getEventId() + ""); 34 | if (!file.exists()) { 35 | file.getParentFile().getParentFile().mkdir(); 36 | file.getParentFile().mkdir(); 37 | file.createNewFile(); 38 | } 39 | outputStream = new FileOutputStream(file); 40 | outputStream.write(s.getBytes()); 41 | outputStream.close(); 42 | } catch (Exception e) { 43 | e.printStackTrace(); 44 | } 45 | 46 | } 47 | 48 | public static GroupApprovalEvent getGroupApprovalEvent(Context context, String eventId) { 49 | GroupApprovalEvent groupApprovalEvent = events.get(eventId); 50 | if (groupApprovalEvent != null) { 51 | return groupApprovalEvent; 52 | } 53 | 54 | 55 | FileInputStream inputStream; 56 | GroupApprovalEvent event = null; 57 | try { 58 | // inputStream = context.openFileInput(GROUP_APPROVAL_EVENT_NAME+eventId); 59 | File file = new File(context.getFilesDir() + GROUP_APPROVAL_EVENT_NAME, eventId); 60 | inputStream = new FileInputStream(file); 61 | byte[] bytes = new byte[inputStream.available()]; 62 | StringBuffer sb = new StringBuffer(); 63 | int len = -1; 64 | while ((len = inputStream.read(bytes)) != -1) { 65 | sb.append(new String(bytes, 0, len)); 66 | } 67 | Logger.i(TAG, "Get group approval event:" + sb.toString()); 68 | inputStream.close(); 69 | event = gson.fromJson(sb.toString(), GroupApprovalEvent.class); 70 | 71 | } catch (Exception e) { 72 | e.printStackTrace(); 73 | } 74 | return event; 75 | } 76 | 77 | public static void removeGroupApprovalEvent(Context context, String eventId) { 78 | events.remove(eventId); 79 | File file = new File(context.getFilesDir() + GROUP_APPROVAL_EVENT_NAME, eventId); 80 | if (file.exists()) { 81 | Boolean isSucc = file.delete(); 82 | Logger.i(TAG, "Delete group approval event " + eventId + ": " + isSucc); 83 | } 84 | } 85 | 86 | public static void removeGroupApprovalEvents(Context context, List groupApprovalEventList) { 87 | for (int i = 0; i < groupApprovalEventList.size(); i++) { 88 | GroupApprovalEvent groupApprovalEvent = groupApprovalEventList.get(i); 89 | removeGroupApprovalEvent(context, groupApprovalEvent.getEventId() + ""); 90 | } 91 | } 92 | 93 | 94 | } 95 | -------------------------------------------------------------------------------- /src/android/JMessageUtils.java: -------------------------------------------------------------------------------- 1 | package cn.jiguang.cordova.im; 2 | 3 | import android.graphics.Bitmap; 4 | import android.os.Environment; 5 | import android.util.Log; 6 | 7 | import org.apache.cordova.CallbackContext; 8 | import org.json.JSONArray; 9 | import org.json.JSONException; 10 | import org.json.JSONObject; 11 | 12 | import java.io.BufferedOutputStream; 13 | import java.io.File; 14 | import java.io.FileNotFoundException; 15 | import java.io.FileOutputStream; 16 | import java.io.IOException; 17 | import java.net.URI; 18 | 19 | import cn.jpush.im.android.api.JMessageClient; 20 | import cn.jpush.im.android.api.callback.GetUserInfoCallback; 21 | import cn.jpush.im.android.api.content.MessageContent; 22 | import cn.jpush.im.android.api.model.Conversation; 23 | import cn.jpush.im.android.api.model.Message; 24 | import cn.jpush.im.android.api.options.MessageSendingOptions; 25 | import cn.jpush.im.api.BasicCallback; 26 | 27 | import static cn.jiguang.cordova.im.JsonUtils.JsonToMessage; 28 | 29 | class JMessageUtils { 30 | 31 | private static JSONObject getErrorObject(int code, String description) throws JSONException { 32 | JSONObject error = new JSONObject(); 33 | error.put("code", code); 34 | error.put("description", description); 35 | return error; 36 | } 37 | 38 | static void handleResult(int status, String desc, CallbackContext callback) { 39 | if (status == 0) { 40 | callback.success(); 41 | } else { 42 | try { 43 | JSONObject errorObject = getErrorObject(status, desc); 44 | callback.error(getErrorObject(status, desc)); 45 | } catch (JSONException e) { 46 | e.printStackTrace(); 47 | } 48 | } 49 | } 50 | 51 | static void handleResult(JSONObject returnObject, int status, String desc, CallbackContext callback) { 52 | if (status == 0) { 53 | callback.success(returnObject); 54 | } else { 55 | try { 56 | callback.error(getErrorObject(status, desc)); 57 | } catch (JSONException e) { 58 | e.printStackTrace(); 59 | } 60 | } 61 | } 62 | 63 | static void handleResult(JSONArray returnObject, int status, String desc, CallbackContext callback) { 64 | if (status == 0) { 65 | callback.success(returnObject); 66 | } else { 67 | try { 68 | callback.error(getErrorObject(status, desc)); 69 | } catch (JSONException e) { 70 | e.printStackTrace(); 71 | } 72 | } 73 | } 74 | 75 | static MessageSendingOptions toMessageSendingOptions(JSONObject json) throws JSONException { 76 | MessageSendingOptions messageSendingOptions = new MessageSendingOptions(); 77 | 78 | if (json.has("isShowNotification") && !json.isNull("isShowNotification")) { 79 | messageSendingOptions.setShowNotification(json.getBoolean("isShowNotification")); 80 | } 81 | 82 | if (json.has("isRetainOffline") && !json.isNull("isRetainOffline")) { 83 | messageSendingOptions.setRetainOffline(json.getBoolean("isRetainOffline")); 84 | } 85 | 86 | if (json.has("isCustomNotificationEnabled") && !json.isNull("isCustomNotificationEnabled")) { 87 | messageSendingOptions.setCustomNotificationEnabled(json.getBoolean("isCustomNotificationEnabled")); 88 | } 89 | 90 | if (json.has("notificationTitle") && !json.isNull("notificationTitle")) { 91 | messageSendingOptions.setNotificationTitle(json.getString("notificationTitle")); 92 | } 93 | 94 | if (json.has("notificationText") && !json.isNull("notificationText")) { 95 | messageSendingOptions.setNotificationText(json.getString("notificationText")); 96 | } 97 | 98 | if (json.has("needReadReceipt") && !json.isNull("needReadReceipt")) { 99 | messageSendingOptions.setNeedReadReceipt(json.getBoolean("needReadReceipt")); 100 | } 101 | 102 | return messageSendingOptions; 103 | } 104 | 105 | static void getUserInfo(JSONObject params, GetUserInfoCallback callback) throws JSONException { 106 | String username, appKey; 107 | 108 | username = params.getString("username"); 109 | appKey = params.has("appKey") ? params.getString("appKey") : ""; 110 | 111 | JMessageClient.getUserInfo(username, appKey, callback); 112 | } 113 | 114 | /** 115 | * 创建会话对象,如果本地以及存在,则直接返回而不会重新创建。 116 | */ 117 | static Conversation createConversation(JSONObject params) throws JSONException { 118 | String type = params.getString("type"); 119 | Conversation conversation = null; 120 | 121 | if (type.equals("single")) { 122 | String username = params.getString("username"); 123 | String appKey = params.has("appKey") ? params.getString("appKey") : ""; 124 | conversation = Conversation.createSingleConversation(username, appKey); 125 | 126 | } else if (type.equals("group")) { 127 | String groupId = params.getString("groupId"); 128 | conversation = Conversation.createGroupConversation(Long.parseLong(groupId)); 129 | 130 | } else if (type.equals("chatRoom")) { 131 | long roomId = Long.parseLong(params.getString("roomId")); 132 | conversation = Conversation.createChatRoomConversation(roomId); 133 | } 134 | 135 | return conversation; 136 | } 137 | 138 | static Conversation getConversation(JSONObject params) throws JSONException { 139 | String type = params.getString("type"); 140 | Conversation conversation = null; 141 | 142 | if (type.equals("single")) { 143 | String username = params.getString("username"); 144 | String appKey = params.has("appKey") ? params.getString("appKey") : ""; 145 | conversation = JMessageClient.getSingleConversation(username, appKey); 146 | 147 | } else if (type.equals("group")) { 148 | String groupId = params.getString("groupId"); 149 | conversation = JMessageClient.getGroupConversation(Long.parseLong(groupId)); 150 | 151 | } else if (type.equals("chatRoom")) { 152 | long roomId = Long.parseLong(params.getString("roomId")); 153 | conversation = JMessageClient.getChatRoomConversation(roomId); 154 | } 155 | 156 | return conversation; 157 | } 158 | 159 | static Message getMessage(JSONObject params) throws JSONException { 160 | if (params.has("messageId")) { // 代表 JS 层为显式传入所需的参数。 161 | Conversation conversation = getConversation(params); 162 | if (conversation == null) { 163 | return null; 164 | } 165 | 166 | String messageId = params.getString("messageId"); 167 | return conversation.getMessage(Integer.parseInt(messageId)); 168 | 169 | } else if (params.has("id")) { // 代表 JS 层传入的是 Message 对象。 170 | return JsonToMessage(params); 171 | } 172 | 173 | return null; 174 | } 175 | 176 | static void sendMessage(Conversation conversation, MessageContent content, MessageSendingOptions options, 177 | final CallbackContext callback) { 178 | final Message msg = conversation.createSendMessage(content); 179 | msg.setOnSendCompleteCallback(new BasicCallback() { 180 | @Override 181 | public void gotResult(int status, String desc) { 182 | if (status == 0) { 183 | JSONObject json = JsonUtils.toJson(msg); 184 | handleResult(json, status, desc, callback); 185 | } else { 186 | handleResult(status, desc, callback); 187 | } 188 | } 189 | }); 190 | 191 | if (options == null) { 192 | JMessageClient.sendMessage(msg); 193 | } else { 194 | JMessageClient.sendMessage(msg, options); 195 | } 196 | } 197 | 198 | static String storeImage(Bitmap bitmap, String filename, String pkgName) { 199 | File avatarFile = new File(getAvatarPath(pkgName)); 200 | if (!avatarFile.exists()) { 201 | avatarFile.mkdirs(); 202 | } 203 | 204 | String filePath = getAvatarPath(pkgName) + filename + ".png"; 205 | try { 206 | FileOutputStream fos = new FileOutputStream(filePath); 207 | BufferedOutputStream bos = new BufferedOutputStream(fos); 208 | bitmap.compress(Bitmap.CompressFormat.PNG, 100, bos); 209 | bos.flush(); 210 | bos.close(); 211 | return filePath; 212 | } catch (FileNotFoundException e) { 213 | e.printStackTrace(); 214 | return ""; 215 | } catch (IOException e) { 216 | e.printStackTrace(); 217 | return ""; 218 | } 219 | } 220 | 221 | static String getFilePath(String pkgName) { 222 | return Environment.getExternalStorageDirectory() + "/" + pkgName; 223 | } 224 | 225 | static String getAvatarPath(String pkgName) { 226 | return getFilePath(pkgName) + "/images/avatar/"; 227 | } 228 | 229 | static String getFileExtension(String path) { 230 | return path.substring(path.lastIndexOf(".")); 231 | } 232 | 233 | /** 234 | * 根据绝对路径或 URI 获得本地图片。 235 | * 236 | * @param path 文件路径或者 URI。 237 | * @return 文件对象。 238 | */ 239 | static File getFile(String path) throws FileNotFoundException { 240 | File file = new File(path); // if it is a absolute path 241 | 242 | if (!file.isFile()) { 243 | URI uri = URI.create(path); // if it is a uri. 244 | file = new File(uri); 245 | } 246 | 247 | if (!file.exists() || !file.isFile()) { 248 | throw new FileNotFoundException(); 249 | } 250 | 251 | return file; 252 | } 253 | 254 | } 255 | -------------------------------------------------------------------------------- /src/android/Logger.java: -------------------------------------------------------------------------------- 1 | package cn.jiguang.cordova.im; 2 | 3 | import android.content.Context; 4 | import android.util.Log; 5 | import android.widget.Toast; 6 | 7 | class Logger { 8 | 9 | public static boolean SHUTDOWNLOG; 10 | public static boolean SHUTDOWNTOAST; 11 | 12 | public static void i(String tag, String msg) { 13 | if (!SHUTDOWNLOG) { 14 | Log.i(tag, msg); 15 | } 16 | } 17 | 18 | public static void d(String tag, String msg) { 19 | if (!SHUTDOWNLOG) { 20 | Log.d(tag, msg); 21 | } 22 | } 23 | 24 | public static void w(String tag, String msg) { 25 | if (!SHUTDOWNLOG) { 26 | Log.w(tag, msg); 27 | } 28 | } 29 | 30 | public static void toast(Context context, String msg) { 31 | if (!SHUTDOWNTOAST) { 32 | Toast.makeText(context, msg, Toast.LENGTH_SHORT).show(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/android/libs/jmessage-sdk-android-2.7.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/src/android/libs/jmessage-sdk-android-2.7.1.jar -------------------------------------------------------------------------------- /src/ios/JMessageConfig.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Appkey 6 | 7 | Channel 8 | Subscription 9 | IsProduction 10 | 11 | Delay 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/ios/Plugins/AppDelegate+JMessage.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate+JPush.h 3 | // delegateExtention 4 | // 5 | // Created by 张庆贺 on 15/8/3. 6 | // Copyright (c) 2015年 JPush. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | #import 11 | #import 12 | 13 | @interface AppDelegate (JMessage) 14 | 15 | -(void)startJMessageSDK; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /src/ios/Plugins/AppDelegate+JMessage.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate+JPush.m 3 | // delegateExtention 4 | // 5 | // Created by 张庆贺 on 15/8/3. 6 | // Copyright (c) 2015年 JPush. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "JMessagePlugin.h" 12 | #import "JMessageHelper.h" 13 | #import "AppDelegate+JMessage.h" 14 | 15 | 16 | @implementation AppDelegate (JMessage) 17 | 18 | +(void)load{ 19 | Method origin1; 20 | Method swizzle1; 21 | origin1 = class_getInstanceMethod([self class],@selector(init)); 22 | swizzle1 = class_getInstanceMethod([self class], @selector(init_plus1)); 23 | method_exchangeImplementations(origin1, swizzle1); 24 | } 25 | 26 | -(instancetype)init_plus1{ 27 | [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidLaunch1:) name:UIApplicationDidFinishLaunchingNotification object:nil]; 28 | return [self init_plus1]; 29 | } 30 | 31 | NSDictionary *_launchOptions; 32 | 33 | -(void)applicationDidLaunch1:(NSNotification *)notification{ 34 | [self startJMessageSDK]; 35 | } 36 | 37 | -(void)startJMessageSDK{ 38 | // [[JMessageHelper shareInstance] initJMessage:_launchOptions]; 39 | [JMessageHelper shareInstance].launchOptions = _launchOptions; 40 | 41 | 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /src/ios/Plugins/JMessageDefine.h: -------------------------------------------------------------------------------- 1 | // 2 | // ConstantDef.h 3 | // jmessage 4 | // 5 | // Created by ljg on 16/1/19. 6 | // 7 | // 8 | 9 | #ifndef ConstantDef_h 10 | #define ConstantDef_h 11 | 12 | 13 | #define WEAK_SELF(weakSelf) __weak __typeof(&*self)weakSelf = self; 14 | 15 | static NSString *const JMessagePluginName = @"window.plugins.jmessage"; 16 | static NSString *const JPushPluginName = @"window.plugins.jPushPlugin"; 17 | 18 | static NSString *const JMessageConfig_FileName = @"JMessageConfig"; 19 | static NSString *const JMessageConfig_Appkey = @"Appkey"; 20 | static NSString *const JMessageConfig_Channel = @"Channel"; 21 | static NSString *const JMessageConfig_IsProduction = @"IsProduction"; 22 | static NSString *const JMessageConfig_IsIDFA = @"IsIDFA"; 23 | static NSString *const JMessageConfig_Delay = @"Delay"; 24 | 25 | // 在线消息 26 | #define kJJMessageReceiveMessage @"kJJMessageReceiveMessage" 27 | #define kJJMessageReceiptMessage @"kJJMessageReceiptMessage" 28 | #define kJJMessageReceiveChatroomMessage @"kJJMessageReceiveChatroomMessage" 29 | #define kJJMessageSendMessageRespone @"kJJMessageSendMessageRespone" 30 | 31 | //Conversation 回调 32 | #define kJJMessageConversationChanged @"kJJMessageConversationChanged" 33 | #define kJJMessageUnreadChanged @"kJJMessageUnreadChanged" 34 | 35 | //离线消息 36 | #define kJJMessageSyncOfflineMessage @"kJJMessageSyncOfflineMessage" 37 | 38 | // 漫游消息同步 39 | 40 | #define kJJMessageSyncRoamingMessage @"kJJMessageSyncRoamingMessage" 41 | 42 | //Group 回调 43 | #define kJJMessageGroupInfoChanged @"kJJMessageGroupInfoChanged" 44 | #define kJJMessageGroupInfoChanged @"kJJMessageGroupInfoChanged" 45 | #define kJJMessageReceiveApplyJoinGroupApproval @"kJJMessageReceiveApplyJoinGroupApproval" 46 | #define kJJMessageReceiveGroupAdminReject @"kJJMessageReceiveGroupAdminReject" 47 | #define kJMessageReceiveGroupAdminApproval @"kJMessageReceiveGroupAdminApproval" 48 | 49 | //User 回调 50 | #define kJJMessageLoginUserKicked @"kJJMessageLoginUserKicked" 51 | #define kJJMessageLoginStateChanged @"kJJMessageLoginStateChanged" 52 | #define kJJMessageContactNotify @"kJJMessageContactNotify" 53 | #define kJJMessageRetractMessage @"kJJMessageretractMessage" 54 | 55 | 56 | //message 57 | static NSString *const KEY_ERRORCODE = @"errorCode"; 58 | static NSString *const KEY_ERRORDESCRIP = @"errorDscription"; 59 | static NSString *const KEY_CONTENTTYPE = @"contentType"; 60 | static NSString *const KEY_LASTMESSAGE = @"lastMessage"; 61 | static NSString *const KEY_UNREADCOUNT = @"unreadCount"; 62 | static NSString *const KEY_CONTENT = @"content"; 63 | static NSString *const KEY_MSGID = @"msgId"; 64 | static NSString *const KEY_RESPONE = @"respone"; 65 | 66 | 67 | //Group 68 | static NSString *const KEY_GROUP_GID = @"gid"; 69 | static NSString *const KEY_GROUP_NAME = @"name"; 70 | static NSString *const KEY_GROUP_DESC = @"desc"; 71 | static NSString *const KEY_GROUP_LEVEL = @"level"; 72 | static NSString *const KEY_GROUP_GLAG = @"flag"; 73 | static NSString *const KEY_GROUP_OWNER = @"owner"; 74 | static NSString *const KEY_GROUP_OWNERAPPKEY = @"ownerappkey"; 75 | static NSString *const KEY_GROUP_MAXMEMBERCOUNT = @"maxMemberCount"; 76 | static NSString *const KEY_GROUP_ISNODISTURB = @"isNoDisturb"; 77 | 78 | 79 | 80 | #endif /* ConstantDef_h */ 81 | -------------------------------------------------------------------------------- /src/ios/Plugins/JMessageHelper.h: -------------------------------------------------------------------------------- 1 | // __ __ ________ 2 | // | | | | \ \ / / | | | | / _______| 3 | // | |____| | \ \/ / | |____| | / / 4 | // | |____| | \ / | |____| | | | _____ 5 | // | | | | / \ | | | | | | |____ | 6 | // | | | | / /\ \ | | | | \ \______| | 7 | // | | | | /_/ \_\ | | | | \_________| 8 | // 9 | // Copyright (c) 2012年 HXHG. All rights reserved. 10 | // http://www.jpush.cn 11 | // Created by liangjianguo 12 | // 13 | 14 | 15 | #import 16 | #import 17 | 18 | //static NSString *JMessageAppKey; 19 | 20 | @interface JMessageHelper : NSObject 21 | @property(nonatomic, strong)NSString *JMessageAppKey; 22 | @property(strong,nonatomic)NSDictionary *launchOptions; 23 | + (JMessageHelper *)shareInstance; 24 | 25 | -(void)initJMessage:(NSDictionary*)launchOptions; 26 | 27 | @end 28 | 29 | 30 | @interface NSArray (JMessage) 31 | - (NSArray *)mapObjectsUsingBlock:(id (^)(id obj, NSUInteger idx))block; 32 | @end 33 | 34 | @interface NSDictionary (JMessage) 35 | -(NSString*)toJsonString; 36 | @end 37 | 38 | @interface NSString (JMessage) 39 | -(NSDictionary*)toDictionary; 40 | @end 41 | 42 | @interface JMSGConversation (JMessage) 43 | -(NSMutableDictionary*)conversationToDictionary; 44 | @end 45 | 46 | @interface JMSGUser (JMessage) 47 | -(NSMutableDictionary*)userToDictionary; 48 | @end 49 | 50 | @interface JMSGGroup (JMessage) 51 | -(NSMutableDictionary*)groupToDictionary; 52 | @end 53 | 54 | @interface JMSGGroupMemberInfo (JMessage) 55 | - (NSMutableDictionary *)memberToDictionary; 56 | @end 57 | 58 | @interface JMSGGroupInfo (JMessage) 59 | -(NSMutableDictionary*)groupToDictionary; 60 | @end 61 | 62 | @interface JMSGMessage (JMessage) 63 | - (NSMutableDictionary *)messageToDictionary; 64 | @end 65 | 66 | @interface JMSGChatRoom (JMessage) 67 | - (NSMutableDictionary *)chatRoomToDictionary; 68 | @end 69 | 70 | @interface JMSGApplyJoinGroupEvent (JMessage) 71 | - (NSMutableDictionary *)eventToDictionary; 72 | @end 73 | 74 | @interface JMSGGroupAdminRejectApplicationEvent (JMessage) 75 | - (NSMutableDictionary *)eventToDictionary; 76 | @end 77 | 78 | @interface JMSGGroupAdminApprovalEvent (JMessage) 79 | - (NSMutableDictionary *)eventToDictionary; 80 | @end 81 | -------------------------------------------------------------------------------- /src/ios/Plugins/JMessagePlugin.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | @interface JMessagePlugin : CDVPlugin 5 | + (void)fireDocumentEvent:(NSString*)eventName jsString:(NSString*)jsString; 6 | 7 | - (void)startJMessageSDK:(CDVInvokedUrlCommand *)command; 8 | 9 | - (void)init:(CDVInvokedUrlCommand *)command; 10 | - (void)setDebugMode:(CDVInvokedUrlCommand *)command; 11 | 12 | // account 13 | - (void)userRegister:(CDVInvokedUrlCommand *)command; 14 | - (void)userLogin:(CDVInvokedUrlCommand *)command; 15 | - (void)userLogout:(CDVInvokedUrlCommand *)command; 16 | - (void)getMyInfo:(CDVInvokedUrlCommand *)command; 17 | - (void)getUserInfo:(CDVInvokedUrlCommand *)command; 18 | - (void)updateMyAvatar:(CDVInvokedUrlCommand *)command; 19 | - (void)updateMyPassword:(CDVInvokedUrlCommand *)command; 20 | - (void)updateMyInfo:(CDVInvokedUrlCommand *)command; 21 | 22 | // Send message 23 | - (void)sendTextMessage:(CDVInvokedUrlCommand *)command; 24 | - (void)sendImageMessage:(CDVInvokedUrlCommand *)command; 25 | - (void)sendVoiceMessage:(CDVInvokedUrlCommand *)command; 26 | - (void)sendCustomMessage:(CDVInvokedUrlCommand *)command; 27 | - (void)sendLocationMessage:(CDVInvokedUrlCommand *)command; 28 | - (void)sendFileMessage:(CDVInvokedUrlCommand *)command; 29 | - (void)getHistoryMessages:(CDVInvokedUrlCommand *)command; 30 | - (void)sendInvitationRequest:(CDVInvokedUrlCommand *)command; 31 | - (void)acceptInvitation:(CDVInvokedUrlCommand *)command; 32 | - (void)declineInvitation:(CDVInvokedUrlCommand *)command; 33 | - (void)removeFromFriendList:(CDVInvokedUrlCommand *)command; 34 | - (void)updateFriendNoteName:(CDVInvokedUrlCommand *)command; 35 | - (void)updateFriendNoteText:(CDVInvokedUrlCommand *)command; 36 | - (void)getFriends:(CDVInvokedUrlCommand *)command; 37 | - (void)createGroup:(CDVInvokedUrlCommand *)command; 38 | - (void)getGroupIds:(CDVInvokedUrlCommand *)command; 39 | - (void)getGroupInfo:(CDVInvokedUrlCommand *)command; 40 | - (void)updateGroupInfo:(CDVInvokedUrlCommand *)command; 41 | - (void)addGroupMembers:(CDVInvokedUrlCommand *)command; 42 | - (void)removeGroupMembers:(CDVInvokedUrlCommand *)command; 43 | - (void)exitGroup:(CDVInvokedUrlCommand *)command; 44 | - (void)getGroupMembers:(CDVInvokedUrlCommand *)command; 45 | - (void)addUsersToBlacklist:(CDVInvokedUrlCommand *)command; 46 | - (void)removeUsersFromBlacklist:(CDVInvokedUrlCommand *)command; 47 | 48 | - (void)getBlacklist:(CDVInvokedUrlCommand *)command; 49 | - (void)setNoDisturb:(CDVInvokedUrlCommand *)command; 50 | - (void)getNoDisturbList:(CDVInvokedUrlCommand *)command; 51 | - (void)setNoDisturbGlobal:(CDVInvokedUrlCommand *)command; 52 | - (void)isNoDisturbGlobal:(CDVInvokedUrlCommand *)command; 53 | - (void)downloadThumbUserAvatar:(CDVInvokedUrlCommand *)command; 54 | - (void)downloadOriginalUserAvatar:(CDVInvokedUrlCommand *)command; 55 | - (void)downloadThumbImage:(CDVInvokedUrlCommand *)command; 56 | - (void)downloadOriginalImage:(CDVInvokedUrlCommand *)command; 57 | - (void)downloadVoiceFile:(CDVInvokedUrlCommand *)command; 58 | - (void)downloadVideoFile:(CDVInvokedUrlCommand *)command; 59 | - (void)downloadFile:(CDVInvokedUrlCommand *)command; 60 | - (void)createConversation:(CDVInvokedUrlCommand *)command; 61 | - (void)deleteConversation:(CDVInvokedUrlCommand *)command; 62 | - (void)getConversation:(CDVInvokedUrlCommand *)command; 63 | - (void)getConversations:(CDVInvokedUrlCommand *)command; 64 | - (void)resetUnreadMessageCount:(CDVInvokedUrlCommand *)command; 65 | - (void)retractMessage:(CDVInvokedUrlCommand *)command; 66 | 67 | - (void)isGroupBlocked:(CDVInvokedUrlCommand *)command; 68 | - (void)getBlockedGroupList:(CDVInvokedUrlCommand *)command; 69 | - (void)updateGroupAvatar:(CDVInvokedUrlCommand *)command; 70 | - (void)downloadThumbGroupAvatar:(CDVInvokedUrlCommand *)command; 71 | - (void)downloadOriginalGroupAvatar:(CDVInvokedUrlCommand *)command; 72 | - (void)setConversationExtras:(CDVInvokedUrlCommand *)command; 73 | 74 | - (void)transferGroupOwner:(CDVInvokedUrlCommand *)command; 75 | - (void)setGroupMemberSilence:(CDVInvokedUrlCommand *)command; 76 | - (void)isSilenceMember:(CDVInvokedUrlCommand *)command; 77 | - (void)groupSilenceMembers:(CDVInvokedUrlCommand *)command; 78 | - (void)setGroupNickname:(CDVInvokedUrlCommand *)command; 79 | 80 | // 聊天室 API 81 | - (void)getChatRoomInfoListOfApp:(CDVInvokedUrlCommand *)command; 82 | - (void)getChatRoomInfoListOfUser:(CDVInvokedUrlCommand *)command; 83 | - (void)getChatRoomInfoListById:(CDVInvokedUrlCommand *)command; 84 | - (void)enterChatRoom:(CDVInvokedUrlCommand *)command; 85 | - (void)exitChatRoom:(CDVInvokedUrlCommand *)command; 86 | - (void)getChatRoomConversation:(CDVInvokedUrlCommand *)command; 87 | - (void)getChatRoomConversationList:(CDVInvokedUrlCommand *)command; 88 | - (void)getChatRoomOwner:(CDVInvokedUrlCommand *)command; 89 | - (void)setBadge:(CDVInvokedUrlCommand *)command; 90 | @end 91 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGAbstractContent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | #import 14 | 15 | 16 | /*! 17 | * 消息内容(抽象类) 18 | * 19 | * 所有消息内容的实体类,都直接或者间接继承这个类。很多 API 上使用这个抽象类作为类型。 20 | * 21 | * 有时候通过 API 得到的是这个抽象类型,需要基于消息的 contentType 属性来转型为相应的具体子类, 22 | * 做进一步的动作。 23 | * 24 | * ``` 25 | * // 转移到子类举例 26 | * JMSGAbstractContent *content = oneMessage.content; 27 | * if (oneMessage.contentType == kJMSGContentTypeText) { 28 | * JMSGTextContent *textContent = (JMSGTextContent *)content; 29 | * String text = textContent.text; 30 | * } 31 | * ``` 32 | */ 33 | @interface JMSGAbstractContent : NSObject {} 34 | 35 | JMSG_ASSUME_NONNULL_BEGIN 36 | 37 | /*! 38 | * @abstract 附加参数 39 | * 40 | * @discussion 对某个类型的消息, 比如 VoiceContent, 可以附加参数以便用于业务逻辑 41 | */ 42 | @property(nonatomic, strong, readonly) NSDictionary * JMSG_NULLABLE extras; 43 | 44 | // 无效的初始化方法. 应使用各具体子类内容类型的特别的方法 45 | - (nullable instancetype)init NS_UNAVAILABLE; 46 | 47 | /*! 48 | * @abstract 增加一个字符串值类型的字段 49 | * 50 | * @param value 新增键值对的值. String 类型. 51 | * @param key 新增键值对的键 52 | */ 53 | - (BOOL)addStringExtra:(NSString *)value forKey:(NSString *)key; 54 | 55 | /*! 56 | * @abstract 增加一个数字值类型的字段 57 | * 58 | * @param value 新增键值对的值. Number 类型. 59 | * @param key 新增键值对的键 60 | */ 61 | - (BOOL)addNumberExtra:(NSNumber *)value forKey:(NSString *)key; 62 | 63 | /*! 64 | * @abstract 调用此方法得到 JSON 格式描述的 Message Content 65 | */ 66 | - (NSString *)toJsonString; 67 | 68 | /*! 69 | * @abstract 判断消息内容是否相等 70 | * 71 | * @param content 比较的内容对象 72 | * 73 | * @discussion 对于媒体类的内容, 即使同样的内容, 每次也视为新的资源, 会生成不同的资源ID, 74 | * 从而最终 content 不相等. 75 | * 76 | * 所有的子类都提供本方法. 77 | */ 78 | - (BOOL)isEqualToContent:(JMSGAbstractContent * JMSG_NULLABLE)content; 79 | 80 | JMSG_ASSUME_NONNULL_END 81 | 82 | @end 83 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGChatRoom.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | #import 14 | 15 | @class JMSGUser; 16 | 17 | /*! 18 | * 聊天室 19 | * 20 | * #### 主要特点 21 | * 22 | * 聊天室的消息没有推送通知和离线保存,也没有常驻成员的概念,只要进入聊天室即可接收消息,开始聊天, 23 | 一旦退出聊天室,不再会接收到任何消息、通知和提醒。 24 | * 25 | * #### 发送消息 26 | * 27 | * 聊天室消息的发送与单聊、群聊是一样的,通用的发送接口 28 | * 29 | * #### 接收消息 30 | * 31 | * 聊天室消息的接收与单聊、群聊做了区分,聊天室消息的接收将通过 JMSGConversationDelegate 类里的 onReceiveChatRoomConversation:messages: 方法通知到上层 32 | * 33 | */ 34 | @interface JMSGChatRoom : NSObject 35 | JMSG_ASSUME_NONNULL_BEGIN 36 | 37 | /*! 38 | * @abstract 分页获取聊天室详情 39 | * 40 | * @param appKey 选填,为 nil 则获取当前应用下的聊天室 41 | * @param start 分页获取的下标,第一页从 index = 0 开始 42 | * @param count 一页的数量,每页最大值是 50 43 | * @param handler 结果回调. 正常返回时 resultObject 类型是 NSArray 44 | * 45 | * @discussion 该接口总是向服务器端发起请求. 46 | */ 47 | + (void)getChatRoomListWithAppKey:(NSString *JMSG_NULLABLE)appKey 48 | start:(NSInteger)start 49 | count:(NSInteger)count 50 | completionHandler:(JMSGCompletionHandler JMSG_NULLABLE)handler; 51 | 52 | /*! 53 | * @abstract 获取当前用户已加入的聊天室列表 54 | * 55 | * @param handler 结果回调. 正常返回时 resultObject 类型是 NSArray 56 | * 57 | * @discussion 该接口总是向服务器端发起请求. 58 | */ 59 | + (void)getMyChatRoomListCompletionHandler:(JMSGCompletionHandler JMSG_NULLABLE)handler; 60 | 61 | /*! 62 | * @abstract 获取聊天室详情 63 | * 64 | * @param roomIds 待获取详情的聊天室 ID 数组 65 | * @param handler 结果回调. 正常返回时 resultObject 类型是 NSArray 66 | * 67 | * @discussion 该接口总是向服务器端发起请求. 68 | */ 69 | + (void)getChatRoomInfosWithRoomIds:(NSArray *JMSG_NONNULL)roomIds 70 | completionHandler:(JMSGCompletionHandler JMSG_NULLABLE)handler; 71 | 72 | /*! 73 | * @abstract 加入聊天室 74 | * 75 | * @param roomId 聊天室 id 76 | * @param handler 结果回调. error = nil 表示加入成功,resultObject 为 JMSGConversation 类型 77 | * 78 | * @discussion 成功进入聊天室之后,会将聊天室中最近若干条聊天记录同步下来并以 onReceiveChatRoomConversation: 事件的形式通知到上层,进入聊天室会自动获取最近50条消息。 79 | */ 80 | + (void)enterChatRoomWithRoomId:(NSString *JMSG_NONNULL)roomId 81 | completionHandler:(JMSGCompletionHandler JMSG_NULLABLE)handler; 82 | 83 | /*! 84 | * @abstract 退出聊天室 85 | * 86 | * @param roomId 聊天室 id 87 | * @param handler 结果回调. error = nil 表示加入成功. 88 | * 89 | * @discussion 退出聊天室后获取不到任何消息和通知. 90 | */ 91 | + (void)leaveChatRoomWithRoomId:(NSString *JMSG_NONNULL)roomId 92 | completionHandler:(JMSGCompletionHandler JMSG_NULLABLE)handler; 93 | 94 | ///---------------------------------------------------- 95 | /// @name Group basic fields 群组基本属性 96 | ///---------------------------------------------------- 97 | 98 | 99 | /*! 100 | * @abstract 聊天室 id 101 | */ 102 | @property(nonatomic, strong, readonly) NSString *JMSG_NONNULL roomID; 103 | /*! 104 | * @abstract 名称 105 | */ 106 | @property(nonatomic, strong, readonly) NSString *JMSG_NONNULL name; 107 | /*! 108 | * @abstract 聊天室所属应用 AppKey 109 | */ 110 | @property(nonatomic, strong, readonly) NSString *JMSG_NONNULL appkey; 111 | /*! 112 | * @abstract 描述信息 113 | */ 114 | @property(nonatomic, strong, readonly) NSString *JMSG_NULLABLE desc; 115 | 116 | /*! 117 | * @abstract 聊天室人数 118 | */ 119 | @property(nonatomic, assign, readonly) NSInteger totalMemberCount; 120 | 121 | /*! 122 | * @abstract 聊天室最大人数限制 123 | */ 124 | @property(nonatomic, strong, readonly) NSString *JMSG_NULLABLE maxMemberCount; 125 | 126 | /*! 127 | * @abstract 聊天室的创建时间 128 | */ 129 | @property(nonatomic, strong, readonly) NSNumber *ctime; 130 | 131 | /*! 132 | * @abstract 聊天室创建者 133 | * 134 | * @param handler 结果回调. error = nil 表示获取成功, resultObject 为 JMSGUser 类型. 135 | */ 136 | - (void)getChatRoomOwnerInfo:(JMSGCompletionHandler JMSG_NULLABLE)handler; 137 | 138 | /*! 139 | * @abstract 聊天室的黑名单列表 140 | * 141 | * @param handler 结果回调. resultObject 是 NSArray 类型,元素是 JMSGUser 142 | * 143 | * @since 3.8.0 144 | */ 145 | - (void)chatRoomBlacklist:(JMSGCompletionHandler JMSG_NULLABLE)handler; 146 | 147 | /*! 148 | * @abstract 添加黑名单 149 | * 150 | * @param usernames 用户名列表 151 | * @param appkey 用户 appKey,usernames 中的所有用户必须在同一个 AppKey 下,不填则默认为本应用 appKey 152 | * @param handler 结果回调。error 为 nil 表示成功. 153 | * 154 | * @since 3.8.0 155 | */ 156 | - (void)addBlacklistWithUsernames:(NSArray <__kindof NSString *>*)usernames 157 | appKey:(NSString *JMSG_NULLABLE)appKey 158 | handler:(JMSGCompletionHandler JMSG_NULLABLE)handler; 159 | /*! 160 | * @abstract 删除黑名单 161 | * 162 | * @param usernames 用户名列表 163 | * @param appkey 用户 appKey,usernames 中的所有用户必须在同一个 AppKey 下,不填则默认为本应用 appKey 164 | * @param handler 结果回调。error 为 nil 表示成功. 165 | * 166 | * @since 3.8.0 167 | */ 168 | - (void)deleteBlacklistWithUsernames:(NSArray <__kindof NSString *>*)usernames 169 | appKey:(NSString *JMSG_NULLABLE)appKey 170 | handler:(JMSGCompletionHandler JMSG_NULLABLE)handler; 171 | 172 | /*! 173 | * @abstract 管理员列表 174 | * 175 | * @param handler 结果回调. resultObject 是 NSArray 类型,元素是 JMSGUser 176 | * 177 | * @discussion 注意:返回列表中不包含房主. 178 | * 179 | * @since 3.8.0 180 | */ 181 | - (void)chatRoomAdminList:(JMSGCompletionHandler JMSG_NULLABLE)handler; 182 | 183 | /*! 184 | * @abstract 添加管理员 185 | * 186 | * @param usernames 用户名列表 187 | * @param appkey 用户 AppKey,不填则默认为本应用 AppKey 188 | * @param handler 结果回调。error 为 nil 表示成功. 189 | * 190 | * @discussion 注意:非 VIP 应用最多设置 15 个管理员,不包括群主本身 191 | * 192 | * @since 3.8.0 193 | */ 194 | - (void)addAdminWithUsernames:(NSArray <__kindof NSString *>*)usernames 195 | appKey:(NSString *JMSG_NULLABLE)appkey 196 | handler:(JMSGCompletionHandler JMSG_NULLABLE)handler; 197 | 198 | /*! 199 | * @abstract 删除管理员 200 | * 201 | * @param usernames 用户名列表 202 | * @param appkey 用户 AppKey,不填则默认为本应用 AppKey 203 | * @param handler 结果回调。error 为 nil 表示成功. 204 | * 205 | * @since 3.8.0 206 | */ 207 | - (void)deleteAdminWithUsernames:(NSArray <__kindof NSString *>*)usernames 208 | appKey:(NSString *JMSG_NULLABLE)appkey 209 | handler:(JMSGCompletionHandler JMSG_NULLABLE)handler; 210 | 211 | /*! 212 | * @abstract 聊天室的展示名 213 | * 214 | * @discussion 如果 chatroom.name 为空, 则此接口会返回 chatroom.roomID. 215 | */ 216 | - (NSString *)displayName; 217 | 218 | JMSG_ASSUME_NONNULL_END 219 | @end 220 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGConversationDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | 14 | /*! 15 | * 会话相关变更通知 16 | */ 17 | @protocol JMSGConversationDelegate 18 | 19 | /*! 20 | * @abstract 会话信息变更通知 21 | * 22 | * @param conversation 变更后的会话对象 23 | * 24 | * @discussion 当前有二个属性: 会话标题(title), 会话图标 25 | * 26 | * 收到此通知后, 建议处理: 如果 App 当前在会话列表页,刷新整个列表;如果在聊天界面,刷新聊天标题。 27 | */ 28 | @optional 29 | - (void)onConversationChanged:(JMSGConversation *)conversation; 30 | 31 | /*! 32 | * @abstract 同步离线消息、离线事件通知 33 | * 34 | * @param conversation 同步离线消息的会话 35 | * @param offlineMessages 离线消息、离线事件数组 36 | * 37 | * @discussion 注意: 38 | * 39 | * SDK 会将消息下发分为在线下发和离线下发两种情况, 40 | * 其中用户在离线状态(包括用户登出或者网络断开)期间所收到的消息我们称之为离线消息. 41 | * 42 | * 当用户上线收到这部分离线消息后,这里的处理与之前版本不同的是: 43 | * 44 | * 3.1.0 版本之前: SDK 会和在线时收到的消息一样,每收到一条消息都会上抛一个在线消息 JMSGMessage 来通知上层. 45 | * 46 | * 3.1.0 版本之后: SDK 会以会话为单位,不管该会话有多少离线消息,SDK同步完成后每个会话只上抛一次. 47 | * 48 | * 3.2.1 版本之后: SDK 会以会话为单位,不管该会话有多少离线事件,SDK同步完成后每个会话只上抛一次 49 | * 50 | * 注意:一个会话最多触发两次这个代理,即:离线消息和离线事件各一次,这样会大大减轻上层在收到消息刷新 UI 的压力. 51 | * 52 | * 上层通过此代理方法监听离线消息同步的会话,详见官方文档. 53 | * 54 | */ 55 | @optional 56 | - (void)onSyncOfflineMessageConversation:(JMSGConversation *)conversation 57 | offlineMessages:(NSArray JMSG_GENERIC(__kindof JMSGMessage *)*)offlineMessages; 58 | /*! 59 | * @abstract 同步漫游消息通知 60 | * 61 | * @param conversation 同步漫游消息的会话 62 | * 63 | * @discussion 注意: 64 | * 65 | * 当 SDK 触发此函数时,说明该会话有同步下漫游消息,并且已经存储到本地数据库中, 66 | * 上层可通过 JMSGConversation 类中的获取message的方法刷新UI. 67 | * 68 | * @since 3.1.0 69 | */ 70 | @optional 71 | - (void)onSyncRoamingMessageConversation:(JMSGConversation *)conversation; 72 | 73 | /*! 74 | * @abstract 接收聊天室消息 75 | * 76 | * @param conversation 聊天室会话 77 | * @param messages 接收到的消息数组,元素是 JMSGMessage 78 | * 79 | * @discussion 注意: 80 | * 81 | * 接收聊天室的消息与单聊、群聊消息不同,聊天室消息都是通过这个代理方法来接收的。 82 | * 83 | * @since 3.4.0 84 | */ 85 | - (void)onReceiveChatRoomConversation:(JMSGConversation *)conversation 86 | messages:(NSArray JMSG_GENERIC(__kindof JMSGMessage *)*)messages; 87 | 88 | 89 | /*! 90 | * @abstract 当前剩余的全局未读数 91 | * 92 | * @param newCount 变更后的数量 93 | */ 94 | @optional 95 | - (void)onUnreadChanged:(NSUInteger)newCount __attribute__((deprecated("deprecated"))); 96 | @end 97 | 98 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGCustomContent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | #import 14 | 15 | /*! 16 | * 定制内容类型 17 | * 18 | * 用于自定义消息的内容类型. 19 | * 20 | * 建议只在基本类型 (TextContent, VoiceContent, ImageContent) 不满足使用的情况才使用此类型. 21 | * 22 | * 所有的内容类型都带有 extras 可附加字段信息, 从而都具备一定的定制能力. 23 | * 比如如果需要基于图片做简单定制, 建议基于 ImageContent 再附加 extra 的方式. 24 | * 25 | */ 26 | @interface JMSGCustomContent : JMSGAbstractContent 27 | 28 | JMSG_ASSUME_NONNULL_BEGIN 29 | 30 | @property(nonatomic, strong, readonly) NSDictionary * JMSG_NULLABLE customDictionary; 31 | 32 | // 不支持使用的初始化方法 33 | - (instancetype)init NS_UNAVAILABLE; 34 | 35 | /*! 36 | * @abstract 预期使用的初始化方法 37 | * 38 | * @param customDict 初始化时指定的字典 39 | */ 40 | - (instancetype)initWithCustomDictionary:(NSDictionary * JMSG_NULLABLE)customDict; 41 | 42 | /*! 43 | * @abstract 添加一个键值对. 44 | * 45 | * @param value 值. 必须满足 JSON Value 的要求, 基本规则是: NSNumber, NSString, NSArray, NSDictionary 46 | * @param key 键 47 | * 48 | * @return 如果无效的 value, 返回 false, 添加失败 49 | * 50 | * @discussion value的有效性校验, 参考 Apple 官方文档: https://developer.apple.com/library//ios/documentation/Foundation/Reference/NSJSONSerialization_Class/index.html#//apple_ref/occ/clm/NSJSONSerialization/isValidJSONObject: 51 | */ 52 | - (BOOL)addObjectValue:(NSObject *)value forKey:(NSString *)key; 53 | 54 | /*! 55 | * @abstract 快捷添加 String 类型 value 的方法 56 | * 57 | * @param value 键值对里的值. String 类型. 58 | * @param key 键值对里的键 59 | * 60 | * @return 如果无效的 value, 返回 false, 添加失败 61 | */ 62 | - (BOOL)addStringValue:(NSString *)value forKey:(NSString *)key; 63 | 64 | /*! 65 | * @abstract 快捷添加 Number 类型 value 的方法 66 | * 67 | * @param value 键值对里的值. Number 类型. 68 | * @param key 键值对里的键 69 | * 70 | * @return 如果无效的 value, 返回 false, 添加失败 71 | */ 72 | - (BOOL)addNumberValue:(NSNumber *)value forKey:(NSString *)key; 73 | 74 | /*! 75 | * @abstract 设置该自定义消息内容的文本描述 76 | * 77 | * @param contentText 内容文本描述 78 | * 79 | * @discussion 用于展示在会话列表, 文本地简要描述这条消息. 80 | * 如果未设置, 则默认值为 "[自定义消息]" 81 | */ 82 | - (void)setContentText:(NSString *)contentText; 83 | 84 | JMSG_ASSUME_NONNULL_END 85 | 86 | @end 87 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGDBMigrateDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | 14 | 15 | /*! 16 | * 数据库升级通知 17 | * 18 | * 当一个新版本的 SDK 第一次启动时, 如果发现新版本所使用的 DB 需要升级, 则会暂停启动过程, 进行升级操作. 19 | * 数据库升级操作可能需要花费较长的时间. 20 | * 21 | * 在数据库升级操作进行期间, SDK 未启动正常工作, 所有 API 禁止访问. 简单地说, SDK 在不可用状态. 22 | * 23 | * 为了让 App 能够处理 SDK 的这个状态, 数据库升级期间, SDK 会发出升级开始, 与升级完成的通知. 24 | * 25 | * 建议 App 应处理这个数据库升级的通知, 以让 App 交互看起来是可以接受的. 26 | * 27 | * 典型的作法是: 收到升级开始通知时, App 弹出全屏进度状态, 提示用户正在升级数据. 在这个状态下用户不可以操作 App. 28 | * 收到升级完成通知时, 结束升级提示, 并且继续执行 SDK 准备好后需要做的事情. 29 | */ 30 | @protocol JMSGDBMigrateDelegate 31 | 32 | /*! 33 | * @abstract 数据库升级开始 34 | */ 35 | @optional 36 | - (void)onDBMigrateStart; 37 | 38 | /*! 39 | * @abstract 数据库升级完成 40 | * 41 | * @param error 如果升级失败, 则 error 不为 nil. 反之 error 为 nil 时升级成功. 42 | * 43 | * @discussion SDK会有自动重试, 竭力避免失败. 如果实在返回失败, 建议提示用户重新安装 App. 44 | */ 45 | @optional 46 | - (void)onDBMigrateFinishedWithError:(NSError *)error; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGEventContent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | #import 14 | 15 | /*! 16 | * 事件类型的消息内容 17 | * 18 | * 服务器端下发的事件通知, 比如用户被踢下线,群组里加了人, SDK 作为一个特殊的消息类型处理. 19 | * SDK 以消息的形式通知到 App. 详情参见 JMessageDelegate. 20 | */ 21 | @interface JMSGEventContent : JMSGAbstractContent 22 | 23 | /*! 24 | * @abstract 事件类型 25 | * @discussion 参考事件类型的定义 JMSGEventNotificationType 26 | */ 27 | @property(nonatomic, assign, readonly) JMSGEventNotificationType eventType; 28 | 29 | // 不支持使用的初始化方法 30 | - (nullable instancetype)init NS_UNAVAILABLE; 31 | 32 | /*! 33 | * @abstract 获取事件发起者的用户名 34 | * @return 正常返回事件发起者的用户名,如果是调用后台 API 产生的事件,则返回:管理员 35 | * 36 | * @discussion 如果设置了nickname,则返回nickname,否则返回username 37 | * 可以用于定制 event message,拼接成完整的事件描述信息。 38 | */ 39 | - (NSString *JMSG_NULLABLE)getEventFromUsername; 40 | 41 | /*! 42 | * @abstract 获取事件发起者 43 | */ 44 | - (JMSGUser *JMSG_NULLABLE)getEventFromUser; 45 | 46 | /*! 47 | * @abstract 获取事件作用对象用户名列表 48 | * @return 返回类型为 NSArray,数组成员为事件作用对象的用户名 49 | * 50 | * @discussion 如果设置了nickname,则返回nickname,否则返回username 51 | * 可以用于定制 event message,拼接成完整的事件描述信息。 52 | */ 53 | - (NSArray *JMSG_NULLABLE)getEventToUsernameList; 54 | 55 | /*! 56 | * @abstract 获取事件作用对象列表。 57 | */ 58 | - (NSArray <__kindof JMSGUser *>*JMSG_NULLABLE)getEventToUserList; 59 | 60 | /*! 61 | * @abstract 获取事件自定义字段 62 | */ 63 | - (NSString *JMSG_NULLABLE)getEventCustom; 64 | 65 | /*! 66 | @abstract 展示此事件的文本描述 67 | 68 | @discussion SDK 根据事件类型,拼接成完整的事件描述信息。 69 | */ 70 | - (NSString * JMSG_NONNULL)showEventNotification; 71 | 72 | @end 73 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGEventDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | 13 | #import 14 | #import 15 | #import 16 | 17 | /*! 18 | * 监听通知事件 19 | */ 20 | @protocol JMSGEventDelegate 21 | 22 | 23 | /*! 24 | * @abstract 监听好友相关事件 25 | * 26 | * @discussion 可监听:加好友、删除好友、好友更新等事件 27 | * 28 | * @since 3.5.0 29 | */ 30 | @optional 31 | - (void)onReceiveFriendNotificationEvent:(JMSGFriendNotificationEvent *)event; 32 | 33 | /*! 34 | * @abstract 监听消息撤回事件 35 | * 36 | * @param retractEvent 下发的通知事件,事件类型请查看 JMSGMessageRetractEvent 类 37 | * 38 | * @since 3.2.0 39 | */ 40 | @optional 41 | - (void)onReceiveMessageRetractEvent:(JMSGMessageRetractEvent *)retractEvent; 42 | 43 | /*! 44 | * @abstract 监听消息回执状态变更事件 45 | * 46 | * @param receiptEvent 下发的通知事件,事件类型请查看 JMSGMessageReceiptStatusChangeEvent 类 47 | * 48 | * @discussion 上层可以通过 receiptEvent 获取相应信息 49 | * 50 | * @since 3.3.0 51 | */ 52 | @optional 53 | - (void)onReceiveMessageReceiptStatusChangeEvent:(JMSGMessageReceiptStatusChangeEvent *)receiptEvent; 54 | 55 | /*! 56 | * @abstract 监听消息透传事件 57 | * 58 | * @param transparentEvent 下发的通知事件,事件类型请查看 JMSGMessageTransparentEvent 类 59 | * 60 | * @discussion 消息透传的类型:单聊、群聊、设备间透传消息 61 | * 62 | * @since 3.3.0 63 | */ 64 | @optional 65 | - (void)onReceiveMessageTransparentEvent:(JMSGMessageTransparentEvent *)transparentEvent; 66 | 67 | /*! 68 | * @abstract 聊天室管理员变更通知 69 | * 70 | * @param event 管理员事件列表 71 | * 72 | * @discussion 事件具体相关属性请查看 JMSGChatRoomAdminChangeEvent 类 73 | * 74 | * @since 3.8.0 75 | */ 76 | - (void)onReceiveChatRoomAdminChangeEvents:(NSArray<__kindof JMSGChatRoomAdminChangeEvent*>*)events; 77 | 78 | /*! 79 | * @abstract 聊天室黑名单变更通知 80 | * 81 | * @param event 黑名单事件列表 82 | * 83 | * @discussion 事件具体相关属性请查看 JMSGChatRoomBlacklisChangetEvent 类 84 | * 85 | * @since 3.8.0 86 | */ 87 | - (void)onReceiveChatRoomBlacklistChangeEvents:(NSArray<__kindof JMSGChatRoomBlacklisChangetEvent*>*)events; 88 | 89 | 90 | ///---------------------------------------------------- 91 | /// @name 以下是已经过期方法,请使用提示的新方法 92 | ///---------------------------------------------------- 93 | 94 | /*! 95 | * @abstract 监听通知事件 96 | * 97 | * @param event 下发的通知事件,上层通过 event.eventType 判断具体事件 98 | * 99 | * @discussion 此方法可监听如下事件: 100 | * 101 | * - 好友事件:加好友、删除好友、好友更新; 102 | * - 当前用户登录状态变更事件:当前登录用户被踢、非客户端修改密码强制登出、登录状态异常、被删除、信息变更通; 103 | * 104 | * #### 方法变更: 105 | * 106 | * 之前版本的好友事件、当前登录用户状态变更事件都是通过此方法监听,SDK 从 3.5.0 开始将此方法细分为两个方法. 107 | * 108 | * ``` 109 | * // 当前用户登录状态变更事件,在 JMSGUserDelegate 类 110 | * - (void)onReceiveUserLoginStatusChangeEvent:(JMSGUserLoginStatusChangeEvent *)event; 111 | * // 好友相关事件 112 | * - (void)onReceiveFriendNotificationEvent:(JMSGFriendNotificationEvent *)event; 113 | * ``` 114 | * 115 | * #### 注意:此方法已过期,请使用如上所述的两个方法 116 | */ 117 | @optional 118 | - (void)onReceiveNotificationEvent:(JMSGNotificationEvent *)event __attribute__((deprecated("在 JMessage 3.5.0 过期了"))); 119 | @end 120 | 121 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGFileContent.h: -------------------------------------------------------------------------------- 1 | // 2 | // JMSGFileContent.h 3 | // JMessage 4 | // 5 | // Created by deng on 16/7/4. 6 | // Copyright © 2016年 HXHG. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | /*! 13 | * 文件内容类型 14 | */ 15 | @interface JMSGFileContent : JMSGMediaAbstractContent 16 | 17 | JMSG_ASSUME_NONNULL_BEGIN 18 | 19 | /*! 20 | * @abstract 文件名 21 | */ 22 | @property(nonatomic, copy, readonly) NSString *fileName; 23 | 24 | /*! 25 | * @abstract 文件格式 26 | * 27 | * 注意:格式后缀不需要带点,只需后缀名,如:pdf、doc 等 28 | */ 29 | @property(nonatomic, strong) NSString * JMSG_NULLABLE format; 30 | 31 | // 不支持使用的初始化方法 32 | - (nullable instancetype)init NS_UNAVAILABLE; 33 | 34 | /** 35 | * 初始化文件内容 36 | * 37 | * @param data 文件数据 38 | * @param fileName 文件名 39 | * 40 | */ 41 | - (instancetype)initWithFileData:(NSData *)data 42 | fileName:(NSString *)fileName; 43 | 44 | /*! 45 | * @abstract 获取文件内容的数据 46 | */ 47 | - (void)fileData:(JMSGAsyncDataHandler)handler; 48 | 49 | /*! 50 | * @abstract 获取文件内容的数据 51 | * 52 | * @param progressHandler 下载进度。会持续回调更新进度, 直接下载完成。如果为 nil 则表示不关心进度。 53 | * @param handler 结果回调。回调参数: 54 | * 55 | * - data 文件数据; 56 | * - objectId 消息msgId; 57 | * - error 不为nil表示出错; 58 | * 59 | * 如果 error 为 ni, data 也为 nil, 表示没有数据. 60 | * 61 | * @discussion 62 | * 如果本地数据文件已经存在, 则直接返回; 63 | * 如果本地还没有文件,会发起网络请求下载。下载完后再回调。 64 | */ 65 | - (void)fileDataWithProgress:(JMSGMediaProgressHandler JMSG_NULLABLE)progressHandler 66 | completionHandler:(JMSGAsyncDataHandler JMSG_NULLABLE)handler; 67 | 68 | JMSG_ASSUME_NONNULL_END 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGFriendManager.h: -------------------------------------------------------------------------------- 1 | // 2 | // JMSGFriendManager.h 3 | // JMessage 4 | // 5 | // Created by xudong.rao on 16/7/25. 6 | // Copyright © 2016年 HXHG. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | @interface JMSGFriendManager : NSObject 13 | 14 | /*! 15 | * @abstract 获取好友列表 16 | * 17 | * @param handler 结果回调。回调参数: 18 | * 19 | * - resultObject 类型为 NSArray,数组里成员的类型为 JMSGUser 20 | * - error 错误信息 21 | * 22 | * 如果 error 为 nil, 表示设置成功 23 | * 如果 error 不为 nil,表示设置失败 24 | * 25 | * @discussion 从服务器获取,异步返回结果,返回用户的好友列表。 26 | * 建议开发者在 SDK 完全启动之后,再调用此接口获取数据 27 | */ 28 | + (void)getFriendList:(JMSGCompletionHandler)handler; 29 | 30 | /*! 31 | * @abstract 发送添加好友请求 32 | * 33 | * @param username 对方用户名 34 | * @param userAppKey 对方所在应用appkey,不传则默认是本应用 35 | * @param reason 添加好友时的备注,可不填 36 | * 37 | * @param handler 结果回调。回调参数 38 | * 39 | * - resultObject 相应的返回对象 40 | * - error 错误信息 41 | * 42 | * 如果 error 为 nil, 表示设置成功 43 | * 如果 error 不为 nil,表示设置失败 44 | * 45 | * @discussion 在对方未做回应的前提下,允许重复发送添加好友的请求。 46 | */ 47 | + (void)sendInvitationRequestWithUsername:(NSString *)username 48 | appKey:(NSString *)userAppKey 49 | reason:(NSString *)reason 50 | completionHandler:(JMSGCompletionHandler)handler; 51 | 52 | /*! 53 | * @abstract 接受好友邀请 54 | * 55 | * @param username 对方用户名 56 | * @param userAppKey 对方所在应用appkey,不传则默认是本应用 57 | * 58 | * @param handler 结果回调。回调参数: 59 | * 60 | * - resultObject 相应的返回对象 61 | * - error 错误信息 62 | * 63 | * 如果 error 为 nil, 表示设置成功 64 | * 如果 error 不为 nil,表示设置失败 65 | * 66 | */ 67 | + (void)acceptInvitationWithUsername:(NSString *)username 68 | appKey:(NSString *)userAppKey 69 | completionHandler:(JMSGCompletionHandler)handler; 70 | 71 | /*! 72 | * @abstract 拒绝好友邀请 73 | * 74 | * @param username 对方用户名 75 | * @param userAppKey 对方所在应用appkey,不传则默认是本应用 76 | * @param reason 拒绝理由,可不传 77 | * 78 | * @param handler 结果回调。回调参数: 79 | * 80 | * - resultObject 相应的返回对象 81 | * - error 错误信息 82 | * 83 | * 如果 error 为 nil, 表示设置成功 84 | * 如果 error 不为 nil,表示设置失败 85 | * 86 | */ 87 | + (void)rejectInvitationWithUsername:(NSString *)username 88 | appKey:(NSString *)userAppKey 89 | reason:(NSString *)reason 90 | completionHandler:(JMSGCompletionHandler)handler; 91 | /*! 92 | * @abstract 删除好友 93 | * 94 | * @param username 好友username 95 | * @param userAppKey 好友所在应用appkey,不传则默认是本应用 96 | * 97 | * @param handler 结果回调。回调参数: 98 | * 99 | * - resultObject 相应对象 100 | * - error 错误信息 101 | * 102 | * 如果 error 为 nil, 表示设置成功 103 | * 如果 error 不为 nil,表示设置失败 104 | * 105 | * @discussion 106 | */ 107 | + (void)removeFriendWithUsername:(NSString *)username 108 | appKey:(NSString *)userAppKey 109 | completionHandler:(JMSGCompletionHandler)handler; 110 | 111 | @end 112 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGFriendNotificationEvent.h: -------------------------------------------------------------------------------- 1 | // 2 | // JMSGFriendEventContent.h 3 | // JMessage 4 | // 5 | // Created by xudong.rao on 16/7/25. 6 | // Copyright © 2016年 HXHG. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | #import 13 | 14 | 15 | @interface JMSGFriendNotificationEvent : JMSGNotificationEvent 16 | 17 | /// 事件的 id 18 | @property(nonatomic, strong, readonly) NSString *JMSG_NULLABLE eventID; 19 | 20 | /*! 21 | * @abstract 获取事件发生的理由 22 | * 23 | * @discussion 该字段由对方发起请求时所填,对方如果未填则将返回默认字符串 24 | */ 25 | - (NSString *JMSG_NULLABLE)getReason; 26 | 27 | /*! 28 | * @abstract 事件发送者的username 29 | * 30 | * @discussion 该字段由对方发起请求时所填,对方如果未填则将返回默认字符串 31 | * 如果设置了noteName、nickname,返回优先级为noteName、nickname;否则返回username 32 | */ 33 | - (NSString *JMSG_NULLABLE)getFromUsername; 34 | 35 | /*! 36 | * @abstract 获取事件发送者user 37 | */ 38 | - (JMSGUser *JMSG_NULLABLE)getFromUser; 39 | @end 40 | 41 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGGroupDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | #import 14 | 15 | @class JMSGGroup; 16 | 17 | 18 | /*! 19 | * Group 相关变更通知 20 | */ 21 | @protocol JMSGGroupDelegate 22 | 23 | /*! 24 | * @abstract 群组信息 (GroupInfo) 变更通知 25 | * 26 | * @param group 变更后的群组对象 27 | * 28 | * @discussion 如果想要获取通知, 需要先注册回调. 具体请参考 JMessageDelegate 里的说明. 29 | */ 30 | @optional 31 | - (void)onGroupInfoChanged:(JMSGGroup *)group; 32 | 33 | /*! 34 | * @abstract 监听申请入群通知 35 | * 36 | * @param event 申请入群事件 37 | * 38 | * @discussion 只有群主和管理员能收到此事件;申请入群事件相关参数请查看 JMSGApplyJoinGroupEvent 类,在群主审批此事件时需要传递事件的相关参数 39 | * 40 | * @since 3.4.0 41 | */ 42 | @optional 43 | - (void)onReceiveApplyJoinGroupApprovalEvent:(JMSGApplyJoinGroupEvent *)event; 44 | 45 | /*! 46 | * @abstract 监听管理员拒绝入群申请通知 47 | * 48 | * @param event 拒绝入群申请事件 49 | * 50 | * @discussion 只有申请方和被申请方会收到此事件;拒绝的相关描述和原因请查看 JMSGGroupAdminRejectApplicationEvent 类 51 | * 52 | * @since 3.4.0 53 | */ 54 | @optional 55 | - (void)onReceiveGroupAdminRejectApplicationEvent:(JMSGGroupAdminRejectApplicationEvent *)event; 56 | 57 | /*! 58 | * @abstract 监听管理员审批通知 59 | * 60 | * @param event 管理员审批事件 61 | * 62 | * @discussion 只有管理员才会收到该事件;当管理员同意或拒绝了某个入群申请事件时,其他管理员就会收到该事件,相关属性请查看 JMSGGroupAdminApprovalEvent 类 63 | * 64 | * @since 3.5.0 65 | */ 66 | @optional 67 | - (void)onReceiveGroupAdminApprovalEvent:(JMSGGroupAdminApprovalEvent *)event; 68 | 69 | /*! 70 | * @abstract 群成员群昵称变更通知 71 | * 72 | * @param events 群成员昵称变更事件列表 73 | * 74 | * @discussion 如果是离线事件,SDK 会将所有的修改记录加入数组上抛。事件具体相关属性请查看 JMSGGroupNicknameChangeEvent 类 75 | * 76 | * @since 3.7.0 77 | */ 78 | @optional 79 | - (void)onReceiveGroupNicknameChangeEvents:(NSArray<__kindof JMSGGroupNicknameChangeEvent*>*)events; 80 | 81 | /*! 82 | * @abstract 群公告变更通知 83 | * 84 | * @param event 群公告事件列表 85 | * 86 | * @discussion 事件具体相关属性请查看 JMSGGroupAnnouncementEvent 类 87 | * 88 | * @since 3.8.0 89 | */ 90 | @optional 91 | - (void)onReceiveGroupAnnouncementEvents:(NSArray<__kindof JMSGGroupAnnouncementEvent*>*)events; 92 | 93 | /*! 94 | * @abstract 群组黑名单变更通知 95 | * 96 | * @param event 群组黑名单事件列表 97 | * 98 | * @discussion 事件具体相关属性请查看 JMSGGroupBlacklistChangeEvent 类 99 | * 100 | * @since 3.8.0 101 | */ 102 | - (void)onReceiveGroupBlacklistChangeEvents:(NSArray<__kindof JMSGGroupBlacklistChangeEvent*>*)events; 103 | @end 104 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGImageContent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | #import 14 | #import 15 | 16 | 17 | /*! 18 | * 图片内容 19 | * 20 | * 图片区分缩略图与大图. 21 | * 22 | * 大图指的创建对象时图片. 这个大图一般来说, 也是 App 对拍照或者相册里的 "原图" 经过压缩处理的. 23 | * 因为消息应用一般不会发送相册或者拍照的 "原图", 这太大了. 24 | * 25 | * 暂不支持可选 "原图" 发送功能. 有计划支持. 26 | * 27 | * 缩略图则是 SDK 根据一定的算法 (主要基于屏幕, 长宽比等), 裁减出来的一个相对小的图片, 28 | * 用于默认显示在聊天窗口. 29 | * 第一次访问缩略图后, SDK 会缓存把该数据缓存在该对象上, 所以访问多次访问会非常快, 30 | * 有利于聊天窗口滚动的性能表现. 31 | * 32 | * 收到消息时, SDK 会默认预下载缩略图, 这样查看消息就可以即时展示出来. 33 | * 而大图, 则一般是 App 预览图片调用接口时, SDK 再去发起下载. 34 | * 35 | * 针对每种资源(缩略图或者大图), 只提供一个异步接口获取数据. SDK 去做缓存,文件,下载的适配工作. 36 | */ 37 | @interface JMSGImageContent : JMSGMediaAbstractContent 38 | 39 | /*! 40 | * @abstract 图片链接 41 | */ 42 | @property(nonatomic, strong, readonly) NSString * JMSG_NULLABLE imageLink; 43 | 44 | /*! 45 | * @abstract 图片格式 46 | * 47 | * 注意:格式后缀不需要带点,只需后缀名,如:png、jpg 等 48 | */ 49 | @property(nonatomic, strong) NSString * JMSG_NULLABLE format; 50 | 51 | /*! 52 | * @abstract 图片原始大小 53 | */ 54 | @property(nonatomic, assign, readonly) CGSize imageSize; 55 | 56 | /*! 57 | * @abstract 获取缩略图的本地路径 58 | * 59 | * @discussion 此属性是通过懒加载的方式获取,必须在下载完成之后此属性值才有意义 60 | */ 61 | @property(nonatomic, strong, readonly) NSString * JMSG_NULLABLE thumbImageLocalPath; 62 | 63 | // 不支持使用的初始化方法 64 | - (nullable instancetype)init NS_UNAVAILABLE; 65 | 66 | /*! 67 | * @abstract 初始化消息图片内容 68 | * 69 | * @param data 图片数据 70 | * 71 | * @discussion 这是预设的初始化方法. 创建一个图片内容对象, 必须要传入图片数据. 72 | * 73 | * 对于图片消息, 一般来说创建此图片内容的数据, 是对拍照原图经过裁减处理的, 否则发图片消息太大. 74 | * 这里传入的图片数据, SDK视为大图. 方法 largeImageDataWithProgress:completionHandler 下载到的, 75 | * 就是这个概念上的图片数据. 76 | */ 77 | - (nullable instancetype)initWithImageData:(NSData * JMSG_NONNULL)data; 78 | 79 | /*! 80 | * @abstract 获取图片消息的缩略图数据 81 | * 82 | * @param handler 结果回调。回调参数: 83 | * 84 | * - data 图片数据; 85 | * - objectId 消息msgId; 86 | * - error 不为nil表示出错; 87 | * 88 | * 如果 error 为 ni, data 也为 nil, 表示没有数据. 89 | * 90 | * @discussion 展示缩略时调用此接口,获取缩略图数据。 91 | * 如果本地数据文件已经存在, 则直接返回; 92 | * 如果本地还没有图片,会发起网络请求下载。下载完后再回调。 93 | */ 94 | - (void)thumbImageData:(JMSGAsyncDataHandler JMSG_NULLABLE)handler; 95 | 96 | /*! 97 | * @abstract 获取图片消息的大图数据 98 | * 99 | * @param progressHandler 下载进度。会持续回调更新进度, 直接下载完成。如果为 nil 则表示不关心进度。 100 | * @param handler 结果回调。回调参数: 101 | * 102 | * - data 图片数据; 103 | * - objectId 消息msgId; 104 | * - error 不为nil表示出错; 105 | * 106 | * 如果 error 为 ni, data 也为 nil, 表示没有数据. 107 | * 108 | * @discussion 一般在预览图片大图时,要用此接口。 109 | * 如果本地数据文件已经存在, 则直接返回; 110 | * 如果本地还没有图片,会发起网络请求下载。下载完后再回调。 111 | */ 112 | - (void)largeImageDataWithProgress:(JMSGMediaProgressHandler JMSG_NULLABLE)progressHandler 113 | completionHandler:(JMSGAsyncDataHandler JMSG_NULLABLE)handler; 114 | 115 | @end 116 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGLocationContent.h: -------------------------------------------------------------------------------- 1 | // 2 | // JMSGLocationContent.h 3 | // JMessage 4 | // 5 | // Created by dyh on 16/7/26. 6 | // Copyright © 2016年 HXHG. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | 12 | /** 13 | * 地理位置内容类型 14 | */ 15 | @interface JMSGLocationContent : JMSGAbstractContent 16 | 17 | JMSG_ASSUME_NONNULL_BEGIN 18 | 19 | /*! 20 | * @abstract 纬度 21 | */ 22 | @property(nonatomic, strong, readonly) NSNumber *latitude; 23 | 24 | /*! 25 | * @abstract 经度 26 | */ 27 | @property(nonatomic, strong, readonly) NSNumber *longitude; 28 | 29 | /*! 30 | * @abstract 缩放 31 | */ 32 | @property(nonatomic, strong, readonly) NSNumber *scale; 33 | 34 | /*! 35 | * @abstract 详细地址信息 36 | */ 37 | @property(nonatomic, copy, readonly) NSString *address; 38 | 39 | // 不支持使用的初始化方法 40 | - (nullable instancetype)init NS_UNAVAILABLE; 41 | 42 | /** 43 | * 初始化地理位置消息内容 44 | * 45 | * @param latitude 纬度 46 | * @param longitude 经度 47 | * @param scale 缩放比例 48 | * @param address 详细地址信息 49 | * 50 | * @return 地理位置消息内容 51 | */ 52 | - (instancetype)initWithLatitude:(NSNumber *)latitude 53 | longitude:(NSNumber *)longitude 54 | scale:(NSNumber *)scale 55 | address:(NSString *)address; 56 | 57 | JMSG_ASSUME_NONNULL_END 58 | 59 | @end 60 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGMediaAbstractContent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | #import 14 | 15 | @class JMSGData; 16 | 17 | /*! 18 | * 媒体内容类型的抽象父类 19 | * 20 | * 所有的媒体文件内容, 如 VoiceContent,ImageContent, 21 | * 都有媒体文件的处理逻辑, 比如上传与下载, 这些逻辑都放在这个类里统一处理. 22 | * 23 | * 这个类一般对外不可见. 24 | */ 25 | @interface JMSGMediaAbstractContent : JMSGAbstractContent 26 | 27 | JMSG_ASSUME_NONNULL_BEGIN 28 | 29 | /*! 30 | * @abstract 媒体文件ID 31 | * 32 | * @discussion 这是 JMessage 内部用于表示资源文件的ID,使用该ID 可以定位到网络上的资源。 33 | * 34 | * 收到消息时,通过此ID 可以下载到资源;发出消息时,文件上传成功会生成此ID。 35 | * 36 | * 注意: 不支持外部设置媒体ID,也不支持把此字段设置为 URL 来下载到资源文件。 37 | */ 38 | @property(nonatomic, strong, readonly) NSString * JMSG_NULLABLE mediaID; 39 | 40 | /*! @abstract 媒体格式*/ 41 | @property(nonatomic, strong, readonly) NSString * JMSG_NULLABLE format; 42 | 43 | /*! @abstract 媒体文件大小 */ 44 | @property(nonatomic, strong, readonly) NSNumber *fSize; 45 | 46 | /*! 47 | * @abstract 上传资源文件progress绑定(用来监听上传progress回调) 48 | * @discussion 如果需要监听这条消息的上传文件进度, 则需要赋值这个 block 为你你自己的实现 49 | */ 50 | @property(nonatomic, copy)JMSGMediaProgressHandler JMSG_NULLABLE uploadHandler; 51 | 52 | /*! 53 | * @abstract 获取原文件的本地路径 54 | * 55 | * @discussion 此属性是通过懒加载的方式获取,必须在下载完成之后此属性值才有意义 56 | */ 57 | @property(nonatomic, strong, readonly) NSString * JMSG_NULLABLE originMediaLocalPath; 58 | 59 | // 不支持使用的初始化方法 60 | - (nullable instancetype)init NS_UNAVAILABLE; 61 | 62 | JMSG_ASSUME_NONNULL_END 63 | 64 | @end 65 | 66 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGMessageDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | #import 14 | 15 | /*! 16 | * 消息相关的变更通知 17 | * 18 | * 包括三类: 19 | * 20 | * - 发出消息的返回结果; 21 | * - 服务器端下发的消息; 22 | * - 服务器端下发的事件(一类特殊的消息); 23 | */ 24 | @protocol JMSGMessageDelegate 25 | 26 | /*! 27 | * @abstract 发送消息结果返回回调 28 | * 29 | * @param message 原发出的消息对象 30 | * @param error 不为nil表示发送消息出错 31 | * 32 | * @discussion 应检查 error 是否为空来判断是否出错. 如果未出错, 则成功. 33 | */ 34 | @optional 35 | - (void)onSendMessageResponse:(JMSGMessage *)message error:(NSError *)error; 36 | 37 | /*! 38 | * @abstract 接收消息(服务器端下发的)回调 39 | * 40 | * @param message 接收到下发的消息 41 | * @param error 不为 nil 表示接收消息出错 42 | * 43 | * @discussion 应检查 error 是否为空来判断有没有出错. 如果未出错, 则成功. 44 | * 留意的是, 这里的 error 不包含媒体消息下载文件错误. 这类错误有单独的回调 onReceiveMessageDownloadFailed: 45 | * 46 | * 收到的消息里, 也包含服务器端下发的各类消息事件, 比如有人被加入了群聊. 这类消息事件处理为特殊的 JMSGMessage 类型. 47 | * 48 | * 事件类的消息, 基于 JMSGMessage 类里的 contentType 属性来做判断, 49 | * contentType = kJMSGContentTypeEventNotification. 50 | */ 51 | @optional 52 | - (void)onReceiveMessage:(JMSGMessage *)message error:(NSError *)error; 53 | 54 | /*! 55 | * @abstract 接收消息媒体文件下载失败的回调 56 | * 57 | * @param message 下载出错的消息 58 | * 59 | * @discussion 因为对于接收消息, 最主要需要特别做处理的就是媒体文件下载, 所以单列出来. 一定要处理. 60 | * 61 | * 通过的作法是: 如果是图片, 则 App 展示一张特别的表明未下载成功的图, 用户点击再次发起下载. 如果是语音, 62 | * 则不必特别处理, 还是原来的图标展示. 用户点击时, SDK 发现语音文件在本地没有, 会再次发起下载. 63 | */ 64 | @optional 65 | - (void)onReceiveMessageDownloadFailed:(JMSGMessage *)message; 66 | @end 67 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGNotificationEvent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | #import 14 | 15 | /*! 16 | * 事件 17 | * 18 | * #### 事件分类 19 | * 20 | * 事件主要区分两类,通知事件、消息事件,两种不同类型的事件是通过不同的监听方法来监听的。 21 | * 22 | * #### 通知事件 23 | * 24 | * 通知事件就是除群事件之外的,如:当前登录登录状态变更、好友相关、消息撤回、消息透传、入群申请、管理员审批等事件. 25 | * 上层通过对应类里的相对应的代理方法接收事件,如:JMSGEventDelegate 、JMSGGroupDelegate 等类. 26 | * 27 | * #### 消息事件 28 | * 29 | * 消息事件就是群事件,如:群加人、踢人、修改群信息、群成员禁言、管理员变更等(即:会展示在消息列表的事件),SDK 依旧作为一个特殊的消息类型下发,上层通过 [JMSGMessageDelegate onReceiveMessage:] 接收消息事件. 30 | */ 31 | @interface JMSGNotificationEvent : NSObject 32 | 33 | /*! 34 | * @abstract 事件类型 35 | * @discussion 参考事件类型的定义 JMSGEventNotificationType 36 | */ 37 | @property(nonatomic, assign, readonly) JMSGEventNotificationType eventType; 38 | 39 | /*! 40 | * @abstract 事件的描述信息 41 | * @discussion 下发事件的文字描述,可能为空 42 | */ 43 | @property(nonatomic, strong, readonly) NSString *eventDescription; 44 | 45 | @end 46 | 47 | 48 | #pragma mark - 用户登录状态改变事件 49 | 50 | 51 | /*! 52 | * @abstract 当前用户登录状态改变事件 53 | * 54 | * @discussion 当前登录用户被踢、非客户端修改密码强制登出、登录状态异常、被删除、被禁用、信息变更等通知 55 | * 56 | * @since 3.5.0 57 | */ 58 | @interface JMSGUserLoginStatusChangeEvent: JMSGNotificationEvent 59 | @end 60 | 61 | 62 | #pragma mark - 消息撤回事件 63 | 64 | 65 | /*! 66 | * @abstract 消息撤回事件 67 | * 68 | * @discussion 上层通过 JMSGEventDelegate 类中的 [JMSGEventDelegate onReceiveMessageRetractEvent:] 代理方法监听此事件,详见官方文档. 69 | */ 70 | @interface JMSGMessageRetractEvent : JMSGNotificationEvent 71 | 72 | /// 消息撤回所属会话 73 | @property(nonatomic, strong, readonly) JMSGConversation *conversation; 74 | 75 | /// 撤回之后的消息 76 | @property(nonatomic, strong, readonly) JMSGMessage *retractMessage; 77 | 78 | @end 79 | 80 | 81 | #pragma mark - 消息已读回执状态变更事件 82 | 83 | 84 | /*! 85 | * @abstract 消息已读回执状态变更事件 86 | * 87 | * @discussion 上层通过 JMSGEventDelegate 类中的 [JMSGEventDelegate onReceiveMessageReceiptStatusChangeEvent:] 代理方法监听该事件 88 | */ 89 | @interface JMSGMessageReceiptStatusChangeEvent : JMSGNotificationEvent 90 | 91 | /// 消息所属会话 92 | @property(nonatomic, strong, readonly) JMSGConversation *conversation; 93 | /// 已读回执变更的消息列表 94 | @property(nonatomic, strong, readonly) NSArray <__kindof JMSGMessage *>*messages; 95 | 96 | @end 97 | 98 | 99 | #pragma mark - 消息透传事件 100 | 101 | 102 | /*! 103 | * @abstract 消息透传事件 104 | * 105 | * @discussion 上层通过 JMSGEventDelegate 类中的 [JMSGEventDelegate onReceiveMessageTransparentEvent:] 代理方法监听该事件 106 | */ 107 | @interface JMSGMessageTransparentEvent : JMSGNotificationEvent 108 | 109 | /// 消息透传的类型,单聊、群聊、设备间透传消息 110 | @property(nonatomic, assign, readonly) JMSGTransMessageType transMessageType; 111 | /// 透传消息的发送者 112 | @property(nonatomic, strong, readonly) JMSGUser *sendUser; 113 | /// 透传消息的目标对象,JMSGUser、JMSGGroup 114 | @property(nonatomic, strong, readonly) id target; 115 | /// 透传消息内容 116 | @property(nonatomic, strong, readonly) NSString *transparentText; 117 | 118 | /*! 119 | * @abstract 透传消息所属会话 120 | * 121 | * @discussion 注意:如果接收到设备间的透传事件,此属性的值为 nil;如果本地并没有创建会话,此属性也为 nil 122 | */ 123 | @property(nonatomic, strong, readonly) JMSGConversation *conversation; 124 | 125 | @end 126 | 127 | 128 | #pragma mark - 申请入群事件 129 | 130 | 131 | /*! 132 | * @abstract 申请入群事件 133 | * 134 | * @discussion 上层通过 JMSGGroupDelegate 类中的 [JMSGGroupDelegate onReceiveApplyJoinGroupApprovalEvent:] 代理方法监听该事件 135 | */ 136 | @interface JMSGApplyJoinGroupEvent : JMSGNotificationEvent 137 | 138 | /// 事件的 id 139 | @property(nonatomic, strong, readonly) NSString *eventID; 140 | /// 群 gid 141 | @property(nonatomic, strong, readonly) NSString *groupID; 142 | /// 是否是用户主动申请入群,YES:主动申请加入,NO:被邀请加入 143 | @property(nonatomic, assign, readonly) BOOL isInitiativeApply; 144 | /// 发起申请的 user 145 | @property(nonatomic, strong, readonly) JMSGUser *sendApplyUser; 146 | /// 被邀请入群的 user 数组 147 | @property(nonatomic, strong, readonly) NSArray JMSG_GENERIC(__kindof JMSGUser *)*joinGroupUsers; 148 | /// 原因 149 | @property(nonatomic, strong, readonly) NSString *reason; 150 | 151 | @end 152 | 153 | 154 | #pragma mark - 管理员拒绝入群申请事件 155 | 156 | 157 | /*! 158 | * @abstract 管理员拒绝入群申请事件 159 | * 160 | * @discussion 上层通过 JMSGGroupDelegate 类中的 [JMSGGroupDelegate onReceiveGroupAdminRejectApplicationEvent:] 代理方法监听该事件 161 | */ 162 | @interface JMSGGroupAdminRejectApplicationEvent : JMSGNotificationEvent 163 | 164 | /// 群 gid 165 | @property(nonatomic, strong, readonly) NSString *groupID; 166 | /// 拒绝原因 167 | @property(nonatomic, strong, readonly) NSString *rejectReason; 168 | /// 操作的管理员 169 | @property(nonatomic, strong, readonly) JMSGUser *groupManager; 170 | 171 | @end 172 | 173 | 174 | #pragma mark - 管理员审批事件 175 | 176 | 177 | /*! 178 | * @abstract 管理员审批事件 179 | * 180 | * @discussion 管理员同意或者拒绝了某个入群申请,其他管理员会收到该通知,上层通过 [JMSGGroupDelegate onReceiveGroupAdminApprovalEvent:] 代理方法监听该事件 181 | */ 182 | @interface JMSGGroupAdminApprovalEvent : JMSGNotificationEvent 183 | 184 | /// 管理员是否同意申请,YES:同意,NO:拒绝 185 | @property(nonatomic, assign, readonly) BOOL isAgreeApply; 186 | /// 申请入群事件的事件 id 187 | @property(nonatomic, strong, readonly) NSString *applyEventID; 188 | /// 群 gid 189 | @property(nonatomic, strong, readonly) NSString *groupID; 190 | /// 操作的管理员 191 | @property(nonatomic, strong, readonly) JMSGUser *groupAdmin; 192 | /// 申请或被邀请加入群的用户,即:实际入群的用户 193 | @property(nonatomic, strong, readonly) NSArray JMSG_GENERIC(__kindof JMSGUser *)*users; 194 | 195 | @end 196 | 197 | 198 | #pragma mark - 群成员群昵称修改事件 199 | 200 | 201 | /*! 202 | * @abstract 群成员群昵称修改事件 203 | * 204 | * @discussion 如果是离线事件, memberInfoList 里会包含群成员每一次的修改记录,上层通过 [JMSGGroupDelegate onReceiveGroupNicknameChangeEvents:] 监听。 205 | */ 206 | @interface JMSGGroupNicknameChangeEvent : NSObject 207 | 208 | /// 群组 209 | @property(nonatomic, strong, readonly) JMSGGroup *group; 210 | /// 修改昵称的群成员 211 | @property(nonatomic, strong, readonly) JMSGGroupMemberInfo *fromMemberInfo; 212 | /// 被修改昵称的群成员 213 | @property(nonatomic, strong, readonly) JMSGGroupMemberInfo *toMemberInfo; 214 | /// 事件时间 215 | @property(nonatomic, assign, readonly) UInt64 ctime; 216 | 217 | @end 218 | 219 | 220 | #pragma mark - 群公告事件 221 | 222 | 223 | /*! 224 | * @abstract 群公告事件 225 | * 226 | * @discussion 收到事件后根据 eventType 判断类型,取相应的数据,上层通过 [JMSGGroupDelegate onReceiveGroupAnnouncementEvents:] 监听。 227 | */ 228 | @interface JMSGGroupAnnouncementEvent : JMSGNotificationEvent 229 | 230 | /// 群公告 231 | @property(nonatomic, strong, readonly) JMSGGroupAnnouncement *announcement; 232 | /// 事件操作者 233 | @property(nonatomic, strong, readonly) JMSGUser *fromUser; 234 | /// 群组 235 | @property(nonatomic, strong, readonly) JMSGGroup *group; 236 | /// 事件时间 237 | @property(nonatomic, assign, readonly) UInt64 ctime; 238 | 239 | @end 240 | 241 | 242 | #pragma mark - 群黑名单变更事件 243 | 244 | 245 | /*! 246 | * @abstract 群黑名单变更事件 247 | * 248 | * @discussion 收到事件后根据 eventType 判断类型,取相应的数据,上层通过 [JMSGGroupDelegate onReceiveGroupBlacklistChangeEvents:] 监听。 249 | */ 250 | @interface JMSGGroupBlacklistChangeEvent : JMSGNotificationEvent 251 | 252 | /// 群组 253 | @property(nonatomic, strong, readonly) JMSGGroup *group; 254 | /// 事件操作者 255 | @property(nonatomic, strong, readonly) JMSGUser *fromUser; 256 | /// 被加入/被删除 群组黑名单的用户列表 257 | @property(nonatomic, strong, readonly) NSArray <__kindof JMSGUser *>*targetList; 258 | 259 | @end 260 | 261 | 262 | #pragma mark - 聊天室管理员变更事件 263 | 264 | 265 | /*! 266 | * @abstract 聊天室管理员变更事件 267 | * 268 | * @discussion 收到事件后根据 eventType 判断类型,取相应的数据,上层通过 [JMSGGroupDelegate onReceiveChatRoomAdminChangeEvents:] 监听。 269 | */ 270 | @interface JMSGChatRoomAdminChangeEvent : JMSGNotificationEvent 271 | 272 | /// 聊天室 273 | @property(nonatomic, strong, readonly) JMSGChatRoom *chatRoom; 274 | /// 事件操作者 275 | @property(nonatomic, strong, readonly) JMSGUser *fromUser; 276 | /// 被添加/被删除 聊天室管理员的用户列表 277 | @property(nonatomic, strong, readonly) NSArray <__kindof JMSGUser *>*targetList; 278 | 279 | @end 280 | 281 | 282 | #pragma mark - 聊天室黑名单变更事件 283 | 284 | 285 | /*! 286 | * @abstract 聊天室黑名单变更事件 287 | * 288 | * @discussion 收到事件后根据 eventType 判断类型,取相应的数据,上层通过 [JMSGGroupDelegate onReceiveChatRoomBlacklistChangeEvents:] 监听。 289 | */ 290 | @interface JMSGChatRoomBlacklisChangetEvent : JMSGNotificationEvent 291 | 292 | /// 聊天室 293 | @property(nonatomic, strong, readonly) JMSGChatRoom *chatRoom; 294 | /// 事件操作者 295 | @property(nonatomic, strong, readonly) JMSGUser *fromUser; 296 | /// 被添加/被删除 聊天室黑名单的用户列表 297 | @property(nonatomic, strong, readonly) NSArray <__kindof JMSGUser *>*targetList; 298 | 299 | @end 300 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGOptionalContent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | 13 | #import 14 | 15 | @class JMSGCustomNotification; 16 | 17 | /*! 18 | * @abstract 发送消息的可选功能 19 | * 20 | */ 21 | @interface JMSGOptionalContent : NSObject 22 | 23 | /*! 24 | * @abstract 不保存离线消息,NO,默认值,保存离线消息;YES,不保存离线消息 25 | */ 26 | @property(nonatomic, assign) BOOL noSaveOffline; 27 | 28 | /*! 29 | * @abstract 不在状态栏显示消息,NO,默认值,状态栏显示消息;YES,状态栏不显示消息 30 | */ 31 | @property(nonatomic, assign) BOOL noSaveNotification; 32 | 33 | /*! 34 | * @abstract 设置这条消息的发送是否需要对方发送已读回执,NO,默认值 35 | */ 36 | @property(nonatomic, assign) BOOL needReadReceipt; 37 | 38 | 39 | /*! 40 | * @abstract 自定义消息通知栏的内容 41 | * 42 | * @discussion 这个属性可以具体参考 JMSGCustomNotification 类 43 | */ 44 | @property(nonatomic, strong) JMSGCustomNotification *customNotification; 45 | 46 | @end 47 | 48 | 49 | 50 | 51 | /// 自定义通知栏消息的内容 52 | @interface JMSGCustomNotification : NSObject 53 | 54 | /*! 55 | * @abstract 是否启用自定义通知栏,默认:NO 56 | */ 57 | @property(nonatomic, assign) BOOL enabled; 58 | 59 | /*! 60 | * @abstract 自定义消息通知栏的标题 61 | */ 62 | @property(nonatomic, strong) NSString *title; 63 | 64 | /*! 65 | * @abstract 自定义消息通知栏的内容 66 | * 67 | */ 68 | @property(nonatomic, strong) NSString *alert; 69 | 70 | /*! 71 | * @abstract 被@目标的通知内容前缀 72 | * 73 | * @discussion 此字段仅对@消息设置有效 74 | */ 75 | @property(nonatomic, strong) NSString *atPrefix; 76 | 77 | @end 78 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGPromptContent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | #import 14 | 15 | /*! 16 | * @abstract 提示性消息内容 17 | * 18 | * @discussion 此 MessageContent 类型仅由 SDK 主动创建,上层做展示用,不能当做发送的消息体。 19 | */ 20 | @interface JMSGPromptContent : JMSGAbstractContent 21 | JMSG_ASSUME_NONNULL_BEGIN 22 | 23 | /*! 24 | * @abstract 获取提示信息 25 | * 26 | * @discussion 消息提示文字 27 | */ 28 | @property(nonatomic,strong, readonly) NSString *promptText; 29 | 30 | /*! 31 | * @abstract 提示性消息的类型 32 | * 33 | * @discussion 比如:消息撤回提示、后台自定义消息提示等 34 | */ 35 | @property(nonatomic,assign, readonly) JMSGPromptContentType promptType; 36 | 37 | // 不支持使用的初始化方法 38 | - (instancetype)init NS_UNAVAILABLE; 39 | 40 | 41 | JMSG_ASSUME_NONNULL_END 42 | @end 43 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGTextContent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | #import 14 | 15 | 16 | /*! 17 | * 纯文本内容类型 18 | */ 19 | @interface JMSGTextContent : JMSGAbstractContent 20 | 21 | JMSG_ASSUME_NONNULL_BEGIN 22 | 23 | /*! 24 | * @abstract 内容文本 25 | */ 26 | @property(nonatomic, readonly, copy) NSString *text; 27 | 28 | // 不支持使用的初始化方法 29 | - (instancetype)init NS_UNAVAILABLE; 30 | 31 | /*! 32 | * @abstract 基于文本初始化内容对象 33 | * 34 | * @param text 纯文本内容 35 | * 36 | * @discussion 这是预设的创建文本类型内容的方法 37 | */ 38 | - (instancetype)initWithText:(NSString *)text; 39 | 40 | JMSG_ASSUME_NONNULL_END 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGUserDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | 14 | @class JMSGGroup,JMSGUserLoginStatusChangeEvent; 15 | 16 | 17 | /*! 18 | * User 相关变更通知 19 | */ 20 | @protocol JMSGUserDelegate 21 | 22 | /*! 23 | * @abstract 监听当前用户登录状态变更事件 24 | * 25 | * @discussion 可监听:当前登录用户被踢、非客户端修改密码强制登出、登录状态异常、被删除、被禁用、信息变更等事件 26 | * 27 | * @since 3.5.0 28 | */ 29 | @optional 30 | - (void)onReceiveUserLoginStatusChangeEvent:(JMSGUserLoginStatusChangeEvent *)event; 31 | 32 | 33 | ///---------------------------------------------------- 34 | /// @name 以下是已经过期方法,请使用提示的新方法 35 | ///---------------------------------------------------- 36 | 37 | 38 | /*! 39 | * @abstract 当前登录用户被踢下线通知(方法已过期,建议使用新方法) 40 | * 41 | * @discussion 一般可能是, 该用户在其他设备上登录, 把当前设备的登录踢出登录. 42 | * 43 | * SDK 收到服务器端下发事件后, 会内部退出登录. 44 | * App 也应该退出登录. 否则所有的 SDK API 调用将失败, 因为 SDK 已经退出登录了. 45 | * 46 | * 注意: 这是旧版本的监听方法,建议不要使用,已经过期,请使用 [JMSGUserDelegate onReceiveUserLoginStatusChangeEvent:] 新的监听方法. 47 | */ 48 | @optional 49 | - (void)onLoginUserKicked __attribute__((deprecated("first deprecated in JMessage 2.2.0 - Use -onReceiveUserLoginStatusChangeEvent:"))); 50 | @end 51 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGVideoContent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | #import 14 | 15 | /*! 16 | * 视频内容类型 17 | */ 18 | @interface JMSGVideoContent : JMSGMediaAbstractContent 19 | 20 | JMSG_ASSUME_NONNULL_BEGIN 21 | // 不支持使用的初始化方法 22 | - (instancetype)init NS_UNAVAILABLE; 23 | 24 | /*! 25 | * @abstract 视频时长 (单位:秒) 26 | */ 27 | @property(nonatomic, copy, readonly) NSNumber *duration; 28 | 29 | /*! 30 | * @abstract 视频封面图片大小 31 | */ 32 | @property(nonatomic, assign, readonly) CGSize videoThumbImageSize; 33 | 34 | /*! 35 | * @abstract 获取视频封面图片的本地路径 36 | * 37 | * @discussion 此属性是通过懒加载的方式获取,必须在下载完成之后此属性值才有意义 38 | */ 39 | @property(nonatomic, strong, readonly) NSString *JMSG_NULLABLE videoThumbImageLocalPath; 40 | 41 | /*! 42 | * @abstract 初始化视频消息内容 43 | * 44 | * @param data 该视频内容的数据 45 | * @param thumbData 缩略图,建议:缩略图上层要控制大小,避免上传过大图片 46 | * @param duration 该视频内容的持续时长,长度应大于 0 47 | * 48 | * @discussion 建议:缩略图上层要控制大小,避免上传过大图片. 49 | */ 50 | - (instancetype)initWithVideoData:(NSData *)data 51 | thumbData:(NSData *JMSG_NULLABLE)thumbData 52 | duration:(NSNumber *)duration; 53 | /*! 54 | * @abstract 视频格式 55 | * 56 | * @discussion 创建 videoContent 时可设置,建议设置 format。后缀不需要带点,只需后缀名,如: mp4、mov 等 57 | */ 58 | @property(nonatomic, strong) NSString * JMSG_NULLABLE format; 59 | 60 | /*! 61 | * @abstract 视频文件名 62 | * 63 | * @discussion 创建 videoContent 时可设置 64 | */ 65 | @property(nonatomic, strong) NSString * JMSG_NULLABLE fileName; 66 | 67 | /*! 68 | * @abstract 获取视频消息的封面缩略图 69 | * 70 | * @param handler 结果回调。回调参数: 71 | * 72 | * - data 图片数据; 73 | * - objectId 消息msgId; 74 | * - error 不为nil表示出错; 75 | * 76 | * 如果 error 为 ni, data 也为 nil, 表示没有数据. 77 | * 78 | * @discussion 展示缩略时调用此接口,获取缩略图数据。如果本地数据文件已经存在, 则直接返回; 如果本地还没有图片,会发起网络请求下载。下载完后再回调。 79 | */ 80 | - (void)videoThumbImageData:(JMSGAsyncDataHandler JMSG_NULLABLE)handler; 81 | 82 | /*! 83 | * @abstract 获取视频 84 | * 85 | * @param progressHandler 下载进度。会持续回调更新进度, 直接下载完成。如果为 nil 则表示不关心进度。 86 | * @param handler 结果回调。回调参数: 87 | * 88 | * - data 文件数据; 89 | * - objectId 消息msgId; 90 | * - error 不为nil表示出错; 91 | * 92 | * 如果 error 为 ni, data 也为 nil, 表示没有数据. 93 | * 94 | * @discussion 如果本地数据文件已经存在, 则直接返回;如果本地还没有文件,会发起网络请求下载。下载完后再回调。 95 | */ 96 | - (void)videoDataWithProgress:(JMSGMediaProgressHandler JMSG_NULLABLE)progressHandler 97 | completionHandler:(JMSGAsyncDataHandler JMSG_NULLABLE)handler; 98 | 99 | 100 | JMSG_ASSUME_NONNULL_END 101 | 102 | @end 103 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMSGVoiceContent.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | #import 14 | 15 | /*! 16 | * 语音内容类型 17 | */ 18 | @interface JMSGVoiceContent : JMSGMediaAbstractContent 19 | 20 | JMSG_ASSUME_NONNULL_BEGIN 21 | 22 | /*! 23 | * @abstract 语音时长 (单位:秒) 24 | */ 25 | @property(nonatomic, copy, readonly) NSNumber *duration; 26 | 27 | 28 | // 不支持使用的初始化方法 29 | - (instancetype)init NS_UNAVAILABLE; 30 | 31 | /*! 32 | * @abstract 初始化语音内容 33 | * 34 | * @param data 该语音内容的数据. 不允许为 nil, 并且内容长度应大于 0, 否则失败 35 | * @param duration 该语音内容的持续时长. 单位是秒. 不允许为 nil, 并且应大于 0. 36 | * 37 | * @discussion 这是预设的初始化方法, 创建一条语音内容, 必然传入语音数据, 以及时长. 38 | */ 39 | - (instancetype)initWithVoiceData:(NSData *)data 40 | voiceDuration:(NSNumber *)duration; 41 | 42 | /*! 43 | * @abstract 获取语音内容的数据 44 | * 45 | * @param handler 结果回调。回调参数: 46 | * 47 | * - data 语音数据; 48 | * - objectId 消息msgId; 49 | * - error 不为nil表示出错; 50 | * 51 | * 如果 error 为 ni, data 也为 nil, 表示没有数据. 52 | * 53 | * @discussion 如果本地数据文件存在, 则直接返回. 54 | * 如果本地还没有语音数据,会发起网络请求下载。下载完后再回调。 55 | */ 56 | - (void)voiceData:(JMSGAsyncDataHandler)handler; 57 | 58 | 59 | JMSG_ASSUME_NONNULL_END 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMessage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | #import 14 | #import 15 | #import 16 | #import 17 | #import 18 | #import 19 | #import 20 | #import 21 | #import 22 | #import 23 | #import 24 | #import 25 | #import 26 | #import 27 | #import 28 | #import 29 | #import 30 | #import 31 | #import 32 | #import 33 | #import 34 | #import 35 | #import 36 | 37 | @protocol JMSGMessageDelegate; 38 | @protocol JMessageDelegate; 39 | @class JMSGConversation; 40 | 41 | extern NSString *const kJMSGNetworkIsConnectingNotification; // 正在连接中 42 | extern NSString *const kJMSGNetworkDidSetupNotification; // 建立连接 43 | extern NSString *const kJMSGNetworkDidCloseNotification; // 关闭连接 44 | extern NSString *const kJMSGNetworkDidRegisterNotification; // 注册成功 45 | extern NSString *const kJMSGNetworkFailedRegisterNotification; // 注册失败 46 | extern NSString *const kJMSGNetworkDidLoginNotification; // 连接成功 47 | extern NSString *const kJMSGNetworkDidReceiveMessageNotification; // 收到消息 48 | extern NSString *const kJMSGServiceErrorNotification; // 错误提示 49 | 50 | /*! 51 | * JMessage核心头文件 52 | * 53 | * 这是唯一需要导入到你的项目里的头文件,它引用了内部需要用到的头文件。 54 | */ 55 | @interface JMessage : NSObject 56 | 57 | /*! JMessage SDK 版本号。用于展示 SDK 的版本信息 */ 58 | #define JMESSAGE_VERSION @"3.8.0" 59 | 60 | /*! JMessage SDK 构建ID. 每次构建都会增加 */ 61 | #define JMESSAGE_BUILD 244 62 | 63 | /*! API Version - int for program logic. SDK API 有变更时会增加 */ 64 | extern NSInteger const JMESSAGE_API_VERSION; 65 | 66 | 67 | /*! 68 | * @abstract 初始化 JMessage SDK 69 | * 70 | * @discussion 此方法被[JMessage setupJMessage:appKey:channel:apsForProduction:category:messageRoaming:]方法取代 71 | */ 72 | + (void)setupJMessage:(NSDictionary *)launchOptions 73 | appKey:(NSString *)appKey 74 | channel:(NSString *)channel 75 | apsForProduction:(BOOL)isProduction 76 | category:(NSSet *)category __attribute__((deprecated("JMessage 3.1.0 版本已过期"))); 77 | 78 | /*! 79 | * @abstract 初始化 JMessage SDK 80 | * 81 | * @param launchOptions AppDelegate启动函数的参数launchingOption(用于推送服务) 82 | * @param appKey appKey(应用Key值,通过JPush官网可以获取) 83 | * @param channel 应用的渠道名称 84 | * @param isProduction 是否为生产模式 85 | * @param category iOS8新增通知快捷按钮参数 86 | * @param isRoaming 是否启用消息漫游,默认关闭 87 | * 88 | * @discussion 此方法必须被调用, 以初始化 JMessage SDK 89 | * 90 | * 如果未调用此方法, 本 SDK 的所有功能将不可用. 91 | */ 92 | + (void)setupJMessage:(NSDictionary *)launchOptions 93 | appKey:(NSString *)appKey 94 | channel:(NSString *)channel 95 | apsForProduction:(BOOL)isProduction 96 | category:(NSSet *)category 97 | messageRoaming:(BOOL)isRoaming; 98 | 99 | /*! 100 | * @abstract 增加回调(delegate protocol)监听 101 | * 102 | * @param delegate 需要监听的 Delegate Protocol 103 | * @param conversation 允许为nil 104 | * 105 | * - 为 nil, 表示接收所有的通知, 不区分会话. 106 | * - 不为 nil,表示只接收指定的 conversation 相关的通知. 107 | * 108 | * @discussion 默认监听全局 JMessageDelegate 即可. 109 | * 110 | * 这个调用可以在任何地方, 任何时候调用, 可以在未进行 SDK 111 | * 启动 setupJMessage:appKey:channel:apsForProduction:category: 时就被调用. 112 | * 113 | * 并且, 如果你有必要接收数据库升级通知 JMSGDBMigrateDelegate, 114 | * 就应该在 SDK 启动前就调用此方法, 来注册通知接收. 115 | * 这样, SDK启动过程中发现需要进行数据库升级, 给 App 发送数据库升级通知时, 116 | * App 才可以收到并进行处理. 117 | */ 118 | + (void)addDelegate:(id )delegate withConversation:(JMSGConversation *)conversation; 119 | 120 | /*! 121 | * @abstract 删除Delegate监听 122 | * 123 | * @param delegate 监听的 Delegate Protocol 124 | * @param conversation 基于某个会话的监听. 允许为 nil. 125 | * 126 | * - 为 nil, 表示全局的监听, 即所有会话相关. 127 | * - 不为 nil, 表示特定的会话. 128 | */ 129 | + (void)removeDelegate:(id )delegate withConversation:(JMSGConversation *)conversation; 130 | 131 | /*! 132 | * @abstract 删除全部监听 133 | */ 134 | + (void)removeAllDelegates; 135 | 136 | /*! 137 | * @abstract 打开日志级别到 Debug 138 | * 139 | * @discussion JMessage iOS SDK 默认开启的日志级别为: Info. 只显示必要的信息, 不打印调试日志. 140 | * 141 | * 调用本接口可打开日志级别为: Debug, 打印调试日志,初始化 SDK 前调用. 142 | */ 143 | + (void)setDebugMode; 144 | 145 | /*! 146 | * @abstract 关闭日志 147 | * 148 | * @discussion 关于日志级别的说明, 参考 [JMessage setDebugMode] 149 | * 150 | * 虽说是关闭日志, 但还是会打印 Warning, Error 日志. 这二种日志级别, 在程序运行正常时, 不应有打印输出. 151 | * 152 | * 建议在发布的版本里, 调用此接口, 关闭掉日志打印. 153 | */ 154 | + (void)setLogOFF; 155 | 156 | /*! 157 | * @abstract 注册远程推送 158 | * @param types 通知类型 159 | * @param categories 类别组 160 | * 161 | */ 162 | + (void)registerForRemoteNotificationTypes:(NSUInteger)types categories:(NSSet *)categories; 163 | 164 | /*! 165 | * @abstract 注册 DeviceToken 166 | * @param deviceToken 从注册推送回调中拿到的 DeviceToken 167 | */ 168 | + (void)registerDeviceToken:(NSData *)deviceToken; 169 | 170 | /*! 171 | * @abstract 验证此 appKey 是否为当前应用 appKey 172 | * 173 | * @param appKey 应用 AppKey 174 | * 175 | * @return 是否为当前应用 appKey 176 | */ 177 | + (BOOL)isMainAppKey:(NSString *)appKey; 178 | 179 | /*! 180 | * @abstract 设置角标(到服务器) 181 | * 182 | * @param value 新的值. 会覆盖服务器上保存的值(这个用户) 183 | * 184 | * @discussion 本接口不会改变应用本地的角标值. 185 | * 本地仍须调用 UIApplication:setApplicationIconBadgeNumber 函数来设置脚标. 186 | * 187 | * 该功能解决的问题是, 服务器端推送 APNs 时, 并不知道客户端原来已经存在的角标是多少, 指定一个固定的数字不太合理. 188 | * 189 | * APNS 服务器端脚标功能提供: 190 | * 191 | * - 通过本 API 把当前客户端(当前这个用户的) 的实际 badge 设置到服务器端保存起来; 192 | * - 调用服务器端 API 发 APNs 时(通常这个调用是批量针对大量用户), 193 | * 使用 "+1" 的语义, 来表达需要基于目标用户实际的 badge 值(保存的) +1 来下发通知时带上新的 badge 值; 194 | */ 195 | + (BOOL)setBadge:(NSInteger)value; 196 | 197 | /*! 198 | * @abstract 重置角标(为0) 199 | * 200 | * @discussion 相当于 [setBadge:0] 的效果. 201 | * 参考 [JMessage setBadge:] 说明来理解其作用. 202 | */ 203 | + (void)resetBadge; 204 | 205 | /*! 206 | * @abstract 发送透传消息给自己在线的其他设备 207 | * 208 | * @param message 发送的内容 209 | * @param platform 设备类型 210 | * @param handler 回调 211 | * 212 | * @discussion 注意: 213 | * 214 | * 1. 消息透传功能,消息不会进入到后台的离线存储中去,仅当对方用户当前在线时才会成功送达,SDK 不会将此类消息内容存储; 215 | * 216 | * 2. 透传命令到达是,接收方通过 [JMSGEventDelegate onReceiveMessageTransparentEvent:] 方法监听。 217 | * 218 | * @since 3.5.0 219 | */ 220 | + (void)sendCrossDeviceTransMessage:(NSString *)message 221 | platform:(JMSGPlatformType)platform 222 | handler:(JMSGCompletionHandler)handler; 223 | 224 | /*! 225 | * @abstract 判断是否设置全局免打扰 226 | * 227 | * @return YES/NO 228 | */ 229 | + (BOOL)isSetGlobalNoDisturb; 230 | 231 | /*! 232 | * @abstract 设置是否全局免打扰 233 | * 234 | * @param isNoDisturb 是否全局免打扰 YES:是 NO: 否 235 | * @param handler 结果回调。回调参数:error 不为 nil,表示设置失败 236 | * 237 | * @discussion 此函数为设置全局的消息免打扰,建议开发者在 SDK 完全启动之后,再调用此接口获取数据 238 | */ 239 | + (void)setIsGlobalNoDisturb:(BOOL)isNoDisturb handler:(JMSGCompletionHandler)handler; 240 | 241 | /*! 242 | * @abstract 用户免打扰列表 243 | * 244 | * @param handler 结果回调。回调参数: 245 | * 246 | * - resultObject 类型为 NSArray,数组里成员的类型为 JMSGUser、JMSGGroup 247 | * - error 错误信息 248 | * 249 | * 如果 error 为 nil, 表示设置成功 250 | * 如果 error 不为 nil,表示设置失败 251 | * 252 | * @discussion 从服务器获取,返回用户的免打扰列表。 253 | * 建议开发者在 SDK 完全启动之后,再调用此接口获取数据 254 | */ 255 | + (void)noDisturbList:(JMSGCompletionHandler)handler; 256 | 257 | /*! 258 | * @abstract 黑名单列表 259 | * 260 | * @param handler 结果回调。回调参数: 261 | * 262 | * - resultObject 类型为 NSArray,数组里成员的类型为 JMSGUser 263 | * - error 错误信息 264 | * 265 | * 如果 error 为 nil, 表示设置成功 266 | * 如果 error 不为 nil,表示设置失败 267 | * 268 | * @discussion 从服务器获取,返回用户的黑名单列表。 269 | * 建议开发者在 SDK 完全启动之后,再调用此接口获取数据 270 | */ 271 | + (void)blackList:(JMSGCompletionHandler)handler; 272 | 273 | /*! 274 | * @abstract 获取当前服务器端时间 275 | * 276 | * @discussion 可用于纠正本地时间。 277 | */ 278 | + (NSTimeInterval)currentServerTime; 279 | 280 | /*! 281 | * @abstract 发起数据库升级测试 282 | * 283 | * @discussion 这是一个专用于测试时使用到的接口. 284 | * 285 | * 关于数据库升级相关, 参考这个 [JMSGDBMigrateDelegate] 类里的说明. 286 | * 287 | * 调用此接口后, App 会收到一个升级开始通知, 30s 后再收到一个升级结束通知. 288 | * 289 | * 本接口内部并不会真实地发起数据库升级操作, 而仅用于发出开始与完成的通知, 以方便 App 来测试处理流程. 290 | */ 291 | + (void)testDBMigrating; 292 | @end 293 | 294 | 295 | /*! 296 | * 用户登录设备信息 297 | */ 298 | @interface JMSGDeviceInfo: NSObject 299 | 300 | /// 设备所属平台,Android、iOS、Windows、web 301 | @property(nonatomic, assign, readonly) JMSGPlatformType platformType; 302 | /// 是否登录,YES:已登录,NO:未登录 303 | @property(nonatomic, assign, readonly) BOOL isLogin; 304 | /// 是否在线,0:不在线,1:在线 305 | @property(nonatomic, assign, readonly) UInt32 online; 306 | /// 上次登录时间 307 | @property(nonatomic, strong, readonly) NSNumber *mtime; 308 | /// 默认为0,1表示该设备被当前登录设备踢出 309 | @property(nonatomic, assign, readonly) NSInteger flag; 310 | 311 | @end 312 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Headers/JMessageDelegate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * | | | | \ \ / / | | | | / _______| 3 | * | |____| | \ \/ / | |____| | / / 4 | * | |____| | \ / | |____| | | | _____ 5 | * | | | | / \ | | | | | | |____ | 6 | * | | | | / /\ \ | | | | \ \______| | 7 | * | | | | /_/ \_\ | | | | \_________| 8 | * 9 | * Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved. 10 | */ 11 | 12 | #import 13 | #import 14 | #import 15 | #import 16 | #import 17 | #import 18 | #import 19 | 20 | /*! 21 | * 全局代理协议 22 | * 23 | * 一般情况下, App 只需要注册这个全局代理, 则其他类别里的代理都注册到. 24 | * 由于回调方法都是可选, 你可以根据需要实现一个或者多个回调, 在你实现的方法里, 有事件时就会回调. 25 | * 26 | * #### 消息接收和发送 27 | * 28 | * 以下代码, 假设当前类是 ChatViewController, 要完成这样的功能: 29 | * 接收当前聊天所在的会话的 - 发出的消息的返回, 以及服务器端下发的消息. 30 | * 31 | * ``` 32 | * // 通过你的方式取到了 Conversation 实例 33 | * JMSGConversation *theConversation = ...; 34 | * 35 | * // 在类的初始化代码里, 注册代理, 指定 Conversation. 36 | * [JMessage addDelegate:self withConversation:theConversation]; 37 | * 38 | * // 实现 JMSGMessageDelegate 里的发送消息返回的回调方法 39 | * - (void)onSendMessageResponse:(JMSGMessage *)message 40 | * error:(NSError *)error { 41 | * // 这里处理发送消息返回 42 | * // message 对象是你原本发出的消息对象 43 | * } 44 | * 45 | * // 实现 JMSGMessageDelegate 里的接收消息回调方法 46 | * - (void)onReceiveMessage:(JMSGMessage *)message 47 | * error:(NSError *)error { 48 | * // 这里处理收到的消息 49 | * } 50 | * ``` 51 | * 52 | * 有些特殊的消息,需要做特殊判断,比如:群里的一些事件消息,添加群成员、设置群管理员事件等. 53 | * 思路上, 需要先从 onReceiveMessage 上收到事件类型的消息, 判断 JMSGEventContent 里的 54 | * eventType = kJMSGEventNotificationAddGroupMembers 表示这是一个群组加人的事件. 55 | * 56 | * 以下示例代码在上述 onReceiveMessage 监听里: 57 | * 58 | * ``` 59 | * if (message.contentType == kJMSGContentTypeEventNotification) { 60 | * JMSGEventContent *eventContent = (JMSGEventContent) message.content; 61 | * if (eventContent.eventType == kJMSGEventNotificationAddGroupMembers) { 62 | * // 一般的作法应该是界面显示一条消息: “xxx 加入了群组” 63 | * } 64 | * } 65 | * ``` 66 | * 67 | * #### 事件代理 68 | * 69 | * 有一类特殊的系统事件, 需要特别提示,如:其他设备登录被踢、加好友、申请入群等事件,SDK 会收到一个下发通知. 70 | * 思路上, 需要先实现相关事件的代理方法,如果有多个事件共用同一个代理还需判断 eventType. 71 | * 72 | * 以用户被踢事件为例: 73 | * 74 | * ``` 75 | * // 实现 JMSGEventDelegate 里的接收事件代理方法 76 | * - (void)onReceiveUserLoginStatusChangeEvent:(JMSGUserLoginStatusChangeEvent *)event { 77 | * if (event.eventType == kJMSGEventNotificationLoginKicked) { 78 | * // 这里做用户被踢处理. 一般的作法应该是: 弹出提示信息,告诉用户在其他设备登录了; 79 | * // 弹窗关闭后界面切换到用户登录界面 80 | * } 81 | * } 82 | * ``` 83 | * 其他事件的监听类似. 84 | */ 85 | @protocol JMessageDelegate 91 | 92 | @end 93 | -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Info.plist: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/src/ios/lib/JMessage.framework/Info.plist -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/JMessage: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jpush/jmessage-phonegap-plugin/32a7f636d33217cd61f548a26e1a7b3daff7d164/src/ios/lib/JMessage.framework/JMessage -------------------------------------------------------------------------------- /src/ios/lib/JMessage.framework/Modules/module.modulemap: -------------------------------------------------------------------------------- 1 | framework module JMessage { 2 | umbrella header "JMessage.h" 3 | 4 | export * 5 | module * { export * } 6 | } 7 | --------------------------------------------------------------------------------