Skip to content

Commit ba32d35

Browse files
Merge pull request #31 from jpush/dev
Dev
2 parents 58ec81a + 057b0a0 commit ba32d35

File tree

33 files changed

+573
-130
lines changed

33 files changed

+573
-130
lines changed

android/build.gradle

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
buildscript {
2-
repositories {
3-
jcenter()
4-
}
5-
6-
dependencies {
7-
classpath 'com.android.tools.build:gradle:2.3.1'
8-
}
9-
}
10-
111
apply plugin: 'com.android.library'
122

133
android {

android/src/io/jchat/android/Constant.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class Constant {
2424
public static final String TYPE_GROUP = "group";
2525
public static final String TYPE_SINGLE = "single";
2626
public static final String ID = "id";
27+
public static final String SERVER_ID = "serverMessageId";
2728
public static final String MESSAGE_ID = "messageId";
2829
public static final String GROUP_ID = "groupId";
2930
public static final String NAME = "name";
@@ -44,11 +45,11 @@ public class Constant {
4445
public static final String LIMIT = "limit";
4546
public static final String CREATE_TIME = "createTime";
4647
public static final String TEXT = "text";
47-
static final String IMAGE = "image";
48-
static final String VOICE = "voice";
49-
static final String LOCATION = "location";
50-
static final String FILE = "file";
51-
static final String CUSTOM = "custom";
48+
public static final String IMAGE = "image";
49+
public static final String VOICE = "voice";
50+
public static final String LOCATION = "location";
51+
public static final String FILE = "file";
52+
public static final String CUSTOM = "custom";
5253
public static final String EXTRAS = "extras";
5354
public static final String THUMB_PATH = "thumbPath";
5455
public static final String PATH = "path";

android/src/io/jchat/android/utils/ResultUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ public static WritableMap toJSObject(Message msg) {
119119
WritableMap result = Arguments.createMap();
120120
try {
121121
result.putString(Constant.ID, String.valueOf(msg.getId()));
122+
result.putString(Constant.SERVER_ID, String.valueOf(msg.getServerMessageId()));
122123
result.putMap(Constant.FROM, toJSObject(msg.getFromUser()));
123124

124125
if (msg.getDirect() == MessageDirect.send) {

document/API.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ JMessage.createSendMessage({type: 'single', username: 'username', appKey: 'appke
333333
- groupId: 对象群组 id。当 `type` 为 'group' 时,`groupId` 为必填。
334334

335335

336-
- messageSendingOptions: 消息发送配置参数(只对 Android 生效)。支持的属性:
336+
- messageSendingOptions: 消息发送配置参数。支持的属性:
337337
- isShowNotification: 接收方是否针对此次消息发送展示通知栏通知。默认为 `true`
338338
- isRetainOffline: 是否让后台在对方不在线时保存这条离线消息,等到对方上线后再推送给对方。默认为 `true`
339339
- isCustomNotificationEnabled: 是否开启自定义接收方通知栏功能,设置为 `true` 后可设置下面的 `notificationTitle``notificationText`。默认未设置。

document/Models.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ target: UserInfo / GroupInfo // 聊天对象信息
6666

6767
```js
6868
id: string, // 消息 id
69+
serverMessageId: string, // 消息服务器Id 用于服务器追踪问题
6970
type: 'text', // 消息类型
7071
from: UserInfo, // 消息发送者对象
7172
target: UserInfo / GroupInfo, // 消息接收者对象
@@ -80,6 +81,7 @@ extras: object // 附带的键值对
8081

8182
```js
8283
id: string, // 消息 id
84+
serverMessageId: string, // 消息服务器Id 用于服务器追踪问题
8385
type: 'image', // 消息类型
8486
from: UserInfo, // 消息发送者对象
8587
target: UserInfo / GroupInfo, // 消息接收者对象
@@ -91,6 +93,7 @@ thumbPath: string // 图片的缩略图路径
9193

9294
```js
9395
id: string, // 消息 id
96+
serverMessageId: string, // 消息服务器Id 用于服务器追踪问题
9497
type: 'voice', // 消息类型
9598
from: UserInfo, // 消息发送者对象
9699
target: UserInfo / GroupInfo, // 消息接收者对象
@@ -103,6 +106,7 @@ duration: number // 语音时长,单位秒
103106

104107
```js
105108
id: string, // 消息 id
109+
serverMessageId: string, // 消息服务器Id 用于服务器追踪问题
106110
type: 'location', // 消息类型
107111
from: UserInfo, // 消息发送者对象
108112
target: UserInfo / GroupInfo, // 消息接收者对象
@@ -119,6 +123,7 @@ scale:number // 地图缩放比例
119123

120124
```js
121125
id: string, // 消息 id
126+
serverMessageId: string, // 消息服务器Id 用于服务器追踪问题
122127
type: 'file', // 消息类型
123128
from: UserInfo, // 消息发送者对象
124129
target: UserInfo / GroupInfo, // 消息接收者对象
@@ -130,6 +135,7 @@ fileName: string // 文件名
130135

131136
```js
132137
id: string, // 消息 id
138+
serverMessageId: string, // 消息服务器Id 用于服务器追踪问题
133139
type: 'custom', // 消息类型
134140
from: UserInfo, // 消息发送者对象
135141
target: UserInfo / GroupInfo, // 消息接收者对象

example/.vscode/launch.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
// 使用 IntelliSense 了解相关属性。
3+
// 悬停以查看现有属性的描述。
4+
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node",
9+
"request": "launch",
10+
"name": "Launch Program",
11+
"program": "${file}"
12+
}
13+
]
14+
}

example/android/app/app.iml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@
8787
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
8888
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/javaPrecompile" />
8989
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
90-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/lint" />
9190
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
9291
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/prebuild" />
9392
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
@@ -104,23 +103,23 @@
104103
<orderEntry type="jdk" jdkName="Android API 25 Platform (1)" jdkType="Android SDK" />
105104
<orderEntry type="sourceFolder" forTests="false" />
106105
<orderEntry type="library" name="com.google.code.gson:gson:2.8.0@jar" level="project" />
107-
<orderEntry type="library" name="cn.jiguang.imui:chatinput-0.4.9" level="project" />
108106
<orderEntry type="library" name="com.squareup.okhttp3:okhttp-ws:3.4.1@jar" level="project" />
109107
<orderEntry type="library" name="com.github.w446108264:AndroidEmoji-1.0.0" level="project" />
110108
<orderEntry type="library" name="com.google.android:flexbox-0.2.5" level="project" />
111109
<orderEntry type="library" name="com.facebook.fresco:imagepipeline-base-1.0.1" level="project" />
110+
<orderEntry type="library" name="cn.jiguang.imui:chatinput-0.5.6" level="project" />
112111
<orderEntry type="library" name="javax.inject:javax.inject:1@jar" level="project" />
113112
<orderEntry type="library" name="com.android.support:support-core-ui-25.3.1" level="project" />
114113
<orderEntry type="library" name="com.android.support:support-compat-25.3.1" level="project" />
115114
<orderEntry type="library" name="com.parse.bolts:bolts-tasks:1.4.0@jar" level="project" />
116-
<orderEntry type="library" name="cn.jiguang.imui:messagelist-0.5.0" level="project" />
117115
<orderEntry type="library" name="com.google.code.findbugs:jsr305:3.0.0@jar" level="project" />
118116
<orderEntry type="library" name="com.facebook.react:react-native-0.44.2" level="project" />
119117
<orderEntry type="library" name="com.squareup.okhttp3:okhttp-urlconnection:3.4.1@jar" level="project" />
120118
<orderEntry type="library" name="__local_aars__:/Users/caiyg/Desktop/github/jmessage-react-plugin/example/node_modules/jcore-react-native/android/libs/jcore-android-1.1.7.jar:unspecified@jar" level="project" />
121119
<orderEntry type="library" name="com.facebook.soloader:soloader-0.1.0" level="project" />
122120
<orderEntry type="library" name="com.android.support:support-core-utils-25.3.1" level="project" />
123121
<orderEntry type="library" name="com.github.w446108264:XhsEmoticonsKeyboard-2.0.4" level="project" />
122+
<orderEntry type="library" name="cn.jiguang.imui:messagelist-0.5.5" level="project" />
124123
<orderEntry type="library" name="com.android.support:support-v4-25.3.1" level="project" />
125124
<orderEntry type="library" name="com.facebook.fresco:fresco-1.0.1" level="project" />
126125
<orderEntry type="library" name="com.android.support:support-fragment-25.3.1" level="project" />

example/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ buildscript {
1414
}
1515
}
1616
dependencies {
17-
classpath 'com.android.tools.build:gradle:3.0.0'
17+
classpath 'com.android.tools.build:gradle:3.0.1'
1818

1919
// NOTE: Do not place your application dependencies here; they belong
2020
// in the individual module build.gradle files

example/app/routes/Chat/index.js

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,16 @@ export default class Chat extends Component {
4343
constructor(props) {
4444
super(props);
4545
this.state = {
46-
inputViewLayout: { width: window.width, height: 200, },
4746
menuContainerHeight: 1000,
4847
isDismissMenuContainer: false,
4948
shouldExpandMenuContainer: false,
5049
};
51-
50+
if (Platform.OS == 'ios') {
51+
this.state.inputViewLayout = { width: window.width, height: 86, }
52+
} else {
53+
this.state.inputViewLayout = { width: window.width, height: 200, }
54+
}
55+
5256
this.updateLayout = this.updateLayout.bind(this);
5357
this.onTouchMsgList = this.onTouchMsgList.bind(this);
5458
this.conversation = this.props.navigation.state.params.conversation
@@ -138,7 +142,7 @@ export default class Chat extends Component {
138142
message.isOutgoing = true
139143
message.content = '<body bgcolor="#ff3399"><h5>This is a custom message. </h5>\
140144
<img src="/storage/emulated/0/XhsEmoticonsKeyboard/Emoticons/wxemoticons/icon_040_cover.png"></img></body>'
141-
message.contentSize = {'height': 400, 'width': 400}
145+
message.contentSize = {'height': 200, 'width': 200}
142146
message.extras = {"extras": "fdfsf"}
143147
var user = {
144148
userId: "1",
@@ -156,6 +160,7 @@ export default class Chat extends Component {
156160
}
157161

158162
componentDidMount() {
163+
this.resetMenu()
159164
var parames = {
160165

161166
'from': 0, // 开始的消息下标。
@@ -211,10 +216,10 @@ export default class Chat extends Component {
211216
JMessage.addReceiveMessageListener(this.receiveMessageCallBack)
212217
}
213218
AuroraIController.addMessageListDidLoadListener(this.messageListDidLoadCallback)
214-
//this.timer = setTimeout(() => {
215-
// console.log("Sending custom message")
216-
// this.sendCustomMessage();
217-
//}, 2000)
219+
this.timer = setTimeout(() => {
220+
console.log("Sending custom message")
221+
this.sendCustomMessage();
222+
}, 2000)
218223
}
219224

220225
componentWillUnmount() {
@@ -227,6 +232,31 @@ export default class Chat extends Component {
227232

228233
}
229234

235+
resetMenu() {
236+
if (Platform.OS === "android") {
237+
console.log("reset menu, count: " + this.state.lineCount)
238+
if (this.lineCount == 1) {
239+
this.setState({
240+
inputHeight: 120,
241+
inputViewLayout: { width: window.width, height: 200 }
242+
})
243+
} else {
244+
this.setState({
245+
inputHeight: 80 + this.state.lineCount * 40,
246+
inputViewLayout: { width: window.width, height: 160 + 40 * this.state.lineCount }
247+
})
248+
}
249+
this.setState({
250+
shouldExpandMenuContainer: false,
251+
})
252+
} else {
253+
this.setState({
254+
inputViewLayout: { width: window.width, height: 86 }
255+
})
256+
AuroraIController.hidenFeatureView(true)
257+
}
258+
}
259+
230260
updateLayout(layout) {
231261
this.setState({ inputViewLayout: layout })
232262
}
@@ -237,14 +267,7 @@ export default class Chat extends Component {
237267

238268
onTouchMsgList() {
239269
console.log("Touch msg list, hidding soft input and dismiss menu");
240-
this.setState({
241-
isDismissMenuContainer: true,
242-
inputViewLayout: {
243-
width: Dimensions.get('window').width,
244-
height: 200
245-
},
246-
shouldExpandMenuContainer: false,
247-
});
270+
this.resetMenu()
248271
}
249272

250273
onTouchEditText = () => {
@@ -560,7 +583,6 @@ export default class Chat extends Component {
560583
sendBubbleTextColor={"#000000"}
561584
sendBubblePadding={{ left: 10, top: 10, right: 15, bottom: 10 }}
562585
/>
563-
}
564586
<InputView style={this.state.inputViewLayout}
565587
menuContainerHeight={this.state.menuContainerHeight}
566588
isDismissMenuContainer={this.state.isDismissMenuContainer}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
'use strict';
2+
3+
import React from 'react';
4+
import ReactNative from 'react-native';
5+
import JMessage from 'jmessage-react-plugin';
6+
import {
7+
TabNavigator
8+
} from 'react-navigation';
9+
10+
11+
const {
12+
View,
13+
Text,
14+
TouchableHighlight,
15+
StyleSheet,
16+
Button,
17+
Alert,
18+
TextInput,
19+
Image,
20+
FlatList,
21+
ScrollView,
22+
} = ReactNative;
23+
24+
25+
26+
export default class ConversationDetail extends React.Component {
27+
static navigationOptions = {
28+
title: "会话详情",
29+
};
30+
31+
static navigationOptions = ({
32+
navigation
33+
}) => {
34+
const {
35+
params = {}
36+
} = navigation.state;
37+
return {
38+
headerLeft: <Button title="返回" onPress={() => {
39+
// this.props.navigation.goBack()
40+
navigation.goBack()
41+
// this.props.navigation.goBack()
42+
// this.onGoBack()
43+
// Alert.alert("navigation", this.)
44+
setTimeout(() => {
45+
params.onGoBack()
46+
}, 100);
47+
48+
// Alert.alert("goback",par)
49+
}} />,
50+
title: "会话详情",
51+
52+
}
53+
};
54+
55+
constructor(props) {
56+
super(props)
57+
this.state = {
58+
data: [],
59+
}
60+
// this.props.navigation.state.params.onGoBack();
61+
// Alert.alert("navigation", JSON.stringify(this.props.navigation.state.params.onGoBack))
62+
}
63+
64+
componentWillMount() {
65+
}
66+
67+
68+
render() {
69+
70+
return (
71+
<ScrollView>
72+
73+
</ScrollView>
74+
);
75+
}
76+
}

0 commit comments

Comments
 (0)