Skip to content

Commit 54ebb64

Browse files
Merge pull request #8 from jpush/dev
Dev
2 parents 652b8ab + 56e4e32 commit 54ebb64

File tree

6 files changed

+58
-5
lines changed

6 files changed

+58
-5
lines changed

example/app/routes/Chat/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export default class Chat extends Component {
4040

4141
this.updateLayout = this.updateLayout.bind(this);
4242
this.conversation = this.props.navigation.state.params.conversation
43-
43+
Alert.alert("the conversation ",JSON.stringify(this.conversation))
4444
JMessage.getMyInfo((myInfo) => {
4545
this.myInfo = myInfo
4646
})
@@ -197,6 +197,7 @@ export default class Chat extends Component {
197197
onSendText = (text) => {
198198

199199
var message = this.getNormalMessage()
200+
200201
message.text = text
201202
JMessage.sendTextMessage(message, (message) => {
202203
var auroraMsg = this.convertJMessageToAuroraMsg(message)

example/app/routes/ConversationList/index.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,18 @@ var count = 0
5353
var item
5454
if (conversaion.conversationType === 'single') {
5555
item = {key: conversaion.target.username}
56+
item.conversationType = 'single'
5657
} else {
5758
item = {key: conversaion.target.id}
59+
item.conversationType = 'group'
5860
Alert.alert('conversaion', JSON.stringify(conversaion))
5961
}
6062

63+
if (conversaion.latestMessage === undefined) {
64+
item.latestMessageString = ""
65+
return item
66+
}
67+
6168
item.conversationType = conversaion.conversationType
6269
if (conversaion.latestMessage.type === 'text') {
6370
item.latestMessageString = conversaion.latestMessage.text
@@ -84,6 +91,21 @@ var count = 0
8491
}
8592

8693
_onPress() {
94+
Alert.alert("click","fasdf")
95+
JMessage.createConversation({type: 'single', username: '0002'}, (conv) => {
96+
var item
97+
if (conv.conversationType === 'single') {
98+
item = {key: conv.target.username}
99+
item.conversationType = 'single'
100+
} else {
101+
item = {key: conv.target.id}
102+
item.conversationType = 'group'
103+
Alert.alert('conversaion', JSON.stringify(conv))
104+
}
105+
this.props.navigation.navigate('Chat', {conversation: item})
106+
}, (error) => {
107+
Alert.alert('error', JSON.stringify(error))
108+
})
87109
}
88110

89111
render() {

example/app/routes/Login/index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ const {
2727
}
2828

2929
onPress() {
30+
const { navigate } = this.props.navigation
31+
3032
JMessage.login({username: this.state.username, password: this.state.password}, () => {
3133
Alert.alert('login success')
34+
navigate('ConversationList')
3235
}, (error) => {
3336
Alert.alert('login success', JSON.stringify(error))
3437
})
@@ -46,7 +49,7 @@ const {
4649
onChangeText = { (e) => { this.setState({password: e}) } }>
4750
</TextInput>
4851
<FormButton
49-
title="lala"
52+
title="登录"
5053
onPress={this.onPress}
5154
>
5255
</FormButton>

example/ios/JMessageDemo/AppDelegate.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
1919
NSURL *jsCodeLocation;
2020

2121
jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil];
22-
22+
// jsCodeLocation = [NSURL URLWithString:@"http://192.168.10.73:8081/index.ios.bundle?platform=ios&dev=true"];
2323
RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
2424
moduleName:@"ReactJChat"
2525
initialProperties:nil

ios/RCTJMessageModule/RCTJMessageModule.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,10 @@ - (void)onSyncRoamingMessage: (NSNotification *) notification {
148148
-(void)didSendMessage:(NSNotification *)notification {
149149
NSDictionary *response = notification.object;
150150

151-
// CDVPluginResult *result = nil;
151+
if (!response[@"message"]) {
152+
return;
153+
}
154+
152155
NSDictionary *msgDic = response[@"message"];
153156
NSArray *callBacks = self.SendMsgCallbackDic[msgDic[@"id"]];
154157
if (response[@"error"] == nil) {

package.json

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jmessage-react-plugin",
3-
"version": "1.0.2",
3+
"version": "2.0.0-beta",
44
"description": "a jmessage plugin for react native application",
55
"main": "index.js",
66
"repository": {
@@ -17,5 +17,29 @@
1717
"bugs": {
1818
"url": "https://github.com/jpush/jmessage-react-plugin/issues"
1919
},
20+
"peerDependencies": {
21+
"jcore-react-native": ">= 1.1.8"
22+
},
23+
"rnpm": {
24+
"ios": {
25+
"sharedLibraries": [
26+
"libz",
27+
"UserNotifications",
28+
"CoreTelephony",
29+
"Security",
30+
"CFNetwork",
31+
"CoreFoundation",
32+
"SystemConfiguration",
33+
"Foundation",
34+
"UIKit",
35+
"libresolv",
36+
"CoreGraphics",
37+
"CoreAudio",
38+
"AudioToolbox",
39+
"MobileCoreServices",
40+
"libsqlite3.0"
41+
]
42+
}
43+
},
2044
"homepage": "https://github.com/jpush/jmessage-react-plugin#readme"
2145
}

0 commit comments

Comments
 (0)