Commit 0b15dc7f by zhangyunjie

demo

parent aea824b3
......@@ -270,8 +270,7 @@
A9D1B64124FE765F000F4662 /* ZYJQNIP.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B5FC24FE765F000F4662 /* ZYJQNIP.m */; };
A9D1B64224FE765F000F4662 /* ZYJQNSystemTool.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B60224FE765F000F4662 /* ZYJQNSystemTool.m */; };
A9D1B64524FE7D1F000F4662 /* AppDelegate+OffcnIMPush.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D1B64424FE7D1F000F4662 /* AppDelegate+OffcnIMPush.m */; };
A9D1C641250F1246000F4662 /* oimcore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9D1C63F250F123D000F4662 /* oimcore.framework */; };
A9D1C642250F1246000F4662 /* oimcore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = A9D1C63F250F123D000F4662 /* oimcore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
A9D1C6782510588C000F4662 /* oimcore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A9D1C6772510588C000F4662 /* oimcore.framework */; };
B94FCB1053F8932068A11CC9 /* libPods-OffcnIMSDKiOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 49CE5E230A14D9B821170F61 /* libPods-OffcnIMSDKiOS.a */; };
/* End PBXBuildFile section */
......@@ -282,7 +281,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
A9D1C642250F1246000F4662 /* oimcore.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
......@@ -844,7 +842,7 @@
A9D1B60524FE765F000F4662 /* ZYJQNUploadInfoReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZYJQNUploadInfoReporter.h; sourceTree = "<group>"; };
A9D1B64324FE7D1F000F4662 /* AppDelegate+OffcnIMPush.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "AppDelegate+OffcnIMPush.h"; sourceTree = "<group>"; };
A9D1B64424FE7D1F000F4662 /* AppDelegate+OffcnIMPush.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "AppDelegate+OffcnIMPush.m"; sourceTree = "<group>"; };
A9D1C63F250F123D000F4662 /* oimcore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = oimcore.framework; sourceTree = "<group>"; };
A9D1C6772510588C000F4662 /* oimcore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = oimcore.framework; 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 */
......@@ -857,7 +855,7 @@
A96621F624EA84230024EB54 /* libsqlite3.tbd in Frameworks */,
A96621F524EA84160024EB54 /* libxml2.tbd in Frameworks */,
A96621EF24EA83A80024EB54 /* SystemConfiguration.framework in Frameworks */,
A9D1C641250F1246000F4662 /* oimcore.framework in Frameworks */,
A9D1C6782510588C000F4662 /* oimcore.framework in Frameworks */,
A96621F124EA83B10024EB54 /* CoreTelephony.framework in Frameworks */,
B94FCB1053F8932068A11CC9 /* libPods-OffcnIMSDKiOS.a in Frameworks */,
);
......@@ -896,7 +894,7 @@
A9661B4224EA64EE0024EB54 /* OffcnIMSDKiOS */ = {
isa = PBXGroup;
children = (
A9D1C63F250F123D000F4662 /* oimcore.framework */,
A9D1C6772510588C000F4662 /* oimcore.framework */,
A9662CBF24ECD98B0024EB54 /* OffcnIMSDKiOS.entitlements */,
A966274724EBA36A0024EB54 /* ExposedInterface-(外放接口) */,
A9661FC824EA7AD10024EB54 /* Common-(宏) */,
......
//
//
......@@ -12,11 +12,14 @@
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, OffcnIMConnectStatus) {
OffcnIMConnectStatusSuccess, //连接成功
OffcnIMConnectStatusFail, //连接失败
OffcnIMConnectStatusBreak, //连接断开
OffcnIMConnectStatusDisConnectOK, //手动断开成功
OffcnIMConnectStatusKickout, //互挤
OffcnIMConnectStatusSuccess = 0, //连接成功
OffcnIMConnectStatusFail = 1, //连接失败
OffcnIMConnectStatusBreak = 2, //连接断开
OffcnIMConnectStatusDisConnectOK = 3, //手动断开成功
OffcnIMConnectStatusOverLimit = 3001, //连接数量超过限制
OffcnIMConnectStatusUserNoExist = 5002, //用户不存在
OffcnIMConnectStatusTokenInvalid = 5003, //token已失效
OffcnIMConnectStatusKickout = 8003, //账号被踢
};
//收到消息回调
......
//
//
......@@ -182,18 +182,40 @@ static OffcnIMSocketManager *socketManager;
//
// Z_DISCONN_IM_SRV_OK,
//
// Z_CONN_IM_KICK_OUT, //±ªÃfl ≤ª–Ë“™÷ÿ¡¨
//
//}OImEventCode;
-(void)OnOImCoreEventWithCode:(OImEventCode)code context:(const char *_Nonnull)context{
//typedef NS_ENUM(NSUInteger, OffcnIMConnectStatus) {
// OffcnIMConnectStatusSuccess = 0, //连接成功
// OffcnIMConnectStatusFail = 1, //连接失败
// OffcnIMConnectStatusBreak = 2, //连接断开
// OffcnIMConnectStatusDisConnectOK = 3, //手动断开成功
// OffcnIMConnectStatusOverLimit = 3001, //连接数量超过限制
// OffcnIMConnectStatusUserNoExist = 5002, //用户不存在
// OffcnIMConnectStatusTokenInvalid = 5003, //token已失效
// OffcnIMConnectStatusKickout = 8003, //账号被踢
//};
-(void)OnOImCoreEventWithCode:(OImEventCode)code errorCode:(int)nErrorCode context:(const char *_Nonnull)context{
//连接状态
if (code == Z_CONN_IM_SRV_FAILED || code == Z_CONN_IM_SRV_BROKEN || code == Z_CONN_IM_KICK_OUT) {
if (code == Z_CONN_IM_SRV_FAILED || code == Z_CONN_IM_SRV_BROKEN || nErrorCode == OffcnIMConnectStatusOverLimit || nErrorCode == OffcnIMConnectStatusUserNoExist || nErrorCode == OffcnIMConnectStatusTokenInvalid || nErrorCode == OffcnIMConnectStatusKickout) {
[self.adapter DisConnectImServer];
}
if (self.connectStatus) {
NSString *message = [NSString stringWithUTF8String:context];
if (code == Z_CONN_IM_SRV_OK) {
if (nErrorCode == OffcnIMConnectStatusOverLimit){
self.IMConnectStatus = OffcnIMConnectStatusOverLimit;
self.connectStatus(OffcnIMConnectStatusOverLimit,message);
}else if (nErrorCode == OffcnIMConnectStatusUserNoExist){
self.IMConnectStatus = OffcnIMConnectStatusUserNoExist;
self.connectStatus(OffcnIMConnectStatusUserNoExist,message);
}else if (nErrorCode == OffcnIMConnectStatusTokenInvalid){
self.IMConnectStatus = OffcnIMConnectStatusTokenInvalid;
self.connectStatus(OffcnIMConnectStatusTokenInvalid,message);
}else if (nErrorCode == OffcnIMConnectStatusKickout){
self.IMConnectStatus = OffcnIMConnectStatusKickout;
self.connectStatus(OffcnIMConnectStatusKickout,message);
}else if (code == Z_CONN_IM_SRV_OK) {
self.IMConnectStatus = OffcnIMConnectStatusSuccess;
self.connectStatus(OffcnIMConnectStatusSuccess,message);
}else if (code == Z_CONN_IM_SRV_FAILED){
......@@ -205,9 +227,6 @@ static OffcnIMSocketManager *socketManager;
}else if (code == Z_DISCONN_IM_SRV_OK){
self.IMConnectStatus = OffcnIMConnectStatusDisConnectOK;
self.connectStatus(OffcnIMConnectStatusDisConnectOK,message);
}else if (code == Z_CONN_IM_KICK_OUT){
self.IMConnectStatus = OffcnIMConnectStatusKickout;
self.connectStatus(OffcnIMConnectStatusKickout,message);
}
}
}
......
......@@ -39,19 +39,14 @@ namespace im
{
Z_CONN_IM_SRV_OK,
Z_CONN_IM_SRV_FAILED,
Z_CONN_IM_SRV_BROKEN,
Z_DISCONN_IM_SRV_OK,
Z_CONN_IM_KICK_OUT, //被踢 不需要重连
}OImEventCode;
class OImCoreObserver
{
public:
virtual void OnOImCoreEvent(OImEventCode code, const char *context) = 0;
virtual void OnOImCoreEvent(OImEventCode nEvent, int nCode, const char *context) = 0;
virtual void OnOImCoreMessage(const char *message, int len) = 0;
};
}
......
......@@ -13,7 +13,7 @@ using namespace offcn::im;
@protocol OIMCoreDelegate <NSObject>
-(void)OnOImCoreMessageWithMessage:(const char *_Nonnull)message msgLength:(int)len;
-(void)OnOImCoreEventWithCode:(OImEventCode)code context:(const char *_Nonnull)context;
-(void)OnOImCoreEventWithCode:(OImEventCode)code errorCode:(int)nErrorCode context:(const char *_Nonnull)context;
@end
......
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