Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
OffcnIMSDKiOS
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
opensource
OffcnIMSDKiOS
Commits
6cf4c29f
Commit
6cf4c29f
authored
Aug 28, 2020
by
zhangyunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demo
parent
12769036
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
23 deletions
+57
-23
AppDelegate.m
OffcnIMSDKiOS/AppDelegate.m
+1
-2
Main.storyboard
OffcnIMSDKiOS/Base.lproj/Main.storyboard
+0
-0
OffcnIMSocketManager.h
OffcnIMSDKiOS/ExposedInterface-(外放接口)/OffcnIMSocketManager.h
+7
-4
OffcnIMSocketManager.m
OffcnIMSDKiOS/ExposedInterface-(外放接口)/OffcnIMSocketManager.m
+22
-1
OffcnZYJFMDBHandler.h
...KiOS/Tools-(工具)/OffcnZYJFMDBHandler/OffcnZYJFMDBHandler.h
+4
-1
ViewController.mm
OffcnIMSDKiOS/ViewController.mm
+23
-15
No files found.
OffcnIMSDKiOS/AppDelegate.m
View file @
6cf4c29f
...
@@ -59,8 +59,7 @@
...
@@ -59,8 +59,7 @@
-
(
void
)
applicationDidBecomeActive
:(
UIApplication
*
)
application
{
-
(
void
)
applicationDidBecomeActive
:(
UIApplication
*
)
application
{
if
([
OffcnIMSocketManager
defaultService
].
IMConnectStatus
!=
OffcnIMConnectStatusSuccess
)
{
if
([
OffcnIMSocketManager
defaultService
].
IMConnectStatus
!=
OffcnIMConnectStatusSuccess
)
{
//建立连接
//建立连接
NSString
*
paramStr
=
@"{
\"
server_ip
\"
:
\"
192.168.43.141
\"
,
\"
server_port
\"
:1026,
\"
account_id
\"
:
\"
ce0819db8391f1e7258a71cc9e2c3235
\"
,
\"
app_id
\"
:
\"
offcn_live
\"
,
\"
device_type
\"
:
\"
ios
\"
,
\"
token
\"
:
\"
fadbce3f4929b6bdee0617fee34e32ae
\"
,
\"
session_id
\"
:
\"
123
\"
,
\"
connection_type
\"
:
\"
websocket
\"
,
\"
tls
\"
:
\"
disable
\"
}"
;
// [[OffcnIMSocketManager defaultService] connectIMServerWithAccount_id:@"ce0819db8391f1e7258a71cc9e2c3235" token:@"fadbce3f4929b6bdee0617fee34e32ae"];
[[
OffcnIMSocketManager
defaultService
]
connectIMServerWithParam
:
paramStr
];
}
}
//进入前台,清除推送角标
//进入前台,清除推送角标
...
...
OffcnIMSDKiOS/Base.lproj/Main.storyboard
View file @
6cf4c29f
This diff is collapsed.
Click to expand it.
OffcnIMSDKiOS/ExposedInterface-(外放接口)/OffcnIMSocketManager.h
View file @
6cf4c29f
//
//
...
@@ -31,11 +31,14 @@ typedef void(^OffcnIMReceiveConnectStatus)(OffcnIMConnectStatus status,NSString
...
@@ -31,11 +31,14 @@ typedef void(^OffcnIMReceiveConnectStatus)(OffcnIMConnectStatus status,NSString
@property
(
nonatomic
,
copy
)
OffcnIMConnectReceiveMessage
connectReceiveMessage
;
@property
(
nonatomic
,
copy
)
OffcnIMConnectReceiveMessage
connectReceiveMessage
;
@property
(
nonatomic
,
copy
)
OffcnIMReceiveConnectStatus
connectStatus
;
@property
(
nonatomic
,
copy
)
OffcnIMReceiveConnectStatus
connectStatus
;
//单例
+
(
OffcnIMSocketManager
*
)
defaultService
;
+
(
OffcnIMSocketManager
*
)
defaultService
;
//建立连接
/// 建立连接
-
(
void
)
connectIMServerWithParam
:(
NSString
*
)
param
;
/// @param account_id 用户ID
/// @param token 用户token
-
(
void
)
connectIMServerWithAccount_id
:(
NSString
*
)
account_id
token
:(
NSString
*
)
token
;
//断开连接
//断开连接
-
(
void
)
disConnectIMServer
;
-
(
void
)
disConnectIMServer
;
@end
@end
...
...
OffcnIMSDKiOS/ExposedInterface-(外放接口)/OffcnIMSocketManager.m
View file @
6cf4c29f
//
//
...
@@ -10,6 +10,7 @@
...
@@ -10,6 +10,7 @@
#import <oimcore/oimcoreAdapter.h>
#import <oimcore/oimcoreAdapter.h>
#import "ZYJMJExtension.h"
#import "ZYJMJExtension.h"
#import "DataSafe.h"
#import "DataSafe.h"
#import "SDGeneralTool.h"
@interface
OffcnIMSocketManager
()
<
OIMCoreDelegate
>
@interface
OffcnIMSocketManager
()
<
OIMCoreDelegate
>
...
@@ -45,6 +46,26 @@ static OffcnIMSocketManager *socketManager;
...
@@ -45,6 +46,26 @@ static OffcnIMSocketManager *socketManager;
}
}
//建立连接
//建立连接
-
(
void
)
connectIMServerWithAccount_id
:
(
NSString
*
)
account_id
token
:
(
NSString
*
)
token
{
// connection_type = ["kcp", "websocket"]
// tls = ["disable", "enable"]
NSMutableDictionary
*
dic
=
[
NSMutableDictionary
dictionary
];
[
dic
setObjectOnSafe
:
@"192.168.43.141"
forKey
:
@"server_ip"
];
[
dic
setObjectOnSafe
:[
NSNumber
numberWithInteger
:
1026
]
forKey
:
@"server_port"
];
[
dic
setObjectOnSafe
:
account_id
forKey
:
@"account_id"
];
[
dic
setObjectOnSafe
:
@"offcn_live"
forKey
:
@"app_id"
];
[
dic
setObjectOnSafe
:
@"ios"
forKey
:
@"device_type"
];
[
dic
setObjectOnSafe
:
token
forKey
:
@"token"
];
NSString
*
session_id
=
[
SDGeneralTool
getNowSSSTimeTimestamp
];
[
dic
setObjectOnSafe
:
session_id
forKey
:
@"session_id"
];
[
dic
setObjectOnSafe
:
@"websocket"
forKey
:
@"connection_type"
];
[
dic
setObjectOnSafe
:
@"disable"
forKey
:
@"tls"
];
[
self
connectIMServerWithParam
:[
dic
mj_ZYJJSONString
]];
}
-
(
void
)
connectIMServerWithParam
:
(
NSString
*
)
param
{
-
(
void
)
connectIMServerWithParam
:
(
NSString
*
)
param
{
[
self
.
adapter
ConnectImServerWithParam
:
param
];
[
self
.
adapter
ConnectImServerWithParam
:
param
];
}
}
...
...
OffcnIMSDKiOS/Tools-(工具)/OffcnZYJFMDBHandler/OffcnZYJFMDBHandler.h
View file @
6cf4c29f
//
//
...
@@ -22,5 +22,8 @@ typedef void(^ReturnData)(NSMutableArray *modelArr);
...
@@ -22,5 +22,8 @@ typedef void(^ReturnData)(NSMutableArray *modelArr);
+
(
OffcnZYJFMDBHandler
*
)
sharedInstance
;
+
(
OffcnZYJFMDBHandler
*
)
sharedInstance
;
@end
@end
OffcnIMSDKiOS/ViewController.mm
View file @
6cf4c29f
...
@@ -15,6 +15,10 @@
...
@@ -15,6 +15,10 @@
@property
(
weak
,
nonatomic
)
IBOutlet
UIButton
*
changeEnvironmentBtn
;
@property
(
weak
,
nonatomic
)
IBOutlet
UIButton
*
changeEnvironmentBtn
;
@property
(
weak
,
nonatomic
)
IBOutlet
UITextField
*
megTextField
;
@property
(
weak
,
nonatomic
)
IBOutlet
UITextField
*
megTextField
;
@property
(
weak
,
nonatomic
)
IBOutlet
UITextField
*
sendIDTextField
;
@property
(
weak
,
nonatomic
)
IBOutlet
UITextField
*
sendTokenTextField
;
@property
(
weak
,
nonatomic
)
IBOutlet
UITextField
*
recvIDTextField
;
@property
(
strong
,
nonatomic
)
NSString
*
fromId
;
@property
(
strong
,
nonatomic
)
NSString
*
fromId
;
@property
(
strong
,
nonatomic
)
NSString
*
toId
;
@property
(
strong
,
nonatomic
)
NSString
*
toId
;
...
@@ -25,6 +29,21 @@
...
@@ -25,6 +29,21 @@
@implementation
ViewController
@implementation
ViewController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
title
=
@"demo"
;
self
.
changeEnvironmentBtn
.
selected
=
[
OffcnIMSDKiOS
defaultService
].
isTest
;
self
.
sendIDTextField
.
text
=
@"jfdfjei0343"
;
self
.
recvIDTextField
.
text
=
@"ce0819db8391f1e7258a71cc9e2c3235"
;
self
.
sendTokenTextField
.
text
=
@"fadbce3f4929b6bdee0617fee34e32ae"
;
self
.
fromId
=
self
.
sendIDTextField
.
text
;
self
.
toId
=
self
.
recvIDTextField
.
text
;
}
#pragma mark - 切换环境
#pragma mark - 切换环境
-
(
IBAction
)
clickChangeEnvironmentBtnAction
:
(
UIButton
*
)
sender
{
-
(
IBAction
)
clickChangeEnvironmentBtnAction
:
(
UIButton
*
)
sender
{
sender
.
selected
=
!
sender
.
isSelected
;
sender
.
selected
=
!
sender
.
isSelected
;
...
@@ -41,10 +60,7 @@
...
@@ -41,10 +60,7 @@
}
}
-
(
IBAction
)
connectAction
:
(
UIButton
*
)
sender
{
-
(
IBAction
)
connectAction
:
(
UIButton
*
)
sender
{
//建立连接
//建立连接
// connection_type = ["kcp", "websocket"]
[[
OffcnIMSocketManager
defaultService
]
connectIMServerWithAccount_id
:
self
.
toId
token
:
self
.
sendTokenTextField
.
text
];
// tls = ["disable", "enable"]
NSString
*
paramStr
=
@"{
\"
server_ip
\"
:
\"
192.168.43.141
\"
,
\"
server_port
\"
:1026,
\"
account_id
\"
:
\"
ce0819db8391f1e7258a71cc9e2c3235
\"
,
\"
app_id
\"
:
\"
offcn_live
\"
,
\"
device_type
\"
:
\"
ios
\"
,
\"
token
\"
:
\"
fadbce3f4929b6bdee0617fee34e32ae
\"
,
\"
session_id
\"
:
\"
123
\"
,
\"
connection_type
\"
:
\"
websocket
\"
,
\"
tls
\"
:
\"
disable
\"
}"
;
[[
OffcnIMSocketManager
defaultService
]
connectIMServerWithParam
:
paramStr
];
__weak
typeof
(
self
)
weakSelf
=
self
;
__weak
typeof
(
self
)
weakSelf
=
self
;
[
OffcnIMSocketManager
defaultService
].
connectReceiveMessage
=
^
(
OffcnIMModel
*
IMModel
)
{
[
OffcnIMSocketManager
defaultService
].
connectReceiveMessage
=
^
(
OffcnIMModel
*
IMModel
)
{
...
@@ -120,6 +136,7 @@
...
@@ -120,6 +136,7 @@
}
}
msg
=
[
msg
stringByAppendingString
:
@"
\r\n
"
];
msg
=
[
msg
stringByAppendingString
:
@"
\r\n
"
];
msg
=
[
msg
stringByAppendingString
:
@"
\r\n
"
];
}
}
OffcnZYJTestDataStorageView
*
storageView
=
[[
OffcnZYJTestDataStorageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
20
,
self
.
view
.
bounds
.
size
.
width
,
self
.
view
.
bounds
.
size
.
height
-
20
)];
OffcnZYJTestDataStorageView
*
storageView
=
[[
OffcnZYJTestDataStorageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
20
,
self
.
view
.
bounds
.
size
.
width
,
self
.
view
.
bounds
.
size
.
height
-
20
)];
...
@@ -158,6 +175,7 @@
...
@@ -158,6 +175,7 @@
}
}
msg
=
[
msg
stringByAppendingString
:
@"
\r\n
"
];
msg
=
[
msg
stringByAppendingString
:
@"
\r\n
"
];
msg
=
[
msg
stringByAppendingString
:
@"
\r\n
"
];
}
}
OffcnZYJTestDataStorageView
*
storageView
=
[[
OffcnZYJTestDataStorageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
20
,
self
.
view
.
bounds
.
size
.
width
,
self
.
view
.
bounds
.
size
.
height
-
20
)];
OffcnZYJTestDataStorageView
*
storageView
=
[[
OffcnZYJTestDataStorageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
20
,
self
.
view
.
bounds
.
size
.
width
,
self
.
view
.
bounds
.
size
.
height
-
20
)];
...
@@ -184,6 +202,7 @@
...
@@ -184,6 +202,7 @@
}
}
msg
=
[
msg
stringByAppendingString
:
@"
\r\n
"
];
msg
=
[
msg
stringByAppendingString
:
@"
\r\n
"
];
msg
=
[
msg
stringByAppendingString
:
@"
\r\n
"
];
}
}
OffcnZYJTestDataStorageView
*
storageView
=
[[
OffcnZYJTestDataStorageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
20
,
self
.
view
.
bounds
.
size
.
width
,
self
.
view
.
bounds
.
size
.
height
-
20
)];
OffcnZYJTestDataStorageView
*
storageView
=
[[
OffcnZYJTestDataStorageView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
20
,
self
.
view
.
bounds
.
size
.
width
,
self
.
view
.
bounds
.
size
.
height
-
20
)];
...
@@ -236,17 +255,6 @@
...
@@ -236,17 +255,6 @@
}];
}];
}
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
title
=
@"demo"
;
self
.
changeEnvironmentBtn
.
selected
=
[
OffcnIMSDKiOS
defaultService
].
isTest
;
self
.
fromId
=
@"jfdfjei0343"
;
self
.
toId
=
@"ce0819db8391f1e7258a71cc9e2c3235"
;
}
#pragma mark UIImagePickerControllerDelegate
#pragma mark UIImagePickerControllerDelegate
-
(
void
)
imagePickerController
:
(
UIImagePickerController
*
)
picker
didFinishPickingMediaWithInfo
:
(
NSDictionary
<
UIImagePickerControllerInfoKey
,
id
>
*
)
info
{
-
(
void
)
imagePickerController
:
(
UIImagePickerController
*
)
picker
didFinishPickingMediaWithInfo
:
(
NSDictionary
<
UIImagePickerControllerInfoKey
,
id
>
*
)
info
{
self
.
pickImage
=
info
[
UIImagePickerControllerOriginalImage
];
self
.
pickImage
=
info
[
UIImagePickerControllerOriginalImage
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment