Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
std-s committed May 9, 2022
2 parents 917e367 + cf91ecd commit cc4a14c
Show file tree
Hide file tree
Showing 12 changed files with 112 additions and 20 deletions.
48 changes: 34 additions & 14 deletions Example/OpenIMSDKiOS/OPENIMSDKViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ - (void)viewDidLoad
@{OIM_LIST_CELL_TITLE: @"获取好友列表", OIM_LIST_CELL_FUNC: @"getFriendList"},
@{OIM_LIST_CELL_TITLE: @"验证是否好友关系", OIM_LIST_CELL_FUNC: @"checkFriend"},
@{OIM_LIST_CELL_TITLE: @"设置好友备注", OIM_LIST_CELL_FUNC: @"setFriendRemark"},
@{OIM_LIST_CELL_TITLE: @"删除好友", OIM_LIST_CELL_FUNC: @"deleteFriend"}],
@{OIM_LIST_CELL_TITLE: @"删除好友", OIM_LIST_CELL_FUNC: @"deleteFriend"},
@{OIM_LIST_CELL_TITLE: @"本地查询用户", OIM_LIST_CELL_FUNC: @"searchUsers"}],

@[@{OIM_LIST_CELL_TITLE: @"创建群聊", OIM_LIST_CELL_FUNC: @"createGroup"},
@{OIM_LIST_CELL_TITLE: @"加入群聊", OIM_LIST_CELL_FUNC: @"joinGroup"},
Expand Down Expand Up @@ -302,16 +303,13 @@ - (void)initSDK {

NSLog(@"\n\n-----初始化------");

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *path = [paths.firstObject stringByAppendingString:@"/"];

BOOL initSuccess = [OIMManager.manager initSDK:iOS
apiAdrr:API_ADDRESS
wsAddr:WS_ADDRESS
dataDir:path
logLevel:6
objectStorage:nil
onConnecting:^{
BOOL initSuccess = [OIMManager.manager initSDKWithApiAdrr:API_ADDRESS
wsAddr:WS_ADDRESS
dataDir:nil
logLevel:6
objectStorage:nil
onConnecting:^{

NSLog(@"\nconnecting");
} onConnectFailure:^(NSInteger code, NSString * _Nullable msg) {
NSLog(@"\n connect failure");
Expand All @@ -324,9 +322,6 @@ - (void)initSDK {
}];

NSLog(@"初始化成功与否:%d", initSuccess);



}

- (void)login {
Expand Down Expand Up @@ -600,6 +595,27 @@ - (void)deleteFriend {
}];
}


- (void)searchUsers {
[self operate:_cmd
todo:^(void (^callback)(NSNumber *code, NSString *msg)) {

OIMSearchUserParam *t = [OIMSearchUserParam new];
t.keywordList = @[@"x2"];
t.isSearchRemark = YES;
t.isSearchUserID = YES;

[OIMManager.manager searchUsers:t
onSuccess:^(NSArray<OIMSearchUserInfo *> * _Nullable usersInfo) {


callback(nil, nil);
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
callback(@(code), msg);
}];
}];
}

#pragma mark -
#pragma mark - group

Expand Down Expand Up @@ -940,6 +956,10 @@ - (void)sendMessage {
//
// NSString *path4 = [[NSBundle mainBundle]pathForResource:@"file_test" ofType:@"zip"];
// self.testMessage = [OIMMessageInfo createFileMessageFromFullPath:path4 fileName:@"file_test"];
// OIMAtInfo *t = [OIMAtInfo new];
// t.atUserID = OTHER_USER_ID;
// t.groupNickname = @"x2";
// self.testMessage = [OIMMessageInfo createTextAtMessage:@"一条消息" atUidList:@[] atUsersInfo:@[t] message:nil];

[OIMManager.manager sendMessage:self.testMessage
recvID:OTHER_USER_ID
Expand Down
8 changes: 4 additions & 4 deletions OpenIMSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'OpenIMSDK'
s.version = '2.0.7.4'
s.version = '2.0.8'
s.summary = 'Open-IM-SDK'

# This description is used to generate tags and improve search results.
Expand Down Expand Up @@ -70,9 +70,9 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = {
'ARCHS[sdk=iphonesimulator*]' => '$(ARCHS_STANDARD_64_BIT)', 'DEFINES_MODULE' => 'YES'
}

s.dependency 'OpenIMSDKCore', '2.0.7.1'
s.static_framework = true


s.static_framework = true
s.dependency 'OpenIMSDKCore', '2.0.8'
s.dependency 'MJExtension'
end
1 change: 1 addition & 0 deletions OpenIMSDK/Callbacker/OIMCallbacker.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ typedef void (^OIMFriendApplicationsCallback)(NSArray <OIMFriendApplication *> *

typedef void (^OIMFriendInfoCallback)(OIMFriendInfo * _Nullable friendInfo);
typedef void (^OIMBlackInfoCallback)(OIMBlackInfo * _Nullable blackInfo);
typedef void (^OIMSearchUsersInfoCallback)(NSArray<OIMSearchUserInfo *> * _Nullable usersInfo);

typedef void (^OIMGroupApplicationCallback)(OIMGroupApplicationInfo * _Nullable groupApplication);
typedef void (^OIMGroupsApplicationCallback)(NSArray <OIMGroupApplicationInfo *> * _Nullable groupsInfo);
Expand Down
6 changes: 6 additions & 0 deletions OpenIMSDK/Interface/OIMManager+Friend.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ NS_ASSUME_NONNULL_BEGIN
onSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;

/*
* 搜索用户,可能是非好友
*/
- (void)searchUsers:(OIMSearchUserParam *)searchParam
onSuccess:(nullable OIMSearchUsersInfoCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
@end

NS_ASSUME_NONNULL_END
15 changes: 15 additions & 0 deletions OpenIMSDK/Interface/OIMManager+Friend.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,20 @@ - (void)deleteFriend:(NSString *)friendUserID
Open_im_sdkDeleteFriend(callback, [self operationId], friendUserID);
}

- (void)searchUsers:(OIMSearchUserParam *)searchParam
onSuccess:(nullable OIMSearchUsersInfoCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure {

assert(searchParam.isSearchRemark || searchParam.isSearchNickname || searchParam.isSearchUserID);

CallbackProxy *callback = [[CallbackProxy alloc]initWithOnSuccess:^(NSString * _Nullable data) {
if (onSuccess) {
onSuccess([OIMSearchUserInfo mj_objectArrayWithKeyValuesArray:data]);
}
} onFailure:onFailure];

Open_im_sdkSearchFriends(callback, [self operationId], searchParam.mj_JSONString);
}


@end
4 changes: 4 additions & 0 deletions OpenIMSDK/Model/OIMAtElem.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, assign) BOOL isAtSelf;


/*
* 是否@全体成员
*/
@property (nonatomic, assign) BOOL isAtAll;

@end

Expand Down
13 changes: 13 additions & 0 deletions OpenIMSDK/Model/OIMAtElem.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,25 @@
//

#import "OIMAtElem.h"
#import <MJExtension/MJExtension.h>

@import OpenIMCore;

@implementation OIMAtInfo

@end

@implementation OIMAtElem

+ (NSDictionary *)mj_objectClassInArray
{
return @{@"atUsersInfo" : [OIMAtInfo class]};
}

- (BOOL)isAtAll {
return self.atUserList.firstObject != nil &&
[self.atUserList.firstObject isKindOfClass:[NSString class]] &&
[self.atUserList.firstObject isEqualToString:Open_im_sdkGetAtAllTag()];
}

@end
6 changes: 6 additions & 0 deletions OpenIMSDK/Model/OIMFullUserInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ NS_ASSUME_NONNULL_BEGIN

@end

@interface OIMSearchUserInfo : OIMFriendInfo

@property (nonatomic, assign) OIMRelationship relationship;

@end

/*
整合了PublicUserInfo, FriendInfo和BlackInfo
getuserinfo时,
Expand Down
4 changes: 4 additions & 0 deletions OpenIMSDK/Model/OIMFullUserInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ @implementation OIMFriendInfo

@end

@implementation OIMSearchUserInfo

@end

@implementation OIMFullUserInfo

- (NSString *)userID {
Expand Down
18 changes: 17 additions & 1 deletion OpenIMSDK/Model/OIMSearchParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ NS_ASSUME_NONNULL_BEGIN



// 查询聊天记录使用
// 查询群使用
@interface OIMSearchGroupParam : NSObject

// 搜索关键词,目前仅支持一个关键词搜索,不能为空
Expand All @@ -77,6 +77,22 @@ NS_ASSUME_NONNULL_BEGIN

@end

// 查询好友使用
@interface OIMSearchUserParam : NSObject

// 搜索关键词,目前仅支持一个关键词搜索,不能为空
@property (nonatomic, copy) NSArray *keywordList;

// 是否以关键词搜索UserID
@property (nonatomic, assign) BOOL isSearchUserID;

// 是否以关键词搜索昵称,默认false
@property (nonatomic, assign) BOOL isSearchNickname;

// 是否以关键词搜索备注,默认false
@property (nonatomic, assign) BOOL isSearchRemark;
@end


// 查询聊天记录使用
@interface OIMGetMessageOptions : NSObject
Expand Down
4 changes: 3 additions & 1 deletion OpenIMSDK/Model/OIMSearchParam.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ - (instancetype)init {

@implementation OIMSearchGroupParam


@end

@implementation OIMGetMessageOptions

@end

@implementation OIMSearchUserParam

@end

5 changes: 5 additions & 0 deletions OpenIMSDK/Utils/OIMModelDefine.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,4 +116,9 @@ typedef NS_ENUM(NSInteger, OIMApplicationStatus) {
OIMApplicationStatusAccept = 1, /// 已同意
};

typedef NS_ENUM(NSInteger, OIMRelationship) {
OIMRelationshipBlack = 0,
OIMRelationshipFriend = 1
};

#endif /* OIMModelDefine_h */

0 comments on commit cc4a14c

Please sign in to comment.