Commit 465ce70b by zhangyunjie

添加model

parent 9220604b
...@@ -207,6 +207,7 @@ ...@@ -207,6 +207,7 @@
A9D1B31524EE0772000F4662 /* oimcore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A9D1B31224EE076B000F4662 /* oimcore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; A9D1B31524EE0772000F4662 /* oimcore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A9D1B31224EE076B000F4662 /* oimcore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
A9D1B31824EFAD8C000F4662 /* OffcnUploadManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B31724EFAD8C000F4662 /* OffcnUploadManager.m */; }; A9D1B31824EFAD8C000F4662 /* OffcnUploadManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B31724EFAD8C000F4662 /* OffcnUploadManager.m */; };
A9D1B31B24F34C25000F4662 /* OffcnIMSocketManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B31A24F34C25000F4662 /* OffcnIMSocketManager.m */; }; A9D1B31B24F34C25000F4662 /* OffcnIMSocketManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B31A24F34C25000F4662 /* OffcnIMSocketManager.m */; };
A9D1B32224F50973000F4662 /* OffcnIMModel.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B32124F50973000F4662 /* OffcnIMModel.m */; };
B94FCB1053F8932068A11CC9 /* libPods-OffcnIMSDKiOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 49CE5E230A14D9B821170F61 /* libPods-OffcnIMSDKiOS.a */; }; B94FCB1053F8932068A11CC9 /* libPods-OffcnIMSDKiOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 49CE5E230A14D9B821170F61 /* libPods-OffcnIMSDKiOS.a */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
...@@ -641,6 +642,8 @@ ...@@ -641,6 +642,8 @@
A9D1B31724EFAD8C000F4662 /* OffcnUploadManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OffcnUploadManager.m; sourceTree = "<group>"; }; A9D1B31724EFAD8C000F4662 /* OffcnUploadManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OffcnUploadManager.m; sourceTree = "<group>"; };
A9D1B31924F34C25000F4662 /* OffcnIMSocketManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OffcnIMSocketManager.h; sourceTree = "<group>"; }; A9D1B31924F34C25000F4662 /* OffcnIMSocketManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OffcnIMSocketManager.h; sourceTree = "<group>"; };
A9D1B31A24F34C25000F4662 /* OffcnIMSocketManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OffcnIMSocketManager.m; sourceTree = "<group>"; }; A9D1B31A24F34C25000F4662 /* OffcnIMSocketManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OffcnIMSocketManager.m; sourceTree = "<group>"; };
A9D1B32024F50973000F4662 /* OffcnIMModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OffcnIMModel.h; sourceTree = "<group>"; };
A9D1B32124F50973000F4662 /* OffcnIMModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OffcnIMModel.m; sourceTree = "<group>"; };
D7DCDED1DEE7F99F223D5C73 /* Pods-OffcnIMSDKiOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OffcnIMSDKiOS.release.xcconfig"; path = "Target Support Files/Pods-OffcnIMSDKiOS/Pods-OffcnIMSDKiOS.release.xcconfig"; sourceTree = "<group>"; }; D7DCDED1DEE7F99F223D5C73 /* Pods-OffcnIMSDKiOS.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-OffcnIMSDKiOS.release.xcconfig"; path = "Target Support Files/Pods-OffcnIMSDKiOS/Pods-OffcnIMSDKiOS.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
...@@ -1444,6 +1447,8 @@ ...@@ -1444,6 +1447,8 @@
A9D1B31724EFAD8C000F4662 /* OffcnUploadManager.m */, A9D1B31724EFAD8C000F4662 /* OffcnUploadManager.m */,
A9D1B31924F34C25000F4662 /* OffcnIMSocketManager.h */, A9D1B31924F34C25000F4662 /* OffcnIMSocketManager.h */,
A9D1B31A24F34C25000F4662 /* OffcnIMSocketManager.m */, A9D1B31A24F34C25000F4662 /* OffcnIMSocketManager.m */,
A9D1B32024F50973000F4662 /* OffcnIMModel.h */,
A9D1B32124F50973000F4662 /* OffcnIMModel.m */,
); );
path = "ExposedInterface-(外放接口)"; path = "ExposedInterface-(外放接口)";
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -1619,6 +1624,7 @@ ...@@ -1619,6 +1624,7 @@
A966217924EA80A60024EB54 /* UIImage+ZYJGIF.m in Sources */, A966217924EA80A60024EB54 /* UIImage+ZYJGIF.m in Sources */,
A9661FCE24EA7AD10024EB54 /* SDTool.m in Sources */, A9661FCE24EA7AD10024EB54 /* SDTool.m in Sources */,
A966218B24EA80A60024EB54 /* UIView+ZYJMJExtension.m in Sources */, A966218B24EA80A60024EB54 /* UIView+ZYJMJExtension.m in Sources */,
A9D1B32224F50973000F4662 /* OffcnIMModel.m in Sources */,
A9661B6124EA72900024EB54 /* ViewController.mm in Sources */, A9661B6124EA72900024EB54 /* ViewController.mm in Sources */,
A9661FDC24EA7AD10024EB54 /* UIView+bezierShape.m in Sources */, A9661FDC24EA7AD10024EB54 /* UIView+bezierShape.m in Sources */,
A966215224EA80A60024EB54 /* ZYJZYJFMDatabase.m in Sources */, A966215224EA80A60024EB54 /* ZYJZYJFMDatabase.m in Sources */,
......
//
//
// OffcnIMModel.h
// OffcnIMSDKiOS
//
// Created by vockey on 2020/8/25.
// Copyright © 2020 offcn. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@class OffcnIMBodyModel;
@interface OffcnIMModel : NSObject
@property (nonatomic,assign)NSInteger type;//报文类型,1:IM 消息
@property (nonatomic,strong)OffcnIMBodyModel *body;
@end
@class OffcnIMMsgModel;
@interface OffcnIMBodyModel : NSObject
@property (nonatomic,copy)NSString *session_id; //会话ID
@property (nonatomic,copy)NSString *msg_id;//消息Id
@property (nonatomic,copy)NSString *version;
@property (nonatomic,copy)NSString *send_time;//发送时间
@property (nonatomic,assign)NSInteger msg_seq;//消息时序
@property (nonatomic,assign)NSInteger msg_scope;// 区分单聊:1以及群聊:2
@property (nonatomic,copy)NSString *msg_from;//发送消息的用户id
@property (nonatomic,copy)NSString *msg_to;//接受消息的用户id
@property (nonatomic,assign)NSInteger msg_type;//消息类型
@property (nonatomic,strong)OffcnIMMsgModel *msg;//消息内容
@end
@interface OffcnIMMsgModel : NSObject
@property (nonatomic,copy)NSString *msg;//文本消息内容
@property (nonatomic,assign)NSInteger dur;//只有音频消息和视频消息返回的时长ms
@property (nonatomic,copy)NSString *name;//只有图片消息和文件消息返回的名字
@property (nonatomic,copy)NSString *md5;//md5
@property (nonatomic,copy)NSString *url;//下载地址
@property (nonatomic,copy)NSString *thumb_url;//只有图片消息返回的缩略图URL
@property (nonatomic,copy)NSString *cover_url;//只有视频消息返回的视频封面url
@property (nonatomic,copy)NSString *ext;//文件类型
@property (nonatomic,assign)NSInteger w;//宽
@property (nonatomic,assign)NSInteger h;//高
@property (nonatomic,assign)NSInteger size;//文件大小
@end
//发送消息Model
@interface OffcnIMSendMsgModel : NSObject
@property (nonatomic,copy)NSString *msg_id;//消息Id
@property (nonatomic,copy)NSString *send_time;//发送时间
@property (nonatomic,copy)NSString *session_id; //会话ID
@property (nonatomic,copy)NSString *tid;//本地的消息Id
@end
//获取会话未读消息列表Model
@interface OffcnIMUnreadMsgModel : NSObject
@property (nonatomic,strong)NSMutableArray *msg_list;
@end
//获取用户最近会话记录Model
@interface OffcnIMRecentMsgModel : NSObject
@property (nonatomic,strong)NSMutableArray *sessions;
@end
@class OffcnIMLast_msgModel;
@interface OffcnIMSessionModel : NSObject
@property (nonatomic,strong)OffcnIMLast_msgModel *last_msg;//消息信息
@property (nonatomic,copy)NSString *session_id;//会话Id
@property (nonatomic,copy)NSString *to;//接受人Id
@property (nonatomic,assign)NSInteger type;//类型
@property (nonatomic,assign)NSInteger unread_number;//数量
@end
@interface OffcnIMLast_msgModel : NSObject
@property (nonatomic,strong)OffcnIMMsgModel *msg_content;//消息内容
@property (nonatomic,assign)NSInteger msg_type;//消息类型
@property (nonatomic,copy)NSString *send_time;//时间
@end
//获取会话历史消息列表Model
@interface OffcnIMHistoryMsgModel : NSObject
@property (nonatomic,strong)NSMutableArray *msg_list;
@end
NS_ASSUME_NONNULL_END
//
//
// OffcnIMModel.m
// OffcnIMSDKiOS
//
// Created by vockey on 2020/8/25.
// Copyright © 2020 offcn. All rights reserved.
//
#import "OffcnIMModel.h"
@implementation OffcnIMModel
@end
@implementation OffcnIMBodyModel
@end
@implementation OffcnIMMsgModel
@end
@implementation OffcnIMSendMsgModel
@end
@implementation OffcnIMUnreadMsgModel
//+ (NSDictionary *)mj_ZYJreplacedKeyFromPropertyName {
// return @{
// @"ID":@"id",
// };
//}
+ (NSDictionary *)mj_ZYJobjectClassInArray{
return @{
@"msg_list" : @"OffcnIMBodyModel",
};
}
@end
@implementation OffcnIMRecentMsgModel
+ (NSDictionary *)mj_ZYJobjectClassInArray{
return @{
@"sessions" : @"OffcnIMSessionModel",
};
}
@end
@implementation OffcnIMSessionModel
@end
@implementation OffcnIMLast_msgModel
@end
@implementation OffcnIMHistoryMsgModel
+ (NSDictionary *)mj_ZYJobjectClassInArray{
return @{
@"msg_list" : @"OffcnIMBodyModel",
};
}
@end
// //
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// //
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "OffcnIMModel.h"
static const NSString *OffcnIMSDKiOSVersion = @"1.0.0.0"; static const NSString *OffcnIMSDKiOSVersion = @"1.0.0.0";
...@@ -58,10 +59,49 @@ typedef void(^OffcnSDKReachabilityStatusCallBack)(OffcnSDKReachabilityStatus sta ...@@ -58,10 +59,49 @@ typedef void(^OffcnSDKReachabilityStatusCallBack)(OffcnSDKReachabilityStatus sta
/// 发送消息 /// 发送消息
/// @param msg_fromID 发送人ID /// @param msg_fromID 发送人ID
/// @param msg_toID 接收人ID /// @param msg_toID 接收人ID
/// @param tid 本地的消息Id
/// @param msg_type 发送消息类型 /// @param msg_type 发送消息类型
/// @param text 文本 /// @param text 文本
/// @param filePath 图片/音频(语音消息格式,只能是aac格式)/视频/文件路径 /// @param filePath 图片/音频(语音消息格式,只能是aac格式)/视频/文件,沙盒路径
/// @param finished 结果回调 /// @param finished 结果回调
-(void)sendMsgWithMsg_fromID:(NSString *)msg_fromID msg_toID:(NSString *)msg_toID msg_type:(OffcnSDKMsgType)msg_type text:(NSString *)text filePath:(NSString *)filePath Finished:(void(^)(BOOL success,id response,NSString *errorMessage))finished; -(void)sendMsgWithMsg_fromID:(NSString *)msg_fromID msg_toID:(NSString *)msg_toID tid:(NSString *)tid msg_type:(OffcnSDKMsgType)msg_type text:(NSString *)text filePath:(NSString *)filePath Finished:(void(^)(BOOL success,OffcnIMSendMsgModel *sendMsgModel,NSString *errorMessage))finished;
/// 用户信息标记已读
/// @param msg_fromID 发送人ID
/// @param msg_toID 接收人ID
/// @param msg_seq 消息时序
/// @param finished 结果回调
-(void)markMsgReadWithMsg_fromID:(NSString *)msg_fromID msg_toID:(NSString *)msg_toID msg_seq:(NSInteger)msg_seq Finished:(void(^)(BOOL success,id response,NSString *errorMessage))finished;
/// 获取会话未读消息列表
/// @param fromID 发送人ID
/// @param toID 接收人ID
/// @param finished 结果回调
-(void)getSessionUnreadMsgWithFromID:(NSString *)fromID toID:(NSString *)toID Finished:(void(^)(BOOL success,OffcnIMUnreadMsgModel *unreadMsgModel,NSString *errorMessage))finished;
/// 获取用户最近会话记录
/// @param accid 被获取用户id
/// @param finished 结果回调
-(void)getRecentSessionsWithAccid:(NSString *)accid Finished:(void(^)(BOOL success,OffcnIMRecentMsgModel *recentMsgModel,NSString *errorMessage))finished;
/// 获取会话历史消息列表
/// @param fromID 发送人ID
/// @param toID 接收人ID
/// @param msg_seq 消息时序
/// @param finished 结果回调
-(void)getSessionHistoryMsgWithFromID:(NSString *)fromID toID:(NSString *)toID msg_seq:(NSString *)msg_seq Finished:(void(^)(BOOL success,OffcnIMHistoryMsgModel *historyMsgModel,NSString *errorMessage))finished;
/// 注册用户设备
/// @param accid 用户ID
/// @param device_token 设备Token
/// @param finished 结果回调
-(void)registerDevicesWithAccid:(NSString *)accid device_token:(NSString *)device_token Finished:(void(^)(BOOL success,id response,NSString *errorMessage))finished;
/// 注销用户设备
/// @param accid 用户ID
/// @param device_token 设备Token
/// @param finished 结果回调
-(void)unregisterDevicesWithAccid:(NSString *)accid device_token:(NSString *)device_token Finished:(void(^)(BOOL success,id response,NSString *errorMessage))finished;
@end @end
//所有接口code 1000处理:重连
// //
...@@ -109,20 +109,18 @@ static OffcnIMSDKiOS *liveTelecastSDK; ...@@ -109,20 +109,18 @@ static OffcnIMSDKiOS *liveTelecastSDK;
} }
#pragma mark - 操作事件 #pragma mark - 操作事件
-(void)sendMsgWithMsg_fromID:(NSString *)msg_fromID msg_toID:(NSString *)msg_toID msg_type:(OffcnSDKMsgType)msg_type text:(NSString *)text filePath:(NSString *)filePath Finished:(void(^)(BOOL success,id response,NSString *errorMessage))finished{ //发送消息
-(void)sendMsgWithMsg_fromID:(NSString *)msg_fromID msg_toID:(NSString *)msg_toID tid:(NSString *)tid msg_type:(OffcnSDKMsgType)msg_type text:(NSString *)text filePath:(NSString *)filePath Finished:(void(^)(BOOL success,OffcnIMSendMsgModel *sendMsgModel,NSString *errorMessage))finished{
KWeakSelf KWeakSelf
//发送消息
if (msg_type == OffcnSDKMsgTypeText) { if (msg_type == OffcnSDKMsgTypeText) {
if (!text || !text.length) { if (!text || !text.length) {
text = @""; text = @"";
} }
NSMutableDictionary *dataDic = [NSMutableDictionary dictionaryWithObject:text forKey:@"msg"]; NSMutableDictionary *dataDic = [NSMutableDictionary dictionaryWithObject:text forKey:@"msg"];
[OffcnNetworkExecutor requestSendMsgWithMsg_fromID:msg_fromID msg_toID:msg_toID msg_type:msg_type msg:dataDic Finished:^(BOOL success, id response, BaseResponse *baseResponse) { [OffcnNetworkExecutor requestSendMsgWithMsg_fromID:msg_fromID msg_toID:msg_toID msg_type:msg_type tid:tid msg:dataDic Finished:^(BOOL success, OffcnIMSendMsgModel *sendMsgModel, BaseResponse *baseResponse) {
// {
// "msg_id" = "6a4b71b9-e372-11ea-88a4-4a5555fb6ab4"; finished(success,sendMsgModel,baseResponse.errorMessage);
// }
finished(success,nil,baseResponse.errorMessage);
}]; }];
}else{ }else{
if (!filePath || !filePath.length) { if (!filePath || !filePath.length) {
...@@ -191,9 +189,9 @@ static OffcnIMSDKiOS *liveTelecastSDK; ...@@ -191,9 +189,9 @@ static OffcnIMSDKiOS *liveTelecastSDK;
[dataDic setObjectOnSafe:[NSNumber numberWithLongLong:folderSize] forKey:@"size"]; [dataDic setObjectOnSafe:[NSNumber numberWithLongLong:folderSize] forKey:@"size"];
} }
[OffcnNetworkExecutor requestSendMsgWithMsg_fromID:msg_fromID msg_toID:msg_toID msg_type:msg_type msg:dataDic Finished:^(BOOL success, id response, BaseResponse *baseResponse) { [OffcnNetworkExecutor requestSendMsgWithMsg_fromID:msg_fromID msg_toID:msg_toID msg_type:msg_type tid:tid msg:dataDic Finished:^(BOOL success, OffcnIMSendMsgModel *sendMsgModel, BaseResponse *baseResponse) {
finished(success,nil,baseResponse.errorMessage); finished(success,sendMsgModel,baseResponse.errorMessage);
}]; }];
}else{ }else{
finished(success,nil,errorMessage); finished(success,nil,errorMessage);
...@@ -202,6 +200,64 @@ static OffcnIMSDKiOS *liveTelecastSDK; ...@@ -202,6 +200,64 @@ static OffcnIMSDKiOS *liveTelecastSDK;
} }
} }
// 用户信息标记已读
-(void)markMsgReadWithMsg_fromID:(NSString *)msg_fromID msg_toID:(NSString *)msg_toID msg_seq:(NSInteger)msg_seq Finished:(void(^)(BOOL success,id response,NSString *errorMessage))finished{
[OffcnNetworkExecutor requestMarkMsgReadWithMsg_fromID:msg_fromID msg_toID:msg_toID msg_seq:msg_seq Finished:^(BOOL success, id response, BaseResponse *baseResponse) {
finished(success,response,baseResponse.errorMessage);
}];
}
//获取会话未读消息列表
-(void)getSessionUnreadMsgWithFromID:(NSString *)fromID toID:(NSString *)toID Finished:(void(^)(BOOL success,OffcnIMUnreadMsgModel *unreadMsgModel,NSString *errorMessage))finished{
[OffcnNetworkExecutor requestGetSessionUnreadMsgWithFromID:fromID toID:toID Finished:^(BOOL success, OffcnIMUnreadMsgModel *unreadMsgModel, BaseResponse *baseResponse) {
finished(success,unreadMsgModel,baseResponse.errorMessage);
}];
}
//获取用户最近会话记录
-(void)getRecentSessionsWithAccid:(NSString *)accid Finished:(void(^)(BOOL success,OffcnIMRecentMsgModel *recentMsgModel,NSString *errorMessage))finished{
[OffcnNetworkExecutor requestGetRecentSessionsWithAccid:accid Finished:^(BOOL success, OffcnIMRecentMsgModel *recentMsgModel, BaseResponse *baseResponse) {
finished(success,recentMsgModel,baseResponse.errorMessage);
}];
}
// 获取会话历史消息列表
-(void)getSessionHistoryMsgWithFromID:(NSString *)fromID toID:(NSString *)toID msg_seq:(NSString *)msg_seq Finished:(void(^)(BOOL success,OffcnIMHistoryMsgModel *historyMsgModel,NSString *errorMessage))finished{
[OffcnNetworkExecutor requestGetSessionHistoryMsgWithFromID:fromID toID:toID msg_seq:msg_seq Finished:^(BOOL success, OffcnIMHistoryMsgModel *historyMsgModel, BaseResponse *baseResponse) {
finished(success,historyMsgModel,baseResponse.errorMessage);
}];
}
// 注册用户设备
-(void)registerDevicesWithAccid:(NSString *)accid device_token:(NSString *)device_token Finished:(void(^)(BOOL success,id response,NSString *errorMessage))finished{
[OffcnNetworkExecutor requestRegisterDevicesWithAccid:accid device_token:device_token Finished:^(BOOL success, id response, BaseResponse *baseResponse) {
finished(success,response,baseResponse.errorMessage);
}];
}
// 注销用户设备
-(void)unregisterDevicesWithAccid:(NSString *)accid device_token:(NSString *)device_token Finished:(void(^)(BOOL success,id response,NSString *errorMessage))finished{
[OffcnNetworkExecutor requestUnregisterDevicesWithAccid:accid device_token:device_token Finished:^(BOOL success, id response, BaseResponse *baseResponse) {
finished(success,response,baseResponse.errorMessage);
}];
}
//单个文件的大小 //单个文件的大小
- (long long)fileSizeAtPath:(NSString*)filePath{ - (long long)fileSizeAtPath:(NSString*)filePath{
NSFileManager* manager = [NSFileManager defaultManager]; NSFileManager* manager = [NSFileManager defaultManager];
......
// //
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "OffcnBaseNetworking.h" #import "OffcnBaseNetworking.h"
#import "OffcnIMModel.h"
@interface OffcnNetworkExecutor : NSObject @interface OffcnNetworkExecutor : NSObject
+ (void)cancelAllOperations; + (void)cancelAllOperations;
...@@ -16,15 +17,15 @@ ...@@ -16,15 +17,15 @@
+ (void)requesImgJsonWithUrlStr:(NSString *)urlStr Finished:(void(^)(BOOL success,id response,NSString *message))finished; + (void)requesImgJsonWithUrlStr:(NSString *)urlStr Finished:(void(^)(BOOL success,id response,NSString *message))finished;
//发送消息 //发送消息
+ (void)requestSendMsgWithMsg_fromID:(NSString *)msg_fromID msg_toID:(NSString *)msg_toID msg_type:(NSInteger)msg_type msg:(NSMutableDictionary *)msgDic Finished:(void(^)(BOOL success,id response,BaseResponse *baseResponse))finished; + (void)requestSendMsgWithMsg_fromID:(NSString *)msg_fromID msg_toID:(NSString *)msg_toID msg_type:(NSInteger)msg_type tid:(NSString *)tid msg:(NSMutableDictionary *)msgDic Finished:(void(^)(BOOL success,OffcnIMSendMsgModel *sendMsgModel,BaseResponse *baseResponse))finished;
//用户信息标记已读 //用户信息标记已读
+ (void)requestMarkMsgReadWithMsg_fromID:(NSString *)msg_fromID msg_toID:(NSString *)msg_toID Finished:(void(^)(BOOL success,id response,BaseResponse *baseResponse))finished; + (void)requestMarkMsgReadWithMsg_fromID:(NSString *)msg_fromID msg_toID:(NSString *)msg_toID msg_seq:(NSInteger)msg_seq Finished:(void(^)(BOOL success,id response,BaseResponse *baseResponse))finished;
//获取会话未读消息列表 //获取会话未读消息列表
+ (void)requestGetSessionUnreadMsgWithFromID:(NSString *)fromID toID:(NSString *)toID Finished:(void(^)(BOOL success,id response,BaseResponse *baseResponse))finished; + (void)requestGetSessionUnreadMsgWithFromID:(NSString *)fromID toID:(NSString *)toID Finished:(void(^)(BOOL success,OffcnIMUnreadMsgModel *unreadMsgModel,BaseResponse *baseResponse))finished;
//获取用户最近会话记录 //获取用户最近会话记录
+ (void)requestGetRecentSessionsWithAccid:(NSString *)accid Finished:(void(^)(BOOL success,id response,BaseResponse *baseResponse))finished; + (void)requestGetRecentSessionsWithAccid:(NSString *)accid Finished:(void(^)(BOOL success,OffcnIMRecentMsgModel *recentMsgModel,BaseResponse *baseResponse))finished;
//获取会话历史消息列表 //获取会话历史消息列表
+ (void)requestGetSessionHistoryMsgWithFromID:(NSString *)fromID toID:(NSString *)toID msg_seq:(NSString *)msg_seq Finished:(void(^)(BOOL success,id response,BaseResponse *baseResponse))finished; + (void)requestGetSessionHistoryMsgWithFromID:(NSString *)fromID toID:(NSString *)toID msg_seq:(NSString *)msg_seq Finished:(void(^)(BOOL success,OffcnIMHistoryMsgModel *historyMsgModel,BaseResponse *baseResponse))finished;
//获取七牛Token //获取七牛Token
+ (void)requestUploadTokenFinished:(void(^)(BOOL success,id response,BaseResponse *baseResponse))finished; + (void)requestUploadTokenFinished:(void(^)(BOOL success,id response,BaseResponse *baseResponse))finished;
//注册用户设备 //注册用户设备
......
...@@ -69,43 +69,43 @@ ...@@ -69,43 +69,43 @@
- (IBAction)sendMeg:(UIButton *)sender { - (IBAction)sendMeg:(UIButton *)sender {
//发送消息 //发送消息
[[OffcnIMSDKiOS defaultService] sendMsgWithMsg_fromID:self.fromId msg_toID:self.toId msg_type:OffcnSDKMsgTypeText text:@"你好" filePath:nil Finished:^(BOOL success, id response, NSString *errorMessage) { [[OffcnIMSDKiOS defaultService] sendMsgWithMsg_fromID:self.fromId msg_toID:self.toId tid:@"13e266f3-e139-11ea-88a4-4a5555fb6ab4" msg_type:OffcnSDKMsgTypeText text:@"你好" filePath:nil Finished:^(BOOL success, OffcnIMSendMsgModel *sendMsgModel, NSString *errorMessage) {
}]; }];
} }
- (IBAction)noReadListAction:(UIButton *)sender { - (IBAction)noReadListAction:(UIButton *)sender {
//获取会话未读消息列表 //获取会话未读消息列表
[OffcnNetworkExecutor requestGetSessionUnreadMsgWithFromID:self.fromId toID:self.toId Finished:^(BOOL success, id response, BaseResponse *baseResponse) { [[OffcnIMSDKiOS defaultService] getSessionUnreadMsgWithFromID:self.fromId toID:self.toId Finished:^(BOOL success, OffcnIMUnreadMsgModel *unreadMsgModel, NSString *errorMessage) {
}]; }];
} }
- (IBAction)readedAction:(UIButton *)sender { - (IBAction)readedAction:(UIButton *)sender {
//用户信息标记已读 //用户信息标记已读
[OffcnNetworkExecutor requestMarkMsgReadWithMsg_fromID:self.fromId msg_toID:self.toId Finished:^(BOOL success, id response, BaseResponse *baseResponse) { [[OffcnIMSDKiOS defaultService] markMsgReadWithMsg_fromID:self.fromId msg_toID:self.toId msg_seq:1597744585 Finished:^(BOOL success, id response, NSString *errorMessage) {
}]; }];
} }
- (IBAction)recentVChatAction:(UIButton *)sender { - (IBAction)recentVChatAction:(UIButton *)sender {
//获取用户最近会话记录 //获取用户最近会话记录
[OffcnNetworkExecutor requestGetRecentSessionsWithAccid:self.fromId Finished:^(BOOL success, id response, BaseResponse *baseResponse) { [[OffcnIMSDKiOS defaultService] getRecentSessionsWithAccid:self.fromId Finished:^(BOOL success, OffcnIMRecentMsgModel *recentMsgModel, NSString *errorMessage) {
}]; }];
} }
- (IBAction)historyMegListAction:(UIButton *)sender { - (IBAction)historyMegListAction:(UIButton *)sender {
//获取会话历史消息列表,msg_seq当前时间的时间戳 //获取会话历史消息列表
[OffcnNetworkExecutor requestGetSessionHistoryMsgWithFromID:self.fromId toID:self.toId msg_seq:@"" Finished:^(BOOL success, id response, BaseResponse *baseResponse) { [[OffcnIMSDKiOS defaultService] getSessionHistoryMsgWithFromID:self.fromId toID:self.toId msg_seq:@"" Finished:^(BOOL success, OffcnIMHistoryMsgModel *historyMsgModel, NSString *errorMessage) {
}]; }];
} }
- (IBAction)registeredUser:(UIButton *)sender { - (IBAction)registeredUser:(UIButton *)sender {
//注册用户设备 //注册用户设备
[OffcnNetworkExecutor requestRegisterDevicesWithAccid:self.fromId device_token:[OffcnIMSDKiOS defaultService].deviceToken Finished:^(BOOL success, id response, BaseResponse *baseResponse) { [[OffcnIMSDKiOS defaultService] registerDevicesWithAccid:self.fromId device_token:[OffcnIMSDKiOS defaultService].deviceToken Finished:^(BOOL success, id response, NSString *errorMessage) {
}]; }];
} }
- (IBAction)UnRegisteredUser:(UIButton *)sender { - (IBAction)UnRegisteredUser:(UIButton *)sender {
//注销用户设备 //注销用户设备
[OffcnNetworkExecutor requestUnregisterDevicesWithAccid:self.fromId device_token:[OffcnIMSDKiOS defaultService].deviceToken Finished:^(BOOL success, id response, BaseResponse *baseResponse) { [[OffcnIMSDKiOS defaultService] unregisterDevicesWithAccid:self.fromId device_token:[OffcnIMSDKiOS defaultService].deviceToken Finished:^(BOOL success, id response, NSString *errorMessage) {
}]; }];
} }
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
- (IBAction)uploadFile:(UIButton *)sender { - (IBAction)uploadFile:(UIButton *)sender {
//上传 //上传
NSString *filePath = [self getImagePath:self.pickImage]; NSString *filePath = [self getImagePath:self.pickImage];
[[OffcnIMSDKiOS defaultService] sendMsgWithMsg_fromID:self.fromId msg_toID:self.toId msg_type:OffcnSDKMsgTypePicture text:nil filePath:filePath Finished:^(BOOL success, id response, NSString *errorMessage) { [[OffcnIMSDKiOS defaultService] sendMsgWithMsg_fromID:self.fromId msg_toID:self.toId tid:@"" msg_type:OffcnSDKMsgTypePicture text:nil filePath:filePath Finished:^(BOOL success, OffcnIMSendMsgModel *sendMsgModel, NSString *errorMessage) {
}]; }];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment