mirror of
https://gitee.com/farsunset/cim.git
synced 2025-06-16 23:29:57 +08:00
迁移基于oc的ios sdk
This commit is contained in:
parent
2a2613b5cc
commit
35ab7cc72c
@ -1,23 +0,0 @@
|
||||
//
|
||||
// CIMHeader.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/13.
|
||||
//
|
||||
|
||||
#ifndef CIMHeader_h
|
||||
#define CIMHeader_h
|
||||
|
||||
|
||||
#import "GCDAsyncSocket.h"
|
||||
#import "SentBody.pbobjc.h"
|
||||
#import "Message.pbobjc.h"
|
||||
#import "NSData+IM.h"
|
||||
#import "NSString+IM.h"
|
||||
|
||||
#import "CIMSendMessageData.h"
|
||||
#import "CIMService.h"
|
||||
|
||||
|
||||
|
||||
#endif /* CIMHeader_h */
|
@ -1,103 +0,0 @@
|
||||
//
|
||||
// CIMMessageObserver.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/18.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "GCDAsyncSocket.h"
|
||||
#import "CIMMessageModel.h"
|
||||
|
||||
@class CIMService;
|
||||
/// 消息回调
|
||||
@protocol CIMPeerMessageObserver <NSObject>
|
||||
|
||||
/// 接受到消息
|
||||
/// @param msg msg description
|
||||
-(void)cimHandleMessage:(CIMMessageModel * _Nonnull)msg;
|
||||
|
||||
/// 消息解析失败
|
||||
/// @param data data description
|
||||
-(void)cimHandleMessageError:(NSData * _Nonnull)data;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
/// 服务器连接回调
|
||||
@protocol CIMConnectionObserver <NSObject>
|
||||
@optional
|
||||
|
||||
/// 用户绑定成功
|
||||
/// @param bindSuccess bindSuccess description
|
||||
-(void)cimDidBindUserSuccess:(BOOL)bindSuccess;
|
||||
|
||||
/// 连接成功
|
||||
-(void)cimDidConnectSuccess;
|
||||
|
||||
/// 断开连接
|
||||
-(void)cimDidConnectClose;
|
||||
|
||||
/// 连接失败
|
||||
/// @param error res description
|
||||
-(void)cimDidConnectError:(NSError *_Nullable)error;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CIMService : NSObject
|
||||
|
||||
+(CIMService*)instance;
|
||||
|
||||
/// 配置IM服务器
|
||||
/// @param host host description
|
||||
/// @param port port description
|
||||
-(void)configHost:(NSString *)host onPort:(NSInteger)port;
|
||||
|
||||
/// 连接服务器并绑定用户
|
||||
/// @param userId userId description
|
||||
-(void)connectionBindUserId:(NSString *)userId;
|
||||
|
||||
/// 添加消息监听回调
|
||||
/// @param observer observer description (可添加多个)不同时记得Remove
|
||||
-(void)addMessageObserver:(id<CIMPeerMessageObserver>)observer;
|
||||
|
||||
/// 添加连接状态监听回调
|
||||
/// @param observer observer description (可添加多个)不同时记得Remove
|
||||
-(void)addConnectionObserver:(id<CIMConnectionObserver>)observer;
|
||||
|
||||
/// 移除监听
|
||||
/// @param observer observer description
|
||||
-(void)removeMessageObserver:(id<CIMPeerMessageObserver>)observer;
|
||||
|
||||
/// 移除监听回调
|
||||
/// @param observer observer description
|
||||
-(void)removeConnectionObserver:(id<CIMConnectionObserver>)observer;
|
||||
|
||||
/// 退出后台 断开连接
|
||||
-(void)enterBackground;
|
||||
|
||||
/// 进入前台重新连接
|
||||
-(void)enterForeground;
|
||||
|
||||
/// 重新连接
|
||||
-(void)reconnect;
|
||||
|
||||
/// 断开连接
|
||||
-(void)disconnect;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
Binary file not shown.
@ -1,5 +0,0 @@
|
||||
#### iOS版本SDK介绍
|
||||
iOS版本SDK是由开发者Siter(siterwu@gmail.com)贡献提供的,感谢Siter在百忙之中做出的贡献。
|
||||
---
|
||||
## 源码和集成方式参见下面地址
|
||||
## [https://gitee.com/Siter/cimkit](https://gitee.com/Siter/cimkit)
|
@ -1,204 +0,0 @@
|
||||
/*CIM服务器IP*/
|
||||
const CIM_HOST = window.location.hostname;
|
||||
/*
|
||||
*服务端 websocket端口
|
||||
*/
|
||||
const CIM_PORT = 34567;
|
||||
const CIM_URI = "ws://" + CIM_HOST + ":" + CIM_PORT;
|
||||
|
||||
const APP_VERSION = "1.0.0";
|
||||
const APP_CHANNEL = "web";
|
||||
const APP_PACKAGE = "com.farsunset.cim";
|
||||
|
||||
/*
|
||||
*特殊的消息类型,代表被服务端强制下线
|
||||
*/
|
||||
const ACTION_999 = "999";
|
||||
const DATA_HEADER_LENGTH = 1;
|
||||
|
||||
const MESSAGE = 2;
|
||||
const REPLY_BODY = 4;
|
||||
const SENT_BODY = 3;
|
||||
const PING = 1;
|
||||
const PONG = 0;
|
||||
/**
|
||||
* PONG字符串转换后
|
||||
* @type {Uint8Array}
|
||||
*/
|
||||
const PONG_BODY = new Uint8Array([80,79,78,71]);
|
||||
|
||||
|
||||
let socket;
|
||||
let manualStop = false;
|
||||
const CIMPushManager = {};
|
||||
CIMPushManager.connect = function () {
|
||||
manualStop = false;
|
||||
window.localStorage.account = '';
|
||||
socket = new WebSocket(CIM_URI);
|
||||
socket.cookieEnabled = false;
|
||||
socket.binaryType = 'arraybuffer';
|
||||
socket.onopen = CIMPushManager.innerOnConnectFinished;
|
||||
socket.onmessage = CIMPushManager.innerOnMessageReceived;
|
||||
socket.onclose = CIMPushManager.innerOnConnectionClosed;
|
||||
};
|
||||
|
||||
CIMPushManager.bind = function (account) {
|
||||
|
||||
window.localStorage.account = account;
|
||||
|
||||
let deviceId = window.localStorage.deviceId;
|
||||
if (deviceId === '' || deviceId === undefined) {
|
||||
deviceId = generateUUID();
|
||||
window.localStorage.deviceId = deviceId;
|
||||
}
|
||||
|
||||
let browser = getBrowser();
|
||||
let body = new proto.com.farsunset.cim.sdk.web.model.SentBody();
|
||||
body.setKey("client_bind");
|
||||
body.setTimestamp(new Date().getTime());
|
||||
body.getDataMap().set("uid", account);
|
||||
body.getDataMap().set("channel", APP_CHANNEL);
|
||||
body.getDataMap().set("appVersion", APP_VERSION);
|
||||
body.getDataMap().set("osVersion", browser.version);
|
||||
body.getDataMap().set("packageName", APP_PACKAGE);
|
||||
body.getDataMap().set("deviceId", deviceId);
|
||||
body.getDataMap().set("deviceName", browser.name);
|
||||
body.getDataMap().set("language", navigator.language);
|
||||
CIMPushManager.sendRequest(body);
|
||||
};
|
||||
|
||||
CIMPushManager.stop = function () {
|
||||
manualStop = true;
|
||||
socket.close();
|
||||
};
|
||||
|
||||
CIMPushManager.resume = function () {
|
||||
manualStop = false;
|
||||
CIMPushManager.connect();
|
||||
};
|
||||
|
||||
|
||||
CIMPushManager.innerOnConnectFinished = function () {
|
||||
let account = window.localStorage.account;
|
||||
if (account === '' || account === undefined) {
|
||||
onConnectFinished();
|
||||
} else {
|
||||
CIMPushManager.bindAccount(account);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
CIMPushManager.innerOnMessageReceived = function (e) {
|
||||
let data = new Uint8Array(e.data);
|
||||
let type = data[0];
|
||||
let body = data.subarray(DATA_HEADER_LENGTH, data.length);
|
||||
|
||||
if (type === PING) {
|
||||
CIMPushManager.pong();
|
||||
return;
|
||||
}
|
||||
|
||||
if (type === MESSAGE) {
|
||||
let message = proto.com.farsunset.cim.sdk.web.model.Message.deserializeBinary(body);
|
||||
onInterceptMessageReceived(message.toObject(false));
|
||||
return;
|
||||
}
|
||||
|
||||
if (type === REPLY_BODY) {
|
||||
let message = proto.com.farsunset.cim.sdk.web.model.ReplyBody.deserializeBinary(body);
|
||||
/**
|
||||
* 将proto对象转换成json对象,去除无用信息
|
||||
*/
|
||||
let reply = {};
|
||||
reply.code = message.getCode();
|
||||
reply.key = message.getKey();
|
||||
reply.message = message.getMessage();
|
||||
reply.timestamp = message.getTimestamp();
|
||||
reply.data = {};
|
||||
|
||||
/**
|
||||
* 注意,遍历map这里的参数 value在前key在后
|
||||
*/
|
||||
message.getDataMap().forEach(function (v, k) {
|
||||
reply.data[k] = v;
|
||||
});
|
||||
|
||||
onReplyReceived(reply);
|
||||
}
|
||||
};
|
||||
|
||||
CIMPushManager.innerOnConnectionClosed = function (e) {
|
||||
if (!manualStop) {
|
||||
let time = Math.floor(Math.random() * (30 - 15 + 1) + 15);
|
||||
setTimeout(function () {
|
||||
CIMPushManager.connect();
|
||||
}, time);
|
||||
}
|
||||
};
|
||||
|
||||
CIMPushManager.sendRequest = function (body) {
|
||||
let data = body.serializeBinary();
|
||||
let protobuf = new Uint8Array(data.length + 1);
|
||||
protobuf[0] = SENT_BODY;
|
||||
protobuf.set(data, 1);
|
||||
socket.send(protobuf);
|
||||
};
|
||||
|
||||
CIMPushManager.pong = function () {
|
||||
let pong = new Uint8Array(PONG_BODY.byteLength + 1);
|
||||
pong[0] = PONG;
|
||||
pong.set(PONG_BODY,1);
|
||||
socket.send(pong);
|
||||
};
|
||||
|
||||
function onInterceptMessageReceived(message) {
|
||||
/*
|
||||
*被强制下线之后,不再继续连接服务端
|
||||
*/
|
||||
if (message.action === ACTION_999) {
|
||||
manualStop = true;
|
||||
}
|
||||
/*
|
||||
*收到消息后,将消息发送给页面
|
||||
*/
|
||||
if (onMessageReceived instanceof Function) {
|
||||
onMessageReceived(message);
|
||||
}
|
||||
}
|
||||
|
||||
function getBrowser() {
|
||||
let explorer = window.navigator.userAgent.toLowerCase();
|
||||
if (explorer.indexOf("msie") >= 0) {
|
||||
let ver = explorer.match(/msie ([\d.]+)/)[1];
|
||||
return {name: "IE", version: ver};
|
||||
}
|
||||
else if (explorer.indexOf("firefox") >= 0) {
|
||||
let ver = explorer.match(/firefox\/([\d.]+)/)[1];
|
||||
return {name: "Firefox", version: ver};
|
||||
}
|
||||
else if (explorer.indexOf("chrome") >= 0) {
|
||||
let ver = explorer.match(/chrome\/([\d.]+)/)[1];
|
||||
return {name: "Chrome", version: ver};
|
||||
}
|
||||
else if (explorer.indexOf("opera") >= 0) {
|
||||
let ver = explorer.match(/opera.([\d.]+)/)[1];
|
||||
return {name: "Opera", version: ver};
|
||||
}
|
||||
else if (explorer.indexOf("Safari") >= 0) {
|
||||
let ver = explorer.match(/version\/([\d.]+)/)[1];
|
||||
return {name: "Safari", version: ver};
|
||||
}
|
||||
|
||||
return {name: "Other", version: "1.0.0"};
|
||||
}
|
||||
|
||||
function generateUUID() {
|
||||
let d = new Date().getTime();
|
||||
let uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||
let r = (d + Math.random() * 16) % 16 | 0;
|
||||
d = Math.floor(d / 16);
|
||||
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
|
||||
});
|
||||
return uuid.replace(/-/g, '');
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
||||
集成方式请参考文档和cim-use-examples中对应的demo
|
@ -1,480 +0,0 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 55;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
C625DCFE28BF1106008F267F /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C625DCFD28BF1106008F267F /* AppDelegate.m */; };
|
||||
C625DD0128BF1106008F267F /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C625DD0028BF1106008F267F /* SceneDelegate.m */; };
|
||||
C625DD0428BF1106008F267F /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C625DD0328BF1106008F267F /* ViewController.m */; };
|
||||
C625DD0728BF1106008F267F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C625DD0528BF1106008F267F /* Main.storyboard */; };
|
||||
C625DD0928BF1108008F267F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C625DD0828BF1108008F267F /* Assets.xcassets */; };
|
||||
C625DD0C28BF1108008F267F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C625DD0A28BF1108008F267F /* LaunchScreen.storyboard */; };
|
||||
C625DD0F28BF1108008F267F /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C625DD0E28BF1108008F267F /* main.m */; };
|
||||
C625DD1828BF2BDF008F267F /* CIMService.m in Sources */ = {isa = PBXBuildFile; fileRef = C625DD1728BF2BDF008F267F /* CIMService.m */; };
|
||||
C66CFB5528BF9000002506AD /* CIMMessageModel.m in Sources */ = {isa = PBXBuildFile; fileRef = C66CFB5428BF9000002506AD /* CIMMessageModel.m */; };
|
||||
C66CFB6928C07ED5002506AD /* ReplyBody.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = C66CFB6428C07ED5002506AD /* ReplyBody.pbobjc.m */; };
|
||||
C66CFB6A28C07ED5002506AD /* Message.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = C66CFB6528C07ED5002506AD /* Message.pbobjc.m */; };
|
||||
C66CFB6B28C07ED5002506AD /* SentBody.pbobjc.m in Sources */ = {isa = PBXBuildFile; fileRef = C66CFB6728C07ED5002506AD /* SentBody.pbobjc.m */; };
|
||||
C66CFB6E28C1B19C002506AD /* CIMSignalService.m in Sources */ = {isa = PBXBuildFile; fileRef = C66CFB6D28C1B19C002506AD /* CIMSignalService.m */; };
|
||||
C66CFB7828C3548F002506AD /* CIMSignalServiceBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = C66CFB7728C3548F002506AD /* CIMSignalServiceBuffer.m */; };
|
||||
C66CFB7B28C38D8E002506AD /* CIMSignalPacket.m in Sources */ = {isa = PBXBuildFile; fileRef = C66CFB7A28C38D8E002506AD /* CIMSignalPacket.m */; };
|
||||
C68DFB5528D210790088E639 /* KCLDataWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = C68DFB4E28D210790088E639 /* KCLDataWriter.m */; };
|
||||
C68DFB5628D210790088E639 /* KCLDataReader.m in Sources */ = {isa = PBXBuildFile; fileRef = C68DFB5128D210790088E639 /* KCLDataReader.m */; };
|
||||
C68DFB5728D210790088E639 /* CIMWeakProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = C68DFB5328D210790088E639 /* CIMWeakProxy.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
C625DCF928BF1106008F267F /* CIMKit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CIMKit.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
C625DCFC28BF1106008F267F /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
|
||||
C625DCFD28BF1106008F267F /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
|
||||
C625DCFF28BF1106008F267F /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = "<group>"; };
|
||||
C625DD0028BF1106008F267F /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = "<group>"; };
|
||||
C625DD0228BF1106008F267F /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
|
||||
C625DD0328BF1106008F267F /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
|
||||
C625DD0628BF1106008F267F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
|
||||
C625DD0828BF1108008F267F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
||||
C625DD0B28BF1108008F267F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
|
||||
C625DD0D28BF1108008F267F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
C625DD0E28BF1108008F267F /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
C625DD1628BF2BDE008F267F /* CIMService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CIMService.h; sourceTree = "<group>"; };
|
||||
C625DD1728BF2BDF008F267F /* CIMService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CIMService.m; sourceTree = "<group>"; };
|
||||
C66CFB5328BF9000002506AD /* CIMMessageModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CIMMessageModel.h; sourceTree = "<group>"; };
|
||||
C66CFB5428BF9000002506AD /* CIMMessageModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CIMMessageModel.m; sourceTree = "<group>"; };
|
||||
C66CFB6328C07ED5002506AD /* SentBody.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SentBody.pbobjc.h; sourceTree = "<group>"; };
|
||||
C66CFB6428C07ED5002506AD /* ReplyBody.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReplyBody.pbobjc.m; sourceTree = "<group>"; };
|
||||
C66CFB6528C07ED5002506AD /* Message.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Message.pbobjc.m; sourceTree = "<group>"; };
|
||||
C66CFB6628C07ED5002506AD /* ReplyBody.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReplyBody.pbobjc.h; sourceTree = "<group>"; };
|
||||
C66CFB6728C07ED5002506AD /* SentBody.pbobjc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SentBody.pbobjc.m; sourceTree = "<group>"; };
|
||||
C66CFB6828C07ED5002506AD /* Message.pbobjc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Message.pbobjc.h; sourceTree = "<group>"; };
|
||||
C66CFB6C28C1B19C002506AD /* CIMSignalService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CIMSignalService.h; sourceTree = "<group>"; };
|
||||
C66CFB6D28C1B19C002506AD /* CIMSignalService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CIMSignalService.m; sourceTree = "<group>"; };
|
||||
C66CFB7628C3548F002506AD /* CIMSignalServiceBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CIMSignalServiceBuffer.h; sourceTree = "<group>"; };
|
||||
C66CFB7728C3548F002506AD /* CIMSignalServiceBuffer.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CIMSignalServiceBuffer.m; sourceTree = "<group>"; };
|
||||
C66CFB7928C38D8E002506AD /* CIMSignalPacket.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CIMSignalPacket.h; sourceTree = "<group>"; };
|
||||
C66CFB7A28C38D8E002506AD /* CIMSignalPacket.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CIMSignalPacket.m; sourceTree = "<group>"; };
|
||||
C68DFB4E28D210790088E639 /* KCLDataWriter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KCLDataWriter.m; sourceTree = "<group>"; };
|
||||
C68DFB4F28D210790088E639 /* KCLDataReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KCLDataReader.h; sourceTree = "<group>"; };
|
||||
C68DFB5028D210790088E639 /* KCLDataWriter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KCLDataWriter.h; sourceTree = "<group>"; };
|
||||
C68DFB5128D210790088E639 /* KCLDataReader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KCLDataReader.m; sourceTree = "<group>"; };
|
||||
C68DFB5328D210790088E639 /* CIMWeakProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CIMWeakProxy.m; sourceTree = "<group>"; };
|
||||
C68DFB5428D210790088E639 /* CIMWeakProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CIMWeakProxy.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
C625DCF628BF1106008F267F /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
B17C5FA540C326B8C638FB9C /* Pods */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C625DCF028BF1105008F267F = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C625DCFB28BF1106008F267F /* CIMKit */,
|
||||
C625DCFA28BF1106008F267F /* Products */,
|
||||
B17C5FA540C326B8C638FB9C /* Pods */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C625DCFA28BF1106008F267F /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C625DCF928BF1106008F267F /* CIMKit.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C625DCFB28BF1106008F267F /* CIMKit */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C625DD1528BF2BA0008F267F /* CIMKit */,
|
||||
C625DCFC28BF1106008F267F /* AppDelegate.h */,
|
||||
C625DCFD28BF1106008F267F /* AppDelegate.m */,
|
||||
C625DCFF28BF1106008F267F /* SceneDelegate.h */,
|
||||
C625DD0028BF1106008F267F /* SceneDelegate.m */,
|
||||
C625DD0228BF1106008F267F /* ViewController.h */,
|
||||
C625DD0328BF1106008F267F /* ViewController.m */,
|
||||
C625DD0528BF1106008F267F /* Main.storyboard */,
|
||||
C625DD0828BF1108008F267F /* Assets.xcassets */,
|
||||
C625DD0A28BF1108008F267F /* LaunchScreen.storyboard */,
|
||||
C625DD0D28BF1108008F267F /* Info.plist */,
|
||||
C625DD0E28BF1108008F267F /* main.m */,
|
||||
);
|
||||
path = CIMKit;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C625DD1528BF2BA0008F267F /* CIMKit */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C68DFB4C28D210790088E639 /* Tool */,
|
||||
C66CFB6228C07ED5002506AD /* Proto */,
|
||||
C625DD1628BF2BDE008F267F /* CIMService.h */,
|
||||
C625DD1728BF2BDF008F267F /* CIMService.m */,
|
||||
C66CFB6C28C1B19C002506AD /* CIMSignalService.h */,
|
||||
C66CFB6D28C1B19C002506AD /* CIMSignalService.m */,
|
||||
C66CFB7628C3548F002506AD /* CIMSignalServiceBuffer.h */,
|
||||
C66CFB7728C3548F002506AD /* CIMSignalServiceBuffer.m */,
|
||||
C66CFB7928C38D8E002506AD /* CIMSignalPacket.h */,
|
||||
C66CFB7A28C38D8E002506AD /* CIMSignalPacket.m */,
|
||||
C66CFB5328BF9000002506AD /* CIMMessageModel.h */,
|
||||
C66CFB5428BF9000002506AD /* CIMMessageModel.m */,
|
||||
);
|
||||
path = CIMKit;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C66CFB6228C07ED5002506AD /* Proto */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C66CFB6328C07ED5002506AD /* SentBody.pbobjc.h */,
|
||||
C66CFB6728C07ED5002506AD /* SentBody.pbobjc.m */,
|
||||
C66CFB6628C07ED5002506AD /* ReplyBody.pbobjc.h */,
|
||||
C66CFB6428C07ED5002506AD /* ReplyBody.pbobjc.m */,
|
||||
C66CFB6828C07ED5002506AD /* Message.pbobjc.h */,
|
||||
C66CFB6528C07ED5002506AD /* Message.pbobjc.m */,
|
||||
);
|
||||
path = Proto;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C68DFB4C28D210790088E639 /* Tool */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C68DFB4D28D210790088E639 /* KCLDataReaderWriter */,
|
||||
C68DFB5228D210790088E639 /* CIMWeakProxy */,
|
||||
);
|
||||
path = Tool;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C68DFB4D28D210790088E639 /* KCLDataReaderWriter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C68DFB4E28D210790088E639 /* KCLDataWriter.m */,
|
||||
C68DFB4F28D210790088E639 /* KCLDataReader.h */,
|
||||
C68DFB5028D210790088E639 /* KCLDataWriter.h */,
|
||||
C68DFB5128D210790088E639 /* KCLDataReader.m */,
|
||||
);
|
||||
path = KCLDataReaderWriter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C68DFB5228D210790088E639 /* CIMWeakProxy */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
C68DFB5328D210790088E639 /* CIMWeakProxy.m */,
|
||||
C68DFB5428D210790088E639 /* CIMWeakProxy.h */,
|
||||
);
|
||||
path = CIMWeakProxy;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
C625DCF828BF1106008F267F /* CIMKit */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = C625DD1228BF1108008F267F /* Build configuration list for PBXNativeTarget "CIMKit" */;
|
||||
buildPhases = (
|
||||
C625DCF528BF1106008F267F /* Sources */,
|
||||
C625DCF628BF1106008F267F /* Frameworks */,
|
||||
C625DCF728BF1106008F267F /* Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = CIMKit;
|
||||
productName = CIMKit;
|
||||
productReference = C625DCF928BF1106008F267F /* CIMKit.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
C625DCF128BF1105008F267F /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
BuildIndependentTargetsInParallel = 1;
|
||||
LastUpgradeCheck = 1340;
|
||||
TargetAttributes = {
|
||||
C625DCF828BF1106008F267F = {
|
||||
CreatedOnToolsVersion = 13.4;
|
||||
};
|
||||
};
|
||||
};
|
||||
buildConfigurationList = C625DCF428BF1105008F267F /* Build configuration list for PBXProject "CIMKit" */;
|
||||
compatibilityVersion = "Xcode 13.0";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = C625DCF028BF1105008F267F;
|
||||
productRefGroup = C625DCFA28BF1106008F267F /* Products */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
C625DCF828BF1106008F267F /* CIMKit */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
C625DCF728BF1106008F267F /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C625DD0C28BF1108008F267F /* LaunchScreen.storyboard in Resources */,
|
||||
C625DD0928BF1108008F267F /* Assets.xcassets in Resources */,
|
||||
C625DD0728BF1106008F267F /* Main.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
C625DCF528BF1106008F267F /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
C66CFB7828C3548F002506AD /* CIMSignalServiceBuffer.m in Sources */,
|
||||
C68DFB5728D210790088E639 /* CIMWeakProxy.m in Sources */,
|
||||
C625DD0428BF1106008F267F /* ViewController.m in Sources */,
|
||||
C66CFB5528BF9000002506AD /* CIMMessageModel.m in Sources */,
|
||||
C66CFB6B28C07ED5002506AD /* SentBody.pbobjc.m in Sources */,
|
||||
C66CFB7B28C38D8E002506AD /* CIMSignalPacket.m in Sources */,
|
||||
C68DFB5528D210790088E639 /* KCLDataWriter.m in Sources */,
|
||||
C625DCFE28BF1106008F267F /* AppDelegate.m in Sources */,
|
||||
C625DD0F28BF1108008F267F /* main.m in Sources */,
|
||||
C625DD1828BF2BDF008F267F /* CIMService.m in Sources */,
|
||||
C68DFB5628D210790088E639 /* KCLDataReader.m in Sources */,
|
||||
C66CFB6928C07ED5002506AD /* ReplyBody.pbobjc.m in Sources */,
|
||||
C66CFB6E28C1B19C002506AD /* CIMSignalService.m in Sources */,
|
||||
C66CFB6A28C07ED5002506AD /* Message.pbobjc.m in Sources */,
|
||||
C625DD0128BF1106008F267F /* SceneDelegate.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXVariantGroup section */
|
||||
C625DD0528BF1106008F267F /* Main.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
C625DD0628BF1106008F267F /* Base */,
|
||||
);
|
||||
name = Main.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
C625DD0A28BF1108008F267F /* LaunchScreen.storyboard */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
C625DD0B28BF1108008F267F /* Base */,
|
||||
);
|
||||
name = LaunchScreen.storyboard;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXVariantGroup section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
C625DD1028BF1108008F267F /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
"$(inherited)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
C625DD1128BF1108008F267F /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
CLANG_ANALYZER_NONNULL = YES;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
|
||||
CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
MTL_FAST_MATH = YES;
|
||||
SDKROOT = iphoneos;
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
C625DD1328BF1108008F267F /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = H6UN23L6E6;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = CIMKit/Info.plist;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
||||
INFOPLIST_KEY_UIMainStoryboardFile = Main;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.chen.CIMKit;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
C625DD1428BF1108008F267F /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 1;
|
||||
DEVELOPMENT_TEAM = H6UN23L6E6;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
INFOPLIST_FILE = CIMKit/Info.plist;
|
||||
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
|
||||
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
|
||||
INFOPLIST_KEY_UIMainStoryboardFile = Main;
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
MARKETING_VERSION = 1.0;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = com.chen.CIMKit;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SWIFT_EMIT_LOC_STRINGS = YES;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
C625DCF428BF1105008F267F /* Build configuration list for PBXProject "CIMKit" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
C625DD1028BF1108008F267F /* Debug */,
|
||||
C625DD1128BF1108008F267F /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
C625DD1228BF1108008F267F /* Build configuration list for PBXNativeTarget "CIMKit" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
C625DD1328BF1108008F267F /* Debug */,
|
||||
C625DD1428BF1108008F267F /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = C625DCF128BF1105008F267F /* Project object */;
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>CIMKit.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>3</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:CIMKit.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
@ -1,168 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
uuid = "042D2A47-E033-4FB6-831C-62051BE0DD2C"
|
||||
type = "0"
|
||||
version = "2.0">
|
||||
<Breakpoints>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "B2111124-DE40-441F-B9F6-097D555E9935"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "CIMKit/Class/CIMSendMessageData.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "17"
|
||||
endingLineNumber = "17"
|
||||
landmarkName = "+initHeartbeatData"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "2389BB28-5472-4BB3-87D5-EA288B0D3ABB"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "CIMKit/Class/Tool/NSString+IM.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "18"
|
||||
endingLineNumber = "18"
|
||||
landmarkName = "-convertBytesStringToData"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "F989D3DE-3E36-4658-952A-6DDDC1CD0582"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "CIMKit/ViewController.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "76"
|
||||
endingLineNumber = "76"
|
||||
landmarkName = "-cimDidBindUserSuccess:"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "02CD0C33-AB44-4BB3-9E83-1CFBB8666E17"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "CIMKit/ViewController.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "87"
|
||||
endingLineNumber = "87"
|
||||
landmarkName = "-cimDidConnectError:"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "3E5ADEAB-4FBE-40A2-9344-6B5CB8A7291B"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "CIMKit/ViewController.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "90"
|
||||
endingLineNumber = "90"
|
||||
landmarkName = "ViewController"
|
||||
landmarkType = "3">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "D1E5A5E8-D161-4CB9-A00D-F4AAC8FDD8BD"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "CIMKit/ViewController.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "95"
|
||||
endingLineNumber = "95"
|
||||
landmarkName = "-cimHandleMessageError:"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "347B18CB-3F11-4A42-960A-F42941969893"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "CIMKit/ViewController.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "98"
|
||||
endingLineNumber = "98"
|
||||
landmarkName = "ViewController"
|
||||
landmarkType = "3">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "15F4EEA7-FF1A-4CED-8974-7428222E9853"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "CIMKit/ViewController.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "79"
|
||||
endingLineNumber = "79"
|
||||
landmarkName = "-cimDidConnectSuccess"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "CF67C50F-634D-4884-AC44-3B4383833873"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "CIMKit/Class/CIMService.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "299"
|
||||
endingLineNumber = "299"
|
||||
landmarkName = "-disconnect"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "A766F010-D0DC-425A-AFB6-8AEA573D5575"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "CIMKit/Class/CIMSignalService.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "99"
|
||||
endingLineNumber = "99"
|
||||
landmarkName = "-socketDidDisconnect:withError:"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
</Bucket>
|
@ -1,14 +0,0 @@
|
||||
//
|
||||
// AppDelegate.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/8/31.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
|
||||
@end
|
||||
|
@ -1,43 +0,0 @@
|
||||
//
|
||||
// AppDelegate.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/8/31.
|
||||
//
|
||||
|
||||
#import "AppDelegate.h"
|
||||
|
||||
@interface AppDelegate ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
// Override point for customization after application launch.
|
||||
|
||||
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UISceneSession lifecycle
|
||||
|
||||
|
||||
- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
|
||||
// Called when a new scene session is being created.
|
||||
// Use this method to select a configuration to create the new scene with.
|
||||
return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
|
||||
}
|
||||
|
||||
|
||||
- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {
|
||||
// Called when the user discards a scene session.
|
||||
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
|
||||
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
|
||||
}
|
||||
|
||||
|
||||
@end
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "60x60"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "60x60"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "76x76"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "83.5x83.5"
|
||||
},
|
||||
{
|
||||
"idiom" : "ios-marketing",
|
||||
"scale" : "1x",
|
||||
"size" : "1024x1024"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
@ -1,34 +0,0 @@
|
||||
//
|
||||
// CIMMessageModel.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/8/31.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CIMMessageModel : NSObject
|
||||
|
||||
@property (nonatomic, readwrite) int64_t id_p;
|
||||
|
||||
@property (nonatomic, readwrite, copy) NSString *action;
|
||||
|
||||
@property (nonatomic, readwrite, copy) NSString *content;
|
||||
|
||||
@property (nonatomic, readwrite, copy) NSString *sender;
|
||||
|
||||
@property (nonatomic, readwrite, copy) NSString *receiver;
|
||||
|
||||
@property (nonatomic, readwrite, copy) NSString *extra;
|
||||
|
||||
@property (nonatomic, readwrite, copy) NSString *title;
|
||||
|
||||
@property (nonatomic, readwrite, copy) NSString *format;
|
||||
|
||||
@property (nonatomic, readwrite) int64_t timestamp;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -1,12 +0,0 @@
|
||||
//
|
||||
// CIMMessageModel.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/8/31.
|
||||
//
|
||||
|
||||
#import "CIMMessageModel.h"
|
||||
|
||||
@implementation CIMMessageModel
|
||||
|
||||
@end
|
@ -1,148 +0,0 @@
|
||||
//
|
||||
// CIMService.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/9/4.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "CIMMessageModel.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class CIMService;
|
||||
|
||||
/**
|
||||
消息回调
|
||||
*/
|
||||
@protocol CIMPeerMessageObserver <NSObject>
|
||||
|
||||
/**
|
||||
接受到消息
|
||||
*/
|
||||
- (void)cimHandleMessage:(CIMMessageModel *_Nonnull)msg;
|
||||
|
||||
/**
|
||||
消息解析失败
|
||||
*/
|
||||
- (void)cimHandleMessageError:(NSData *_Nonnull)data;
|
||||
|
||||
@end
|
||||
|
||||
/**
|
||||
服务器连接回调
|
||||
*/
|
||||
@protocol CIMConnectionObserver <NSObject>
|
||||
@optional
|
||||
|
||||
/**
|
||||
用户绑定成功
|
||||
*/
|
||||
- (void)cimDidBindUserSuccess:(BOOL)bindSuccess;
|
||||
|
||||
/**
|
||||
连接成功
|
||||
*/
|
||||
- (void)cimDidConnectSuccess;
|
||||
|
||||
/**
|
||||
重连回调
|
||||
*/
|
||||
- (void)cimDidReconnection:(NSInteger)reconnectionCount;
|
||||
|
||||
/**
|
||||
断开连接
|
||||
*/
|
||||
- (void)cimDidConnectClose;
|
||||
|
||||
/**
|
||||
连接失败
|
||||
*/
|
||||
- (void)cimDidConnectError:(NSError *_Nullable)error;
|
||||
|
||||
@end
|
||||
|
||||
@interface CIMService : NSObject
|
||||
|
||||
+ (CIMService *)instance;
|
||||
|
||||
@property (nonatomic, readonly) BOOL isConnected;
|
||||
|
||||
/**
|
||||
指示由于网络原因导致连接断开是否自动重连,reconnection = YES 自动重连,reconnection = NO 不自动重连;
|
||||
默认reconnection = YES;
|
||||
重连逻辑受reconnectionTimeInterval和reconnectionMaxCount影响;
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL reconnection;
|
||||
|
||||
/**
|
||||
当reconnection = YES时自动重连的时间间隔,默认reconnectionTimeInterval=1.0 单位:秒;
|
||||
*/
|
||||
@property (nonatomic, assign) NSTimeInterval reconnectionTimeInterval;
|
||||
|
||||
/**
|
||||
当reconnection = YES时自动重连的最大次数,默认reconnectionMaxCount=3;
|
||||
*/
|
||||
@property (nonatomic, assign) NSInteger reconnectionMaxCount;
|
||||
|
||||
/**
|
||||
配置IM服务器
|
||||
*/
|
||||
- (void)configHost:(NSString *)host onPort:(NSInteger)port;
|
||||
|
||||
/**
|
||||
连接到host:port对应的服务器
|
||||
*/
|
||||
- (void)connection;
|
||||
|
||||
/**
|
||||
绑定userId,需要更具isConnected判断当前连接的状态;
|
||||
如果isConnected=NO需要先调用[[CIMService instance] connection],等到连接成功后再调用[[CIMService instance] bindUserId:];
|
||||
如果isConnected=YES,可直接调用[[CIMService instance] bindUserId:];
|
||||
*/
|
||||
- (void)bindUserId:(NSString *)userId;
|
||||
|
||||
/**
|
||||
添加消息监听回调,(可添加多个)不同时记得Remove
|
||||
*/
|
||||
- (void)addMessageObserver:(id<CIMPeerMessageObserver>)observer;
|
||||
|
||||
/**
|
||||
移除监听
|
||||
*/
|
||||
- (void)removeMessageObserver:(id<CIMPeerMessageObserver>)observer;
|
||||
|
||||
/**
|
||||
添加连接状态监听回调,(可添加多个)不同时记得Remove
|
||||
*/
|
||||
- (void)addConnectionObserver:(id<CIMConnectionObserver>)observer;
|
||||
|
||||
/**
|
||||
移除监听
|
||||
*/
|
||||
- (void)removeConnectionObserver:(id<CIMConnectionObserver>)observer;
|
||||
|
||||
/**
|
||||
退出后台 断开连接
|
||||
*/
|
||||
- (void)enterBackground;
|
||||
|
||||
/**
|
||||
进入前台重新连接
|
||||
*/
|
||||
- (void)enterForeground;
|
||||
|
||||
/**
|
||||
重新连接
|
||||
*/
|
||||
- (void)reconnect;
|
||||
|
||||
/**
|
||||
断开连接
|
||||
*/
|
||||
- (void)disconnect;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -1,417 +0,0 @@
|
||||
//
|
||||
// CIMService.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/9/4.
|
||||
//
|
||||
//
|
||||
|
||||
#import "CIMService.h"
|
||||
#import "CIMSignalService.h"
|
||||
#import "SentBody.pbobjc.h"
|
||||
#import "ReplyBody.pbobjc.h"
|
||||
#import "Message.pbobjc.h"
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "CIMWeakProxy.h"
|
||||
|
||||
@interface CIMService ()<CIMSignalServiceDelegate>
|
||||
|
||||
@property (nonatomic, strong) CIMSignalService *signalService;
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray<CIMConnectionObserver> *connectionObservers;
|
||||
@property (nonatomic, strong) NSMutableArray<CIMPeerMessageObserver> *messageObservers;
|
||||
|
||||
@property (nonatomic, assign) BOOL manualDisconnect;
|
||||
|
||||
@property (nonatomic, assign) NSInteger reconnectionCount;
|
||||
|
||||
@property (nonatomic, strong) NSTimer *reconnectionTimer;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CIMService
|
||||
|
||||
static CIMService *SINGLETON = nil;
|
||||
|
||||
static bool isFirstAccess = YES;
|
||||
|
||||
#pragma mark - Public Method
|
||||
|
||||
+ (id)instance {
|
||||
static dispatch_once_t onceToken;
|
||||
|
||||
dispatch_once(&onceToken, ^{
|
||||
isFirstAccess = NO;
|
||||
SINGLETON = [[super allocWithZone:NULL] init];
|
||||
});
|
||||
return SINGLETON;
|
||||
}
|
||||
|
||||
#pragma mark - Life Cycle
|
||||
|
||||
+ (id)allocWithZone:(NSZone *)zone {
|
||||
return [self instance];
|
||||
}
|
||||
|
||||
- (id)copy {
|
||||
return [[CIMService alloc] init];
|
||||
}
|
||||
|
||||
- (id)mutableCopy {
|
||||
return [[CIMService alloc] init];
|
||||
}
|
||||
|
||||
- (id)init {
|
||||
if (SINGLETON) {
|
||||
return SINGLETON;
|
||||
}
|
||||
|
||||
if (isFirstAccess) {
|
||||
[self doesNotRecognizeSelector:_cmd];
|
||||
}
|
||||
|
||||
self = [super init];
|
||||
|
||||
self.reconnection = YES;
|
||||
self.reconnectionTimeInterval = 1.0;
|
||||
self.reconnectionMaxCount = 3;
|
||||
self.reconnectionCount = 0;
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - connectionObservers
|
||||
- (NSMutableArray<CIMConnectionObserver> *)connectionObservers {
|
||||
if (!_connectionObservers) {
|
||||
_connectionObservers = [[NSMutableArray<CIMConnectionObserver> alloc] init];
|
||||
}
|
||||
|
||||
return _connectionObservers;
|
||||
}
|
||||
|
||||
- (void)addConnectionObserver:(id<CIMConnectionObserver>)observer {
|
||||
NSValue *value = [NSValue valueWithNonretainedObject:observer];
|
||||
|
||||
if (![self.connectionObservers containsObject:value]) {
|
||||
[self.connectionObservers addObject:value];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeConnectionObserver:(id<CIMConnectionObserver>)observer {
|
||||
NSValue *value = [NSValue valueWithNonretainedObject:observer];
|
||||
|
||||
if ([self.connectionObservers containsObject:value]) {
|
||||
[self.connectionObservers removeObject:value];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - messageObservers
|
||||
- (NSMutableArray<CIMPeerMessageObserver> *)messageObservers {
|
||||
if (!_messageObservers) {
|
||||
_messageObservers = [[NSMutableArray<CIMPeerMessageObserver> alloc] init];
|
||||
}
|
||||
|
||||
return _messageObservers;
|
||||
}
|
||||
|
||||
- (void)addMessageObserver:(id<CIMPeerMessageObserver>)observer {
|
||||
NSValue *value = [NSValue valueWithNonretainedObject:observer];
|
||||
|
||||
if (![self.messageObservers containsObject:value]) {
|
||||
[self.messageObservers addObject:value];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)removeMessageObserver:(id<CIMPeerMessageObserver>)observer {
|
||||
NSValue *value = [NSValue valueWithNonretainedObject:observer];
|
||||
|
||||
if ([self.messageObservers containsObject:value]) {
|
||||
[self.messageObservers removeObject:value];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - signalService
|
||||
|
||||
- (CIMSignalService *)signalService {
|
||||
if (!_signalService) {
|
||||
_signalService = [[CIMSignalService alloc] init];
|
||||
_signalService.delegate = self;
|
||||
}
|
||||
|
||||
return _signalService;
|
||||
}
|
||||
|
||||
#pragma mark - CIMSignalServiceDelegate
|
||||
|
||||
/**
|
||||
* 将要开始连接
|
||||
**/
|
||||
- (void)signalServiceWillConnect:(CIMSignalService *)signalService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始连接时出错
|
||||
**/
|
||||
- (void)signalServiceWillConnect:(CIMSignalService *)signalService error:(NSError *)error {
|
||||
[self handlerConnectError:error];
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接成功
|
||||
**/
|
||||
- (void)signalServiceConnectSuccess:(CIMSignalService *)signalService {
|
||||
self.manualDisconnect = NO;
|
||||
self.reconnectionCount = 0;
|
||||
[self handlerConnectSuccess];
|
||||
}
|
||||
|
||||
/**
|
||||
* 连接断开
|
||||
**/
|
||||
- (void)signalServiceDidDisconnect:(CIMSignalService *)signalService error:(NSError *)error {
|
||||
if (!self.manualDisconnect && self.reconnection && self.reconnectionCount < self.reconnectionMaxCount) {
|
||||
//如果非手动断开连接 并且 需要自动重连 并且 reconnectionCount < reconnectionMaxCount
|
||||
[self startReconnectionTimer];
|
||||
} else {
|
||||
[self handlerConnectClose];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 收到新包
|
||||
**/
|
||||
- (void)signalService:(CIMSignalService *)signalService receivePacket:(CIMSignalPacket *)packet {
|
||||
switch (packet.tag) {
|
||||
case CIMSignalPacketTypePing:{
|
||||
NSLog(@"receive Ping");
|
||||
CIMSignalPacket *pongSignalPacket = [self createPongPacket];
|
||||
[self.signalService sendSignalPacket:pongSignalPacket];
|
||||
break;
|
||||
}
|
||||
|
||||
case CIMSignalPacketTypeMessage:{
|
||||
NSLog(@"receive Message");
|
||||
NSError *error;
|
||||
|
||||
MessageModel *messgae = [[MessageModel alloc] initWithData:packet.packetBody error:&error];
|
||||
|
||||
if (!error) {
|
||||
//返回消息
|
||||
CIMMessageModel *messageModel = [[CIMMessageModel alloc] init];
|
||||
messageModel.id_p = messgae.id_p;
|
||||
messageModel.title = messgae.title;
|
||||
messageModel.action = messgae.action;
|
||||
messageModel.timestamp = messgae.timestamp;
|
||||
messageModel.extra = messgae.extra;
|
||||
messageModel.format = messgae.format;
|
||||
messageModel.sender = messgae.sender;
|
||||
messageModel.content = messgae.content;
|
||||
messageModel.receiver = messgae.receiver;
|
||||
[self handlerMessage:messageModel];
|
||||
} else {
|
||||
[self handlerMessageError:packet.packetBody];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case CIMSignalPacketTypeReplyBody:{
|
||||
NSLog(@"receive ReplyBody");
|
||||
NSError *error;
|
||||
ReplyBodyModel *replyBodyModel = [[ReplyBodyModel alloc] initWithData:packet.packetBody error:&error];
|
||||
|
||||
if (!error) {
|
||||
[self handlerBindUser:[@"200" isEqualToString:replyBodyModel.code]];
|
||||
} else {
|
||||
[self handlerBindUser:NO];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
default:{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
- (void)startReconnectionTimer {
|
||||
[self stopReconnectionTimer];
|
||||
self.reconnectionTimer = [NSTimer timerWithTimeInterval:self.reconnectionTimeInterval target:[CIMWeakProxy proxyWithTarget:self] selector:@selector(reconnectionTimerHandler) userInfo:nil repeats:NO];
|
||||
[NSRunLoop.mainRunLoop addTimer:self.reconnectionTimer forMode:NSRunLoopCommonModes];
|
||||
}
|
||||
|
||||
- (void)stopReconnectionTimer {
|
||||
if (self.reconnectionTimer) {
|
||||
[self.reconnectionTimer invalidate];
|
||||
self.reconnectionTimer = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)reconnectionTimerHandler {
|
||||
self.reconnectionCount += 1;
|
||||
[self handlerDidReconnection:self.reconnectionCount];
|
||||
[self connection];
|
||||
}
|
||||
|
||||
#pragma mark - public
|
||||
|
||||
- (void)configHost:(NSString *)host onPort:(NSInteger)port {
|
||||
CIMSignalServiceConfig *config = [[CIMSignalServiceConfig alloc] init];
|
||||
|
||||
config.host = host;
|
||||
config.port = port;
|
||||
self.signalService.serviceConfig = config;
|
||||
}
|
||||
|
||||
- (void)connection {
|
||||
if (self.signalService.isConnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
[self.signalService connect];
|
||||
}
|
||||
|
||||
- (void)bindUserId:(NSString *)userId {
|
||||
if (self.signalService.isConnected) {
|
||||
CIMSignalPacket *clientBindPacket = [self createClientBindPacketWithUserId:userId];
|
||||
[self.signalService sendSignalPacket:clientBindPacket];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)enterBackground {
|
||||
[self disconnect];
|
||||
}
|
||||
|
||||
- (void)enterForeground {
|
||||
[self reconnect];
|
||||
}
|
||||
|
||||
- (void)reconnect {
|
||||
[self connection];
|
||||
}
|
||||
|
||||
- (void)disconnect {
|
||||
if (self.signalService.isConnected) {
|
||||
self.manualDisconnect = YES;
|
||||
[self stopReconnectionTimer];
|
||||
[self.signalService close];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
- (void)handlerConnectSuccess {
|
||||
for (NSValue *value in self.messageObservers) {
|
||||
id<CIMConnectionObserver> ob = [value nonretainedObjectValue];
|
||||
|
||||
if ([ob respondsToSelector:@selector(cimDidConnectSuccess)]) {
|
||||
[ob cimDidConnectSuccess];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handlerDidReconnection:(NSInteger)count {
|
||||
for (NSValue *value in self.connectionObservers) {
|
||||
id<CIMConnectionObserver> ob = [value nonretainedObjectValue];
|
||||
|
||||
if ([ob respondsToSelector:@selector(cimDidReconnection:)]) {
|
||||
[ob cimDidReconnection:count];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handlerConnectClose {
|
||||
for (NSValue *value in self.connectionObservers) {
|
||||
id<CIMConnectionObserver> ob = [value nonretainedObjectValue];
|
||||
|
||||
if ([ob respondsToSelector:@selector(cimDidConnectClose)]) {
|
||||
[ob cimDidConnectClose];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handlerConnectError:(NSError *)error {
|
||||
for (NSValue *value in self.messageObservers) {
|
||||
id<CIMConnectionObserver> ob = [value nonretainedObjectValue];
|
||||
|
||||
if ([ob respondsToSelector:@selector(cimDidConnectError:)]) {
|
||||
[ob cimDidConnectError:error];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handlerMessageError:(NSData *)data {
|
||||
for (NSValue *value in self.messageObservers) {
|
||||
id<CIMPeerMessageObserver> ob = [value nonretainedObjectValue];
|
||||
|
||||
if ([ob respondsToSelector:@selector(cimHandleMessageError:)]) {
|
||||
[ob cimHandleMessageError:data];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handlerMessage:(CIMMessageModel *)message {
|
||||
for (NSValue *value in self.messageObservers) {
|
||||
id<CIMPeerMessageObserver> ob = [value nonretainedObjectValue];
|
||||
|
||||
if ([ob respondsToSelector:@selector(cimHandleMessage:)]) {
|
||||
[ob cimHandleMessage:message];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)handlerBindUser:(BOOL)bindSuccess {
|
||||
for (NSValue *value in self.connectionObservers) {
|
||||
id<CIMConnectionObserver> ob = [value nonretainedObjectValue];
|
||||
|
||||
if ([ob respondsToSelector:@selector(cimDidBindUserSuccess:)]) {
|
||||
[ob cimDidBindUserSuccess:bindSuccess];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (CIMSignalPacket *)createClientBindPacketWithUserId:(NSString *)userId {
|
||||
SentBodyModel *clientBindBody = [SentBodyModel new];
|
||||
|
||||
clientBindBody.key = @"client_bind";
|
||||
clientBindBody.timestamp = (int64_t)[NSDate timeIntervalSinceReferenceDate] * 1000;
|
||||
clientBindBody.data_p[@"uid"] = userId;
|
||||
clientBindBody.data_p[@"deviceId"] = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
|
||||
clientBindBody.data_p[@"channel"] = @"ios";
|
||||
|
||||
clientBindBody.data_p[@"deviceName"] = [[UIDevice currentDevice] name];
|
||||
|
||||
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
|
||||
clientBindBody.data_p[@"appVersion"] = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
|
||||
|
||||
clientBindBody.data_p[@"osVersion"] = [[UIDevice currentDevice] systemVersion];
|
||||
|
||||
NSArray<NSString *> *languages = [NSLocale preferredLanguages];
|
||||
clientBindBody.data_p[@"language"] = [languages firstObject];
|
||||
NSData *bodyData = clientBindBody.data;
|
||||
|
||||
CIMSignalPacket *clientBindPacket = [[CIMSignalPacket alloc] init];
|
||||
clientBindPacket.tag = CIMSignalPacketTypeSentBody;
|
||||
clientBindPacket.bodyLength = bodyData.length;
|
||||
clientBindPacket.packetBody = bodyData;
|
||||
|
||||
return clientBindPacket;
|
||||
}
|
||||
|
||||
- (CIMSignalPacket *)createPongPacket {
|
||||
CIMSignalPacket *pongPacket = [[CIMSignalPacket alloc] init];
|
||||
|
||||
pongPacket.tag = CIMSignalPacketTypePong;
|
||||
|
||||
NSString *pong = @"PONG";
|
||||
const char *pongChar = [pong cStringUsingEncoding:NSASCIIStringEncoding];
|
||||
UInt16 lenght = pong.length;
|
||||
NSData *bodyData = [NSData dataWithBytes:pongChar length:lenght];
|
||||
|
||||
pongPacket.bodyLength = bodyData.length;
|
||||
pongPacket.packetBody = bodyData;
|
||||
return pongPacket;
|
||||
}
|
||||
|
||||
@end
|
@ -1,30 +0,0 @@
|
||||
//
|
||||
// CIMSignalPacket.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/9/3.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
extern UInt8 const CIMSIGNAL_PACKET_HEAD_SIZE;
|
||||
|
||||
typedef NS_ENUM(UInt8, CIMSignalPacketType) {
|
||||
CIMSignalPacketTypePong = 0, //PONG
|
||||
CIMSignalPacketTypePing = 1, //PING
|
||||
CIMSignalPacketTypeMessage = 2, //Message
|
||||
CIMSignalPacketTypeSentBody = 3, //SentBody
|
||||
CIMSignalPacketTypeReplyBody = 4, //ReplyBody
|
||||
};
|
||||
|
||||
@interface CIMSignalPacket : NSObject
|
||||
|
||||
@property (nonatomic, assign) CIMSignalPacketType tag;
|
||||
@property (nonatomic, assign) UInt16 bodyLength;
|
||||
@property (nonatomic, strong) NSData *packetBody;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -1,14 +0,0 @@
|
||||
//
|
||||
// CIMSignalPacket.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/9/3.
|
||||
//
|
||||
|
||||
#import "CIMSignalPacket.h"
|
||||
|
||||
UInt8 const CIMSIGNAL_PACKET_HEAD_SIZE = 3;
|
||||
|
||||
@implementation CIMSignalPacket
|
||||
|
||||
@end
|
@ -1,65 +0,0 @@
|
||||
//
|
||||
// CIMSignalService.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/9/2.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "CIMSignalPacket.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CIMSignalServiceConfig : NSObject
|
||||
|
||||
@property (nonatomic, copy) NSString *host;
|
||||
@property (nonatomic, assign) NSInteger port;
|
||||
|
||||
@end
|
||||
|
||||
@class CIMSignalService;
|
||||
@protocol CIMSignalServiceDelegate <NSObject>
|
||||
|
||||
/**
|
||||
* 将要开始连接
|
||||
**/
|
||||
- (void)signalServiceWillConnect:(CIMSignalService *)signalService;
|
||||
|
||||
/**
|
||||
* 开始连接时出错
|
||||
**/
|
||||
- (void)signalServiceWillConnect:(CIMSignalService *)signalService error:(NSError *)error;
|
||||
|
||||
/**
|
||||
* 连接成功
|
||||
**/
|
||||
- (void)signalServiceConnectSuccess:(CIMSignalService *)signalService;
|
||||
|
||||
/**
|
||||
* 连接断开
|
||||
**/
|
||||
- (void)signalServiceDidDisconnect:(CIMSignalService *)signalService error:(NSError *)error;
|
||||
|
||||
/**
|
||||
* 收到新包
|
||||
**/
|
||||
- (void)signalService:(CIMSignalService *)signalService receivePacket:(CIMSignalPacket *)packet;
|
||||
|
||||
@end
|
||||
|
||||
@interface CIMSignalService : NSObject
|
||||
|
||||
@property (nonatomic, weak) id<CIMSignalServiceDelegate> delegate;
|
||||
|
||||
@property (nonatomic, strong) CIMSignalServiceConfig *serviceConfig;
|
||||
|
||||
@property (nonatomic, readonly) BOOL isConnected;
|
||||
|
||||
- (void)connect;
|
||||
|
||||
- (void)close;
|
||||
|
||||
- (void)sendSignalPacket:(CIMSignalPacket *)signalPacket;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -1,129 +0,0 @@
|
||||
//
|
||||
// CIMSignalService.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/9/2.
|
||||
//
|
||||
|
||||
#import "CIMSignalService.h"
|
||||
#import "GCDAsyncSocket.h"
|
||||
#import "CIMSignalServiceBuffer.h"
|
||||
#import "KCLDataWriter.h"
|
||||
|
||||
@implementation CIMSignalServiceConfig
|
||||
|
||||
@end
|
||||
|
||||
@interface CIMSignalService ()<GCDAsyncSocketDelegate, CIMSignalServiceBufferDelegate>
|
||||
|
||||
@property (nonatomic, strong) NSLock *signalBufferLock;
|
||||
|
||||
@property (nonatomic, strong) CIMSignalServiceBuffer *signalBuffer;
|
||||
|
||||
@property (nonatomic, strong) GCDAsyncSocket *socket;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CIMSignalService
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
|
||||
if (self) {
|
||||
self.socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:dispatch_queue_create("SignalServiceQueue", NULL)];
|
||||
|
||||
self.signalBufferLock = [[NSLock alloc]init];
|
||||
|
||||
self.signalBuffer = [[CIMSignalServiceBuffer alloc] init];
|
||||
self.signalBuffer.delegate = self;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (BOOL)isConnected {
|
||||
return self.socket.isConnected;
|
||||
}
|
||||
|
||||
- (void)connect {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(signalServiceWillConnect:)]) {
|
||||
[self.delegate signalServiceWillConnect:self];
|
||||
}
|
||||
|
||||
NSError *error;
|
||||
[self.socket connectToHost:self.serviceConfig.host onPort:self.serviceConfig.port withTimeout:15 error:&error];
|
||||
|
||||
if (error) {
|
||||
//NSLog(@"connect error:%@", error);
|
||||
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(signalServiceWillConnect:error:)]) {
|
||||
[self.delegate signalServiceWillConnect:self error:error];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)close {
|
||||
[self.socket disconnect];
|
||||
}
|
||||
|
||||
- (void)sendSignalPacket:(CIMSignalPacket *)signalPacket {
|
||||
KCLDataWriter *dataWriter = [KCLDataWriter writerWithData:[[NSMutableData alloc] init]];
|
||||
|
||||
[dataWriter writeByte:signalPacket.tag];
|
||||
[dataWriter writeUInt16:signalPacket.bodyLength];
|
||||
|
||||
if (signalPacket) {
|
||||
[dataWriter writeBytes:signalPacket.packetBody];
|
||||
}
|
||||
|
||||
[self.socket writeData:dataWriter.data withTimeout:30 tag:0];
|
||||
}
|
||||
|
||||
#pragma mark - GCDAsyncSocketDelegate
|
||||
- (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port {
|
||||
//NSLog(@"%s", __FUNCTION__);
|
||||
[self.signalBufferLock lock];
|
||||
[self.signalBuffer clear];
|
||||
[self.signalBufferLock unlock];
|
||||
[sock readDataWithTimeout:-1 tag:0];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(signalServiceConnectSuccess:)]) {
|
||||
[self.delegate signalServiceConnectSuccess:self];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
- (void)socketDidDisconnect:(GCDAsyncSocket *)sock withError:(NSError *)error {
|
||||
//NSLog(@"%s", __FUNCTION__);
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(signalServiceDidDisconnect:error:)]) {
|
||||
[self.delegate signalServiceDidDisconnect:self error:error];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
- (void)socket:(GCDAsyncSocket *)sock didWriteDataWithTag:(long)tag {
|
||||
//NSLog(@"%s", __FUNCTION__);
|
||||
[sock readDataWithTimeout:-1 tag:0];
|
||||
}
|
||||
|
||||
- (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag {
|
||||
//NSLog(@"%s", __FUNCTION__);
|
||||
[self.signalBufferLock lock];
|
||||
[self.signalBuffer appendData:data];
|
||||
[self.signalBufferLock unlock];
|
||||
|
||||
[sock readDataWithTimeout:-1 tag:0];
|
||||
}
|
||||
|
||||
#pragma mark - CIMSignalServiceBufferDelegate
|
||||
|
||||
- (void)signalServiceBuffer:(CIMSignalServiceBuffer *)signalServiceBuffer receiveSignalPacket:(CIMSignalPacket *)signalPacket {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(signalService:receivePacket:)]) {
|
||||
[self.delegate signalService:self receivePacket:signalPacket];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@end
|
@ -1,29 +0,0 @@
|
||||
//
|
||||
// CIMSignalServiceBuffer.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/9/3.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "CIMSignalPacket.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class CIMSignalServiceBuffer;
|
||||
@protocol CIMSignalServiceBufferDelegate <NSObject>
|
||||
|
||||
- (void)signalServiceBuffer:(CIMSignalServiceBuffer *)signalServiceBuffer receiveSignalPacket:(CIMSignalPacket *)signalPacket;
|
||||
|
||||
@end
|
||||
|
||||
@interface CIMSignalServiceBuffer : NSObject
|
||||
|
||||
@property (nonatomic, weak) id <CIMSignalServiceBufferDelegate> delegate;
|
||||
|
||||
- (void)appendData:(NSData *)data;
|
||||
|
||||
- (void)clear;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -1,86 +0,0 @@
|
||||
//
|
||||
// CIMSignalServiceBuffer.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/9/3.
|
||||
//
|
||||
|
||||
#import "CIMSignalServiceBuffer.h"
|
||||
|
||||
@interface CIMSignalServiceBuffer ()
|
||||
|
||||
@property (nonatomic, strong) NSMutableData *byteDatas;
|
||||
|
||||
@end
|
||||
|
||||
@implementation CIMSignalServiceBuffer
|
||||
|
||||
- (instancetype)init {
|
||||
self = [super init];
|
||||
|
||||
if (self) {
|
||||
self.byteDatas = [[NSMutableData alloc] init];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)appendData:(NSData *)data {
|
||||
[self.byteDatas appendData:data];
|
||||
|
||||
BOOL hasPacket = YES;
|
||||
|
||||
while (hasPacket) {
|
||||
@autoreleasepool {
|
||||
if (CIMSIGNAL_PACKET_HEAD_SIZE <= self.byteDatas.length) {
|
||||
NSData *headData = [self.byteDatas subdataWithRange:NSMakeRange(0, CIMSIGNAL_PACKET_HEAD_SIZE)];
|
||||
uint8_t *ptr = (uint8_t *)headData.bytes;
|
||||
uint64_t _poz = 0;
|
||||
|
||||
uint8_t tag = *(uint8_t *)ptr;
|
||||
_poz += sizeof(uint8_t);
|
||||
|
||||
uint16_t bodyLength = *(uint16_t *)(ptr + _poz);
|
||||
_poz += sizeof(uint16_t);
|
||||
|
||||
UInt32 packetSize = CIMSIGNAL_PACKET_HEAD_SIZE + bodyLength;
|
||||
|
||||
if (packetSize <= self.byteDatas.length) {
|
||||
NSData *packetBody = [self.byteDatas subdataWithRange:NSMakeRange(CIMSIGNAL_PACKET_HEAD_SIZE, bodyLength)];
|
||||
|
||||
CIMSignalPacket *signalPacket = [[CIMSignalPacket alloc] init];
|
||||
signalPacket.tag = tag;
|
||||
signalPacket.bodyLength = bodyLength;
|
||||
signalPacket.packetBody = packetBody;
|
||||
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(signalServiceBuffer:receiveSignalPacket:)]) {
|
||||
[self.delegate signalServiceBuffer:self receiveSignalPacket:signalPacket];
|
||||
}
|
||||
|
||||
NSMutableData *newByteDatas = [self subdata:self.byteDatas loc:packetSize length:self.byteDatas.length - packetSize];
|
||||
self.byteDatas = newByteDatas;
|
||||
hasPacket = YES;
|
||||
} else {
|
||||
hasPacket = NO;
|
||||
}
|
||||
} else {
|
||||
hasPacket = NO;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)clear {
|
||||
@autoreleasepool {
|
||||
self.byteDatas = [[NSMutableData alloc] init];
|
||||
}
|
||||
}
|
||||
|
||||
- (NSMutableData *)subdata:(NSMutableData *)data loc:(NSUInteger)loc length:(NSUInteger)len {
|
||||
NSRange subRange = NSMakeRange(loc, len);
|
||||
NSMutableData *newByteDatas = [[NSMutableData alloc] initWithData:[data subdataWithRange:subRange]];
|
||||
|
||||
return newByteDatas;
|
||||
}
|
||||
|
||||
@end
|
@ -1,89 +0,0 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: Message.proto
|
||||
|
||||
// This CPP symbol can be defined to use imports that match up to the framework
|
||||
// imports needed when using CocoaPods.
|
||||
#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
|
||||
#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
|
||||
#endif
|
||||
|
||||
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
|
||||
#import <Protobuf/GPBProtocolBuffers.h>
|
||||
#else
|
||||
#import "GPBProtocolBuffers.h"
|
||||
#endif
|
||||
|
||||
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
|
||||
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||
#endif
|
||||
#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
|
||||
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||
#endif
|
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
CF_EXTERN_C_BEGIN
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#pragma mark - MessageRoot
|
||||
|
||||
/**
|
||||
* Exposes the extension registry for this file.
|
||||
*
|
||||
* The base class provides:
|
||||
* @code
|
||||
* + (GPBExtensionRegistry *)extensionRegistry;
|
||||
* @endcode
|
||||
* which is a @c GPBExtensionRegistry that includes all the extensions defined by
|
||||
* this file and all files that it depends on.
|
||||
**/
|
||||
@interface MessageRoot : GPBRootObject
|
||||
@end
|
||||
|
||||
#pragma mark - Model
|
||||
|
||||
typedef GPB_ENUM(MessageModel_FieldNumber) {
|
||||
MessageModel_FieldNumber_Id_p = 1,
|
||||
MessageModel_FieldNumber_Action = 2,
|
||||
MessageModel_FieldNumber_Content = 3,
|
||||
MessageModel_FieldNumber_Sender = 4,
|
||||
MessageModel_FieldNumber_Receiver = 5,
|
||||
MessageModel_FieldNumber_Extra = 6,
|
||||
MessageModel_FieldNumber_Title = 7,
|
||||
MessageModel_FieldNumber_Format = 8,
|
||||
MessageModel_FieldNumber_Timestamp = 9,
|
||||
};
|
||||
|
||||
@interface MessageModel : GPBMessage
|
||||
|
||||
@property(nonatomic, readwrite) int64_t id_p;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *action;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *content;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *sender;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *receiver;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *extra;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *title;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *format;
|
||||
|
||||
@property(nonatomic, readwrite) int64_t timestamp;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
CF_EXTERN_C_END
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -1,181 +0,0 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: Message.proto
|
||||
|
||||
// This CPP symbol can be defined to use imports that match up to the framework
|
||||
// imports needed when using CocoaPods.
|
||||
#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
|
||||
#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
|
||||
#endif
|
||||
|
||||
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
|
||||
#import <Protobuf/GPBProtocolBuffers_RuntimeSupport.h>
|
||||
#else
|
||||
#import "GPBProtocolBuffers_RuntimeSupport.h"
|
||||
#endif
|
||||
|
||||
#import "Message.pbobjc.h"
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
#pragma mark - MessageRoot
|
||||
|
||||
@implementation MessageRoot
|
||||
|
||||
// No extensions in the file and no imports, so no need to generate
|
||||
// +extensionRegistry.
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - MessageRoot_FileDescriptor
|
||||
|
||||
static GPBFileDescriptor *MessageRoot_FileDescriptor(void) {
|
||||
// This is called by +initialize so there is no need to worry
|
||||
// about thread safety of the singleton.
|
||||
static GPBFileDescriptor *descriptor = NULL;
|
||||
if (!descriptor) {
|
||||
GPB_DEBUG_CHECK_RUNTIME_VERSIONS();
|
||||
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@""
|
||||
syntax:GPBFileSyntaxProto3];
|
||||
}
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
#pragma mark - Model
|
||||
|
||||
@implementation MessageModel
|
||||
|
||||
@dynamic id_p;
|
||||
@dynamic action;
|
||||
@dynamic content;
|
||||
@dynamic sender;
|
||||
@dynamic receiver;
|
||||
@dynamic extra;
|
||||
@dynamic title;
|
||||
@dynamic format;
|
||||
@dynamic timestamp;
|
||||
|
||||
typedef struct Model__storage_ {
|
||||
uint32_t _has_storage_[1];
|
||||
NSString *action;
|
||||
NSString *content;
|
||||
NSString *sender;
|
||||
NSString *receiver;
|
||||
NSString *extra;
|
||||
NSString *title;
|
||||
NSString *format;
|
||||
int64_t id_p;
|
||||
int64_t timestamp;
|
||||
} Model__storage_;
|
||||
|
||||
// This method is threadsafe because it is initially called
|
||||
// in +initialize for each subclass.
|
||||
+ (GPBDescriptor *)descriptor {
|
||||
static GPBDescriptor *descriptor = nil;
|
||||
if (!descriptor) {
|
||||
static GPBMessageFieldDescription fields[] = {
|
||||
{
|
||||
.name = "id_p",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Id_p,
|
||||
.hasIndex = 0,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, id_p),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeInt64,
|
||||
},
|
||||
{
|
||||
.name = "action",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Action,
|
||||
.hasIndex = 1,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, action),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "content",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Content,
|
||||
.hasIndex = 2,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, content),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "sender",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Sender,
|
||||
.hasIndex = 3,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, sender),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "receiver",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Receiver,
|
||||
.hasIndex = 4,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, receiver),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "extra",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Extra,
|
||||
.hasIndex = 5,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, extra),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "title",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Title,
|
||||
.hasIndex = 6,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, title),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "format",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Format,
|
||||
.hasIndex = 7,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, format),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "timestamp",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Timestamp,
|
||||
.hasIndex = 8,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, timestamp),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeInt64,
|
||||
},
|
||||
};
|
||||
GPBDescriptor *localDescriptor =
|
||||
[GPBDescriptor allocDescriptorForClass:[MessageModel class]
|
||||
rootClass:[MessageRoot class]
|
||||
file:MessageRoot_FileDescriptor()
|
||||
fields:fields
|
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||
storageSize:sizeof(Model__storage_)
|
||||
flags:GPBDescriptorInitializationFlag_None];
|
||||
#if defined(DEBUG) && DEBUG
|
||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||
#endif // DEBUG
|
||||
descriptor = localDescriptor;
|
||||
}
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -1,79 +0,0 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: ReplyBody.proto
|
||||
|
||||
// This CPP symbol can be defined to use imports that match up to the framework
|
||||
// imports needed when using CocoaPods.
|
||||
#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
|
||||
#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
|
||||
#endif
|
||||
|
||||
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
|
||||
#import <Protobuf/GPBProtocolBuffers.h>
|
||||
#else
|
||||
#import "GPBProtocolBuffers.h"
|
||||
#endif
|
||||
|
||||
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
|
||||
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||
#endif
|
||||
#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
|
||||
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||
#endif
|
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
CF_EXTERN_C_BEGIN
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#pragma mark - ReplyBodyRoot
|
||||
|
||||
/**
|
||||
* Exposes the extension registry for this file.
|
||||
*
|
||||
* The base class provides:
|
||||
* @code
|
||||
* + (GPBExtensionRegistry *)extensionRegistry;
|
||||
* @endcode
|
||||
* which is a @c GPBExtensionRegistry that includes all the extensions defined by
|
||||
* this file and all files that it depends on.
|
||||
**/
|
||||
@interface ReplyBodyRoot : GPBRootObject
|
||||
@end
|
||||
|
||||
#pragma mark - Model
|
||||
|
||||
typedef GPB_ENUM(ReplyBodyModel_FieldNumber) {
|
||||
ReplyBodyModel_FieldNumber_Key = 1,
|
||||
ReplyBodyModel_FieldNumber_Code = 2,
|
||||
ReplyBodyModel_FieldNumber_Message = 3,
|
||||
ReplyBodyModel_FieldNumber_Timestamp = 4,
|
||||
ReplyBodyModel_FieldNumber_Data_p = 5,
|
||||
};
|
||||
|
||||
@interface ReplyBodyModel : GPBMessage
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *key;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *code;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *message;
|
||||
|
||||
@property(nonatomic, readwrite) int64_t timestamp;
|
||||
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableDictionary<NSString*, NSString*> *data_p;
|
||||
/** The number of items in @c data_p without causing the array to be created. */
|
||||
@property(nonatomic, readonly) NSUInteger data_p_Count;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
CF_EXTERN_C_END
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -1,137 +0,0 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: ReplyBody.proto
|
||||
|
||||
// This CPP symbol can be defined to use imports that match up to the framework
|
||||
// imports needed when using CocoaPods.
|
||||
#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
|
||||
#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
|
||||
#endif
|
||||
|
||||
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
|
||||
#import <Protobuf/GPBProtocolBuffers_RuntimeSupport.h>
|
||||
#else
|
||||
#import "GPBProtocolBuffers_RuntimeSupport.h"
|
||||
#endif
|
||||
|
||||
#import "ReplyBody.pbobjc.h"
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
#pragma mark - ReplyBodyRoot
|
||||
|
||||
@implementation ReplyBodyRoot
|
||||
|
||||
// No extensions in the file and no imports, so no need to generate
|
||||
// +extensionRegistry.
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - ReplyBodyRoot_FileDescriptor
|
||||
|
||||
static GPBFileDescriptor *ReplyBodyRoot_FileDescriptor(void) {
|
||||
// This is called by +initialize so there is no need to worry
|
||||
// about thread safety of the singleton.
|
||||
static GPBFileDescriptor *descriptor = NULL;
|
||||
if (!descriptor) {
|
||||
GPB_DEBUG_CHECK_RUNTIME_VERSIONS();
|
||||
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@""
|
||||
syntax:GPBFileSyntaxProto3];
|
||||
}
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
#pragma mark - Model
|
||||
|
||||
@implementation ReplyBodyModel
|
||||
|
||||
@dynamic key;
|
||||
@dynamic code;
|
||||
@dynamic message;
|
||||
@dynamic timestamp;
|
||||
@dynamic data_p, data_p_Count;
|
||||
|
||||
typedef struct Model__storage_ {
|
||||
uint32_t _has_storage_[1];
|
||||
NSString *key;
|
||||
NSString *code;
|
||||
NSString *message;
|
||||
NSMutableDictionary *data_p;
|
||||
int64_t timestamp;
|
||||
} Model__storage_;
|
||||
|
||||
// This method is threadsafe because it is initially called
|
||||
// in +initialize for each subclass.
|
||||
+ (GPBDescriptor *)descriptor {
|
||||
static GPBDescriptor *descriptor = nil;
|
||||
if (!descriptor) {
|
||||
static GPBMessageFieldDescription fields[] = {
|
||||
{
|
||||
.name = "key",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = ReplyBodyModel_FieldNumber_Key,
|
||||
.hasIndex = 0,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, key),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "code",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = ReplyBodyModel_FieldNumber_Code,
|
||||
.hasIndex = 1,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, code),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "message",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = ReplyBodyModel_FieldNumber_Message,
|
||||
.hasIndex = 2,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, message),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "timestamp",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = ReplyBodyModel_FieldNumber_Timestamp,
|
||||
.hasIndex = 3,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, timestamp),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeInt64,
|
||||
},
|
||||
{
|
||||
.name = "data_p",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = ReplyBodyModel_FieldNumber_Data_p,
|
||||
.hasIndex = GPBNoHasBit,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, data_p),
|
||||
.flags = GPBFieldMapKeyString,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
};
|
||||
GPBDescriptor *localDescriptor =
|
||||
[GPBDescriptor allocDescriptorForClass:[ReplyBodyModel class]
|
||||
rootClass:[ReplyBodyRoot class]
|
||||
file:ReplyBodyRoot_FileDescriptor()
|
||||
fields:fields
|
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||
storageSize:sizeof(Model__storage_)
|
||||
flags:GPBDescriptorInitializationFlag_None];
|
||||
#if defined(DEBUG) && DEBUG
|
||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||
#endif // DEBUG
|
||||
descriptor = localDescriptor;
|
||||
}
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -1,73 +0,0 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: SentBody.proto
|
||||
|
||||
// This CPP symbol can be defined to use imports that match up to the framework
|
||||
// imports needed when using CocoaPods.
|
||||
#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
|
||||
#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
|
||||
#endif
|
||||
|
||||
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
|
||||
#import <Protobuf/GPBProtocolBuffers.h>
|
||||
#else
|
||||
#import "GPBProtocolBuffers.h"
|
||||
#endif
|
||||
|
||||
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
|
||||
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||
#endif
|
||||
#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
|
||||
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||
#endif
|
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
CF_EXTERN_C_BEGIN
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#pragma mark - SentBodyRoot
|
||||
|
||||
/**
|
||||
* Exposes the extension registry for this file.
|
||||
*
|
||||
* The base class provides:
|
||||
* @code
|
||||
* + (GPBExtensionRegistry *)extensionRegistry;
|
||||
* @endcode
|
||||
* which is a @c GPBExtensionRegistry that includes all the extensions defined by
|
||||
* this file and all files that it depends on.
|
||||
**/
|
||||
@interface SentBodyRoot : GPBRootObject
|
||||
@end
|
||||
|
||||
#pragma mark - Model
|
||||
|
||||
typedef GPB_ENUM(Model_FieldNumber) {
|
||||
Model_FieldNumber_Key = 1,
|
||||
Model_FieldNumber_Timestamp = 2,
|
||||
Model_FieldNumber_Data_p = 3,
|
||||
};
|
||||
|
||||
@interface SentBodyModel : GPBMessage
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *key;
|
||||
|
||||
@property(nonatomic, readwrite) int64_t timestamp;
|
||||
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableDictionary<NSString*, NSString*> *data_p;
|
||||
/** The number of items in @c data_p without causing the array to be created. */
|
||||
@property(nonatomic, readonly) NSUInteger data_p_Count;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
CF_EXTERN_C_END
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -1,118 +0,0 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: SentBody.proto
|
||||
|
||||
// This CPP symbol can be defined to use imports that match up to the framework
|
||||
// imports needed when using CocoaPods.
|
||||
#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
|
||||
#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
|
||||
#endif
|
||||
|
||||
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
|
||||
#import <Protobuf/GPBProtocolBuffers_RuntimeSupport.h>
|
||||
#else
|
||||
#import "GPBProtocolBuffers_RuntimeSupport.h"
|
||||
#endif
|
||||
|
||||
#import "SentBody.pbobjc.h"
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
#pragma mark - SentBodyRoot
|
||||
|
||||
@implementation SentBodyRoot
|
||||
|
||||
// No extensions in the file and no imports, so no need to generate
|
||||
// +extensionRegistry.
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - SentBodyRoot_FileDescriptor
|
||||
|
||||
static GPBFileDescriptor *SentBodyRoot_FileDescriptor(void) {
|
||||
// This is called by +initialize so there is no need to worry
|
||||
// about thread safety of the singleton.
|
||||
static GPBFileDescriptor *descriptor = NULL;
|
||||
if (!descriptor) {
|
||||
GPB_DEBUG_CHECK_RUNTIME_VERSIONS();
|
||||
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@""
|
||||
syntax:GPBFileSyntaxProto3];
|
||||
}
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
#pragma mark - Model
|
||||
|
||||
@implementation SentBodyModel
|
||||
|
||||
@dynamic key;
|
||||
@dynamic timestamp;
|
||||
@dynamic data_p, data_p_Count;
|
||||
|
||||
typedef struct Model__storage_ {
|
||||
uint32_t _has_storage_[1];
|
||||
NSString *key;
|
||||
NSMutableDictionary *data_p;
|
||||
int64_t timestamp;
|
||||
} Model__storage_;
|
||||
|
||||
// This method is threadsafe because it is initially called
|
||||
// in +initialize for each subclass.
|
||||
+ (GPBDescriptor *)descriptor {
|
||||
static GPBDescriptor *descriptor = nil;
|
||||
if (!descriptor) {
|
||||
static GPBMessageFieldDescription fields[] = {
|
||||
{
|
||||
.name = "key",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = Model_FieldNumber_Key,
|
||||
.hasIndex = 0,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, key),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "timestamp",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = Model_FieldNumber_Timestamp,
|
||||
.hasIndex = 1,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, timestamp),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeInt64,
|
||||
},
|
||||
{
|
||||
.name = "data_p",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = Model_FieldNumber_Data_p,
|
||||
.hasIndex = GPBNoHasBit,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, data_p),
|
||||
.flags = GPBFieldMapKeyString,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
GPBDescriptor *localDescriptor =
|
||||
[GPBDescriptor allocDescriptorForClass:[SentBodyModel class]
|
||||
rootClass:[SentBodyRoot class]
|
||||
file:SentBodyRoot_FileDescriptor()
|
||||
fields:fields
|
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||
storageSize:sizeof(Model__storage_)
|
||||
flags:GPBDescriptorInitializationFlag_None];
|
||||
#if defined(DEBUG) && DEBUG
|
||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||
#endif // DEBUG
|
||||
descriptor = localDescriptor;
|
||||
}
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -1,21 +0,0 @@
|
||||
//
|
||||
// CIMWeakProxy.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/9/14.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CIMWeakProxy : NSProxy
|
||||
|
||||
@property (weak, readonly, nullable, nonatomic) id target;
|
||||
|
||||
- (nonnull instancetype)initWithTarget:(nonnull id)target;
|
||||
+ (nonnull instancetype)proxyWithTarget:(nonnull id)target;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -1,79 +0,0 @@
|
||||
//
|
||||
// CIMWeakProxy.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/9/14.
|
||||
//
|
||||
|
||||
#import "CIMWeakProxy.h"
|
||||
|
||||
@implementation CIMWeakProxy
|
||||
|
||||
- (instancetype)initWithTarget:(id)target {
|
||||
_target = target;
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype)proxyWithTarget:(id)target {
|
||||
return [[CIMWeakProxy alloc] initWithTarget:target];
|
||||
}
|
||||
|
||||
- (id)forwardingTargetForSelector:(SEL)selector {
|
||||
return _target;
|
||||
}
|
||||
|
||||
- (void)forwardInvocation:(NSInvocation *)invocation {
|
||||
void *null = NULL;
|
||||
|
||||
[invocation setReturnValue:&null];
|
||||
}
|
||||
|
||||
- (NSMethodSignature *)methodSignatureForSelector:(SEL)selector {
|
||||
return [NSObject instanceMethodSignatureForSelector:@selector(init)];
|
||||
}
|
||||
|
||||
- (BOOL)respondsToSelector:(SEL)aSelector {
|
||||
return [_target respondsToSelector:aSelector];
|
||||
}
|
||||
|
||||
- (BOOL)isEqual:(id)object {
|
||||
return [_target isEqual:object];
|
||||
}
|
||||
|
||||
- (NSUInteger)hash {
|
||||
return [_target hash];
|
||||
}
|
||||
|
||||
- (Class)superclass {
|
||||
return [_target superclass];
|
||||
}
|
||||
|
||||
- (Class)class {
|
||||
return [_target class];
|
||||
}
|
||||
|
||||
- (BOOL)isKindOfClass:(Class)aClass {
|
||||
return [_target isKindOfClass:aClass];
|
||||
}
|
||||
|
||||
- (BOOL)isMemberOfClass:(Class)aClass {
|
||||
return [_target isMemberOfClass:aClass];
|
||||
}
|
||||
|
||||
- (BOOL)conformsToProtocol:(Protocol *)aProtocol {
|
||||
return [_target conformsToProtocol:aProtocol];
|
||||
}
|
||||
|
||||
- (BOOL)isProxy {
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSString *)description {
|
||||
return [_target description];
|
||||
}
|
||||
|
||||
- (NSString *)debugDescription {
|
||||
return [_target debugDescription];
|
||||
}
|
||||
|
||||
@end
|
@ -1,33 +0,0 @@
|
||||
//
|
||||
// KCLDataReader.h
|
||||
// TeachingClient
|
||||
//
|
||||
// Created by Chentao on 2017/4/27.
|
||||
// Copyright © 2017年 Chentao. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface KCLDataReader : NSObject
|
||||
|
||||
@property (nonatomic, assign) uint64_t poz;
|
||||
@property (nonatomic, strong, readonly) NSData *data;
|
||||
|
||||
+ (instancetype)readerWithData:(NSData *)data;
|
||||
- (instancetype)initWithData:(NSData *)data;
|
||||
|
||||
- (NSData *)readBytes:(uint64_t)len;
|
||||
- (int32_t)readInt32;
|
||||
- (int64_t)readInt64;
|
||||
- (int16_t)readInt16;
|
||||
- (uint32_t)readUInt32;
|
||||
- (uint64_t)readUInt64;
|
||||
- (uint16_t)readUInt16;
|
||||
- (char)readByte;
|
||||
- (BOOL)readBool;
|
||||
- (NSString *)readString;
|
||||
- (NSData *)readPrefixedBytes;
|
||||
- (float)readFloat;
|
||||
- (double)readDouble;
|
||||
|
||||
@end
|
@ -1,123 +0,0 @@
|
||||
//
|
||||
// KCLDataReader.m
|
||||
// TeachingClient
|
||||
//
|
||||
// Created by Chentao on 2017/4/27.
|
||||
// Copyright © 2017年 Chentao. All rights reserved.
|
||||
//
|
||||
|
||||
#import "KCLDataReader.h"
|
||||
|
||||
@implementation KCLDataReader {
|
||||
char *_pointer;
|
||||
}
|
||||
|
||||
+ (instancetype)readerWithData:(NSData *)data {
|
||||
return [[KCLDataReader alloc] initWithData:data];
|
||||
}
|
||||
|
||||
- (instancetype)initWithData:(NSData *)data {
|
||||
self = [super init];
|
||||
|
||||
if (!self || !data) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
_data = data;
|
||||
_pointer = (char *)data.bytes;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSData *)readBytes:(uint64_t)len {
|
||||
if (!len) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSData *data = [_data subdataWithRange:NSMakeRange(_poz, len)];
|
||||
_poz += len;
|
||||
return data;
|
||||
}
|
||||
|
||||
- (NSData *)readPrefixedBytes {
|
||||
uint32_t len = [self readUInt32];
|
||||
|
||||
return [self readBytes:len];
|
||||
}
|
||||
|
||||
- (int32_t)readInt32 {
|
||||
char *ptr = _pointer + _poz;
|
||||
|
||||
_poz += sizeof(int32_t);
|
||||
return *(int32_t *)ptr;
|
||||
}
|
||||
|
||||
- (int64_t)readInt64 {
|
||||
char *ptr = _pointer + _poz;
|
||||
|
||||
_poz += sizeof(int64_t);
|
||||
return *(int64_t *)ptr;
|
||||
}
|
||||
|
||||
- (int16_t)readInt16 {
|
||||
char *ptr = _pointer + _poz;
|
||||
|
||||
_poz += sizeof(int16_t);
|
||||
return *(int16_t *)ptr;
|
||||
}
|
||||
|
||||
- (uint32_t)readUInt32 {
|
||||
char *ptr = _pointer + _poz;
|
||||
|
||||
_poz += sizeof(uint32_t);
|
||||
return *(uint32_t *)ptr;
|
||||
}
|
||||
|
||||
- (uint64_t)readUInt64 {
|
||||
char *ptr = _pointer + _poz;
|
||||
|
||||
_poz += sizeof(uint64_t);
|
||||
return *(uint64_t *)ptr;
|
||||
}
|
||||
|
||||
- (uint16_t)readUInt16 {
|
||||
char *ptr = _pointer + _poz;
|
||||
|
||||
_poz += sizeof(uint16_t);
|
||||
return *(uint16_t *)ptr;
|
||||
}
|
||||
|
||||
- (char)readByte {
|
||||
char *ptr = _pointer + _poz;
|
||||
|
||||
_poz += sizeof(char);
|
||||
return *(char *)ptr;
|
||||
}
|
||||
|
||||
- (BOOL)readBool {
|
||||
char *ptr = _pointer + _poz;
|
||||
|
||||
_poz += sizeof(BOOL);
|
||||
return *(BOOL *)ptr;
|
||||
}
|
||||
|
||||
- (float)readFloat {
|
||||
char *ptr = _pointer + _poz;
|
||||
|
||||
_poz += sizeof(float);
|
||||
return *(float *)ptr;
|
||||
}
|
||||
|
||||
- (double)readDouble {
|
||||
char *ptr = _pointer + _poz;
|
||||
|
||||
_poz += sizeof(double);
|
||||
return *(double *)ptr;
|
||||
}
|
||||
|
||||
- (NSString *)readString {
|
||||
NSData *data = [self readPrefixedBytes];
|
||||
|
||||
return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
|
||||
}
|
||||
|
||||
@end
|
@ -1,34 +0,0 @@
|
||||
//
|
||||
// KCLDataWriter.h
|
||||
// TeachingClient
|
||||
//
|
||||
// Created by Chentao on 2017/4/27.
|
||||
// Copyright © 2017年 Chentao. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface KCLDataWriter : NSObject
|
||||
|
||||
@property (nonatomic, strong, readonly) NSMutableData *data;
|
||||
|
||||
+ (instancetype)writerWithData:(NSMutableData *)data;
|
||||
- (instancetype)initWithData:(NSMutableData *)data;
|
||||
|
||||
- (void)writeBytes:(NSData *)bytes;
|
||||
- (void)writeBytes:(const char *)rawBytes length:(uint32_t)length;
|
||||
- (void)writePrefixedBytes:(NSData *)data;
|
||||
- (void)writeInt32:(int32_t)value;
|
||||
- (void)writeInt64:(int64_t)value;
|
||||
- (void)writeInt16:(int16_t)value;
|
||||
- (void)writeUInt32:(uint32_t)value;
|
||||
- (void)writeUInt64:(uint64_t)value;
|
||||
- (void)writeUInt16:(uint16_t)value;
|
||||
- (void)writeByte:(char)byte;
|
||||
- (void)writeBool:(BOOL)value;
|
||||
- (void)writeString:(NSString *)str;
|
||||
- (void)writeFloat:(float)value;
|
||||
- (void)writeDouble:(double)value;
|
||||
|
||||
|
||||
@end
|
@ -1,90 +0,0 @@
|
||||
//
|
||||
// KCLDataWriter.m
|
||||
// TeachingClient
|
||||
//
|
||||
// Created by Chentao on 2017/4/27.
|
||||
// Copyright © 2017年 Chentao. All rights reserved.
|
||||
//
|
||||
|
||||
#import "KCLDataWriter.h"
|
||||
|
||||
@implementation KCLDataWriter
|
||||
|
||||
|
||||
+ (instancetype)writerWithData:(NSMutableData *)data {
|
||||
return [[KCLDataWriter alloc] initWithData:data];
|
||||
}
|
||||
|
||||
- (instancetype)initWithData:(NSMutableData *)data {
|
||||
self = [super init];
|
||||
|
||||
if (!self || !data) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
_data = data;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)writeBytes:(NSData *)bytes {
|
||||
if (bytes.length) {
|
||||
[_data appendData:bytes];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)writeBytes:(const char *)rawBytes length:(uint32_t)length {
|
||||
if (length) {
|
||||
[_data appendBytes:rawBytes length:length];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)writePrefixedBytes:(NSData *)data {
|
||||
[self writeUInt32:(uint32_t)data.length];
|
||||
[self writeBytes:data];
|
||||
}
|
||||
|
||||
- (void)writeInt32:(int32_t)value {
|
||||
[self writeBytes:(const char *)&value length:sizeof(int32_t)];
|
||||
}
|
||||
|
||||
- (void)writeInt64:(int64_t)value {
|
||||
[self writeBytes:(const char *)&value length:sizeof(int64_t)];
|
||||
}
|
||||
|
||||
- (void)writeInt16:(int16_t)value {
|
||||
[self writeBytes:(const char *)&value length:sizeof(int16_t)];
|
||||
}
|
||||
|
||||
- (void)writeUInt32:(uint32_t)value {
|
||||
[self writeBytes:(const char *)&value length:sizeof(uint32_t)];
|
||||
}
|
||||
|
||||
- (void)writeUInt64:(uint64_t)value {
|
||||
[self writeBytes:(const char *)&value length:sizeof(uint64_t)];
|
||||
}
|
||||
|
||||
- (void)writeUInt16:(uint16_t)value {
|
||||
[self writeBytes:(const char *)&value length:sizeof(uint16_t)];
|
||||
}
|
||||
|
||||
- (void)writeByte:(char)byte {
|
||||
[self writeBytes:(const char *)&byte length:sizeof(char)];
|
||||
}
|
||||
|
||||
- (void)writeBool:(BOOL)value {
|
||||
[self writeByte:value ? 1 : 0];
|
||||
}
|
||||
|
||||
- (void)writeString:(NSString *)str {
|
||||
[self writePrefixedBytes:[str dataUsingEncoding:NSUTF8StringEncoding]];
|
||||
}
|
||||
|
||||
- (void)writeFloat:(float)value {
|
||||
[self writeBytes:(const char *)&value length:sizeof(float)];
|
||||
}
|
||||
|
||||
- (void)writeDouble:(double)value {
|
||||
[self writeBytes:(const char *)&value length:sizeof(double)];
|
||||
}
|
||||
|
||||
@end
|
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>UIApplicationSceneManifest</key>
|
||||
<dict>
|
||||
<key>UIApplicationSupportsMultipleScenes</key>
|
||||
<false/>
|
||||
<key>UISceneConfigurations</key>
|
||||
<dict>
|
||||
<key>UIWindowSceneSessionRoleApplication</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>UISceneConfigurationName</key>
|
||||
<string>Default Configuration</string>
|
||||
<key>UISceneDelegateClassName</key>
|
||||
<string>SceneDelegate</string>
|
||||
<key>UISceneStoryboardFile</key>
|
||||
<string>Main</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
@ -1,15 +0,0 @@
|
||||
//
|
||||
// SceneDelegate.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/8/31.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow * window;
|
||||
|
||||
@end
|
||||
|
@ -1,57 +0,0 @@
|
||||
//
|
||||
// SceneDelegate.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/8/31.
|
||||
//
|
||||
|
||||
#import "SceneDelegate.h"
|
||||
|
||||
@interface SceneDelegate ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation SceneDelegate
|
||||
|
||||
|
||||
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
|
||||
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
|
||||
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
|
||||
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
|
||||
}
|
||||
|
||||
|
||||
- (void)sceneDidDisconnect:(UIScene *)scene {
|
||||
// Called as the scene is being released by the system.
|
||||
// This occurs shortly after the scene enters the background, or when its session is discarded.
|
||||
// Release any resources associated with this scene that can be re-created the next time the scene connects.
|
||||
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
|
||||
}
|
||||
|
||||
|
||||
- (void)sceneDidBecomeActive:(UIScene *)scene {
|
||||
// Called when the scene has moved from an inactive state to an active state.
|
||||
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
|
||||
}
|
||||
|
||||
|
||||
- (void)sceneWillResignActive:(UIScene *)scene {
|
||||
// Called when the scene will move from an active state to an inactive state.
|
||||
// This may occur due to temporary interruptions (ex. an incoming phone call).
|
||||
}
|
||||
|
||||
|
||||
- (void)sceneWillEnterForeground:(UIScene *)scene {
|
||||
// Called as the scene transitions from the background to the foreground.
|
||||
// Use this method to undo the changes made on entering the background.
|
||||
}
|
||||
|
||||
|
||||
- (void)sceneDidEnterBackground:(UIScene *)scene {
|
||||
// Called as the scene transitions from the foreground to the background.
|
||||
// Use this method to save data, release shared resources, and store enough scene-specific state information
|
||||
// to restore the scene back to its current state.
|
||||
}
|
||||
|
||||
|
||||
@end
|
@ -1,14 +0,0 @@
|
||||
//
|
||||
// ViewController.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/8/31.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface ViewController : UIViewController
|
||||
|
||||
|
||||
@end
|
||||
|
@ -1,106 +0,0 @@
|
||||
//
|
||||
// ViewController.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/8/31.
|
||||
//
|
||||
|
||||
#import "ViewController.h"
|
||||
#import "CIMService.h"
|
||||
|
||||
@interface ViewController ()<CIMConnectionObserver, CIMPeerMessageObserver>
|
||||
|
||||
@property (nonatomic, strong) UIButton *addObserverButton;
|
||||
|
||||
@property (nonatomic, strong) UIButton *removeObserverButton;
|
||||
|
||||
@property (nonatomic, strong) UIButton *connectButton;
|
||||
|
||||
@property (nonatomic, strong) UIButton *closeButton;
|
||||
|
||||
@end
|
||||
|
||||
@implementation ViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
[[CIMService instance] configHost:@"120.53.221.43" onPort:23456];
|
||||
|
||||
self.addObserverButton = [[UIButton alloc] initWithFrame:CGRectMake(50, 100, 150, 50)];
|
||||
self.addObserverButton.backgroundColor = [UIColor grayColor];
|
||||
[self.addObserverButton addTarget:self action:@selector(addObserverButtonHandler) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.addObserverButton setTitle:@"addObserver" forState:UIControlStateNormal];
|
||||
[self.view addSubview:self.addObserverButton];
|
||||
|
||||
self.removeObserverButton = [[UIButton alloc] initWithFrame:CGRectMake(220, 100, 150, 50)];
|
||||
self.removeObserverButton.backgroundColor = [UIColor grayColor];
|
||||
[self.removeObserverButton addTarget:self action:@selector(removeObserverButtonHandler) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.removeObserverButton setTitle:@"removeObserver" forState:UIControlStateNormal];
|
||||
[self.view addSubview:self.removeObserverButton];
|
||||
|
||||
self.connectButton = [[UIButton alloc] initWithFrame:CGRectMake(50, 170, 150, 50)];
|
||||
self.connectButton.backgroundColor = [UIColor grayColor];
|
||||
[self.connectButton addTarget:self action:@selector(connectButtonHandler) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.connectButton setTitle:@"connec" forState:UIControlStateNormal];
|
||||
[self.view addSubview:self.connectButton];
|
||||
|
||||
self.closeButton = [[UIButton alloc] initWithFrame:CGRectMake(220, 170, 150, 50)];
|
||||
self.closeButton.backgroundColor = [UIColor grayColor];
|
||||
[self.closeButton addTarget:self action:@selector(closeButtonHandler) forControlEvents:UIControlEventTouchUpInside];
|
||||
[self.closeButton setTitle:@"close" forState:UIControlStateNormal];
|
||||
[self.view addSubview:self.closeButton];
|
||||
}
|
||||
|
||||
- (void)addObserverButtonHandler {
|
||||
[[CIMService instance] addConnectionObserver:self];
|
||||
[[CIMService instance] addMessageObserver:self];
|
||||
}
|
||||
|
||||
- (void)removeObserverButtonHandler {
|
||||
[[CIMService instance] removeConnectionObserver:self];
|
||||
[[CIMService instance] removeMessageObserver:self];
|
||||
}
|
||||
|
||||
- (void)connectButtonHandler {
|
||||
[[CIMService instance] connection];
|
||||
}
|
||||
|
||||
- (void)closeButtonHandler {
|
||||
[[CIMService instance] disconnect];
|
||||
}
|
||||
|
||||
#pragma mark - CIMConnectionObserver
|
||||
|
||||
- (void)cimDidBindUserSuccess:(BOOL)bindSuccess {
|
||||
NSLog(@"%s",__FUNCTION__);
|
||||
}
|
||||
|
||||
- (void)cimDidConnectSuccess {
|
||||
[[CIMService instance] bindUserId:@"2222"];
|
||||
NSLog(@"%s",__FUNCTION__);
|
||||
}
|
||||
|
||||
- (void)cimDidReconnection:(NSInteger)reconnectionCount {
|
||||
NSLog(@"reconnection count:%@", @(reconnectionCount));
|
||||
}
|
||||
|
||||
- (void)cimDidConnectClose {
|
||||
NSLog(@"%s",__FUNCTION__);
|
||||
}
|
||||
|
||||
- (void)cimDidConnectError:(NSError *_Nullable)error {
|
||||
NSLog(@"%s",__FUNCTION__);
|
||||
}
|
||||
|
||||
#pragma mark - CIMPeerMessageObserver
|
||||
|
||||
- (void)cimHandleMessage:(CIMMessageModel *_Nonnull)msg {
|
||||
NSLog(@"%s",__FUNCTION__);
|
||||
}
|
||||
|
||||
- (void)cimHandleMessageError:(NSData *_Nonnull)data {
|
||||
NSLog(@"%s",__FUNCTION__);
|
||||
}
|
||||
|
||||
@end
|
@ -1,18 +0,0 @@
|
||||
//
|
||||
// main.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Chentao on 2022/8/31.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "AppDelegate.h"
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
NSString * appDelegateClassName;
|
||||
@autoreleasepool {
|
||||
// Setup code that might create autoreleased objects goes here.
|
||||
appDelegateClassName = NSStringFromClass([AppDelegate class]);
|
||||
}
|
||||
return UIApplicationMain(argc, argv, nil, appDelegateClassName);
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
# Uncomment the next line to define a global platform for your project
|
||||
# platform :ios, '9.0'
|
||||
|
||||
target 'CIMKit' do
|
||||
# Comment the next line if you don't want to use dynamic frameworks
|
||||
use_frameworks!
|
||||
|
||||
# Pods for CIMKit
|
||||
pod 'Protobuf', '~> 3.21.5'
|
||||
pod "CocoaAsyncSocket", '~> 7.6.5'
|
||||
|
||||
|
||||
end
|
2
cim-client-sdk/cim-ios-oc-sdk/README.txt
Normal file
2
cim-client-sdk/cim-ios-oc-sdk/README.txt
Normal file
@ -0,0 +1,2 @@
|
||||
仓库地址:https://gitee.com/farsunset/cim-ios-sdk
|
||||
在线文档:https://www.yuque.com/yuanfangxiyang/ma4ytb/sg6lg4
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "self:">
|
||||
</FileRef>
|
||||
</Workspace>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>BundleSDK.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>9</integer>
|
||||
</dict>
|
||||
<key>CIMKit.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>7</integer>
|
||||
</dict>
|
||||
<key>CimKit.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>8</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>SchemeUserState</key>
|
||||
<dict>
|
||||
<key>BundleSDK.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>CIMKit.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
<key>CimKit.xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
@ -1,10 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:CIMKit.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:Pods/Pods.xcodeproj">
|
||||
</FileRef>
|
||||
</Workspace>
|
@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IDEDidComputeMac32BitWarning</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
Binary file not shown.
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Bucket
|
||||
uuid = "738DD480-4B9A-428F-9E08-217C62231C5A"
|
||||
type = "0"
|
||||
version = "2.0">
|
||||
<Breakpoints>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.ExceptionBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "31134BDC-4640-4F6F-88B2-50F52FC3C0F6"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
breakpointStackSelectionBehavior = "1"
|
||||
scope = "1"
|
||||
stopOnStyle = "0">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
</Bucket>
|
Binary file not shown.
@ -1,16 +0,0 @@
|
||||
//
|
||||
// AViewController.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/19.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface AViewController : UIViewController
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -1,41 +0,0 @@
|
||||
//
|
||||
// AViewController.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/19.
|
||||
//
|
||||
|
||||
#import "AViewController.h"
|
||||
#import "CIMService.h"
|
||||
|
||||
@interface AViewController ()<CIMPeerMessageObserver>
|
||||
|
||||
@end
|
||||
|
||||
@implementation AViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view.
|
||||
|
||||
self.view.backgroundColor = UIColor.whiteColor;
|
||||
|
||||
[[CIMService instance] addMessageObserver:self];
|
||||
}
|
||||
|
||||
|
||||
- (void)cimhandleMessage:(CIMMessageModel *)msg{
|
||||
NSLog(@"AViewController:%@",msg.content);
|
||||
}
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
@ -1,15 +0,0 @@
|
||||
//
|
||||
// AppDelegate.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/7.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface AppDelegate : UIResponder <UIApplicationDelegate>
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
@ -1,47 +0,0 @@
|
||||
//
|
||||
// AppDelegate.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/7.
|
||||
//
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "CIMHeader.h"
|
||||
@interface AppDelegate ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
// Override point for customization after application launch.
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application{
|
||||
[[CIMService instance] enterBackground];
|
||||
}
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application{
|
||||
[[CIMService instance] enterForeground];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - UISceneSession lifecycle
|
||||
|
||||
|
||||
- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
|
||||
// Called when a new scene session is being created.
|
||||
// Use this method to select a configuration to create the new scene with.
|
||||
return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
|
||||
}
|
||||
|
||||
|
||||
- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {
|
||||
// Called when the user discards a scene session.
|
||||
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
|
||||
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
|
||||
}
|
||||
|
||||
|
||||
@end
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"colors" : [
|
||||
{
|
||||
"idiom" : "universal"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@ -1,98 +0,0 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "2x",
|
||||
"size" : "60x60"
|
||||
},
|
||||
{
|
||||
"idiom" : "iphone",
|
||||
"scale" : "3x",
|
||||
"size" : "60x60"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "20x20"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "29x29"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "40x40"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "1x",
|
||||
"size" : "76x76"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "76x76"
|
||||
},
|
||||
{
|
||||
"idiom" : "ipad",
|
||||
"scale" : "2x",
|
||||
"size" : "83.5x83.5"
|
||||
},
|
||||
{
|
||||
"idiom" : "ios-marketing",
|
||||
"scale" : "1x",
|
||||
"size" : "1024x1024"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
{
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="EHf-IW-A2E">
|
||||
<objects>
|
||||
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53" y="375"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--View Controller-->
|
||||
<scene sceneID="tne-QT-ifu">
|
||||
<objects>
|
||||
<viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
|
||||
<viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
</scene>
|
||||
</scenes>
|
||||
</document>
|
@ -1,23 +0,0 @@
|
||||
//
|
||||
// CIMHeader.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/13.
|
||||
//
|
||||
|
||||
#ifndef CIMHeader_h
|
||||
#define CIMHeader_h
|
||||
|
||||
|
||||
#import "GCDAsyncSocket.h"
|
||||
#import "SentBody.pbobjc.h"
|
||||
#import "Message.pbobjc.h"
|
||||
#import "NSData+IM.h"
|
||||
#import "NSString+IM.h"
|
||||
|
||||
#import "CIMSendMessageData.h"
|
||||
#import "CIMService.h"
|
||||
|
||||
|
||||
|
||||
#endif /* CIMHeader_h */
|
@ -1,50 +0,0 @@
|
||||
//
|
||||
// CIMMessageDeCode.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/13.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "CIMService.h"
|
||||
#import "GCDAsyncSocket.h"
|
||||
#import "SentBody.pbobjc.h"
|
||||
#import "Message.pbobjc.h"
|
||||
#import "NSData+IM.h"
|
||||
#import "NSString+IM.h"
|
||||
#import "CIMSendMessageData.h"
|
||||
#import "ReplyBody.pbobjc.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
typedef enum CIMMessageType: NSUInteger {
|
||||
CIMMessageTypeC_H_RS = 0,//客户端心跳响应
|
||||
CIMMessageTypeS_H_RQ,//服务端心跳请求
|
||||
CIMMessageTypeMESSAGE,//服务端推送的消息
|
||||
CIMMessageTypeSENT_BODY,//客户端发送的sentBody请求
|
||||
CIMMessageTypeREPLY_BODY//sentBody请求的异步响应replyBody
|
||||
} CIMMessageType;
|
||||
|
||||
|
||||
@interface CIMMessageHandler : NSObject
|
||||
|
||||
/// 处理服务数据
|
||||
/// @param data data description
|
||||
-(void)doCode:(nullable NSData *)data socket:(GCDAsyncSocket *)sock;
|
||||
|
||||
-(void)addPeerMessageObservers:(id<CIMPeerMessageObserver>)objects;
|
||||
-(void)addConnectionObservers:(id<CIMConnectionObserver>)objects;
|
||||
-(void)removePeerMessageObservers:(id<CIMPeerMessageObserver>)objects;
|
||||
-(void)removeConnectionObservers:(id<CIMConnectionObserver>)objects;
|
||||
|
||||
-(void)handlerMessage:(CIMMessageModel *)message;
|
||||
-(void)handlerMessageError:(NSData *)data;
|
||||
-(void)handlerBindUser:(BOOL)bindSuccess;
|
||||
|
||||
-(void)handlerConnectSuccess;
|
||||
-(void)handlerConnectClose;
|
||||
-(void)handlerConnectError:(NSError *)error;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -1,228 +0,0 @@
|
||||
//
|
||||
// CIMMessageDeCode.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by Siter By:750692607@qq.com on 2020/11/13.
|
||||
//
|
||||
|
||||
#import "CIMMessageHandler.h"
|
||||
|
||||
|
||||
@interface CIMMessageHandler()
|
||||
|
||||
@property(strong,nonatomic)NSData * data;
|
||||
|
||||
@property(strong,nonatomic)NSMutableArray * connectionObservers;
|
||||
@property(strong,nonatomic)NSMutableArray * messageObservers;
|
||||
|
||||
@property(copy,nonatomic)NSString *mainQueueLabel;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation CIMMessageHandler
|
||||
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
const char *label = dispatch_queue_get_label(dispatch_get_main_queue());
|
||||
self.mainQueueLabel = label ? [[NSString alloc] initWithUTF8String:label] : @"";
|
||||
self.connectionObservers = [NSMutableArray array];
|
||||
self.messageObservers = [NSMutableArray array];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
/// 处理服务数据
|
||||
/// @param data data description
|
||||
-(void)doCode:(nullable NSData *)data socket:(GCDAsyncSocket *)sock{
|
||||
self.data = data;
|
||||
//TLV格式
|
||||
int allDateLenght = [self getMessageVauleLenght] + 3;
|
||||
do {
|
||||
[sock readDataWithTimeout:-1 tag:0];
|
||||
} while (self.data.length != allDateLenght);
|
||||
|
||||
NSData *headTagData = [data subdataWithRange:NSMakeRange(0, 1)];//取得头部数据
|
||||
CIMMessageType messageType = (CIMMessageType)[headTagData convertDataToHexStr].integerValue;
|
||||
|
||||
//心跳包请求
|
||||
if(messageType == CIMMessageTypeS_H_RQ){
|
||||
[sock writeData:[CIMSendMessageData initHeartbeatData] withTimeout:-1 tag:0];
|
||||
return;
|
||||
}
|
||||
//绑定异步回调
|
||||
if(messageType == CIMMessageTypeREPLY_BODY){
|
||||
|
||||
NSData * messageData = [data subdataWithRange:NSMakeRange(3, [self getMessageVauleLenght])];
|
||||
|
||||
NSError * error;
|
||||
|
||||
ReplyBodyModel * replyBodyModel = [[ReplyBodyModel alloc] initWithData:messageData error:&error];
|
||||
if(!error){
|
||||
[self handlerBindUser:[replyBodyModel.code isEqualToString:@"200"]];
|
||||
}else{
|
||||
[self handlerBindUser:NO];
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
//服务端消息
|
||||
if(messageType == CIMMessageTypeMESSAGE){
|
||||
|
||||
NSData * messageData = [data subdataWithRange:NSMakeRange(3, [self getMessageVauleLenght])];
|
||||
|
||||
NSError * error;
|
||||
|
||||
MessageModel * messgae = [[MessageModel alloc] initWithData:messageData error:&error];
|
||||
|
||||
if(!error){
|
||||
//返回消息
|
||||
[self handlerMessage:[CIMMessageModel initWithProtoMdoel:messgae]];
|
||||
}else{
|
||||
[self handlerMessageError:data];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#pragma mark Observe methods
|
||||
-(void)handlerConnectSuccess{
|
||||
[self runOnMainThread:^{
|
||||
for (NSValue *value in self.messageObservers) {
|
||||
id<CIMConnectionObserver> ob = [value nonretainedObjectValue];
|
||||
if ([ob respondsToSelector:@selector(cimDidConnectSuccess)]) {
|
||||
[ob cimDidConnectSuccess];
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
|
||||
-(void)handlerConnectError:(NSError *)error{
|
||||
[self runOnMainThread:^{
|
||||
for (NSValue *value in self.messageObservers) {
|
||||
id<CIMConnectionObserver> ob = [value nonretainedObjectValue];
|
||||
if ([ob respondsToSelector:@selector(cimDidConnectError:)]) {
|
||||
[ob cimDidConnectError:error];
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)handlerMessage:(CIMMessageModel *)message{
|
||||
[self runOnMainThread:^{
|
||||
for (NSValue *value in self.messageObservers) {
|
||||
id<CIMPeerMessageObserver> ob = [value nonretainedObjectValue];
|
||||
if ([ob respondsToSelector:@selector(cimHandleMessage:)]) {
|
||||
[ob cimHandleMessage:message];
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)handlerMessageError:(NSData *)data{
|
||||
[self runOnMainThread:^{
|
||||
for (NSValue *value in self.messageObservers) {
|
||||
id<CIMPeerMessageObserver> ob = [value nonretainedObjectValue];
|
||||
if ([ob respondsToSelector:@selector(cimHandleMessageError:)]) {
|
||||
[ob cimHandleMessageError:data];
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
-(void)handlerConnectClose{
|
||||
[self runOnMainThread:^{
|
||||
for (NSValue *value in self.connectionObservers) {//Fix:connectionObservers
|
||||
id<CIMConnectionObserver> ob = [value nonretainedObjectValue];
|
||||
if ([ob respondsToSelector:@selector(cimDidConnectClose)]) {
|
||||
[ob cimDidConnectClose];
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)handlerBindUser:(BOOL)bindSuccess{
|
||||
[self runOnMainThread:^{
|
||||
for (NSValue *value in self.connectionObservers) {
|
||||
id<CIMConnectionObserver> ob = [value nonretainedObjectValue];
|
||||
if ([ob respondsToSelector:@selector(cimDidBindUserSuccess:)]) {
|
||||
[ob cimDidBindUserSuccess:bindSuccess];
|
||||
}
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)addPeerMessageObservers:(id<CIMPeerMessageObserver>)objects{
|
||||
NSValue *value = [NSValue valueWithNonretainedObject:objects];
|
||||
if (![self.messageObservers containsObject:value]) {
|
||||
[self.messageObservers addObject:value];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)addConnectionObservers:(id<CIMConnectionObserver>)objects{
|
||||
NSValue *value = [NSValue valueWithNonretainedObject:objects];
|
||||
if (![self.connectionObservers containsObject:value]) {
|
||||
[self.connectionObservers addObject:value];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)removePeerMessageObservers:(id<CIMPeerMessageObserver>)objects{
|
||||
NSValue *value = [NSValue valueWithNonretainedObject:objects];
|
||||
if ([self.messageObservers containsObject:value]) { // Fix:!
|
||||
[self.messageObservers removeObject:value];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)removeConnectionObservers:(id<CIMConnectionObserver>)objects{
|
||||
NSValue *value = [NSValue valueWithNonretainedObject:objects];
|
||||
if ([self.connectionObservers containsObject:value]) {
|
||||
[self.connectionObservers removeObject:value];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark private methods
|
||||
-(void)runOnQueue:(NSString*)queueLabel block:(dispatch_block_t)block {
|
||||
const char *s = dispatch_queue_get_label(DISPATCH_CURRENT_QUEUE_LABEL);
|
||||
NSString *label = s ? [[NSString alloc] initWithUTF8String:s] : @"";
|
||||
|
||||
if ([queueLabel isEqualToString:label]) {
|
||||
block();
|
||||
} else {
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
block();
|
||||
});
|
||||
}
|
||||
}
|
||||
-(void)runOnMainThread:(dispatch_block_t)block {
|
||||
[self runOnQueue:self.mainQueueLabel block:block];
|
||||
}
|
||||
|
||||
|
||||
/// 获取data 消息长度
|
||||
-(int)getMessageVauleLenght{
|
||||
|
||||
NSData * lv = [self.data subdataWithRange:NSMakeRange(1, 1)];
|
||||
NSData * hv = [self.data subdataWithRange:NSMakeRange(2, 1)];
|
||||
|
||||
int lvString = [[lv convertDataToHexStr] hexToDecimal].intValue;
|
||||
int hvString = [[hv convertDataToHexStr] hexToDecimal].intValue;
|
||||
|
||||
return lvString | hvString << 8;
|
||||
}
|
||||
|
||||
|
||||
- (NSData *)data{
|
||||
if(!_data){
|
||||
_data = [[NSData alloc] init];
|
||||
}
|
||||
return _data;
|
||||
}
|
||||
|
||||
|
||||
@end
|
@ -1,23 +0,0 @@
|
||||
//
|
||||
// CIMSendMessage.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/13.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CIMSendMessageData : NSObject
|
||||
|
||||
/// 心跳包数据
|
||||
+(NSData *)initHeartbeatData;
|
||||
|
||||
/// 绑定用户数据
|
||||
/// @param userId userId description
|
||||
+(NSData *)initBindUserData:(NSString *)userId;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -1,61 +0,0 @@
|
||||
//
|
||||
// CIMSendMessage.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/13.
|
||||
//
|
||||
|
||||
#import "CIMSendMessageData.h"
|
||||
#import "CIMHeader.h"
|
||||
#import "SentBody.pbobjc.h"
|
||||
#import <UIKit/UIDevice.h>
|
||||
|
||||
@implementation CIMSendMessageData
|
||||
|
||||
|
||||
/// 心跳包数据
|
||||
+(NSData *)initHeartbeatData{
|
||||
NSData * model = [@"PONG" convertBytesStringToData];
|
||||
NSInteger lenght = model.length;
|
||||
Byte type = 0;
|
||||
Byte head[3] ;
|
||||
head[0] = type;
|
||||
head[1] = lenght & 0xff;
|
||||
head[2] = (lenght >> 8) & 0xff;
|
||||
NSMutableData * sendData = [[NSMutableData alloc] initWithBytes:head length:3];
|
||||
[sendData appendData:model];
|
||||
|
||||
return sendData;
|
||||
}
|
||||
|
||||
|
||||
/// 绑定用户数据
|
||||
/// @param userId userId description
|
||||
+(NSData *)initBindUserData:(NSString *)userId{
|
||||
SentBodyModel * body = [SentBodyModel new];
|
||||
body.key = @"client_bind";
|
||||
body.timestamp = (int64_t)[NSDate timeIntervalSinceReferenceDate] *1000;
|
||||
body.data_p[@"uid"] = userId;
|
||||
body.data_p[@"deviceId"] = [[self class] deviceId];
|
||||
body.data_p[@"channel"] = @"ios";
|
||||
NSData *modeData = body.data;
|
||||
NSInteger lenght = modeData.length;
|
||||
Byte type = 3;
|
||||
Byte head[3] ;
|
||||
head[0] = type;
|
||||
head[1] = lenght & 0xff;
|
||||
head[2] = (lenght >> 8) & 0xff;
|
||||
NSMutableData * sendData = [[NSMutableData alloc] initWithBytes:head length:3];
|
||||
[sendData appendData:modeData];
|
||||
return sendData;
|
||||
|
||||
}
|
||||
|
||||
|
||||
+(NSString *)deviceId{
|
||||
return [[[UIDevice currentDevice] identifierForVendor] UUIDString];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
@ -1,36 +0,0 @@
|
||||
//
|
||||
// CIMMessageModel.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/19.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "Message.pbobjc.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CIMMessageModel : NSObject
|
||||
|
||||
@property(nonatomic, readwrite) int64_t id_p;
|
||||
|
||||
@property(nonatomic, readwrite, copy) NSString *action;
|
||||
|
||||
@property(nonatomic, readwrite, copy) NSString *content;
|
||||
|
||||
@property(nonatomic, readwrite, copy) NSString *sender;
|
||||
|
||||
@property(nonatomic, readwrite, copy) NSString *receiver;
|
||||
|
||||
@property(nonatomic, readwrite, copy) NSString *extra;
|
||||
|
||||
@property(nonatomic, readwrite, copy) NSString *title;
|
||||
|
||||
@property(nonatomic, readwrite, copy) NSString *format;
|
||||
|
||||
@property(nonatomic, readwrite) int64_t timestamp;
|
||||
|
||||
+(CIMMessageModel *)initWithProtoMdoel:(MessageModel *)model;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -1,28 +0,0 @@
|
||||
//
|
||||
// CIMMessageModel.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/19.
|
||||
//
|
||||
|
||||
#import "CIMMessageModel.h"
|
||||
|
||||
@implementation CIMMessageModel
|
||||
|
||||
|
||||
+(CIMMessageModel *)initWithProtoMdoel:(MessageModel *)model{
|
||||
|
||||
CIMMessageModel * cimMessageModel = [CIMMessageModel new];
|
||||
cimMessageModel.id_p = model.id_p;
|
||||
cimMessageModel.title = model.title;
|
||||
cimMessageModel.action = model.action;
|
||||
cimMessageModel.timestamp = model.timestamp;
|
||||
cimMessageModel.extra = model.extra;
|
||||
cimMessageModel.format = model.format;
|
||||
cimMessageModel.sender = model.sender;
|
||||
cimMessageModel.content = model.content;
|
||||
cimMessageModel.receiver = model.receiver;
|
||||
return cimMessageModel;
|
||||
}
|
||||
|
||||
@end
|
@ -1,89 +0,0 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: Message.proto
|
||||
|
||||
// This CPP symbol can be defined to use imports that match up to the framework
|
||||
// imports needed when using CocoaPods.
|
||||
#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
|
||||
#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
|
||||
#endif
|
||||
|
||||
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
|
||||
#import <Protobuf/GPBProtocolBuffers.h>
|
||||
#else
|
||||
#import "GPBProtocolBuffers.h"
|
||||
#endif
|
||||
|
||||
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
|
||||
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||
#endif
|
||||
#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
|
||||
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||
#endif
|
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
CF_EXTERN_C_BEGIN
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#pragma mark - MessageRoot
|
||||
|
||||
/**
|
||||
* Exposes the extension registry for this file.
|
||||
*
|
||||
* The base class provides:
|
||||
* @code
|
||||
* + (GPBExtensionRegistry *)extensionRegistry;
|
||||
* @endcode
|
||||
* which is a @c GPBExtensionRegistry that includes all the extensions defined by
|
||||
* this file and all files that it depends on.
|
||||
**/
|
||||
@interface MessageRoot : GPBRootObject
|
||||
@end
|
||||
|
||||
#pragma mark - Model
|
||||
|
||||
typedef GPB_ENUM(MessageModel_FieldNumber) {
|
||||
MessageModel_FieldNumber_Id_p = 1,
|
||||
MessageModel_FieldNumber_Action = 2,
|
||||
MessageModel_FieldNumber_Content = 3,
|
||||
MessageModel_FieldNumber_Sender = 4,
|
||||
MessageModel_FieldNumber_Receiver = 5,
|
||||
MessageModel_FieldNumber_Extra = 6,
|
||||
MessageModel_FieldNumber_Title = 7,
|
||||
MessageModel_FieldNumber_Format = 8,
|
||||
MessageModel_FieldNumber_Timestamp = 9,
|
||||
};
|
||||
|
||||
@interface MessageModel : GPBMessage
|
||||
|
||||
@property(nonatomic, readwrite) int64_t id_p;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *action;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *content;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *sender;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *receiver;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *extra;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *title;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *format;
|
||||
|
||||
@property(nonatomic, readwrite) int64_t timestamp;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
CF_EXTERN_C_END
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -1,181 +0,0 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: Message.proto
|
||||
|
||||
// This CPP symbol can be defined to use imports that match up to the framework
|
||||
// imports needed when using CocoaPods.
|
||||
#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
|
||||
#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
|
||||
#endif
|
||||
|
||||
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
|
||||
#import <Protobuf/GPBProtocolBuffers_RuntimeSupport.h>
|
||||
#else
|
||||
#import "GPBProtocolBuffers_RuntimeSupport.h"
|
||||
#endif
|
||||
|
||||
#import "Message.pbobjc.h"
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
#pragma mark - MessageRoot
|
||||
|
||||
@implementation MessageRoot
|
||||
|
||||
// No extensions in the file and no imports, so no need to generate
|
||||
// +extensionRegistry.
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - MessageRoot_FileDescriptor
|
||||
|
||||
static GPBFileDescriptor *MessageRoot_FileDescriptor(void) {
|
||||
// This is called by +initialize so there is no need to worry
|
||||
// about thread safety of the singleton.
|
||||
static GPBFileDescriptor *descriptor = NULL;
|
||||
if (!descriptor) {
|
||||
GPB_DEBUG_CHECK_RUNTIME_VERSIONS();
|
||||
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@""
|
||||
syntax:GPBFileSyntaxProto3];
|
||||
}
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
#pragma mark - Model
|
||||
|
||||
@implementation MessageModel
|
||||
|
||||
@dynamic id_p;
|
||||
@dynamic action;
|
||||
@dynamic content;
|
||||
@dynamic sender;
|
||||
@dynamic receiver;
|
||||
@dynamic extra;
|
||||
@dynamic title;
|
||||
@dynamic format;
|
||||
@dynamic timestamp;
|
||||
|
||||
typedef struct Model__storage_ {
|
||||
uint32_t _has_storage_[1];
|
||||
NSString *action;
|
||||
NSString *content;
|
||||
NSString *sender;
|
||||
NSString *receiver;
|
||||
NSString *extra;
|
||||
NSString *title;
|
||||
NSString *format;
|
||||
int64_t id_p;
|
||||
int64_t timestamp;
|
||||
} Model__storage_;
|
||||
|
||||
// This method is threadsafe because it is initially called
|
||||
// in +initialize for each subclass.
|
||||
+ (GPBDescriptor *)descriptor {
|
||||
static GPBDescriptor *descriptor = nil;
|
||||
if (!descriptor) {
|
||||
static GPBMessageFieldDescription fields[] = {
|
||||
{
|
||||
.name = "id_p",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Id_p,
|
||||
.hasIndex = 0,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, id_p),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeInt64,
|
||||
},
|
||||
{
|
||||
.name = "action",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Action,
|
||||
.hasIndex = 1,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, action),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "content",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Content,
|
||||
.hasIndex = 2,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, content),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "sender",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Sender,
|
||||
.hasIndex = 3,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, sender),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "receiver",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Receiver,
|
||||
.hasIndex = 4,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, receiver),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "extra",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Extra,
|
||||
.hasIndex = 5,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, extra),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "title",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Title,
|
||||
.hasIndex = 6,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, title),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "format",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Format,
|
||||
.hasIndex = 7,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, format),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "timestamp",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = MessageModel_FieldNumber_Timestamp,
|
||||
.hasIndex = 8,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, timestamp),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeInt64,
|
||||
},
|
||||
};
|
||||
GPBDescriptor *localDescriptor =
|
||||
[GPBDescriptor allocDescriptorForClass:[MessageModel class]
|
||||
rootClass:[MessageRoot class]
|
||||
file:MessageRoot_FileDescriptor()
|
||||
fields:fields
|
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||
storageSize:sizeof(Model__storage_)
|
||||
flags:GPBDescriptorInitializationFlag_None];
|
||||
#if defined(DEBUG) && DEBUG
|
||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||
#endif // DEBUG
|
||||
descriptor = localDescriptor;
|
||||
}
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -1,79 +0,0 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: ReplyBody.proto
|
||||
|
||||
// This CPP symbol can be defined to use imports that match up to the framework
|
||||
// imports needed when using CocoaPods.
|
||||
#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
|
||||
#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
|
||||
#endif
|
||||
|
||||
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
|
||||
#import <Protobuf/GPBProtocolBuffers.h>
|
||||
#else
|
||||
#import "GPBProtocolBuffers.h"
|
||||
#endif
|
||||
|
||||
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
|
||||
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||
#endif
|
||||
#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
|
||||
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||
#endif
|
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
CF_EXTERN_C_BEGIN
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#pragma mark - ReplyBodyRoot
|
||||
|
||||
/**
|
||||
* Exposes the extension registry for this file.
|
||||
*
|
||||
* The base class provides:
|
||||
* @code
|
||||
* + (GPBExtensionRegistry *)extensionRegistry;
|
||||
* @endcode
|
||||
* which is a @c GPBExtensionRegistry that includes all the extensions defined by
|
||||
* this file and all files that it depends on.
|
||||
**/
|
||||
@interface ReplyBodyRoot : GPBRootObject
|
||||
@end
|
||||
|
||||
#pragma mark - Model
|
||||
|
||||
typedef GPB_ENUM(ReplyBodyModel_FieldNumber) {
|
||||
ReplyBodyModel_FieldNumber_Key = 1,
|
||||
ReplyBodyModel_FieldNumber_Code = 2,
|
||||
ReplyBodyModel_FieldNumber_Message = 3,
|
||||
ReplyBodyModel_FieldNumber_Timestamp = 4,
|
||||
ReplyBodyModel_FieldNumber_Data_p = 5,
|
||||
};
|
||||
|
||||
@interface ReplyBodyModel : GPBMessage
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *key;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *code;
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *message;
|
||||
|
||||
@property(nonatomic, readwrite) int64_t timestamp;
|
||||
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableDictionary<NSString*, NSString*> *data_p;
|
||||
/** The number of items in @c data_p without causing the array to be created. */
|
||||
@property(nonatomic, readonly) NSUInteger data_p_Count;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
CF_EXTERN_C_END
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -1,137 +0,0 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: ReplyBody.proto
|
||||
|
||||
// This CPP symbol can be defined to use imports that match up to the framework
|
||||
// imports needed when using CocoaPods.
|
||||
#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
|
||||
#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
|
||||
#endif
|
||||
|
||||
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
|
||||
#import <Protobuf/GPBProtocolBuffers_RuntimeSupport.h>
|
||||
#else
|
||||
#import "GPBProtocolBuffers_RuntimeSupport.h"
|
||||
#endif
|
||||
|
||||
#import "ReplyBody.pbobjc.h"
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
#pragma mark - ReplyBodyRoot
|
||||
|
||||
@implementation ReplyBodyRoot
|
||||
|
||||
// No extensions in the file and no imports, so no need to generate
|
||||
// +extensionRegistry.
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - ReplyBodyRoot_FileDescriptor
|
||||
|
||||
static GPBFileDescriptor *ReplyBodyRoot_FileDescriptor(void) {
|
||||
// This is called by +initialize so there is no need to worry
|
||||
// about thread safety of the singleton.
|
||||
static GPBFileDescriptor *descriptor = NULL;
|
||||
if (!descriptor) {
|
||||
GPB_DEBUG_CHECK_RUNTIME_VERSIONS();
|
||||
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@""
|
||||
syntax:GPBFileSyntaxProto3];
|
||||
}
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
#pragma mark - Model
|
||||
|
||||
@implementation ReplyBodyModel
|
||||
|
||||
@dynamic key;
|
||||
@dynamic code;
|
||||
@dynamic message;
|
||||
@dynamic timestamp;
|
||||
@dynamic data_p, data_p_Count;
|
||||
|
||||
typedef struct Model__storage_ {
|
||||
uint32_t _has_storage_[1];
|
||||
NSString *key;
|
||||
NSString *code;
|
||||
NSString *message;
|
||||
NSMutableDictionary *data_p;
|
||||
int64_t timestamp;
|
||||
} Model__storage_;
|
||||
|
||||
// This method is threadsafe because it is initially called
|
||||
// in +initialize for each subclass.
|
||||
+ (GPBDescriptor *)descriptor {
|
||||
static GPBDescriptor *descriptor = nil;
|
||||
if (!descriptor) {
|
||||
static GPBMessageFieldDescription fields[] = {
|
||||
{
|
||||
.name = "key",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = ReplyBodyModel_FieldNumber_Key,
|
||||
.hasIndex = 0,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, key),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "code",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = ReplyBodyModel_FieldNumber_Code,
|
||||
.hasIndex = 1,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, code),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "message",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = ReplyBodyModel_FieldNumber_Message,
|
||||
.hasIndex = 2,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, message),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "timestamp",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = ReplyBodyModel_FieldNumber_Timestamp,
|
||||
.hasIndex = 3,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, timestamp),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeInt64,
|
||||
},
|
||||
{
|
||||
.name = "data_p",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = ReplyBodyModel_FieldNumber_Data_p,
|
||||
.hasIndex = GPBNoHasBit,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, data_p),
|
||||
.flags = GPBFieldMapKeyString,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
};
|
||||
GPBDescriptor *localDescriptor =
|
||||
[GPBDescriptor allocDescriptorForClass:[ReplyBodyModel class]
|
||||
rootClass:[ReplyBodyRoot class]
|
||||
file:ReplyBodyRoot_FileDescriptor()
|
||||
fields:fields
|
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||
storageSize:sizeof(Model__storage_)
|
||||
flags:GPBDescriptorInitializationFlag_None];
|
||||
#if defined(DEBUG) && DEBUG
|
||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||
#endif // DEBUG
|
||||
descriptor = localDescriptor;
|
||||
}
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -1,73 +0,0 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: SentBody.proto
|
||||
|
||||
// This CPP symbol can be defined to use imports that match up to the framework
|
||||
// imports needed when using CocoaPods.
|
||||
#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
|
||||
#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
|
||||
#endif
|
||||
|
||||
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
|
||||
#import <Protobuf/GPBProtocolBuffers.h>
|
||||
#else
|
||||
#import "GPBProtocolBuffers.h"
|
||||
#endif
|
||||
|
||||
#if GOOGLE_PROTOBUF_OBJC_VERSION < 30002
|
||||
#error This file was generated by a newer version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||
#endif
|
||||
#if 30002 < GOOGLE_PROTOBUF_OBJC_MIN_SUPPORTED_VERSION
|
||||
#error This file was generated by an older version of protoc which is incompatible with your Protocol Buffer library sources.
|
||||
#endif
|
||||
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
CF_EXTERN_C_BEGIN
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
#pragma mark - SentBodyRoot
|
||||
|
||||
/**
|
||||
* Exposes the extension registry for this file.
|
||||
*
|
||||
* The base class provides:
|
||||
* @code
|
||||
* + (GPBExtensionRegistry *)extensionRegistry;
|
||||
* @endcode
|
||||
* which is a @c GPBExtensionRegistry that includes all the extensions defined by
|
||||
* this file and all files that it depends on.
|
||||
**/
|
||||
@interface SentBodyRoot : GPBRootObject
|
||||
@end
|
||||
|
||||
#pragma mark - Model
|
||||
|
||||
typedef GPB_ENUM(Model_FieldNumber) {
|
||||
Model_FieldNumber_Key = 1,
|
||||
Model_FieldNumber_Timestamp = 2,
|
||||
Model_FieldNumber_Data_p = 3,
|
||||
};
|
||||
|
||||
@interface SentBodyModel : GPBMessage
|
||||
|
||||
@property(nonatomic, readwrite, copy, null_resettable) NSString *key;
|
||||
|
||||
@property(nonatomic, readwrite) int64_t timestamp;
|
||||
|
||||
@property(nonatomic, readwrite, strong, null_resettable) NSMutableDictionary<NSString*, NSString*> *data_p;
|
||||
/** The number of items in @c data_p without causing the array to be created. */
|
||||
@property(nonatomic, readonly) NSUInteger data_p_Count;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
CF_EXTERN_C_END
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -1,118 +0,0 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: SentBody.proto
|
||||
|
||||
// This CPP symbol can be defined to use imports that match up to the framework
|
||||
// imports needed when using CocoaPods.
|
||||
#if !defined(GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS)
|
||||
#define GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS 0
|
||||
#endif
|
||||
|
||||
#if GPB_USE_PROTOBUF_FRAMEWORK_IMPORTS
|
||||
#import <Protobuf/GPBProtocolBuffers_RuntimeSupport.h>
|
||||
#else
|
||||
#import "GPBProtocolBuffers_RuntimeSupport.h"
|
||||
#endif
|
||||
|
||||
#import "SentBody.pbobjc.h"
|
||||
// @@protoc_insertion_point(imports)
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
|
||||
#pragma mark - SentBodyRoot
|
||||
|
||||
@implementation SentBodyRoot
|
||||
|
||||
// No extensions in the file and no imports, so no need to generate
|
||||
// +extensionRegistry.
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark - SentBodyRoot_FileDescriptor
|
||||
|
||||
static GPBFileDescriptor *SentBodyRoot_FileDescriptor(void) {
|
||||
// This is called by +initialize so there is no need to worry
|
||||
// about thread safety of the singleton.
|
||||
static GPBFileDescriptor *descriptor = NULL;
|
||||
if (!descriptor) {
|
||||
GPB_DEBUG_CHECK_RUNTIME_VERSIONS();
|
||||
descriptor = [[GPBFileDescriptor alloc] initWithPackage:@""
|
||||
syntax:GPBFileSyntaxProto3];
|
||||
}
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
#pragma mark - Model
|
||||
|
||||
@implementation SentBodyModel
|
||||
|
||||
@dynamic key;
|
||||
@dynamic timestamp;
|
||||
@dynamic data_p, data_p_Count;
|
||||
|
||||
typedef struct Model__storage_ {
|
||||
uint32_t _has_storage_[1];
|
||||
NSString *key;
|
||||
NSMutableDictionary *data_p;
|
||||
int64_t timestamp;
|
||||
} Model__storage_;
|
||||
|
||||
// This method is threadsafe because it is initially called
|
||||
// in +initialize for each subclass.
|
||||
+ (GPBDescriptor *)descriptor {
|
||||
static GPBDescriptor *descriptor = nil;
|
||||
if (!descriptor) {
|
||||
static GPBMessageFieldDescription fields[] = {
|
||||
{
|
||||
.name = "key",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = Model_FieldNumber_Key,
|
||||
.hasIndex = 0,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, key),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
{
|
||||
.name = "timestamp",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = Model_FieldNumber_Timestamp,
|
||||
.hasIndex = 1,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, timestamp),
|
||||
.flags = GPBFieldOptional,
|
||||
.dataType = GPBDataTypeInt64,
|
||||
},
|
||||
{
|
||||
.name = "data_p",
|
||||
.dataTypeSpecific.className = NULL,
|
||||
.number = Model_FieldNumber_Data_p,
|
||||
.hasIndex = GPBNoHasBit,
|
||||
.offset = (uint32_t)offsetof(Model__storage_, data_p),
|
||||
.flags = GPBFieldMapKeyString,
|
||||
.dataType = GPBDataTypeString,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
GPBDescriptor *localDescriptor =
|
||||
[GPBDescriptor allocDescriptorForClass:[SentBodyModel class]
|
||||
rootClass:[SentBodyRoot class]
|
||||
file:SentBodyRoot_FileDescriptor()
|
||||
fields:fields
|
||||
fieldCount:(uint32_t)(sizeof(fields) / sizeof(GPBMessageFieldDescription))
|
||||
storageSize:sizeof(Model__storage_)
|
||||
flags:GPBDescriptorInitializationFlag_None];
|
||||
#if defined(DEBUG) && DEBUG
|
||||
NSAssert(descriptor == nil, @"Startup recursed!");
|
||||
#endif // DEBUG
|
||||
descriptor = localDescriptor;
|
||||
}
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
// @@protoc_insertion_point(global_scope)
|
@ -1,103 +0,0 @@
|
||||
//
|
||||
// CIMMessageObserver.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/18.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "GCDAsyncSocket.h"
|
||||
#import "CIMMessageModel.h"
|
||||
|
||||
@class CIMService;
|
||||
/// 消息回调
|
||||
@protocol CIMPeerMessageObserver <NSObject>
|
||||
|
||||
/// 接受到消息
|
||||
/// @param msg msg description
|
||||
-(void)cimHandleMessage:(CIMMessageModel * _Nonnull)msg;
|
||||
|
||||
/// 消息解析失败
|
||||
/// @param data data description
|
||||
-(void)cimHandleMessageError:(NSData * _Nonnull)data;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
/// 服务器连接回调
|
||||
@protocol CIMConnectionObserver <NSObject>
|
||||
@optional
|
||||
|
||||
/// 用户绑定成功
|
||||
/// @param bindSuccess bindSuccess description
|
||||
-(void)cimDidBindUserSuccess:(BOOL)bindSuccess;
|
||||
|
||||
/// 连接成功
|
||||
-(void)cimDidConnectSuccess;
|
||||
|
||||
/// 断开连接
|
||||
-(void)cimDidConnectClose;
|
||||
|
||||
/// 连接失败
|
||||
/// @param error res description
|
||||
-(void)cimDidConnectError:(NSError *_Nullable)error;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface CIMService : NSObject
|
||||
|
||||
+(CIMService*)instance;
|
||||
|
||||
/// 配置IM服务器
|
||||
/// @param host host description
|
||||
/// @param port port description
|
||||
-(void)configHost:(NSString *)host onPort:(NSInteger)port;
|
||||
|
||||
/// 连接服务器并绑定用户
|
||||
/// @param userId userId description
|
||||
-(void)connectionBindUserId:(NSString *)userId;
|
||||
|
||||
/// 添加消息监听回调
|
||||
/// @param observer observer description (可添加多个)不同时记得Remove
|
||||
-(void)addMessageObserver:(id<CIMPeerMessageObserver>)observer;
|
||||
|
||||
/// 添加连接状态监听回调
|
||||
/// @param observer observer description (可添加多个)不同时记得Remove
|
||||
-(void)addConnectionObserver:(id<CIMConnectionObserver>)observer;
|
||||
|
||||
/// 移除监听
|
||||
/// @param observer observer description
|
||||
-(void)removeMessageObserver:(id<CIMPeerMessageObserver>)observer;
|
||||
|
||||
/// 移除监听回调
|
||||
/// @param observer observer description
|
||||
-(void)removeConnectionObserver:(id<CIMConnectionObserver>)observer;
|
||||
|
||||
/// 退出后台 断开连接
|
||||
-(void)enterBackground;
|
||||
|
||||
/// 进入前台重新连接
|
||||
-(void)enterForeground;
|
||||
|
||||
/// 重新连接
|
||||
-(void)reconnect;
|
||||
|
||||
/// 断开连接
|
||||
-(void)disconnect;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -1,164 +0,0 @@
|
||||
//
|
||||
// CIMMessageObserver.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/18.
|
||||
//
|
||||
|
||||
#import "CIMService.h"
|
||||
#import "CIMSendMessageData.h"
|
||||
#import "CIMMessageHandler.h"
|
||||
|
||||
|
||||
@interface CIMService()<GCDAsyncSocketDelegate>
|
||||
|
||||
@property (assign, nonatomic)BOOL deBugLog;
|
||||
|
||||
@property(nonatomic,copy,readonly)NSString * host;
|
||||
@property(nonatomic,assign,readonly)NSInteger port;
|
||||
|
||||
@property (strong, nonatomic) GCDAsyncSocket * clientSocket;
|
||||
@property (strong, nonatomic)dispatch_queue_t queue;
|
||||
|
||||
@property (strong, nonatomic)CIMMessageHandler *handler;
|
||||
|
||||
@property (copy, nonatomic)NSString *userId;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation CIMService
|
||||
|
||||
+(CIMService*)instance {
|
||||
static CIMService *imService;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
if (!imService) {
|
||||
imService = [[CIMService alloc] init];
|
||||
}
|
||||
});
|
||||
return imService;
|
||||
}
|
||||
|
||||
-(id)init {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)configHost:(NSString *)host onPort:(NSInteger)port{
|
||||
_host = host;
|
||||
_port = port;
|
||||
}
|
||||
|
||||
|
||||
- (void)connectionBindUserId:(NSString *)userId{
|
||||
if(userId.length == 0){
|
||||
[self.handler handlerBindUser:NO];
|
||||
return;
|
||||
}
|
||||
self.userId = userId;
|
||||
NSAssert(self.host.length > 1, @"定调用configHost 配置host和port");
|
||||
NSAssert(self.port > 1, @"定调用configHost 配置host和port");
|
||||
//接服务器
|
||||
NSError *error;
|
||||
[self.clientSocket connectToHost:self.host onPort:self.port error:&error];
|
||||
if (error) {
|
||||
[self.handler handlerConnectError:error];
|
||||
}else{
|
||||
NSLog(@"socket 成功");
|
||||
[self.clientSocket writeData:[CIMSendMessageData initBindUserData:userId] withTimeout:-1 tag:0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#pragma mark Observe
|
||||
- (void)addMessageObserver:(id<CIMPeerMessageObserver>)observer{
|
||||
[self.handler addPeerMessageObservers:observer];
|
||||
}
|
||||
|
||||
- (void)addConnectionObserver:(id<CIMConnectionObserver>)observer{
|
||||
[self.handler addConnectionObservers:observer];
|
||||
}
|
||||
|
||||
- (void)removeMessageObserver:(id<CIMPeerMessageObserver>)observer{
|
||||
[self.handler removePeerMessageObservers:observer];
|
||||
}
|
||||
|
||||
- (void)removeConnectionObserver:(id<CIMConnectionObserver>)observer{
|
||||
[self.handler removeConnectionObservers:observer];
|
||||
}
|
||||
#pragma mark -Connection methods
|
||||
-(void)enterBackground{
|
||||
if(self.clientSocket.isConnected){
|
||||
[self.clientSocket disconnect];
|
||||
}
|
||||
}
|
||||
-(void)enterForeground{
|
||||
if(!self.clientSocket.isConnected){
|
||||
[self connectionBindUserId:self.userId];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)reconnect{
|
||||
if(!self.clientSocket.isConnected){
|
||||
[self connectionBindUserId:self.userId];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)disconnect{
|
||||
if(self.clientSocket.isConnected){
|
||||
[self.clientSocket disconnect];
|
||||
self.clientSocket = nil;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - GCDAsyncSocketDelegate
|
||||
// 连接成功
|
||||
- (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port {
|
||||
NSLog(@"socket 连接成功");
|
||||
[self.clientSocket readDataWithTimeout:-1 tag:0];
|
||||
[self.handler handlerConnectSuccess];
|
||||
}
|
||||
|
||||
// 已经断开链接
|
||||
- (void)socketDidDisconnect:(GCDAsyncSocket *)sock withError:(NSError *)err {
|
||||
NSLog(@"socket 断开连接%@",err.localizedDescription);
|
||||
[self.handler handlerConnectClose];
|
||||
}
|
||||
|
||||
//读取到数据
|
||||
- (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag {
|
||||
[self.clientSocket readDataWithTimeout:-1 tag:0];
|
||||
//数据处理
|
||||
NSLog(@"didReadData");
|
||||
[self.handler doCode:data socket:sock];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark lazy
|
||||
- (GCDAsyncSocket *)clientSocket{
|
||||
if(!_clientSocket){
|
||||
self.queue = dispatch_queue_create("com.cim.IMQueue", DISPATCH_QUEUE_CONCURRENT);
|
||||
_clientSocket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:self.queue];
|
||||
}
|
||||
return _clientSocket;
|
||||
}
|
||||
|
||||
- (CIMMessageHandler *)handler{
|
||||
if(!_handler){
|
||||
_handler = [[CIMMessageHandler alloc] init];
|
||||
}
|
||||
return _handler;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
@ -1,20 +0,0 @@
|
||||
//
|
||||
// NSData+IM.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/13.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSData (IM)
|
||||
|
||||
- (NSString *)convertDataToHexStr;
|
||||
|
||||
+ (NSString *)convertDataToHexStr:(NSData *)data;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -1,57 +0,0 @@
|
||||
//
|
||||
// NSData+IM.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/13.
|
||||
//
|
||||
|
||||
#import "NSData+IM.h"
|
||||
|
||||
@implementation NSData (IM)
|
||||
|
||||
- (NSString *)convertDataToHexStr{
|
||||
if (!self || [self length] == 0) {
|
||||
return @"";
|
||||
}
|
||||
NSMutableString *string = [[NSMutableString alloc] initWithCapacity:[self length]];
|
||||
|
||||
[self enumerateByteRangesUsingBlock:^(const void *bytes, NSRange byteRange, BOOL *stop) {
|
||||
unsigned char *dataBytes = (unsigned char*)bytes;
|
||||
for (NSInteger i = 0; i < byteRange.length; i++) {
|
||||
NSString *hexStr = [NSString stringWithFormat:@"%x", (dataBytes[i]) & 0xff];
|
||||
if ([hexStr length] == 2) {
|
||||
[string appendString:hexStr];
|
||||
} else {
|
||||
[string appendFormat:@"0%@", hexStr];
|
||||
}
|
||||
}
|
||||
}];
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
|
||||
+ (NSString *)convertDataToHexStr:(NSData *)data
|
||||
{
|
||||
if (!data || [data length] == 0) {
|
||||
return @"";
|
||||
}
|
||||
NSMutableString *string = [[NSMutableString alloc] initWithCapacity:[data length]];
|
||||
|
||||
[data enumerateByteRangesUsingBlock:^(const void *bytes, NSRange byteRange, BOOL *stop) {
|
||||
unsigned char *dataBytes = (unsigned char*)bytes;
|
||||
for (NSInteger i = 0; i < byteRange.length; i++) {
|
||||
NSString *hexStr = [NSString stringWithFormat:@"%x", (dataBytes[i]) & 0xff];
|
||||
if ([hexStr length] == 2) {
|
||||
[string appendString:hexStr];
|
||||
} else {
|
||||
[string appendFormat:@"0%@", hexStr];
|
||||
}
|
||||
}
|
||||
}];
|
||||
return string;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
@ -1,24 +0,0 @@
|
||||
//
|
||||
// NSString+IM.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/13.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface NSString (IM)
|
||||
|
||||
|
||||
-(NSData*) convertBytesStringToData ;
|
||||
|
||||
- (NSString *)hexToDecimal ;
|
||||
|
||||
//data -> 16进制
|
||||
+(NSString *)hexStringFormData:(NSData *)data;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@ -1,155 +0,0 @@
|
||||
//
|
||||
// NSString+IM.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/13.
|
||||
//
|
||||
|
||||
#import "NSString+IM.h"
|
||||
#
|
||||
@implementation NSString (IM)
|
||||
|
||||
/**
|
||||
带子节的string转为NSData
|
||||
|
||||
@return NSData类型
|
||||
*/
|
||||
-(NSData*) convertBytesStringToData {
|
||||
NSMutableData* data = [NSMutableData data];
|
||||
int idx;
|
||||
for (idx = 0; idx+2 <= self.length; idx+=2) {
|
||||
NSRange range = NSMakeRange(idx, 2);
|
||||
NSString* hexStr = [self substringWithRange:range];
|
||||
NSScanner* scanner = [NSScanner scannerWithString:hexStr];
|
||||
unsigned int intValue;
|
||||
[scanner scanHexInt:&intValue];
|
||||
[data appendBytes:&intValue length:1];
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
十进制转十六进制
|
||||
|
||||
@return 十六进制字符串
|
||||
*/
|
||||
- (NSString *)decimalToHex {
|
||||
long long int tmpid = [self intValue];
|
||||
NSString *nLetterValue;
|
||||
NSString *str = @"";
|
||||
long long int ttmpig;
|
||||
for (int i = 0; i < 9; i++) {
|
||||
ttmpig = tmpid % 16;
|
||||
tmpid = tmpid / 16;
|
||||
switch (ttmpig) {
|
||||
case 10:
|
||||
nLetterValue = @"A";
|
||||
break;
|
||||
case 11:
|
||||
nLetterValue = @"B";
|
||||
break;
|
||||
case 12:
|
||||
nLetterValue = @"C";
|
||||
break;
|
||||
case 13:
|
||||
nLetterValue = @"D";
|
||||
break;
|
||||
case 14:
|
||||
nLetterValue = @"E";
|
||||
break;
|
||||
case 15:
|
||||
nLetterValue = @"F";
|
||||
break;
|
||||
default:
|
||||
nLetterValue = [[NSString alloc]initWithFormat:@"%lli", ttmpig];
|
||||
}
|
||||
str = [nLetterValue stringByAppendingString:str];
|
||||
if (tmpid == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
/**
|
||||
十进制转十六进制
|
||||
length 总长度,不足补0
|
||||
@return 十六进制字符串
|
||||
*/
|
||||
- (NSString *)decimalToHexWithLength:(NSUInteger)length{
|
||||
NSString* subString = [self decimalToHex];
|
||||
NSUInteger moreL = length - subString.length;
|
||||
if (moreL>0) {
|
||||
for (int i = 0; i<moreL; i++) {
|
||||
subString = [NSString stringWithFormat:@"0%@",subString];
|
||||
}
|
||||
}
|
||||
return subString;
|
||||
}
|
||||
/**
|
||||
十六进制转十进制
|
||||
|
||||
@return 十进制字符串
|
||||
*/
|
||||
- (NSString *)hexToDecimal {
|
||||
return [NSString stringWithFormat:@"%lu",strtoul([self UTF8String],0,16)];
|
||||
}
|
||||
/*
|
||||
二进制转十进制
|
||||
|
||||
@return 十进制字符串
|
||||
*/
|
||||
- (NSString *)binaryToDecimal {
|
||||
int ll = 0 ;
|
||||
int temp = 0 ;
|
||||
for (int i = 0; i < self.length; i ++) {
|
||||
temp = [[self substringWithRange:NSMakeRange(i, 1)] intValue];
|
||||
temp = temp * powf(2, self.length - i - 1);
|
||||
ll += temp;
|
||||
}
|
||||
NSString * result = [NSString stringWithFormat:@"%d",ll];
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
十进制转二进制
|
||||
|
||||
@return 二进制字符串
|
||||
*/
|
||||
- (NSString *)decimalToBinary {
|
||||
NSInteger num = [self integerValue];
|
||||
NSInteger remainder = 0; //余数
|
||||
NSInteger divisor = 0; //除数
|
||||
NSString * prepare = @"";
|
||||
|
||||
while (true) {
|
||||
remainder = num%2;
|
||||
divisor = num/2;
|
||||
num = divisor;
|
||||
prepare = [prepare stringByAppendingFormat:@"%d",(int)remainder];
|
||||
|
||||
if (divisor == 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
NSString * result = @"";
|
||||
for (NSInteger i = prepare.length - 1; i >= 0; i --) {
|
||||
result = [result stringByAppendingFormat:@"%@",
|
||||
[prepare substringWithRange:NSMakeRange(i , 1)]];
|
||||
}
|
||||
return [NSString stringWithFormat:@"%08d",[result intValue]];
|
||||
}
|
||||
|
||||
|
||||
+(NSString *)hexStringFormData:(NSData *)data
|
||||
{
|
||||
return [[[[NSString stringWithFormat:@"%@",data]
|
||||
stringByReplacingOccurrencesOfString:@"<" withString:@""]
|
||||
stringByReplacingOccurrencesOfString:@">" withString:@""]
|
||||
stringByReplacingOccurrencesOfString:@" " withString:@""];
|
||||
|
||||
|
||||
|
||||
}
|
||||
@end
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>1</string>
|
||||
</dict>
|
||||
</plist>
|
@ -1,15 +0,0 @@
|
||||
//
|
||||
// SceneDelegate.h
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/7.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>
|
||||
|
||||
@property (strong, nonatomic) UIWindow * window;
|
||||
|
||||
@end
|
||||
|
@ -1,61 +0,0 @@
|
||||
//
|
||||
// SceneDelegate.m
|
||||
// CIMKit
|
||||
//
|
||||
// Created by mason on 2020/11/7.
|
||||
//
|
||||
|
||||
#import "SceneDelegate.h"
|
||||
#import "CIMHeader.h"
|
||||
@interface SceneDelegate ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation SceneDelegate
|
||||
|
||||
|
||||
- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
|
||||
// Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
|
||||
// If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
|
||||
// This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
|
||||
}
|
||||
|
||||
|
||||
- (void)sceneDidDisconnect:(UIScene *)scene {
|
||||
// Called as the scene is being released by the system.
|
||||
// This occurs shortly after the scene enters the background, or when its session is discarded.
|
||||
// Release any resources associated with this scene that can be re-created the next time the scene connects.
|
||||
// The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
|
||||
}
|
||||
|
||||
- (void)sceneDidEnterBackground:(UIScene *)scene{
|
||||
[[CIMService instance] enterBackground];
|
||||
|
||||
}
|
||||
|
||||
- (void)sceneWillEnterForeground:(UIScene *)scene{
|
||||
[[CIMService instance] enterForeground];
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
- (void)sceneDidBecomeActive:(UIScene *)scene {
|
||||
// Called when the scene has moved from an inactive state to an active state.
|
||||
// Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
|
||||
}
|
||||
|
||||
|
||||
- (void)sceneWillResignActive:(UIScene *)scene {
|
||||
// Called when the scene will move from an active state to an inactive state.
|
||||
// This may occur due to temporary interruptions (ex. an incoming phone call).
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user