Commit b4ac53d1 by zhangyunjie

1.0.0.3

parent 334dff8b
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
//启动SDK //启动SDK
[[OffcnIMSDKiOS defaultService] setupWithIsTest:YES]; [[OffcnIMSDKiOS defaultService] setupWithIsTest:YES];
//注册系统推送 //注册系统推送
[OffcnIMPushManager registerOffcnUserNotificationSettingsWithApplication:application options:launchOptions]; [OffcnIMPushManager registerOffcnUserNotification];
//获取用户相关数据库,该方法在登陆或者第一次启动已登陆下执行 //获取用户相关数据库,该方法在登陆或者第一次启动已登陆下执行
[[OffcnIMZYJ1FMDBHandler sharedInstance] getUserDB]; [[OffcnIMZYJ1FMDBHandler sharedInstance] getUserDB];
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
//查询聊天列表 //查询聊天列表
- (IBAction)queryChatList:(UIButton *)sender { - (IBAction)queryChatList:(UIButton *)sender {
[[OffcnIMZYJ1FMDBHandler sharedInstance] getChatListArrayCallback:^(NSArray<OffcnIMBodyModel *> *messagesArray) { [[OffcnIMZYJ1FMDBHandler sharedInstance] getChatListArrayWithFromUser:self.fromId Callback:^(NSArray<OffcnIMBodyModel *> *messagesArray) {
NSString *msg = @""; NSString *msg = @"";
for (int i=0; i<messagesArray.count; i++) { for (int i=0; i<messagesArray.count; i++) {
......
...@@ -341,26 +341,26 @@ ...@@ -341,26 +341,26 @@
- (IBAction)recentVChatAction:(UIButton *)sender { - (IBAction)recentVChatAction:(UIButton *)sender {
//获取用户最近会话记录 //获取用户最近会话记录
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
[[OffcnIMSDKiOS defaultService] getRecentSessionsWithAccid:self.fromId Finished:^(BOOL success, OffcnIMRecentMsgModel *recentMsgModel, NSString *errorMessage) { [[OffcnIMSDKiOS defaultService] getRecentSessionsWithAccid:self.fromId Finished:^(BOOL success, OffcnIMHistoryMsgModel *historyMsgModel, NSString *errorMessage) {
if (success) { if (success) {
NSString *content = @""; NSString *content = @"";
for (int i=0; i<recentMsgModel.sessions.count; i++) { for (int i=0; i<historyMsgModel.msg_list.count; i++) {
OffcnIMSessionModel *model = recentMsgModel.sessions[i]; OffcnIMBodyModel *model = historyMsgModel.msg_list[i];
NSString *sender = [NSString stringWithFormat:@"发送人ID:%@",model.last_msg.msg_from]; NSString *sender = [NSString stringWithFormat:@"发送人ID:%@",model.msg_from];
NSString *rever = [NSString stringWithFormat:@"接收人ID:%@",model.last_msg.msg_to]; NSString *rever = [NSString stringWithFormat:@"接收人ID:%@",model.msg_to];
NSString *time = [NSString stringWithFormat:@"时间:%@",model.last_msg.send_time]; NSString *time = [NSString stringWithFormat:@"时间:%@",model.send_time];
NSString *msg = @""; NSString *msg = @"";
if (model.last_msg.msg_type == 1) { if (model.msg_type == 1) {
//文本消息 //文本消息
msg = [msg stringByAppendingString:model.last_msg.msg.msg?model.last_msg.msg.msg:@"nil"]; msg = [msg stringByAppendingString:model.msg.msg?model.msg.msg:@"nil"];
}else{ }else{
//非文本消息 //非文本消息
msg = [msg stringByAppendingString:model.last_msg.msg.url?model.last_msg.msg.url:@"nil"]; msg = [msg stringByAppendingString:model.msg.url?model.msg.url:@"nil"];
} }
NSString *allmsg = [NSString stringWithFormat:@"%@,%@,%@,消息:%@,未读数:%ld,拓展内容:%@",sender,rever,time,msg,(long)model.unread_number,model.last_msg.ext]; NSString *allmsg = [NSString stringWithFormat:@"%@,%@,%@,消息:%@,未读数:%ld,拓展内容:%@",sender,rever,time,msg,(long)model.unread_number,model.ext];
content = [content stringByAppendingString:allmsg]; content = [content stringByAppendingString:allmsg];
content = [content stringByAppendingString:@"\r\n"]; content = [content stringByAppendingString:@"\r\n"];
...@@ -413,7 +413,7 @@ ...@@ -413,7 +413,7 @@
}]; }];
} }
- (IBAction)registeredUser:(UIButton *)sender { - (IBAction)registeredUser:(UIButton *)sender {
[OffcnIMPushManager registerOffcnUserNotificationSettingsWithApplication:[UIApplication sharedApplication] options:[NSDictionary dictionary]]; [OffcnIMPushManager registerOffcnUserNotification];
__weak typeof(self) weakSelf = self; __weak typeof(self) weakSelf = self;
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'OffcnIMSDKiOS' s.name = 'OffcnIMSDKiOS'
s.version = '1.0.0.2' s.version = '1.0.0.3'
s.summary = 'OffcnIMSDKiOS.' s.summary = 'OffcnIMSDKiOS.'
s.description = <<-DESC s.description = <<-DESC
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
// //
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
...@@ -30,7 +31,9 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -30,7 +31,9 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,copy)NSString *msg_to;//接受消息的用户id @property (nonatomic,copy)NSString *msg_to;//接受消息的用户id
@property (nonatomic,assign)NSInteger msg_type;//消息类型 @property (nonatomic,assign)NSInteger msg_type;//消息类型
@property (nonatomic,strong)OffcnIMMsgModel *msg;//消息内容 @property (nonatomic,strong)OffcnIMMsgModel *msg;//消息内容
@property (nonatomic,copy)NSString *ext;//开发者扩展字段 @property (nonatomic,copy)NSString *ext;//开发者扩展字段
@property (nonatomic,assign)CGFloat cellH;//扩展字段
//以下数据库使用 //以下数据库使用
@property (nonatomic,assign)NSInteger isSentSuccess;//是否发送成功 @property (nonatomic,assign)NSInteger isSentSuccess;//是否发送成功
......
...@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface OffcnIMPushManager : NSObject @interface OffcnIMPushManager : NSObject
//注册系统推送 //注册系统推送
+(void)registerOffcnUserNotificationSettingsWithApplication:(UIApplication *)application options:(NSDictionary *)launchOptions; +(void)registerOffcnUserNotification;
//注销系统推送 //注销系统推送
+(void)unregisterForOffcnUserRemoteNotifications; +(void)unregisterForOffcnUserRemoteNotifications;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "OffcnIMModel.h" #import "OffcnIMModel.h"
static const NSString *OffcnIMSDKiOSVersion = @"1.0.0.2"; static const NSString *OffcnIMSDKiOSVersion = @"1.0.0.3";
typedef NS_ENUM(NSUInteger, OffcnSDKReachabilityStatus) { typedef NS_ENUM(NSUInteger, OffcnSDKReachabilityStatus) {
OffcnSDKReachabilityStatusNotReachable = 0, OffcnSDKReachabilityStatusNotReachable = 0,
...@@ -84,7 +84,7 @@ typedef void(^OffcnSDKReachabilityStatusCallBack)(OffcnSDKReachabilityStatus sta ...@@ -84,7 +84,7 @@ typedef void(^OffcnSDKReachabilityStatusCallBack)(OffcnSDKReachabilityStatus sta
/// 获取用户最近会话记录 /// 获取用户最近会话记录
/// @param accid 被获取用户id /// @param accid 被获取用户id
/// @param finished 结果回调 /// @param finished 结果回调
-(void)getRecentSessionsWithAccid:(NSString *)accid Finished:(void(^)(BOOL success,OffcnIMRecentMsgModel *recentMsgModel,NSString *errorMessage))finished; -(void)getRecentSessionsWithAccid:(NSString *)accid Finished:(void(^)(BOOL success,OffcnIMHistoryMsgModel *historyMsgModel,NSString *errorMessage))finished;
/// 获取会话历史消息列表 /// 获取会话历史消息列表
/// @param fromID 发送人ID /// @param fromID 发送人ID
...@@ -97,11 +97,18 @@ typedef void(^OffcnSDKReachabilityStatusCallBack)(OffcnSDKReachabilityStatus sta ...@@ -97,11 +97,18 @@ typedef void(^OffcnSDKReachabilityStatusCallBack)(OffcnSDKReachabilityStatus sta
/// @param accid 用户ID /// @param accid 用户ID
/// @param device_token 设备Token /// @param device_token 设备Token
/// @param finished 结果回调 /// @param finished 结果回调
-(void)registerDevicesWithAccid:(NSString *)accid device_token:(NSString *)device_token Finished:(void(^)(BOOL success,id response,NSString *errorMessage))finished; -(void)registerDevicesWithAccid:(NSString *)accid device_token:(NSData *)device_token Finished:(void(^)(BOOL success,id response,NSString *errorMessage))finished;
/// 接口注销推送 /// 接口注销推送
/// @param accid 用户ID /// @param accid 用户ID
/// @param device_token 设备Token /// @param device_token 设备Token
/// @param finished 结果回调 /// @param finished 结果回调
-(void)unregisterDevicesWithAccid:(NSString *)accid device_token:(NSString *)device_token Finished:(void(^)(BOOL success,id response,NSString *errorMessage))finished; -(void)unregisterDevicesWithAccid:(NSString *)accid device_token:(NSString *)device_token Finished:(void(^)(BOOL success,id response,NSString *errorMessage))finished;
/// 登陆账号
-(void)login;
/// 退出账号
-(void)logout;
@end @end
...@@ -49,8 +49,8 @@ typedef void(^OffcnIMReceiveConnectStatus)(OffcnIMConnectStatus status,NSString ...@@ -49,8 +49,8 @@ typedef void(^OffcnIMReceiveConnectStatus)(OffcnIMConnectStatus status,NSString
//连接状态回调 //连接状态回调
@property (nonatomic, copy) OffcnIMReceiveConnectStatus connectStatus; @property (nonatomic, copy) OffcnIMReceiveConnectStatus connectStatus;
@property (nonatomic, strong) NSMutableArray *msgArr;//防止重复msg_id缓存池 @property (nonatomic, strong) NSMutableArray *msgArr;//收到消息防止重复msg_id缓存池
@property (nonatomic, strong) NSMutableArray *msgTidArr;//发送消息防止重复tid缓存池
//单例 //单例
+(OffcnIMSocketManager *)defaultService; +(OffcnIMSocketManager *)defaultService;
......
...@@ -63,7 +63,7 @@ typedef void (^callBackIsSuccess)(BOOL isSuccess); ...@@ -63,7 +63,7 @@ typedef void (^callBackIsSuccess)(BOOL isSuccess);
/// @param isSuccess 结果回调 /// @param isSuccess 结果回调
- (void)deleteMessage:(OffcnIMBodyModel *)messageModel dataSource:(NSMutableArray<OffcnIMBodyModel *> *)array callback:(callBackIsSuccess)isSuccess; - (void)deleteMessage:(OffcnIMBodyModel *)messageModel dataSource:(NSMutableArray<OffcnIMBodyModel *> *)array callback:(callBackIsSuccess)isSuccess;
/// 查询聊天记录(按时间戳倒叙排序) /// 查询聊天记录(按时间戳升序排序)
/// @param fromUser 发送人ID /// @param fromUser 发送人ID
/// @param toUser 接收人ID /// @param toUser 接收人ID
/// @param limit 消息数量 /// @param limit 消息数量
...@@ -71,8 +71,8 @@ typedef void (^callBackIsSuccess)(BOOL isSuccess); ...@@ -71,8 +71,8 @@ typedef void (^callBackIsSuccess)(BOOL isSuccess);
/// @param messagesBack 结果回调 /// @param messagesBack 结果回调
- (void)getChatRecordArrayWithFromUser:(NSString *)fromUser toUser:(NSString *)toUser limit:(NSString *)limit startIndex:(NSString *)startIndex callback:(getFMDBHistoryMessagesBlock)messagesBack; - (void)getChatRecordArrayWithFromUser:(NSString *)fromUser toUser:(NSString *)toUser limit:(NSString *)limit startIndex:(NSString *)startIndex callback:(getFMDBHistoryMessagesBlock)messagesBack;
//查询聊天列表(按时间戳升序排序) //查询聊天列表(按时间戳倒叙排序)
- (void)getChatListArrayCallback:(getFMDBHistoryMessagesBlock)messagesBack; - (void)getChatListArrayWithFromUser:(NSString *)fromUser Callback:(getFMDBHistoryMessagesBlock)messagesBack;
//查询聊天列表其中一个会话信息 //查询聊天列表其中一个会话信息
- (void)getChatListOneMessageWithFromUser:(NSString *)fromUser toUser:(NSString *)toUser callback:(getFMDBOneMessageBlock)messagesBack; - (void)getChatListOneMessageWithFromUser:(NSString *)fromUser toUser:(NSString *)toUser callback:(getFMDBOneMessageBlock)messagesBack;
......
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