Commit 377bbaf4 by zhangyunjie

1.0.0.1

parent d98e6b3d
......@@ -8,9 +8,12 @@
#import <UIKit/UIKit.h>
typedef void(^deviceTokenCallback)(void);
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (nonatomic, copy) deviceTokenCallback deviceTokenCallback;
@end
......@@ -11,7 +11,7 @@
#import "OffcnIMSDKiOS.h"
#import "OffcnIMSocketManager.h"
#import "OffcnIMZYJFMDBHandler.h"
#import "OffcnIMZYJ1FMDBHandler.h"
#import "OffcnIMPushManager.h"
@interface AppDelegate ()
......@@ -39,10 +39,11 @@
//启动SDK
[[OffcnIMSDKiOS defaultService] setupWithIsTest:YES];
//注册推送
//注册系统推送
[OffcnIMPushManager registerOffcnUserNotificationSettingsWithApplication:application options:launchOptions];
//获取用户相关数据库,该方法在登陆或者第一次启动已登陆下执行
[[OffcnIMZYJFMDBHandler sharedInstance] getUserDB];
[[OffcnIMZYJ1FMDBHandler sharedInstance] getUserDB];
return YES;
......@@ -58,7 +59,7 @@
- (void)applicationWillEnterForeground:(UIApplication *)application {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
- (void)applicationWillTerminate:(UIApplication *)application {
......@@ -68,16 +69,12 @@
- (void)applicationDidBecomeActive:(UIApplication *)application {
//进入前台,清除推送角标
[UIApplication sharedApplication].applicationIconBadgeNumber = 1;
[UIApplication sharedApplication].applicationIconBadgeNumber = 0;
[application cancelAllLocalNotifications];
// [JPUSHService setBadge:0];
}
- (void)application:(UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)(void))completionHandler{
}
//远程推送注册成功
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
// 25bb75ac 3ffcebd7 90d9f517 1ebca904 154a367a 87781e5d b9ea288e 37fdf487
......@@ -88,6 +85,10 @@
NSString *str = [OffcnIMPushManager hexStringForData:deviceToken];
[OffcnIMSDKiOS defaultService].deviceToken = str;
NSLog(@"token--- %@",str);
if (self.deviceTokenCallback) {
self.deviceTokenCallback();
}
}
//注册失败
......@@ -99,7 +100,26 @@
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler {
NSLog(@"接收到远程推送通知Background ---- %@", userInfo);
[OffcnIMPushManager didReceiveRemoteNotification:userInfo];
// [OffcnIMPushManager didReceiveRemoteNotification:userInfo Finished:^(OffcnIMPushModel * _Nonnull IMPushModel) {
//
// NSString *sender = [NSString stringWithFormat:@"发送人ID:%@",IMPushModel.message.body.msg_from];
// NSString *rever = [NSString stringWithFormat:@"接收人ID:%@",IMPushModel.message.body.msg_to];
// NSString *time = [NSString stringWithFormat:@"时间:%@",IMPushModel.message.body.send_time];
// NSString *msg = @"";
// if (IMPushModel.message.body.msg_type == 1) {
// //文本消息
// msg = [msg stringByAppendingString:IMPushModel.message.body.msg.msg?IMPushModel.message.body.msg.msg:@"nil"];
// }else{
// //非文本消息
// msg = [msg stringByAppendingString:IMPushModel.message.body.msg.url?IMPushModel.message.body.msg.url:@"nil"];
// }
//
// NSString *allmsg = [NSString stringWithFormat:@"%@,%@,%@,消息:%@,拓展内容:%@",sender,rever,time,msg,IMPushModel.message.body.ext];
// dispatch_async(dispatch_get_main_queue(), ^{
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"远程推送通知" message:allmsg delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
// [alert show];
// });
// }];
// if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive) {
//
......@@ -111,15 +131,49 @@
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo{
NSLog(@"接收到远程推送通知 ---- %@", userInfo);
[OffcnIMPushManager didReceiveRemoteNotification:userInfo];
//将推送消息以alert形式呈现
// NSString *message = [[userInfo objectForKey:@"aps"]objectForKey:@"alert"];
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:message delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
// [OffcnIMPushManager didReceiveRemoteNotification:userInfo Finished:^(OffcnIMPushModel * _Nonnull IMPushModel) {
//
// NSString *sender = [NSString stringWithFormat:@"发送人ID:%@",IMPushModel.message.body.msg_from];
// NSString *rever = [NSString stringWithFormat:@"接收人ID:%@",IMPushModel.message.body.msg_to];
// NSString *time = [NSString stringWithFormat:@"时间:%@",IMPushModel.message.body.send_time];
// NSString *msg = @"";
// if (IMPushModel.message.body.msg_type == 1) {
// //文本消息
// msg = [msg stringByAppendingString:IMPushModel.message.body.msg.msg?IMPushModel.message.body.msg.msg:@"nil"];
// }else{
// //非文本消息
// msg = [msg stringByAppendingString:IMPushModel.message.body.msg.url?IMPushModel.message.body.msg.url:@"nil"];
// }
//
// NSString *allmsg = [NSString stringWithFormat:@"%@,%@,%@,消息:%@,拓展内容:%@",sender,rever,time,msg,IMPushModel.message.body.ext];
// dispatch_async(dispatch_get_main_queue(), ^{
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"远程推送通知" message:allmsg delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
// [alert show];
// });
// }];
}
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification{
NSLog(@"接收到本地推送通知 ---- %@", notification.userInfo);
// [OffcnIMPushManager didReceiveLocalNotification:notification.userInfo Finished:^(OffcnIMModel * _Nonnull IMLocalPushModel) {
//
// NSString *sender = [NSString stringWithFormat:@"发送人ID:%@",IMLocalPushModel.body.msg_from];
// NSString *rever = [NSString stringWithFormat:@"接收人ID:%@",IMLocalPushModel.body.msg_to];
// NSString *time = [NSString stringWithFormat:@"时间:%@",IMLocalPushModel.body.send_time];
// NSString *msg = @"";
// if (IMLocalPushModel.body.msg_type == 1) {
// //文本消息
// msg = [msg stringByAppendingString:IMLocalPushModel.body.msg.msg?IMLocalPushModel.body.msg.msg:@"nil"];
// }else{
// //非文本消息
// msg = [msg stringByAppendingString:IMLocalPushModel.body.msg.url?IMLocalPushModel.body.msg.url:@"nil"];
// }
//
// NSString *allmsg = [NSString stringWithFormat:@"%@,%@,%@,消息:%@,拓展内容:%@",sender,rever,time,msg,IMLocalPushModel.body.ext];
// dispatch_async(dispatch_get_main_queue(), ^{
// UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"本地推送通知" message:allmsg delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
// [alert show];
// });
// }];
}
- (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings{
......
......@@ -12,7 +12,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface OffcnIMSqliteTestVC : UIViewController
@property (strong, nonatomic) NSString *fromId;
@property (strong, nonatomic) NSString *toId;
@end
NS_ASSUME_NONNULL_END
......@@ -7,15 +7,13 @@
//
#import "OffcnIMSqliteTestVC.h"
#import "OffcnIMZYJFMDBHandler.h"
#import "OffcnIMZYJ1FMDBHandler.h"
#import "OffcnIMModel.h"
#import "OffcnZYJTestDataStorageView.h"
#import "OffcnZYJ1TestDataStorageView.h"
@interface OffcnIMSqliteTestVC ()
@property (strong, nonatomic) NSString *fromId;
@property (strong, nonatomic) NSString *toId;
@property (assign, nonatomic) UIClearStyle clearStyle;
@end
......@@ -25,15 +23,14 @@
[super viewDidLoad];
self.title = @"数据库";
self.fromId = @"ce0819db8391f1e7258a71cc9e2c3235";
self.toId = @"ceb7383519c5b6a1c8579553f01ad9c4";
self.clearStyle = UIClearStylePart;
self.clearStyle = UIClearStyleAll;
}
//删除记录
- (IBAction)deleteRecord:(UIButton *)sender {
[[OffcnIMZYJFMDBHandler sharedInstance] deleteUserChatDataWithFromUser:self.fromId toUser:self.toId clearStyle:self.clearStyle callBack:^(BOOL isSuccess) {
[[OffcnIMZYJ1FMDBHandler sharedInstance] deleteUserChatDataWithFromUser:self.fromId toUser:self.toId clearStyle:self.clearStyle callBack:^(BOOL isSuccess) {
}];
}
......@@ -41,24 +38,24 @@
//删除表格
- (IBAction)deleteTable:(UIButton *)sender {
[[OffcnIMZYJFMDBHandler sharedInstance] deleteDataTable];
[[OffcnIMZYJ1FMDBHandler sharedInstance] deleteDataTable];
}
//查询聊天列表
- (IBAction)queryChatList:(UIButton *)sender {
[[OffcnIMZYJFMDBHandler sharedInstance] getChatListArrayCallback:^(NSArray<OffcnIMBodyModel *> *messagesArray) {
[[OffcnIMZYJ1FMDBHandler sharedInstance] getChatListArrayCallback:^(NSArray<OffcnIMBodyModel *> *messagesArray) {
NSString *msg = @"";
for (int i=0; i<messagesArray.count; i++) {
OffcnIMBodyModel *model = messagesArray[i];
msg = [msg stringByAppendingString:[NSString stringWithFormat:@"msg_type:%ld,lastSendtime:%@,lastmessage:%@",(long)model.msg_type,model.lastSendtime,model.lastmessage]];
msg = [msg stringByAppendingString:[NSString stringWithFormat:@"发送人ID:%@,接收人ID:%@,消息类型:%ld,时间:%@,内容:%@,未读数:%ld,拓展内容:%@",model.msg_from,model.msg_to,(long)model.msg_type,model.lastSendtime,model.lastmessage,(long)model.unread_number,model.ext]];
msg = [msg stringByAppendingString:@"\r\n"];
msg = [msg stringByAppendingString:@"\r\n"];
}
OffcnZYJTestDataStorageView *storageView = [[OffcnZYJTestDataStorageView alloc] initWithFrame:CGRectMake(0, 20, self.view.bounds.size.width, self.view.bounds.size.height-20)];
OffcnZYJ1TestDataStorageView *storageView = [[OffcnZYJ1TestDataStorageView alloc] initWithFrame:CGRectMake(0, 20, self.view.bounds.size.width, self.view.bounds.size.height-20)];
storageView.msg = msg;
[storageView showView];
}];
......@@ -67,11 +64,15 @@
//查询聊天记录
- (IBAction)queryChat:(UIButton *)sender {
[[OffcnIMZYJFMDBHandler sharedInstance] getChatRecordArrayWithFromUser:self.fromId toUser:self.toId limit:@"20" startIndex:@"0" callback:^(NSArray<OffcnIMBodyModel *> *messagesArray) {
[[OffcnIMZYJ1FMDBHandler sharedInstance] getChatRecordArrayWithFromUser:self.fromId toUser:self.toId limit:@"20" startIndex:@"0" callback:^(NSArray<OffcnIMBodyModel *> *messagesArray) {
NSString *msg = @"";
NSString *content = @"";
for (int i=0; i<messagesArray.count; i++) {
OffcnIMBodyModel *model = messagesArray[i];
NSString *sender = [NSString stringWithFormat:@"发送人ID:%@",model.msg_from];
NSString *rever = [NSString stringWithFormat:@"接收人ID:%@",model.msg_to];
NSString *time = [NSString stringWithFormat:@"时间:%@",model.send_time];
NSString *msg = @"";
if (model.msg_type == 1) {
//文本消息
msg = [msg stringByAppendingString:model.msg.msg?model.msg.msg:@"nil"];
......@@ -80,12 +81,16 @@
msg = [msg stringByAppendingString:model.msg.url?model.msg.url:@"nil"];
}
msg = [msg stringByAppendingString:@"\r\n"];
msg = [msg stringByAppendingString:@"\r\n"];
NSString *allmsg = [NSString stringWithFormat:@"%@,%@,%@,消息:%@,拓展内容:%@",sender,rever,time,msg,model.ext];
content = [content stringByAppendingString:allmsg];
content = [content stringByAppendingString:@"\r\n"];
content = [content stringByAppendingString:@"\r\n"];
}
OffcnZYJTestDataStorageView *storageView = [[OffcnZYJTestDataStorageView alloc] initWithFrame:CGRectMake(0, 20, self.view.bounds.size.width, self.view.bounds.size.height-20)];
storageView.msg = msg;
OffcnZYJ1TestDataStorageView *storageView = [[OffcnZYJ1TestDataStorageView alloc] initWithFrame:CGRectMake(0, 20, self.view.bounds.size.width, self.view.bounds.size.height-20)];
storageView.msg = content;
[storageView showView];
}];
}
......@@ -94,24 +99,20 @@
- (IBAction)setUnreadNum:(UIButton *)sender {
__block OffcnIMBodyModel *IMBodyModel = nil;
[[OffcnIMZYJFMDBHandler sharedInstance] getChatListOneMessageWithFromUser:self.fromId toUser:self.toId callback:^(OffcnIMBodyModel *model) {
[[OffcnIMZYJ1FMDBHandler sharedInstance] getChatListOneMessageWithFromUser:self.fromId toUser:self.toId callback:^(OffcnIMBodyModel *model) {
IMBodyModel = model;
}];
if (IMBodyModel) {
//存在,更新未读数
OffcnIMBodyModel *BodyModel = [[OffcnIMBodyModel alloc] init];
BodyModel.msg_from = self.fromId;
BodyModel.msg_to = self.toId;
BodyModel.unread_number = IMBodyModel.unread_number+1;
[[OffcnIMZYJFMDBHandler sharedInstance] updateChatListUnread_number:BodyModel callBack:^(BOOL isSuccess) {
[[OffcnIMZYJ1FMDBHandler sharedInstance] updateChatListUnread_number:BodyModel callBack:^(OffcnIMBodyModel *model) {
NSLog(@"测试未读数%ld",(long)model.unread_number);
}];
}else{
//不存在,先更新聊天列表再更新未读数
}
}
@end
//
// OffcnZYJTestDataStorageView.h
// OffcnZYJ1TestDataStorageView.h
// OffcnLiveSDK
//
// Created by zyj on 2020/3/28.
// Created by ZYJ1 on 2020/3/28.
// Copyright © 2020 中公教育. All rights reserved.
//
......@@ -10,7 +10,7 @@
NS_ASSUME_NONNULL_BEGIN
@interface OffcnZYJTestDataStorageView : UIView
@interface OffcnZYJ1TestDataStorageView : UIView
@property (nonatomic, strong) NSString *msg;
......
//
// OffcnZYJTestDataStorageView.m
// OffcnZYJ1TestDataStorageView.m
// OffcnLiveSDK
//
// Created by zyj on 2020/3/28.
// Created by ZYJ1 on 2020/3/28.
// Copyright © 2020 中公教育. All rights reserved.
//
#import "OffcnZYJTestDataStorageView.h"
#import "OffcnZYJ1TestDataStorageView.h"
@interface OffcnZYJTestDataStorageView ()
@interface OffcnZYJ1TestDataStorageView ()
@property (nonatomic, strong) UIButton *pasteBtn;
@property (nonatomic, strong) UIButton *cancellBtn;
@property (nonatomic, strong) UITextView *textView;
@end
@implementation OffcnZYJTestDataStorageView
@implementation OffcnZYJ1TestDataStorageView
-(UIButton *)pasteBtn{
if (!_pasteBtn) {
......@@ -55,7 +55,7 @@
if (!_textView){
_textView = [[UITextView alloc] initWithFrame:CGRectZero];
_textView.font = [UIFont systemFontOfSize:13];
_textView.textColor = [UIColor greenColor];
_textView.textColor = [UIColor blackColor];
_textView.textAlignment = NSTextAlignmentLeft;
_textView.linkTextAttributes = @{NSForegroundColorAttributeName:[UIColor blueColor]};
......
......@@ -9,6 +9,8 @@
#import <UIKit/UIKit.h>
#define kOffcnIMSDKiOS_changeEnvironment @"kOffcnIMSDKiOS_changeEnvironment"
#define kOffcnIMSDKiOS_fromid @"kOffcnIMSDKiOS_fromid"
#define kOffcnIMSDKiOS_token @"kOffcnIMSDKiOS_token"
@interface ViewController : UIViewController
......
......@@ -5,6 +5,9 @@ platform :ios, '8.0'
target 'OffcnIMSDKiOS_Example' do
pod 'OffcnIMSDKiOS', :path => '../'
pod 'LMJDropdownMenu'
target 'OffcnIMSDKiOS_Tests' do
inherit! :search_paths
......
......@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = 'OffcnIMSDKiOS'
s.version = '1.0.0.0'
s.version = '1.0.0.1'
s.summary = 'OffcnIMSDKiOS.'
s.description = <<-DESC
......
......@@ -30,6 +30,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,copy)NSString *msg_to;//接受消息的用户id
@property (nonatomic,assign)NSInteger msg_type;//消息类型
@property (nonatomic,strong)OffcnIMMsgModel *msg;//消息内容
@property (nonatomic,copy)NSString *ext;//开发者扩展字段
//以下数据库使用
@property (nonatomic,assign)NSInteger isSentSuccess;//是否发送成功
......@@ -39,6 +40,7 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,copy)NSString *lastSendtime;//最后一条消息时间
@property (nonatomic,copy)NSString *tid;//本地的消息Id
@property (nonatomic,assign)NSInteger unread_number;//未读数
@property (nonatomic,assign)BOOL isJoinSession;//进入会话未读数为0
@end
@interface OffcnIMMsgModel : NSObject
......@@ -93,7 +95,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface OffcnIMLast_msgModel : NSObject
@property (nonatomic,strong)OffcnIMMsgModel *msg_content;//消息内容
@property (nonatomic,copy)NSString *ext;//开发者扩展字段
@property (nonatomic,strong)OffcnIMMsgModel *msg;//消息内容
@property (nonatomic,assign)NSInteger msg_type;//消息类型
@property (nonatomic,copy)NSString *send_time;//时间
@property (nonatomic,copy)NSString *session_id; //会话ID
......
......@@ -7,20 +7,26 @@
//
#import <UIKit/UIKit.h>
#import "OffcnIMModel.h"
NS_ASSUME_NONNULL_BEGIN
@interface OffcnIMPushManager : NSObject
//注册通知
//注册系统推送
+(void)registerOffcnUserNotificationSettingsWithApplication:(UIApplication *)application options:(NSDictionary *)launchOptions;
//注销系统推送
+(void)unregisterForOffcnUserRemoteNotifications;
//解析deviceToken
+(NSString *)hexStringForData:(NSData *)data;
//收到通知
+(void)didReceiveRemoteNotification:(NSDictionary *)userInfo;
//收到远端推送
+(void)didReceiveRemoteNotification:(NSDictionary *)userInfo Finished:(void(^)(OffcnIMPushModel *IMPushModel))finished;
//收到本地推送
+(void)didReceiveLocalNotification:(NSDictionary *)userInfo Finished:(void(^)(OffcnIMModel *IMLocalPushModel))finished;
@end
NS_ASSUME_NONNULL_END
......
......@@ -9,7 +9,7 @@
#import <UIKit/UIKit.h>
#import "OffcnIMModel.h"
static const NSString *OffcnIMSDKiOSVersion = @"1.0.0.0";
static const NSString *OffcnIMSDKiOSVersion = @"1.0.0.1";
typedef NS_ENUM(NSUInteger, OffcnSDKReachabilityStatus) {
OffcnSDKReachabilityStatusNotReachable = 0,
......@@ -64,8 +64,9 @@ typedef void(^OffcnSDKReachabilityStatusCallBack)(OffcnSDKReachabilityStatus sta
/// @param msg_type 发送消息类型
/// @param text 文本
/// @param filePath 图片/音频(语音消息格式,只能是aac格式)/视频/文件,沙盒路径
/// @param ext 开发者扩展字段
/// @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,OffcnIMSendMsgModel *sendMsgModel,NSString *errorMessage))finished ProgressPercent:(void(^)(NSString *key, float percent))progressPercent;
-(void)sendMsgWithMsg_fromID:(NSString *)msg_fromID msg_toID:(NSString *)msg_toID msg_type:(OffcnSDKMsgType)msg_type text:(NSString *)text filePath:(NSString *)filePath ext:(NSString *)ext Finished:(void(^)(BOOL success,OffcnIMBodyModel *sendMsgModel,NSString *errorMessage))finished ProgressPercent:(void(^)(NSString *key, float percent))progressPercent;
/// 用户信息标记已读
/// @param msg_fromID 发送人ID
......@@ -92,13 +93,13 @@ typedef void(^OffcnSDKReachabilityStatusCallBack)(OffcnSDKReachabilityStatus sta
/// @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 结果回调
......
......@@ -16,10 +16,15 @@ typedef NS_ENUM(NSUInteger, OffcnIMConnectStatus) {
OffcnIMConnectStatusFail = 1, //连接失败
OffcnIMConnectStatusBreak = 2, //连接断开
OffcnIMConnectStatusDisConnectOK = 3, //手动断开成功
OffcnIMConnectStatusReconnect_start = 4, //开始重连
OffcnIMConnectStatusReconnect_success = 5, //重连成功
OffcnIMConnectStatusReconnect_fail = 6, //重连失败
OffcnIMConnectStatusOverLimit = 3001, //连接数量超过限制
OffcnIMConnectStatusUserNoExist = 5002, //用户不存在
OffcnIMConnectStatusTokenInvalid = 5003, //token已失效
OffcnIMConnectStatusKickout = 8003, //账号被踢
OffcnIMConnectStatusKickout = 8002, //账号被踢
};
//收到消息回调
......@@ -33,6 +38,7 @@ typedef void(^OffcnIMReceiveConnectStatus)(OffcnIMConnectStatus status,NSString
@property (nonatomic, copy) NSString *msg_fromId;//发送消息的用户id
@property (nonatomic, copy) NSString *token;//发送消息的用户token
@property (nonatomic, assign) BOOL isManualDisconnect;//是手动断开的连接
@property (nonatomic, assign) OffcnIMConnectStatus IMConnectStatus;//连接状态
......@@ -43,9 +49,16 @@ typedef void(^OffcnIMReceiveConnectStatus)(OffcnIMConnectStatus status,NSString
//连接状态回调
@property (nonatomic, copy) OffcnIMReceiveConnectStatus connectStatus;
@property (nonatomic, strong) NSMutableArray *msgArr;//防止重复msg_id缓存池
//单例
+(OffcnIMSocketManager *)defaultService;
/// 进入一个会话需要传入当前会话的参数
/// @param session_fromId 当前会话发送消息的用户id
/// @param session_toId 当前会话接收消息的用户id
-(void)joinSessionWithSession_fromId:(NSString *)session_fromId session_toId:(NSString *)session_toId callBack:(void(^)(NSInteger unread_number,NSString *fromUser,NSString *toUser))numberBack;
/// 建立连接
/// @param account_id 用户ID
/// @param token 用户token
......
//
// OffcnIMZYJFMDBHandler.h
// OffcnIMZYJ1FMDBHandler.h
// OffcnIMSDKiOS
//
// Created by vockey on 2019/4/9.
......@@ -20,10 +20,10 @@ typedef void (^getFMDBOneMessageBlock)(OffcnIMBodyModel *model);
typedef void (^callBackIsSuccess)(BOOL isSuccess);
@interface OffcnIMZYJFMDBHandler : NSObject
@interface OffcnIMZYJ1FMDBHandler : NSObject
//单例
+ (OffcnIMZYJFMDBHandler *)sharedInstance;
+ (OffcnIMZYJ1FMDBHandler *)sharedInstance;
//获取用户相关数据库,该方法在登陆或者第一次启动已登陆下执行
- (void)getUserDB;
......@@ -45,8 +45,10 @@ typedef void (^callBackIsSuccess)(BOOL isSuccess);
//更新和某个用户所有聊天为已读状态
- (void)updateChatInfoIsRead:(OffcnIMBodyModel *)model callBack:(callBackIsSuccess)isSuccess;
//更新和某个用户的聊天未读数
- (void)updateChatListUnread_number:(OffcnIMBodyModel *)model callBack:(callBackIsSuccess)isSuccess;
//更新和某个用户的聊天和未读数
- (void)updateChatListUnread_number:(OffcnIMBodyModel *)model callBack:(getFMDBOneMessageBlock)messagesBack;
//更新和某个用户的未读数
- (void)updateChatListOnlyUnread_number:(NSInteger)unread_number fromUser:(NSString *)fromUser toUser:(NSString *)toUser callBack:(void(^)(NSInteger unread_number,NSString *fromUser,NSString *toUser))numberBack;
/// 删除个人聊天记录
/// @param fromUser 发送人ID
......@@ -74,6 +76,10 @@ typedef void (^callBackIsSuccess)(BOOL isSuccess);
//查询聊天列表其中一个会话信息
- (void)getChatListOneMessageWithFromUser:(NSString *)fromUser toUser:(NSString *)toUser callback:(getFMDBOneMessageBlock)messagesBack;
//查询某条消息是否存在
- (void)queryAMessageExistsWithMegid:(NSString *)megid callback:(getFMDBHistoryMessagesBlock)messagesBack;
//消息内容
- (NSString *)lastMessage:(OffcnIMBodyModel *)messageModel;
......
......@@ -31,8 +31,8 @@ namespace im
{
typedef enum
{
kMsg_Type_Normal, //正常的聊天消息
kMsg_Type_Recv_Confirm, //收到服务端发来的消息确认消息
kMsg_Type_Normal, //normal message type
kMsg_Type_Recv_Confirm, //client recv message confirm type
}OImMsgType;
typedef enum
......@@ -41,6 +41,10 @@ namespace im
Z_CONN_IM_SRV_FAILED,
Z_CONN_IM_SRV_BROKEN,
Z_DISCONN_IM_SRV_OK,
Z_CONN_IM_SRV_RECONNECT_START, //start reconnect
Z_CONN_IM_SRV_RECONNECT_SUCCESS, //reconnect success
Z_CONN_IM_SRV_RECONNECT_FAILED,
}OImEventCode;
class OImCoreObserver
......
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