Skip to content

Commit 7a38dd7

Browse files
committed
update ios jmessage sdk to 3.4.0
1 parent 8dc384a commit 7a38dd7

File tree

19 files changed

+498
-84
lines changed

19 files changed

+498
-84
lines changed
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+
}

ios/RCTJMessageModule.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/* Begin PBXBuildFile section */
1010
6212EB1A1F3C34BB00BDF51A /* RCTJMessageModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 6212EB191F3C34BB00BDF51A /* RCTJMessageModule.m */; };
1111
6212EB1B1F3C34BB00BDF51A /* RCTJMessageModule.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 6212EB181F3C34BB00BDF51A /* RCTJMessageModule.h */; };
12-
6212EB221F3C38D200BDF51A /* JMessage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6212EB211F3C38D200BDF51A /* JMessage.framework */; };
12+
623E44691FE245FA00FB7AD8 /* JMessage.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 623E44681FE245FA00FB7AD8 /* JMessage.framework */; };
1313
62D683E21F4469820083CDF6 /* JMessageHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 62D683E11F4469820083CDF6 /* JMessageHelper.m */; };
1414
/* End PBXBuildFile section */
1515

@@ -30,7 +30,7 @@
3030
6212EB151F3C34BB00BDF51A /* libRCTJMessageModule.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRCTJMessageModule.a; sourceTree = BUILT_PRODUCTS_DIR; };
3131
6212EB181F3C34BB00BDF51A /* RCTJMessageModule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTJMessageModule.h; sourceTree = "<group>"; };
3232
6212EB191F3C34BB00BDF51A /* RCTJMessageModule.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTJMessageModule.m; sourceTree = "<group>"; };
33-
6212EB211F3C38D200BDF51A /* JMessage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JMessage.framework; sourceTree = "<group>"; };
33+
623E44681FE245FA00FB7AD8 /* JMessage.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JMessage.framework; sourceTree = "<group>"; };
3434
62D683E01F4469820083CDF6 /* JMessageHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JMessageHelper.h; sourceTree = "<group>"; };
3535
62D683E11F4469820083CDF6 /* JMessageHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JMessageHelper.m; sourceTree = "<group>"; };
3636
/* End PBXFileReference section */
@@ -40,7 +40,7 @@
4040
isa = PBXFrameworksBuildPhase;
4141
buildActionMask = 2147483647;
4242
files = (
43-
6212EB221F3C38D200BDF51A /* JMessage.framework in Frameworks */,
43+
623E44691FE245FA00FB7AD8 /* JMessage.framework in Frameworks */,
4444
);
4545
runOnlyForDeploymentPostprocessing = 0;
4646
};
@@ -66,7 +66,7 @@
6666
6212EB171F3C34BB00BDF51A /* RCTJMessageModule */ = {
6767
isa = PBXGroup;
6868
children = (
69-
6212EB211F3C38D200BDF51A /* JMessage.framework */,
69+
623E44681FE245FA00FB7AD8 /* JMessage.framework */,
7070
62D683E01F4469820083CDF6 /* JMessageHelper.h */,
7171
62D683E11F4469820083CDF6 /* JMessageHelper.m */,
7272
6212EB181F3C34BB00BDF51A /* RCTJMessageModule.h */,
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
/*
2+
* | | | | \ \ / / | | | | / _______|
3+
* | |____| | \ \/ / | |____| | / /
4+
* | |____| | \ / | |____| | | | _____
5+
* | | | | / \ | | | | | | |____ |
6+
* | | | | / /\ \ | | | | \ \______| |
7+
* | | | | /_/ \_\ | | | | \_________|
8+
*
9+
* Copyright (c) 2011 ~ 2015 Shenzhen HXHG. All rights reserved.
10+
*/
11+
12+
#import <Foundation/Foundation.h>
13+
#import <JMessage/JMSGConstants.h>
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<JMSGChatRoom>
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<JMSGChatRoom>
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<JMSGChatRoom>
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: 事件的形式通知到上层。
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+
* @discussion 如果 chatroom.name 为空, 则此接口会返回 chatroom.roomID.
142+
*/
143+
- (NSString *)displayName;
144+
145+
JMSG_ASSUME_NONNULL_END
146+
@end

ios/RCTJMessageModule/JMessage.framework/Headers/JMSGConstants.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,18 @@ typedef NS_ENUM(NSInteger, JMSGConversationType) {
105105
kJMSGConversationTypeSingle = 1,
106106
/// 群聊
107107
kJMSGConversationTypeGroup = 2,
108+
/// 聊天室
109+
kJMSGConversationTypeChatRoom = 3,
110+
};
111+
112+
/*!
113+
* 群组类型 - 私有、公开
114+
*/
115+
typedef NS_ENUM(NSInteger, JMSGGroupType) {
116+
/// 私有群
117+
kJMSGGroupTypePrivate = 1,
118+
/// 公开群
119+
kJMSGGroupTypePublic = 2,
108120
};
109121

110122
/*!
@@ -228,6 +240,8 @@ typedef NS_ENUM(NSInteger, JMSGEventNotificationType) {
228240
kJMSGEventNotificationRemoveGroupMembers = 11,
229241
/// 事件类型: 群信息更新
230242
kJMSGEventNotificationUpdateGroupInfo = 12,
243+
/// 事件类型: 群禁言通知事件
244+
kJMSGEventNotificationGroupMemberSilence = 65,
231245
};
232246

233247
///----------------------------------------------------
@@ -363,6 +377,13 @@ typedef NS_ENUM(NSInteger, JMSGSDKErrorCode) {
363377
/// group 相关字段无效
364378
kJMSGErrorSDKParamGroupGroupInfoInvalid = 867002,
365379

380+
// ------------------------ ChatRoom (868xxx)
381+
382+
/// ChatRoom 不支持
383+
kJMSGErrorSDKChatRoomNotSupport = 868001,
384+
/// ChatRoom 不存在
385+
kJMSGErrorSDKChatRoomNotExist = 868002,
386+
366387
/// unknown
367388
kJMSGErrorSDKUnknownError = 869999,
368389
};
@@ -431,6 +452,8 @@ typedef NS_ENUM(NSUInteger, JMSGTcpErrorCode) {
431452
kJMSGErrorTcpUserInBlacklist = 803008,
432453
/// 内容不合法
433454
kJMSGErrorTcpContentIsIllegal = 803009,
455+
/// 发送消息失败,请求用户被禁言
456+
kJMSGErrorTcpUserBannedSendMessage = 803012,
434457
/// 群组成员列表为空
435458
kJMSGErrorTcpGroupMembersEmpty = 810002,
436459
/// 群组成员重复

0 commit comments

Comments
 (0)