Skip to content
切换导航面板
P
项目
G
群组
S
代码片段
帮助
徐利超
/
MutiFaceDemo
当前项目
正在载入...
登录
切换导航面板
转到一个项目
项目
版本库
问题
0
合并请求
0
流水线
维基
代码片段
成员
活动
图像
图表
创建新的问题
作业
提交
问题看板
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
cf5e9be6
authored
Oct 13, 2020
by
徐利超
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update 同屏集成
parent
b26cbbf0
显示空白字符变更
内嵌
并排
正在显示
25 个修改的文件
包含
1360 行增加
和
150 行删除
+1360
-150
MutiFaceDemo.xcodeproj/project.pbxproj
+54
-0
MutiFaceDemo/Application/AudioSampling/CHAudioSamplingController.h
+17
-0
MutiFaceDemo/Application/AudioSampling/CHAudioSamplingController.m
+24
-0
MutiFaceDemo/Application/SameScreen/FacesignWebView/CHFacesignWebView.h
+0
-4
MutiFaceDemo/Application/SameScreen/FacesignWebView/CHFacesignWebView.m
+4
-5
MutiFaceDemo/Application/SameScreen/YUNXINDemoView.h
+23
-0
MutiFaceDemo/Application/SameScreen/YUNXINDemoView.m
+171
-0
MutiFaceDemo/Application/SameScreen/YUNXINDemoViewController.h
+19
-0
MutiFaceDemo/Application/SameScreen/YUNXINDemoViewController.m
+119
-0
MutiFaceDemo/Application/SameScreen/YUNXINSameScreen/YUNXINSameScreenDefine.h
+31
-0
MutiFaceDemo/Application/SameScreen/YUNXINSameScreen/YUNXINSameScreenView.h
+33
-0
MutiFaceDemo/Application/SameScreen/YUNXINSameScreen/YUNXINSameScreenView.m
+242
-0
MutiFaceDemo/Application/SameScreen/YUNXINSameScreenManager.h
+134
-0
MutiFaceDemo/Application/SameScreen/YUNXINSameScreenManager.m
+275
-0
MutiFaceDemo/Application/SameScreen/YWWhiteboard/YWScrawlView.h
+2
-2
MutiFaceDemo/Application/SameScreen/YWWhiteboard/YWScrawlView.m
+49
-8
MutiFaceDemo/Application/faceViewController/MutiFaceViewController.m
+10
-0
MutiFaceDemo/Application/loginViewController/LoginViewController.m
+61
-116
MutiFaceDemo/PrefixHeader.pch
+1
-0
MutiFaceDemo/ThirdPartLibs/NIMVideo/CHCustomMsg/CHPIngAttachment.h
+27
-0
MutiFaceDemo/ThirdPartLibs/NIMVideo/CHCustomMsg/CHPIngAttachment.m
+34
-0
MutiFaceDemo/ThirdPartLibs/NIMVideo/CHCustomMsg/Misc/NTESCustomAttachmentDecoder.m
+10
-1
MutiFaceDemo/ThirdPartLibs/NIMVideo/CHCustomMsg/Misc/NTESCustomAttachmentDefines.h
+8
-7
MutiFaceDemo/ThirdPartLibs/NIMVideo/CHCustomSystemNotification/NTESCustomSysNotificationSender.h
+0
-1
MutiFaceDemo/ThirdPartLibs/NIMVideo/Util/NTESNotificationCenter.m
+12
-6
没有找到文件。
MutiFaceDemo.xcodeproj/project.pbxproj
查看文件 @
cf5e9be6
...
...
@@ -46,6 +46,12 @@
40F58B20252317F40087C93F
/* WKWebViewJavascriptBridge.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
40F58B18252317F40087C93F
/* WKWebViewJavascriptBridge.m */
;
};
40F58B21252317F40087C93F
/* WebViewJavascriptBridge.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
40F58B19252317F40087C93F
/* WebViewJavascriptBridge.m */
;
};
40F58B22252317F40087C93F
/* WebViewJavascriptBridge_JS.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
40F58B1C252317F40087C93F
/* WebViewJavascriptBridge_JS.m */
;
};
40F58B26252429CE0087C93F
/* CHAudioSamplingController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
40F58B25252429CD0087C93F
/* CHAudioSamplingController.m */
;
};
40F58B2925304C730087C93F
/* YUNXINSameScreenManager.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
40F58B2825304C730087C93F
/* YUNXINSameScreenManager.m */
;
};
40F58B2D2533FB960087C93F
/* YUNXINSameScreenView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
40F58B2C2533FB960087C93F
/* YUNXINSameScreenView.m */
;
};
40F58B31253554380087C93F
/* YUNXINDemoViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
40F58B30253554380087C93F
/* YUNXINDemoViewController.m */
;
};
40F58B34253554900087C93F
/* YUNXINDemoView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
40F58B33253554900087C93F
/* YUNXINDemoView.m */
;
};
40F58B3725358E630087C93F
/* CHPIngAttachment.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
40F58B3625358E630087C93F
/* CHPIngAttachment.m */
;
};
40F6F99823D696CF00EC3737
/* AppDelegate.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
40F6F99723D696CF00EC3737
/* AppDelegate.m */
;
};
40F6F99E23D696CF00EC3737
/* ViewController.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
40F6F99D23D696CF00EC3737
/* ViewController.m */
;
};
40F6F9A123D696CF00EC3737
/* Main.storyboard in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
40F6F99F23D696CF00EC3737
/* Main.storyboard */
;
};
...
...
@@ -195,6 +201,19 @@
40F58B1C252317F40087C93F
/* WebViewJavascriptBridge_JS.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
WebViewJavascriptBridge_JS.m
;
sourceTree
=
"<group>"
;
};
40F58B1D252317F40087C93F
/* WebViewJavascriptBridge.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
WebViewJavascriptBridge.h
;
sourceTree
=
"<group>"
;
};
40F58B1E252317F40087C93F
/* WKWebViewJavascriptBridge.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
WKWebViewJavascriptBridge.h
;
sourceTree
=
"<group>"
;
};
40F58B24252429CD0087C93F
/* CHAudioSamplingController.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
CHAudioSamplingController.h
;
sourceTree
=
"<group>"
;
};
40F58B25252429CD0087C93F
/* CHAudioSamplingController.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
CHAudioSamplingController.m
;
sourceTree
=
"<group>"
;
};
40F58B2725304C730087C93F
/* YUNXINSameScreenManager.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
YUNXINSameScreenManager.h
;
sourceTree
=
"<group>"
;
};
40F58B2825304C730087C93F
/* YUNXINSameScreenManager.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
YUNXINSameScreenManager.m
;
sourceTree
=
"<group>"
;
};
40F58B2B2533FB960087C93F
/* YUNXINSameScreenView.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
YUNXINSameScreenView.h
;
sourceTree
=
"<group>"
;
};
40F58B2C2533FB960087C93F
/* YUNXINSameScreenView.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
YUNXINSameScreenView.m
;
sourceTree
=
"<group>"
;
};
40F58B2E25342CB60087C93F
/* YUNXINSameScreenDefine.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
YUNXINSameScreenDefine.h
;
sourceTree
=
"<group>"
;
};
40F58B2F253554380087C93F
/* YUNXINDemoViewController.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
YUNXINDemoViewController.h
;
sourceTree
=
"<group>"
;
};
40F58B30253554380087C93F
/* YUNXINDemoViewController.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
YUNXINDemoViewController.m
;
sourceTree
=
"<group>"
;
};
40F58B32253554900087C93F
/* YUNXINDemoView.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
YUNXINDemoView.h
;
sourceTree
=
"<group>"
;
};
40F58B33253554900087C93F
/* YUNXINDemoView.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
YUNXINDemoView.m
;
sourceTree
=
"<group>"
;
};
40F58B3525358E630087C93F
/* CHPIngAttachment.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
CHPIngAttachment.h
;
sourceTree
=
"<group>"
;
};
40F58B3625358E630087C93F
/* CHPIngAttachment.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
CHPIngAttachment.m
;
sourceTree
=
"<group>"
;
};
40F6F99323D696CF00EC3737
/* MutiFaceDemo.app */
=
{
isa
=
PBXFileReference
;
explicitFileType
=
wrapper.application
;
includeInIndex
=
0
;
path
=
MutiFaceDemo.app
;
sourceTree
=
BUILT_PRODUCTS_DIR
;
};
40F6F99623D696CF00EC3737
/* AppDelegate.h */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
AppDelegate.h
;
sourceTree
=
"<group>"
;
};
40F6F99723D696CF00EC3737
/* AppDelegate.m */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
AppDelegate.m
;
sourceTree
=
"<group>"
;
};
...
...
@@ -444,6 +463,8 @@
40F58AF2252197070087C93F
/* CHSameScreenAttachment.m */
,
40F58AF4252197070087C93F
/* CHSnapshotAttachment.h */
,
40F58AF1252197070087C93F
/* CHSnapshotAttachment.m */
,
40F58B3525358E630087C93F
/* CHPIngAttachment.h */
,
40F58B3625358E630087C93F
/* CHPIngAttachment.m */
,
);
path
=
CHCustomMsg
;
sourceTree
=
"<group>"
;
...
...
@@ -464,10 +485,17 @@
40F58AFB2521B1BE0087C93F
/* SameScreen */
=
{
isa
=
PBXGroup
;
children
=
(
40F58B2A2533FB620087C93F
/* YUNXINSameScreen */
,
40F58B0B2521C0A20087C93F
/* YWWhiteboard */
,
40F58B072521B3DF0087C93F
/* CHBaseUIFactory */
,
40F58B002521B3820087C93F
/* CHAlertBaseView */
,
40F58AFC2521B1BE0087C93F
/* FacesignWebView */
,
40F58B2725304C730087C93F
/* YUNXINSameScreenManager.h */
,
40F58B2825304C730087C93F
/* YUNXINSameScreenManager.m */
,
40F58B2F253554380087C93F
/* YUNXINDemoViewController.h */
,
40F58B30253554380087C93F
/* YUNXINDemoViewController.m */
,
40F58B32253554900087C93F
/* YUNXINDemoView.h */
,
40F58B33253554900087C93F
/* YUNXINDemoView.m */
,
);
path
=
SameScreen
;
sourceTree
=
"<group>"
;
...
...
@@ -537,6 +565,25 @@
path
=
WebViewJavascriptBridge
;
sourceTree
=
"<group>"
;
};
40F58B23252429B30087C93F
/* AudioSampling */
=
{
isa
=
PBXGroup
;
children
=
(
40F58B24252429CD0087C93F
/* CHAudioSamplingController.h */
,
40F58B25252429CD0087C93F
/* CHAudioSamplingController.m */
,
);
path
=
AudioSampling
;
sourceTree
=
"<group>"
;
};
40F58B2A2533FB620087C93F
/* YUNXINSameScreen */
=
{
isa
=
PBXGroup
;
children
=
(
40F58B2B2533FB960087C93F
/* YUNXINSameScreenView.h */
,
40F58B2C2533FB960087C93F
/* YUNXINSameScreenView.m */
,
40F58B2E25342CB60087C93F
/* YUNXINSameScreenDefine.h */
,
);
path
=
YUNXINSameScreen
;
sourceTree
=
"<group>"
;
};
40F6F98A23D696CE00EC3737
=
{
isa
=
PBXGroup
;
children
=
(
...
...
@@ -600,6 +647,7 @@
40F6F9CB23D6987D00EC3737
/* Application */
=
{
isa
=
PBXGroup
;
children
=
(
40F58B23252429B30087C93F
/* AudioSampling */
,
40F58AFB2521B1BE0087C93F
/* SameScreen */
,
402C16CA24222A1500F6EA72
/* AutoFaceDetectionViewController */
,
40F6F9CC23D6987D00EC3737
/* faceViewController */
,
...
...
@@ -1058,6 +1106,7 @@
40F58AF8252197070087C93F
/* NSDictionary+NTESJson.m in Sources */
,
40F58AFF2521B1BE0087C93F
/* CHFacesignWebView.m in Sources */
,
40F58B102521C0A20087C93F
/* YWScrawlView.m in Sources */
,
40F58B34253554900087C93F
/* YUNXINDemoView.m in Sources */
,
409E0C3E2424B15000892138
/* UIImage+CH.m in Sources */
,
402C16CD24222A6A00F6EA72
/* AutoFaceDetectionViewController.m in Sources */
,
40F6FA4B23D6B36A00EC3737
/* NTESVideoChatNetStatusView.m in Sources */
,
...
...
@@ -1078,6 +1127,9 @@
40F58AF9252197070087C93F
/* CHSnapshotAttachment.m in Sources */
,
40F6FA5423D6B36A00EC3737
/* yuv444p10le.fsh.c in Sources */
,
40F6FA4123D6B36A00EC3737
/* UIView+NTES.m in Sources */
,
40F58B2D2533FB960087C93F
/* YUNXINSameScreenView.m in Sources */
,
40F58B26252429CE0087C93F
/* CHAudioSamplingController.m in Sources */
,
40F58B3725358E630087C93F
/* CHPIngAttachment.m in Sources */
,
40F58B21252317F40087C93F
/* WebViewJavascriptBridge.m in Sources */
,
40F6FA4623D6B36A00EC3737
/* NTESBundleSetting.m in Sources */
,
40F6FA5623D6B36A00EC3737
/* yuv420sp.fsh.c in Sources */
,
...
...
@@ -1092,12 +1144,14 @@
40F6F9F923D6B2FC00EC3737
/* MBHUDTool.m in Sources */
,
402C16F524236D9B00F6EA72
/* UIImage+Extend.m in Sources */
,
40F6FA5323D6B36A00EC3737
/* renderer.c in Sources */
,
40F58B2925304C730087C93F
/* YUNXINSameScreenManager.m in Sources */
,
40F6F9A923D696D600EC3737
/* main.m in Sources */
,
40F58B1F252317F40087C93F
/* WebViewJavascriptBridgeBase.m in Sources */
,
40F6FA4E23D6B36A00EC3737
/* mvp.vsh.c in Sources */
,
40F6FA4323D6B36A00EC3737
/* NTESClientUtil.m in Sources */
,
40F6FA4423D6B36A00EC3737
/* NTESNotificationCenter.m in Sources */
,
409E0C412424B1F200892138
/* UIColor+CH.m in Sources */
,
40F58B31253554380087C93F
/* YUNXINDemoViewController.m in Sources */
,
40F58B062521B3820087C93F
/* CHShadeView.m in Sources */
,
40F6FA4D23D6B36A00EC3737
/* common.c in Sources */
,
40F58AF5252197070087C93F
/* NTESCustomAttachmentDecoder.m in Sources */
,
...
...
MutiFaceDemo/Application/AudioSampling/CHAudioSamplingController.h
0 → 100644
查看文件 @
cf5e9be6
//
// CHAudioSamplingController.h
// MutiFaceDemo
//
// Created by Xu Lichao on 2020/9/30.
// Copyright © 2020 Yuwei. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface
CHAudioSamplingController
:
UIViewController
@end
NS_ASSUME_NONNULL_END
MutiFaceDemo/Application/AudioSampling/CHAudioSamplingController.m
0 → 100644
查看文件 @
cf5e9be6
//
// CHAudioSamplingController.m
// MutiFaceDemo
//
// Created by Xu Lichao on 2020/9/30.
// Copyright © 2020 Yuwei. All rights reserved.
//
#import "CHAudioSamplingController.h"
@interface
CHAudioSamplingController
()
@end
@implementation
CHAudioSamplingController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
// Do any additional setup after loading the view.
}
@end
MutiFaceDemo/Application/SameScreen/FacesignWebView/CHFacesignWebView.h
查看文件 @
cf5e9be6
...
...
@@ -19,10 +19,6 @@ NS_ASSUME_NONNULL_BEGIN
-
(
void
)
webViewDidViewScroll
:(
CGFloat
)
contentY
;
-
(
void
)
webViewDidViewBeginDecelerating
;
-
(
void
)
webViewDidViewEndDecelerating
;
-
(
void
)
webViewDidReceiveWebAction
:(
NSDictionary
*
)
param
;
-
(
void
)
webViewScrawlAction
:(
NSDictionary
*
)
paramDic
;
...
...
MutiFaceDemo/Application/SameScreen/FacesignWebView/CHFacesignWebView.m
查看文件 @
cf5e9be6
...
...
@@ -13,7 +13,7 @@
#import "CHUIFactory.h"
#import "YWScrawlView.h"
#import "WKWebViewJavascriptBridge.h"
#import "YUNXINSameScreenManager.h"
#define dispatch_main_async_safe(block)\
if ([NSThread isMainThread]) {\
...
...
@@ -162,7 +162,7 @@ dispatch_async(dispatch_get_main_queue(), block);\
[
_markBtn
setTitle
:
@"取消标注"
forState
:
UIControlStateNormal
];
_mShadeView
.
userInteractionEnabled
=
NO
;
if
(
!
_scrawlView
)
{
_scrawlView
=
[[
YWScrawlView
alloc
]
initWithFrame
:
_webView
.
frame
colorHex
:
0x000000
];
_scrawlView
=
[[
YWScrawlView
alloc
]
initWithFrame
:
_webView
.
frame
colorHex
Str
:
@"#000000"
];
_scrawlView
.
delegate
=
self
;
[
_containerView
addSubview
:
_scrawlView
];
}
...
...
@@ -195,7 +195,7 @@ dispatch_async(dispatch_get_main_queue(), block);\
[
_markBtn
setTitle
:
@"取消标注"
forState
:
UIControlStateNormal
];
_mShadeView
.
userInteractionEnabled
=
NO
;
if
(
!
_scrawlView
)
{
_scrawlView
=
[[
YWScrawlView
alloc
]
initWithFrame
:
_webView
.
frame
colorHex
:
0x000000
];
_scrawlView
=
[[
YWScrawlView
alloc
]
initWithFrame
:
_webView
.
frame
colorHex
Str
:
@"#000000"
];
_scrawlView
.
delegate
=
self
;
[
_containerView
addSubview
:
_scrawlView
];
}
...
...
@@ -250,14 +250,13 @@ dispatch_async(dispatch_get_main_queue(), block);\
if
(
!
([
currentDecimal
compare
:[[
NSDecimalNumber
alloc
]
initWithFloat
:
-
999
.
0
]]
==
NSOrderedSame
))
{
// NSLog(@"=====>>>>> scrollView scrollHeight : %f", self.currentY);
if
([
_delegate
respondsToSelector
:
@selector
(
webViewDidViewScroll
:)])
{
[
_delegate
webViewDidViewScroll
:
self
.
currentY
*
SCREEN_DENSITY_SCALE
];
[
_delegate
webViewDidViewScroll
:
self
.
currentY
];
}
self
.
currentY
=
-
999
.
0
;
}
}
#pragma mark - WKUIDelegate
-
(
void
)
webView
:
(
WKWebView
*
)
webView
runJavaScriptAlertPanelWithMessage
:
(
NSString
*
)
message
initiatedByFrame
:
(
WKFrameInfo
*
)
frame
completionHandler
:
(
void
(
^
)(
void
))
completionHandler
{
completionHandler
();
}
...
...
MutiFaceDemo/Application/SameScreen/YUNXINDemoView.h
0 → 100644
查看文件 @
cf5e9be6
//
// YUNXINDemoView.h
// MutiFaceDemo
//
// Created by Xu Lichao on 2020/10/13.
// Copyright © 2020 Yuwei. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface
YUNXINDemoView
:
UIView
-
(
void
)
show
;
-
(
void
)
dismiss
;
-
(
void
)
updateToolBarWhenSameScreenAuthorityReq
;
-
(
void
)
updateToolBarWhenMarkAuthorityReq
;
@end
NS_ASSUME_NONNULL_END
MutiFaceDemo/Application/SameScreen/YUNXINDemoView.m
0 → 100644
查看文件 @
cf5e9be6
//
// YUNXINDemoView.m
// MutiFaceDemo
//
// Created by Xu Lichao on 2020/10/13.
// Copyright © 2020 Yuwei. All rights reserved.
//
#import "YUNXINDemoView.h"
#import "YUNXINSameScreenManager.h"
#import "CHUIFactory.h"
@interface
YUNXINDemoView
()
@property
(
nonatomic
,
strong
)
YUNXINSameScreenView
*
sameScrennView
;
@property
(
nonatomic
,
assign
)
BOOL
isAnimated
;
@property
(
nonatomic
,
strong
)
UIView
*
toolBarView
;
@property
(
nonatomic
,
strong
)
UIButton
*
cancelBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
markBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
callBackBtn
;
@property
(
nonatomic
,
assign
)
BOOL
isMark
;
@end
@implementation
YUNXINDemoView
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
{
self
=
[
super
initWithFrame
:
frame
];
if
(
self
)
{
self
.
isAnimated
=
NO
;
[
self
setupUI
];
}
return
self
;
}
-
(
void
)
setupUI
{
self
.
sameScrennView
=
[[
YUNXINSameScreenManager
shareInstance
]
getSameScreenViewWithFrame
:
CGRectMake
(
0
,
kStatusBarHeight
,
SCREEN_WIDTH
,
SCREEN_HEIGHT
-
kStatusBarHeight
-
40
-
kSafeButtomHeight
)
drawHexColor
:
@"#000000"
isManager
:
YES
];
[[
YUNXINSameScreenManager
shareInstance
]
updateSameScreenViewWithWebUrl
:
@"http://192.168.70.182/glw/private.html"
miniFlag
:
@"1"
];
[
self
addSubview
:
self
.
sameScrennView
];
[
self
addSubview
:
self
.
toolBarView
];
[
self
updateToolBarViewWithshowArray
:@[
self
.
cancelBtn
,
self
.
markBtn
]];
}
-
(
void
)
updateToolBarViewWithshowArray
:
(
NSArray
*
)
showArray
{
for
(
UIButton
*
btn
in
_toolBarView
.
subviews
)
{
[
btn
removeFromSuperview
];
}
for
(
NSInteger
i
=
0
;
i
<
showArray
.
count
;
++
i
)
{
UIButton
*
btn
=
showArray
[
i
];
btn
.
frame
=
CGRectMake
(
20
+
80
*
i
,
8
,
60
,
24
);
[
_toolBarView
addSubview
:
btn
];
}
}
-
(
void
)
updateToolBarWhenSameScreenAuthorityReq
{
[
self
.
callBackBtn
setTitle
:
@"收回同屏"
forState
:
UIControlStateNormal
];
[
self
updateToolBarViewWithshowArray
:@[
self
.
cancelBtn
,
self
.
markBtn
,
self
.
callBackBtn
]];
}
-
(
void
)
updateToolBarWhenMarkAuthorityReq
{
[
self
.
callBackBtn
setTitle
:
@"收回标注"
forState
:
UIControlStateNormal
];
[
self
updateToolBarViewWithshowArray
:@[
self
.
cancelBtn
,
self
.
callBackBtn
]];
}
-
(
void
)
show
{
if
(
_isAnimated
)
{
return
;
}
_isAnimated
=
YES
;
_isMark
=
NO
;
[
UIView
animateWithDuration
:
0
.
2
animations
:
^
{
CGRect
mFrame
=
self
.
frame
;
mFrame
.
origin
.
y
-=
mFrame
.
size
.
height
;
self
.
frame
=
mFrame
;
}
completion
:^
(
BOOL
finished
)
{
self
.
isAnimated
=
NO
;
}];
}
-
(
void
)
dismiss
{
if
(
_isAnimated
)
{
return
;
}
_isAnimated
=
YES
;
[
UIView
animateWithDuration
:
0
.
2
animations
:
^
{
CGRect
mFrame
=
self
.
frame
;
mFrame
.
origin
.
y
+=
mFrame
.
size
.
height
;
self
.
frame
=
mFrame
;
}
completion
:^
(
BOOL
finished
)
{
self
.
isAnimated
=
NO
;
}];
}
#pragma mark - IBAction
-
(
void
)
cancelBtnTouched
{
if
(
self
.
isMark
)
{
self
.
isMark
=
NO
;
[[
YUNXINSameScreenManager
shareInstance
]
closeMark
];
[
self
.
cancelBtn
setTitle
:
@"取消同屏"
forState
:
UIControlStateNormal
];
}
else
{
[
self
dismiss
];
[[
YUNXINSameScreenManager
shareInstance
]
sendDismissSameScreenViewNotification
];
}
}
-
(
void
)
callbackBtnTouched
{
if
(
self
.
isMark
)
{
[
self
updateToolBarViewWithshowArray
:@[
self
.
cancelBtn
]];
}
else
{
[
self
updateToolBarViewWithshowArray
:@[
self
.
cancelBtn
,
self
.
markBtn
]];
}
}
-
(
void
)
markBtnTouched
{
self
.
isMark
=
YES
;
[[
YUNXINSameScreenManager
shareInstance
]
openMark
];
[
self
.
cancelBtn
setTitle
:
@"取消标注"
forState
:
UIControlStateNormal
];
[
self
updateToolBarViewWithshowArray
:@[
self
.
cancelBtn
]];
}
#pragma mark - setter/getter
-
(
UIView
*
)
toolBarView
{
if
(
!
_toolBarView
)
{
_toolBarView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
SCREEN_HEIGHT
-
kSafeButtomHeight
-
40
,
SCREEN_WIDTH
,
40
)];
}
return
_toolBarView
;
}
-
(
UIButton
*
)
cancelBtn
{
if
(
!
_cancelBtn
)
{
_cancelBtn
=
[
CHUIFactory
buttonWithTitle
:
@"取消同屏"
font
:
kFont
(
14
)
titleColor
:
[
UIColor
redColor
]
target
:
self
action
:
@selector
(
cancelBtnTouched
)];
}
return
_cancelBtn
;
}
-
(
UIButton
*
)
markBtn
{
if
(
!
_markBtn
)
{
_markBtn
=
[
CHUIFactory
buttonWithTitle
:
@"标注"
font
:
kFont
(
14
)
titleColor
:
[
UIColor
redColor
]
target
:
self
action
:
@selector
(
markBtnTouched
)];
}
return
_markBtn
;
}
-
(
UIButton
*
)
callBackBtn
{
if
(
!
_callBackBtn
)
{
_callBackBtn
=
[
CHUIFactory
buttonWithTitle
:
@"收回同屏"
font
:
kFont
(
14
)
titleColor
:
[
UIColor
blueColor
]
target
:
self
action
:
@selector
(
callbackBtnTouched
)];
}
return
_callBackBtn
;
}
@end
MutiFaceDemo/Application/SameScreen/YUNXINDemoViewController.h
0 → 100644
查看文件 @
cf5e9be6
//
// YUNXINDemoViewController.h
// MutiFaceDemo
//
// Created by Xu Lichao on 2020/10/13.
// Copyright © 2020 Yuwei. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface
YUNXINDemoViewController
:
UIViewController
@property
(
nonatomic
,
strong
)
NSString
*
otherUid
;
@end
NS_ASSUME_NONNULL_END
MutiFaceDemo/Application/SameScreen/YUNXINDemoViewController.m
0 → 100644
查看文件 @
cf5e9be6
//
// YUNXINDemoViewController.m
// MutiFaceDemo
//
// Created by Xu Lichao on 2020/10/13.
// Copyright © 2020 Yuwei. All rights reserved.
//
#import "YUNXINDemoViewController.h"
#import "CHUIFactory.h"
#import "YUNXINSameScreenManager.h"
#import "YUNXINDemoView.h"
@interface
YUNXINDemoViewController
()
<
YUNXINSameScreenManagerDelegate
>
@property
(
nonatomic
,
strong
)
UILabel
*
noticeLabel
;
@property
(
nonatomic
,
strong
)
UIButton
*
hangupBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
sameScreenBtn
;
@property
(
nonatomic
,
strong
)
YUNXINDemoView
*
demoView
;
@end
@implementation
YUNXINDemoViewController
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[[
YUNXINSameScreenManager
shareInstance
]
configCurrentSession
:[
NIMSession
session
:
self
.
otherUid
type
:
NIMSessionTypeP2P
]];
[[
YUNXINSameScreenManager
shareInstance
]
addDelegate
:
self
];
[
self
.
view
addSubview
:
self
.
noticeLabel
];
[
self
.
view
addSubview
:
self
.
demoView
];
}
#pragma mark - IBAction
-
(
void
)
hangupBtnTouched
{
[
self
dismissViewControllerAnimated
:
YES
completion
:
nil
];
}
-
(
void
)
sameScreenBtnTouched
{
[
_demoView
show
];
[[
YUNXINSameScreenManager
shareInstance
]
sendshowSameScreenViewNotification
];
}
#pragma mark - YUNXINSameScreenManagerDelegate
-
(
void
)
sameScreenCloseView
{
[
_demoView
dismiss
];
}
-
(
void
)
sameScreenReceiveOperateReqWithUid
:
(
NSString
*
)
uid
{
UIAlertController
*
alertController
=
[
UIAlertController
alertControllerWithTitle
:
@""
message
:[
NSString
stringWithFormat
:
@"%@请求同屏操作"
,
uid
]
preferredStyle
:
UIAlertControllerStyleAlert
];
UIAlertAction
*
approve
=
[
UIAlertAction
actionWithTitle
:
@"同意"
style
:
UIAlertActionStyleDefault
handler
:^
(
UIAlertAction
*
_Nonnull
action
)
{
[[
YUNXINSameScreenManager
shareInstance
]
approveTheSameScreenOperateAuthorityWithRequseterUid
:
uid
isApproved
:
YES
];
[
self
.
demoView
updateToolBarWhenSameScreenAuthorityReq
];
}];
UIAlertAction
*
refuse
=
[
UIAlertAction
actionWithTitle
:
@"拒绝"
style
:
UIAlertActionStyleCancel
handler
:^
(
UIAlertAction
*
_Nonnull
action
)
{
[[
YUNXINSameScreenManager
shareInstance
]
approveTheSameScreenOperateAuthorityWithRequseterUid
:
uid
isApproved
:
NO
];
}];
[
alertController
addAction
:
approve
];
[
alertController
addAction
:
refuse
];
[
self
presentViewController
:
alertController
animated
:
YES
completion
:
nil
];
}
-
(
void
)
sameScreenReceiveMarkOperateReqWithUid
:
(
NSString
*
)
uid
{
UIAlertController
*
alertController
=
[
UIAlertController
alertControllerWithTitle
:
@""
message
:[
NSString
stringWithFormat
:
@"%@请求同屏操作"
,
uid
]
preferredStyle
:
UIAlertControllerStyleAlert
];
UIAlertAction
*
approve
=
[
UIAlertAction
actionWithTitle
:
@"同意"
style
:
UIAlertActionStyleDefault
handler
:^
(
UIAlertAction
*
_Nonnull
action
)
{
[[
YUNXINSameScreenManager
shareInstance
]
approveTheSameScreenOperateAuthorityWithRequseterUid
:
uid
isApproved
:
YES
];
[
self
.
demoView
updateToolBarWhenMarkAuthorityReq
];
}];
UIAlertAction
*
refuse
=
[
UIAlertAction
actionWithTitle
:
@"拒绝"
style
:
UIAlertActionStyleCancel
handler
:^
(
UIAlertAction
*
_Nonnull
action
)
{
[[
YUNXINSameScreenManager
shareInstance
]
approveTheSameScreenOperateAuthorityWithRequseterUid
:
uid
isApproved
:
NO
];
}];
[
alertController
addAction
:
approve
];
[
alertController
addAction
:
refuse
];
[
self
presentViewController
:
alertController
animated
:
YES
completion
:
nil
];
}
#pragma mark - setter/getter
-
(
UILabel
*
)
noticeLabel
{
if
(
!
_noticeLabel
)
{
_noticeLabel
=
[
CHUIFactory
labelWithTitle
:
@"音视频界面"
font
:
kFont
(
16
)
textColor
:
[
UIColor
blackColor
]
frame
:
CGRectMake
(
20
,
100
,
100
,
30
)];
}
return
_noticeLabel
;
}
-
(
UIButton
*
)
hangupBtn
{
if
(
!
_hangupBtn
)
{
_hangupBtn
=
[
CHUIFactory
buttonWithTitle
:
@"挂断"
font
:
kFont
(
16
)
titleColor
:
[
UIColor
redColor
]
target
:
self
action
:
@selector
(
hangupBtnTouched
)
frame
:
CGRectMake
(
20
,
150
,
60
,
30
)];
}
return
_hangupBtn
;
}
-
(
UIButton
*
)
sameScreenBtn
{
if
(
!
_sameScreenBtn
)
{
_sameScreenBtn
=
[
CHUIFactory
buttonWithTitle
:
@"同屏"
font
:
kFont
(
16
)
titleColor
:
[
UIColor
blueColor
]
target
:
self
action
:
@selector
(
sameScreenBtnTouched
)
frame
:
CGRectMake
(
40
,
150
,
60
,
30
)];
}
return
_sameScreenBtn
;
}
-
(
YUNXINDemoView
*
)
demoView
{
if
(
!
_demoView
)
{
_demoView
=
[[
YUNXINDemoView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
SCREEN_HEIGHT
,
SCREEN_WIDTH
,
SCREEN_HEIGHT
)];
}
return
_demoView
;
}
@end
MutiFaceDemo/Application/SameScreen/YUNXINSameScreen/YUNXINSameScreenDefine.h
0 → 100644
查看文件 @
cf5e9be6
//
// YUNXINSameScreenDefine.h
// MutiFaceDemo
//
// Created by Xu Lichao on 2020/10/12.
// Copyright © 2020 Yuwei. All rights reserved.
//
#ifndef YUNXINSameScreenDefine_h
#define YUNXINSameScreenDefine_h
#define SameScreenSyncSize @"0"
#define SameScreenOpenView @"1"
#define SameScreenCloseView @"2"
#define SameScreenSyncLocation @"3"
#define SameScreenSyncH5 @"4"
#define SameScreenOperateReq @"5"
#define SameScreenOperateAnswer @"6"
#define SameScreenOperateCallback @"7"
#define SameScreenOpenMark @"11"
#define SameScreenCloseMark @"12"
#define SameScreenSyncMarkPath @"13"
#define SameScreenClearCanvas @"14"
#define SameScreenUndoPreviousPath @"15"
#define SameScreenMarkReq @"16"
#define SameScreenMarkAnswer @"17"
#define SameScreenMarkCallback @"18"
#endif
/* YUNXINSameScreenDefine_h */
MutiFaceDemo/Application/SameScreen/YUNXINSameScreen/YUNXINSameScreenView.h
0 → 100644
查看文件 @
cf5e9be6
//
// YUNXINSameSceenView.h
// MutiFaceDemo
//
// Created by Xu Lichao on 2020/10/12.
// Copyright © 2020 Yuwei. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface
YUNXINSameScreenView
:
UIView
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
drawHexColorStr
:(
NSString
*
)
drawHexColorStr
isManager
:(
BOOL
)
isManager
;
-
(
void
)
updateViewWithWebUrl
:(
NSString
*
)
webUrl
miniFlag
:(
NSString
*
)
miniFlag
;
-
(
void
)
updateWebViewWidth
:(
CGFloat
)
width
height
:(
CGFloat
)
height
;
-
(
void
)
updateViewWithContentY
:(
CGFloat
)
contentY
;
-
(
void
)
updateWebViewWithWebAction
:(
NSDictionary
*
)
param
;
-
(
NSDictionary
*
)
getShowDic
;
-
(
void
)
updateOperateStatus
:(
BOOL
)
couldOperate
;
-
(
void
)
openMark
;
-
(
void
)
cancelMark
;
-
(
void
)
addMarkWithParam
:(
NSDictionary
*
)
paramDic
;
-
(
void
)
clearCanvas
;
-
(
void
)
undo
;
-
(
void
)
updateMarkOperateStatus
:(
BOOL
)
couldMark
;
@end
NS_ASSUME_NONNULL_END
MutiFaceDemo/Application/SameScreen/YUNXINSameScreen/YUNXINSameScreenView.m
0 → 100644
查看文件 @
cf5e9be6
//
// YUNXINSameSceenView.m
// MutiFaceDemo
//
// Created by Xu Lichao on 2020/10/12.
// Copyright © 2020 Yuwei. All rights reserved.
//
#import "YUNXINSameScreenView.h"
#import <WebKit/WebKit.h>
#import "WKWebViewJavascriptBridge.h"
#import "YUNXINSameScreenManager.h"
#import "YWScrawlView.h"
#import "YUNXINSameScreenDefine.h"
#define dispatch_main_async_safe(block)\
if ([NSThread isMainThread]) {\
block();\
} else {\
dispatch_async(dispatch_get_main_queue(), block);\
}
@interface
YUNXINSameScreenView
()
<
UIScrollViewDelegate
,
WKUIDelegate
,
WKNavigationDelegate
,
YWScrawlViewDelegate
>
{
NSTimer
*
heartBeat
;
}
@property
(
nonatomic
,
assign
)
BOOL
isManager
;
@property
(
nonatomic
,
strong
)
WKWebView
*
webView
;
@property
(
nonatomic
,
strong
)
NSString
*
webUrl
;
@property
(
nonatomic
,
strong
)
NSString
*
miniFlag
;
@property
(
nonatomic
,
assign
)
BOOL
couldSend
;
@property
(
nonatomic
,
strong
)
YWScrawlView
*
scrawlView
;
@property
(
nonatomic
,
assign
)
BOOL
isMark
;
@property
(
nonatomic
,
assign
)
CGFloat
currentY
;
@property
(
nonatomic
,
strong
)
WKWebViewJavascriptBridge
*
webViewBridge
;
@property
(
nonatomic
,
assign
)
CGRect
viewFrame
;
@property
(
nonatomic
,
strong
)
NSString
*
hexStr
;
@end
@implementation
YUNXINSameScreenView
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
drawHexColorStr
:(
NSString
*
)
drawHexColorStr
isManager
:(
BOOL
)
isManager
{
self
=
[
super
initWithFrame
:
frame
];
if
(
self
)
{
self
.
isManager
=
isManager
;
self
.
viewFrame
=
frame
;
self
.
hexStr
=
drawHexColorStr
;
self
.
currentY
=
-
999
.
0
;
self
.
couldSend
=
YES
;
[
self
setupUI
];
}
return
self
;
}
-
(
void
)
setupUI
{
[
self
addSubview
:
self
.
webView
];
_webView
.
userInteractionEnabled
=
self
.
isManager
;
// WebViewJavascriptBridge
self
.
webViewBridge
=
[
WKWebViewJavascriptBridge
bridgeForWebView
:
self
.
webView
];
[
self
.
webViewBridge
setWebViewDelegate
:
self
];
[
self
.
webViewBridge
registerHandler
:
@"sendJS2Native"
handler
:
^
(
id
data
,
WVJBResponseCallback
responseCallback
)
{
NSDictionary
*
dic
=
data
;
[
self
actionWithDic
:
dic
];
responseCallback
(
@""
);
}];
}
-
(
void
)
actionWithDic
:
(
NSDictionary
*
)
dic
{
NSLog
(
@"===== >>>>> data: %@"
,
dic
);
[[
YUNXINSameScreenManager
shareInstance
]
sendCustomSysMsgWithParam
:
dic
action
:
SameScreenSyncH5
];
}
#pragma mark - Methods
-
(
void
)
updateViewWithWebUrl
:
(
NSString
*
)
webUrl
miniFlag
:
(
NSString
*
)
miniFlag
{
self
.
miniFlag
=
miniFlag
;
if
(
webUrl
.
length
>
0
&&
[
webUrl
isEqualToString
:
self
.
webUrl
])
{
self
.
webUrl
=
webUrl
;
[
_webView
loadRequest
:[
NSURLRequest
requestWithURL
:[
NSURL
URLWithString
:
self
.
webUrl
]]];
}
}
-
(
void
)
updateWebViewWidth
:
(
CGFloat
)
width
height
:
(
CGFloat
)
height
{
CGFloat
wbWidth
=
width
<
self
.
viewFrame
.
size
.
width
?
width
:
self
.
viewFrame
.
size
.
width
;
CGFloat
wbHeight
=
height
<
self
.
viewFrame
.
size
.
height
?
height
:
self
.
viewFrame
.
size
.
width
;
_webView
.
frame
=
CGRectMake
((
self
.
viewFrame
.
size
.
width
-
wbWidth
)
/
2
,
(
self
.
viewFrame
.
size
.
height
-
wbHeight
)
/
2
,
wbWidth
,
wbHeight
);
_scrawlView
.
frame
=
_webView
.
frame
;
}
-
(
void
)
updateViewWithContentY
:
(
CGFloat
)
contentY
{
[
_webView
.
scrollView
setContentOffset
:
CGPointMake
(
0
,
contentY
)
animated
:
YES
];
}
-
(
void
)
updateWebViewWithWebAction
:
(
NSDictionary
*
)
param
{
[
_webViewBridge
callHandler
:
@"sendNative2JS"
data
:
param
];
}
-
(
NSDictionary
*
)
getShowDic
{
return
@{
@"url"
:
self
.
webUrl
,
@"flag"
:
self
.
miniFlag
};
}
-
(
void
)
updateOperateStatus
:
(
BOOL
)
couldOperate
{
_webView
.
userInteractionEnabled
=
couldOperate
;
}
-
(
void
)
updateMarkOperateStatus
:
(
BOOL
)
couldMark
{
_scrawlView
.
userInteractionEnabled
=
couldMark
;
}
#pragma mark - mark
-
(
void
)
openMark
{
if
(
!
_scrawlView
)
{
_scrawlView
=
[[
YWScrawlView
alloc
]
initWithFrame
:
_webView
.
frame
colorHexStr
:
self
.
hexStr
];
_scrawlView
.
delegate
=
self
;
[
self
addSubview
:
_scrawlView
];
}
_scrawlView
.
hidden
=
NO
;
}
-
(
void
)
cancelMark
{
_scrawlView
.
hidden
=
YES
;
[
_scrawlView
clearAllPaint
];
}
-
(
void
)
addMarkWithParam
:
(
NSDictionary
*
)
paramDic
{
[
_scrawlView
drawLineWithPathData
:
paramDic
];
}
-
(
void
)
clearCanvas
{
[
_scrawlView
clearAllPaint
];
}
-
(
void
)
undo
{
[
_scrawlView
undo
];
}
#pragma mark - heart
//取消心跳
-
(
void
)
destoryHeartBeat
{
dispatch_main_async_safe
(
^
{
if
(
self
->
heartBeat
)
{
if
([
self
->
heartBeat
respondsToSelector
:
@selector
(
isValid
)]){
if
([
self
->
heartBeat
isValid
]){
[
self
->
heartBeat
invalidate
];
self
->
heartBeat
=
nil
;
}
}
}
})
}
//初始化心跳
-
(
void
)
initHeartBeat
{
dispatch_main_async_safe
(
^
{
[
self
destoryHeartBeat
];
//心跳设置为3分钟,NAT超时一般为5分钟
self
->
heartBeat
=
[
NSTimer
timerWithTimeInterval
:
0
.
2
target
:
self
selector
:
@selector
(
sentScrollInfo
)
userInfo
:
nil
repeats
:
YES
];
//和服务端约定好发送什么作为心跳标识,尽可能的减小心跳包大小
[[
NSRunLoop
currentRunLoop
]
addTimer
:
self
->
heartBeat
forMode
:
NSRunLoopCommonModes
];
})
}
-
(
void
)
sentScrollInfo
{
NSDecimalNumber
*
currentDecimal
=
[[
NSDecimalNumber
alloc
]
initWithFloat
:
self
.
currentY
];
if
(
!
([
currentDecimal
compare
:[[
NSDecimalNumber
alloc
]
initWithFloat
:
-
999
.
0
]]
==
NSOrderedSame
))
{
// NSLog(@"=====>>>>> scrollView scrollHeight : %f", self.currentY);
[[
YUNXINSameScreenManager
shareInstance
]
sendCustomSysMsgWithParam
:@{
@"scrollHeight"
:
@
(
self
.
currentY
)}
action
:
SameScreenSyncLocation
];
self
.
currentY
=
-
999
.
0
;
}
}
#pragma mark - YWScrawlViewDelegate
-
(
void
)
sendScrawlViewParam
:
(
NSDictionary
*
)
paramDic
{
[[
YUNXINSameScreenManager
shareInstance
]
sendCustomSysMsgWithParam
:
paramDic
action
:
SameScreenSyncMarkPath
];
}
#pragma mark - UIScrollViewDelegate
-
(
void
)
scrollViewDidScroll
:
(
UIScrollView
*
)
scrollView
{
if
(
scrollView
.
tracking
||
scrollView
.
dragging
||
scrollView
.
decelerating
)
{
CGFloat
y
=
scrollView
.
contentOffset
.
y
;
// TraceS(@"=====>>>>> scrollView scrollHeight : %f", y);
self
.
currentY
=
y
;
}
}
#pragma mark - WKUIDelegate
-
(
void
)
webView
:
(
WKWebView
*
)
webView
runJavaScriptAlertPanelWithMessage
:
(
NSString
*
)
message
initiatedByFrame
:
(
WKFrameInfo
*
)
frame
completionHandler
:
(
void
(
^
)(
void
))
completionHandler
{
completionHandler
();
}
#pragma mark - setter/getter
-
(
WKWebView
*
)
webView
{
if
(
!
_webView
){
WKWebViewConfiguration
*
webConfig
=
[[
WKWebViewConfiguration
alloc
]
init
];
// 设置偏好设置
webConfig
.
preferences
=
[[
WKPreferences
alloc
]
init
];
// 默认为0
webConfig
.
preferences
.
minimumFontSize
=
10
;
// 默认认为YES
webConfig
.
preferences
.
javaScriptEnabled
=
YES
;
// 在iOS上默认为NO,表示不能自动通过窗口打开
webConfig
.
preferences
.
javaScriptCanOpenWindowsAutomatically
=
YES
;
webConfig
.
userContentController
=
[
WKUserContentController
new
];
_webView
=
[[
WKWebView
alloc
]
initWithFrame
:
self
.
viewFrame
configuration
:
webConfig
];
_webView
.
backgroundColor
=
[
UIColor
colorWithRed
:
246
.
0
/
255
green
:
246
.
0
/
255
blue
:
246
.
0
/
255
alpha
:
1
.
0
];
_webView
.
scrollView
.
delegate
=
self
;
_webView
.
UIDelegate
=
self
;
}
return
_webView
;
}
@end
MutiFaceDemo/Application/SameScreen/YUNXINSameScreenManager.h
0 → 100644
查看文件 @
cf5e9be6
//
// YUNXINSameScreenManager.h
// MutiFaceDemo
//
// Created by Xu Lichao on 2020/10/9.
// Copyright © 2020 Yuwei. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "YUNXINSameScreenView.h"
@class
NIMSession
;
NS_ASSUME_NONNULL_BEGIN
@protocol
YUNXINSameScreenManagerDelegate
<
NSObject
>
@optional
//同屏相关
/// 在该回调内添加或展示同屏页面
/// @param showUrl 展示的url
/// @param miniFlag 小程序对应的Flag
-
(
void
)
sameScreenShowViewWithShowUrl
:
(
NSString
*
)
showUrl
miniFlag
:
(
NSString
*
)
miniFlag
;
/// 在该回调内移除或隐藏同屏页面
-
(
void
)
sameScreenCloseView
;
/// 收到对方申请同屏操作的请求,只有管理员能收到该回调
/// @param uid 云信account
-
(
void
)
sameScreenReceiveOperateReqWithUid
:(
NSString
*
)
uid
;
/// 收到管理员关于本方同屏操作申请的回复
/// @param isApproved 是否被同意
-
(
void
)
sameScreenReceiveOperateReqResult
:(
BOOL
)
isApproved
;
/// 收到管理员收回本方操作权限的通知
-
(
void
)
sameScreenReceiveOperateCallBackNotification
;
//标注相关
/// 收到对方申请标注操作的请求,只有管理员 能收到该回调
/// @param uid 云信account
-
(
void
)
sameScreenReceiveMarkOperateReqWithUid
:(
NSString
*
)
uid
;
/// 收到管理员关于本方标注操作申请的回复
/// @param isApproved 是否被同意
-
(
void
)
sameScreenReceiveMarkOperateReqResult
:(
BOOL
)
isApproved
;
/// 收到管理员收回本方标注权限的通知
-
(
void
)
sameScreenReceiveMarkOperateCallBackNotification
;
@end
@interface
YUNXINSameScreenManager
:
NSObject
+
(
instancetype
)
shareInstance
;
/// 添加delegate
/// @param delegate delegate
-
(
void
)
addDelegate
:(
id
<
YUNXINSameScreenManagerDelegate
>
)
delegate
;
/// 移除delegate
/// @param delegate delegate
-
(
void
)
removeDelegate
:(
id
<
YUNXINSameScreenManagerDelegate
>
)
delegate
;
/// 收到自定义消息通知
/// @param msgContent 自定义消息content内容
-
(
void
)
receiveCustomSysMsg
:(
NSDictionary
*
)
msgContent
;
/// 配置通信Session
/// @param session 通话session
-
(
void
)
configCurrentSession
:(
NIMSession
*
)
session
;
/// 获取同屏页面
/// @param frame 同屏页面大小
/// @param hexColorStr 标注颜色色值 默认"#000000"
/// @param isManager 是否是管理员
-
(
YUNXINSameScreenView
*
)
getSameScreenViewWithFrame
:(
CGRect
)
frame
drawHexColor
:(
NSString
*
)
hexColorStr
isManager
:(
BOOL
)
isManager
;
/// 更新同屏页面的内容
/// @param webUrl 打开的H5的url
/// @param miniFlag H5的url在小程序中对应的flag
-
(
void
)
updateSameScreenViewWithWebUrl
:(
NSString
*
)
webUrl
miniFlag
:(
NSString
*
)
miniFlag
;
/// 同步同屏页面的尺寸大小
-
(
void
)
sameScreenSynchronizeViewSize
;
/// 通知manager当前已经展示同屏页面
-
(
void
)
sendshowSameScreenViewNotification
;
/// 通知manager当前已经移除同屏页面
-
(
void
)
sendDismissSameScreenViewNotification
;
/// 请求同屏操作权限(非管理员使用)
-
(
void
)
requestForSameScreenOperateAuthority
;
/// 发送审核同屏权限结果 (管理员使用)
/// @param requesterUid 请求者云信account
/// @param isApproved 是否同意
-
(
void
)
approveTheSameScreenOperateAuthorityWithRequseterUid
:(
NSString
*
)
requesterUid
isApproved
:(
BOOL
)
isApproved
;
/// 收回请求者的操作权限 (管理员使用)
/// @param requesterUid 请求者云信account
-
(
void
)
callbackTheRequsterSameScreenOperateAuthorityWithRequsterUid
:(
NSString
*
)
requesterUid
;
/// 打开标注
-
(
void
)
openMark
;
/// 关闭标注
-
(
void
)
closeMark
;
/// /// 请求标注操作权限(非管理员使用)
-
(
void
)
requestForMarkOperateAuthority
;
/// 发送审核标注权限结果 (管理员使用)
/// @param requesterUid 请求者云信account
/// @param isApproved 是否同意
-
(
void
)
approveTheMarkOperateAuthorityWithRequseterUid
:(
NSString
*
)
requesterUid
isApproved
:(
BOOL
)
isApproved
;
/// 收回请求者标注权限 (管理员使用)
/// @param requesterUid 请求者云信account
-
(
void
)
callbackTheRequsterMarkOperateAuthorityWithRequsterUid
:(
NSString
*
)
requesterUid
;
/// 发送自定义通知消息
/// @param param param
/// @param action action
-
(
void
)
sendCustomSysMsgWithParam
:(
NSDictionary
*
)
param
action
:(
NSString
*
)
action
;
@end
NS_ASSUME_NONNULL_END
MutiFaceDemo/Application/SameScreen/YUNXINSameScreenManager.m
0 → 100644
查看文件 @
cf5e9be6
//
// YUNXINSameScreenManager.m
// MutiFaceDemo
//
// Created by Xu Lichao on 2020/10/9.
// Copyright © 2020 Yuwei. All rights reserved.
//
#import "YUNXINSameScreenManager.h"
#import <NIMSDK/NIMSDK.h>
#import "YUNXINSameScreenDefine.h"
@interface
YUNXINSameScreenManager
()
@property
(
nonatomic
,
weak
)
id
<
YUNXINSameScreenManagerDelegate
>
delegate
;
@property
(
nonatomic
,
strong
)
NIMSession
*
session
;
@property
(
nonatomic
,
assign
)
BOOL
isManager
;
@property
(
nonatomic
,
strong
)
YUNXINSameScreenView
*
webView
;
@property
(
nonatomic
,
assign
)
CGSize
viewSize
;
@end
@implementation
YUNXINSameScreenManager
+
(
instancetype
)
shareInstance
{
static
YUNXINSameScreenManager
*
umInstance
=
nil
;
static
dispatch_once_t
onceToken
;
dispatch_once
(
&
onceToken
,
^
{
umInstance
=
[
YUNXINSameScreenManager
new
];
});
return
umInstance
;
}
-
(
void
)
addDelegate
:
(
id
<
YUNXINSameScreenManagerDelegate
>
)
delegate
{
_delegate
=
delegate
;
}
-
(
void
)
removeDelegate
:
(
id
<
YUNXINSameScreenManagerDelegate
>
)
delegate
{
_delegate
=
nil
;
_session
=
nil
;
_webView
=
nil
;
}
-
(
void
)
configCurrentSession
:
(
NIMSession
*
)
session
{
_session
=
session
;
}
-
(
YUNXINSameScreenView
*
)
getSameScreenViewWithFrame
:
(
CGRect
)
frame
drawHexColor
:
(
NSString
*
)
hexColorStr
isManager
:
(
BOOL
)
isManager
{
self
.
viewSize
=
frame
.
size
;
YUNXINSameScreenView
*
webView
=
[[
YUNXINSameScreenView
alloc
]
initWithFrame
:
frame
drawHexColorStr
:
hexColorStr
isManager
:
isManager
];
self
.
webView
=
webView
;
return
webView
;
}
-
(
void
)
updateSameScreenViewWithWebUrl
:
(
NSString
*
)
webUrl
miniFlag
:
(
NSString
*
)
miniFlag
{
[
self
.
webView
updateViewWithWebUrl
:
webUrl
miniFlag
:
miniFlag
];
}
-
(
void
)
sameScreenSynchronizeViewSize
{
[
self
sendCustomSysMsgWithParam
:@{
@"width"
:
@
(
self
.
viewSize
.
width
),
@"height"
:
@
(
self
.
viewSize
.
height
)}
action
:
SameScreenSyncSize
];
}
-
(
void
)
receiveCustomSysMsg
:
(
NSDictionary
*
)
msgContent
{
NSDictionary
*
attachment
=
msgContent
;
NSString
*
action
=
[
attachment
objectForKey
:
@"action"
];
NSDictionary
*
param
=
[
attachment
objectForKey
:
@"param"
];
if
([
action
isEqualToString
:
SameScreenSyncSize
])
{
CGFloat
remoteUesrWidth
=
[
param
[
@"width"
]
floatValue
];
CGFloat
remoteUesrHeight
=
[
param
[
@"height"
]
floatValue
];
[
self
.
webView
updateWebViewWidth
:
remoteUesrWidth
height
:
remoteUesrHeight
];
}
else
if
([
action
isEqualToString
:
SameScreenOpenView
])
{
if
([
_delegate
respondsToSelector
:
@selector
(
sameScreenShowViewWithShowUrl
:
miniFlag
:
)])
{
[
_delegate
sameScreenShowViewWithShowUrl
:
param
[
@"url"
]
miniFlag
:
param
[
@"flag"
]];
}
}
else
if
([
action
isEqualToString
:
SameScreenCloseView
])
{
if
([
_delegate
respondsToSelector
:
@selector
(
sameScreenCloseView
)])
{
[
_delegate
sameScreenCloseView
];
}
}
else
if
([
action
isEqualToString
:
SameScreenSyncLocation
])
{
[
self
.
webView
updateViewWithContentY
:[
param
[
@"scrollHeight"
]
floatValue
]];
}
else
if
([
action
isEqualToString
:
SameScreenSyncH5
])
{
[
_webView
updateWebViewWithWebAction
:
param
];
}
else
if
([
action
isEqualToString
:
SameScreenOperateReq
])
{
[
self
dealWithOperateReq
:
param
];
}
else
if
([
action
isEqualToString
:
SameScreenOperateAnswer
])
{
[
self
dealWithOperateAnswer
:
param
];
}
else
if
([
action
isEqualToString
:
SameScreenOperateCallback
])
{
[
self
dealWithOperateCallBack
:
param
];
}
else
if
([
action
isEqualToString
:
SameScreenOpenMark
])
{
[
_webView
openMark
];
}
else
if
([
action
isEqualToString
:
SameScreenCloseMark
])
{
[
_webView
cancelMark
];
}
else
if
([
action
isEqualToString
:
SameScreenSyncMarkPath
])
{
[
_webView
addMarkWithParam
:
param
];
}
else
if
([
action
isEqualToString
:
SameScreenClearCanvas
])
{
[
_webView
clearCanvas
];
}
else
if
([
action
isEqualToString
:
SameScreenUndoPreviousPath
])
{
[
_webView
undo
];
}
else
if
([
action
isEqualToString
:
SameScreenMarkReq
])
{
[
self
dealWithMarkOperateReq
:
param
];
}
else
if
([
action
isEqualToString
:
SameScreenMarkAnswer
])
{
[
self
dealWithMarkOperateAnswer
:
param
];
}
else
if
([
action
isEqualToString
:
SameScreenMarkCallback
])
{
[
self
dealWithMarkOperateCallback
:
param
];
}
}
-
(
void
)
sendshowSameScreenViewNotification
{
if
(
_webView
)
{
[
self
sameScreenSynchronizeViewSize
];
[
self
sendCustomSysMsgWithParam
:[
_webView
getShowDic
]
action
:
SameScreenOpenView
];
}
}
-
(
void
)
sendDismissSameScreenViewNotification
{
[
self
sendCustomSysMsgWithParam
:@{}
action
:
SameScreenCloseView
];
}
-
(
void
)
requestForSameScreenOperateAuthority
{
[
self
sendCustomSysMsgWithParam
:@{
@"uid"
:
[[[
NIMSDK
sharedSDK
]
loginManager
]
currentAccount
]}
action
:
SameScreenOperateReq
];
}
-
(
void
)
approveTheSameScreenOperateAuthorityWithRequseterUid
:
(
NSString
*
)
requesterUid
isApproved
:
(
BOOL
)
isApproved
{
NSString
*
approved
=
isApproved
?
@"1"
:
@"0"
;
[
_webView
updateOperateStatus
:
!
isApproved
];
[
self
sendCustomSysMsgWithParam
:@{
@"uid"
:
requesterUid
,
@"approve"
:
approved
}
action
:
SameScreenOperateAnswer
];
}
-
(
void
)
callbackTheRequsterSameScreenOperateAuthorityWithRequsterUid
:
(
NSString
*
)
requesterUid
{
[
_webView
updateOperateStatus
:
YES
];
[
self
sendCustomSysMsgWithParam
:@{
@"uid"
:
requesterUid
}
action
:
SameScreenOperateCallback
];
}
-
(
void
)
openMark
{
[
_webView
openMark
];
[
self
sendCustomSysMsgWithParam
:@{}
action
:
SameScreenOpenMark
];
}
-
(
void
)
closeMark
{
[
_webView
cancelMark
];
[
self
sendCustomSysMsgWithParam
:@{}
action
:
SameScreenCloseMark
];
}
-
(
void
)
requestForMarkOperateAuthority
{
[
self
sendCustomSysMsgWithParam
:@{
@"uid"
:
[[[
NIMSDK
sharedSDK
]
loginManager
]
currentAccount
]}
action
:
SameScreenMarkReq
];
}
-
(
void
)
approveTheMarkOperateAuthorityWithRequseterUid
:
(
NSString
*
)
requesterUid
isApproved
:
(
BOOL
)
isApproved
{
NSString
*
approved
=
isApproved
?
@"1"
:
@"0"
;
[
_webView
updateMarkOperateStatus
:
!
isApproved
];
[
self
sendCustomSysMsgWithParam
:@{
@"uid"
:
requesterUid
,
@"approve"
:
approved
}
action
:
SameScreenMarkAnswer
];
}
-
(
void
)
callbackTheRequsterMarkOperateAuthorityWithRequsterUid
:
(
NSString
*
)
requesterUid
{
[
_webView
updateMarkOperateStatus
:
YES
];
[
self
sendCustomSysMsgWithParam
:@{
@"uid"
:
requesterUid
}
action
:
SameScreenMarkCallback
];
}
#pragma mark - sendCustomSysMsg
-
(
void
)
sendCustomSysMsgWithParam
:
(
NSDictionary
*
)
param
action
:
(
NSString
*
)
action
{
if
(
!
param
)
{
return
;
}
NSDictionary
*
dict
=
@{
@"id"
:
@
(
99
),
@"content"
:
param
,
};
NSData
*
data
=
[
NSJSONSerialization
dataWithJSONObject
:
dict
options
:
0
error
:
nil
];
NSString
*
json
=
[[
NSString
alloc
]
initWithData
:
data
encoding
:
NSUTF8StringEncoding
];
NIMCustomSystemNotification
*
notification
=
[[
NIMCustomSystemNotification
alloc
]
initWithContent
:
json
];
NIMCustomSystemNotificationSetting
*
setting
=
[[
NIMCustomSystemNotificationSetting
alloc
]
init
];
setting
.
apnsEnabled
=
NO
;
setting
.
shouldBeCounted
=
NO
;
notification
.
setting
=
setting
;
[[[
NIMSDK
sharedSDK
]
systemNotificationManager
]
sendCustomNotification
:
notification
toSession
:
self
.
session
completion
:
nil
];
}
#pragma mark - 权限相关
-
(
void
)
dealWithOperateReq
:
(
NSDictionary
*
)
param
{
if
(
self
.
isManager
)
{
if
([
_delegate
respondsToSelector
:
@selector
(
sameScreenReceiveOperateReqWithUid
:)])
{
[
_delegate
sameScreenReceiveOperateReqWithUid
:
param
[
@"uid"
]];
}
}
}
-
(
void
)
dealWithOperateAnswer
:
(
NSDictionary
*
)
param
{
NSString
*
uid
=
param
[
@"uid"
];
if
([
uid
isEqualToString
:[[[
NIMSDK
sharedSDK
]
loginManager
]
currentAccount
]])
{
BOOL
isApprove
=
[
param
[
@"approve"
]
isEqualToString
:
@"1"
];
if
([
_delegate
respondsToSelector
:
@selector
(
sameScreenReceiveOperateReqResult
:)])
{
[
_delegate
sameScreenReceiveOperateReqResult
:
isApprove
];
}
[
_webView
updateOperateStatus
:
isApprove
];
}
}
-
(
void
)
dealWithOperateCallBack
:
(
NSDictionary
*
)
param
{
NSString
*
uid
=
param
[
@"uid"
];
if
([
uid
isEqualToString
:[[[
NIMSDK
sharedSDK
]
loginManager
]
currentAccount
]])
{
if
([
_delegate
respondsToSelector
:
@selector
(
sameScreenReceiveOperateCallBackNotification
)])
{
[
_delegate
sameScreenReceiveOperateCallBackNotification
];
}
[
_webView
updateOperateStatus
:
NO
];
}
}
-
(
void
)
dealWithMarkOperateReq
:
(
NSDictionary
*
)
param
{
if
(
self
.
isManager
)
{
if
([
_delegate
respondsToSelector
:
@selector
(
sameScreenReceiveMarkOperateReqWithUid
:)])
{
[
_delegate
sameScreenReceiveMarkOperateReqWithUid
:
param
[
@"uid"
]];
}
}
}
-
(
void
)
dealWithMarkOperateAnswer
:
(
NSDictionary
*
)
param
{
NSString
*
uid
=
param
[
@"uid"
];
if
([
uid
isEqualToString
:[[[
NIMSDK
sharedSDK
]
loginManager
]
currentAccount
]])
{
BOOL
isApprove
=
[
param
[
@"approve"
]
isEqualToString
:
@"1"
];
if
([
_delegate
respondsToSelector
:
@selector
(
sameScreenReceiveMarkOperateReqResult
:)])
{
[
_delegate
sameScreenReceiveMarkOperateReqResult
:
isApprove
];
}
[
_webView
updateMarkOperateStatus
:
isApprove
];
}
}
-
(
void
)
dealWithMarkOperateCallback
:
(
NSDictionary
*
)
param
{
NSString
*
uid
=
param
[
@"uid"
];
if
([
uid
isEqualToString
:[[[
NIMSDK
sharedSDK
]
loginManager
]
currentAccount
]])
{
if
([
_delegate
respondsToSelector
:
@selector
(
sameScreenReceiveMarkOperateCallBackNotification
)])
{
[
_delegate
sameScreenReceiveMarkOperateCallBackNotification
];
}
[
_webView
updateMarkOperateStatus
:
NO
];
}
}
@end
MutiFaceDemo/Application/SameScreen/YWWhiteboard/YWScrawlView.h
查看文件 @
cf5e9be6
...
...
@@ -22,8 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
@property
(
nonatomic
,
weak
)
id
<
YWScrawlViewDelegate
>
delegate
;
/// 初始化
/// @param frame 画布大小
/// @param colorHex
画笔颜色 例如:0x
000000
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
colorHex
:(
NSInteger
)
colorHex
;
/// @param colorHex
Str 画笔颜色 例如:#
000000
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
colorHex
Str
:(
NSString
*
)
colorHexStr
;
/**
接收到的原数据绘画
...
...
MutiFaceDemo/Application/SameScreen/YWWhiteboard/YWScrawlView.m
查看文件 @
cf5e9be6
...
...
@@ -20,20 +20,25 @@
@property
(
nonatomic
,
strong
)
NSMutableArray
*
pointArr
;
/// 单个轨迹承载的layer
@property
(
nonatomic
,
strong
)
CAShapeLayer
*
slayer
;
/// 画笔颜色
0x
000000
@property
(
nonatomic
,
assign
)
NS
Integer
colorHex
;
/// 画笔颜色
#
000000
@property
(
nonatomic
,
assign
)
NS
String
*
colorHexStr
;
@end
@implementation
YWScrawlView
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
colorHex
:(
NSInteger
)
colorHex
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
colorHexStr
:(
NSString
*
)
colorHexStr
{
self
=
[
super
initWithFrame
:
frame
];
if
(
self
)
{
self
.
backgroundColor
=
[
UIColor
clearColor
];
self
.
colorHex
=
colorHex
;
if
(
colorHexStr
.
length
>
0
)
{
self
.
colorHexStr
=
colorHexStr
;
}
else
{
self
.
colorHexStr
=
@"#000000"
;
}
}
return
self
;
}
...
...
@@ -66,7 +71,7 @@
slayer
.
fillColor
=
[
UIColor
clearColor
].
CGColor
;
slayer
.
lineCap
=
kCALineCapRound
;
slayer
.
lineJoin
=
kCALineJoinRound
;
slayer
.
strokeColor
=
[
UIColor
colorWithHex
:
self
.
colorHex
].
CGColor
;
slayer
.
strokeColor
=
[
self
colorWithHexStr
:
self
.
colorHexStr
].
CGColor
;
slayer
.
lineWidth
=
path
.
lineWidth
;
[
self
.
layer
addSublayer
:
slayer
];
_slayer
=
slayer
;
...
...
@@ -93,14 +98,14 @@
{
//send arr
if
([
_delegate
respondsToSelector
:
@selector
(
sendScrawlViewParam
:)])
{
[
_delegate
sendScrawlViewParam
:@{
@"pathColor"
:
[
NSNumber
numberWithInteger
:
self
.
colorHex
]
,
@"pathArr"
:
self
.
pointArr
}];
[
_delegate
sendScrawlViewParam
:@{
@"pathColor"
:
self
.
colorHexStr
,
@"pathArr"
:
self
.
pointArr
}];
}
}
-
(
void
)
drawLineWithPathData
:(
NSDictionary
*
)
paramDic
{
if
(
paramDic
&&
[[
paramDic
objectForKey
:
@"pathArr"
]
isKindOfClass
:[
NSArray
class
]])
{
NS
Integer
pathColor
=
[[
paramDic
objectForKey
:
@"pathColor"
]
intValue
];
NS
String
*
pathColor
=
[
paramDic
objectForKey
:
@"pathColor"
];
NSArray
*
pathArr
=
[[
NSArray
alloc
]
initWithArray
:[
paramDic
objectForKey
:
@"pathArr"
]];
CGPoint
startP
=
CGPointMake
([[[
pathArr
firstObject
]
objectForKey
:
@"x"
]
floatValue
],
[[[
pathArr
firstObject
]
objectForKey
:
@"y"
]
floatValue
]);
YWPaintPath
*
path
=
[
YWPaintPath
initYWPaintPath
];
...
...
@@ -117,7 +122,7 @@
slayer
.
fillColor
=
[
UIColor
clearColor
].
CGColor
;
slayer
.
lineCap
=
kCALineCapRound
;
slayer
.
lineJoin
=
kCALineJoinRound
;
slayer
.
strokeColor
=
[
UIColor
colorWithHex
:
pathColor
].
CGColor
;
slayer
.
strokeColor
=
[
self
colorWithHexStr
:
pathColor
].
CGColor
;
slayer
.
lineWidth
=
path
.
lineWidth
;
[
self
.
layer
addSublayer
:
slayer
];
_slayer
=
slayer
;
...
...
@@ -151,6 +156,42 @@
[[
self
mutableArrayValueForKey
:
@"pathLinesArr"
]
removeLastObject
];
}
#pragma mark - color
-
(
UIColor
*
)
colorWithHexStr
:
(
NSString
*
)
hexString
{
// Check for hash and add the missing hash
if
(
'#'
!=
[
hexString
characterAtIndex
:
0
])
{
hexString
=
[
NSString
stringWithFormat
:
@"#%@"
,
hexString
];
}
assert
(
7
==
hexString
.
length
);
NSString
*
redHex
=
[
NSString
stringWithFormat
:
@"0x%@"
,
[
hexString
substringWithRange
:
NSMakeRange
(
1
,
2
)]];
unsigned
redInt
=
[[
self
class
]
hexValueToUnsigned
:
redHex
];
NSString
*
greenHex
=
[
NSString
stringWithFormat
:
@"0x%@"
,
[
hexString
substringWithRange
:
NSMakeRange
(
3
,
2
)]];
unsigned
greenInt
=
[[
self
class
]
hexValueToUnsigned
:
greenHex
];
NSString
*
blueHex
=
[
NSString
stringWithFormat
:
@"0x%@"
,
[
hexString
substringWithRange
:
NSMakeRange
(
5
,
2
)]];
unsigned
blueInt
=
[[
self
class
]
hexValueToUnsigned
:
blueHex
];
UIColor
*
color
=
[
UIColor
colorWithRed
:(
float
)
redInt
/
255
green
:(
float
)
greenInt
/
255
blue
:
(
float
)
blueInt
/
255
alpha
:
1
.
0
];
return
color
;
}
+
(
unsigned
)
hexValueToUnsigned
:
(
NSString
*
)
hexValue
{
unsigned
value
=
0
;
NSScanner
*
hexValueScanner
=
[
NSScanner
scannerWithString
:
hexValue
];
[
hexValueScanner
scanHexInt
:
&
value
];
return
value
;
}
#pragma mark - setter/getter
-
(
NSMutableArray
*
)
pathLinesArr
{
if
(
!
_pathLinesArr
)
{
...
...
MutiFaceDemo/Application/faceViewController/MutiFaceViewController.m
查看文件 @
cf5e9be6
...
...
@@ -318,6 +318,16 @@ dispatch_async(dispatch_get_main_queue(), block);\
}
-
(
void
)
onSpeakingUsersReport
:
(
NSArray
<
NIMNetCallUserInfo
*>
*
)
report
{
}
-
(
void
)
onMyVolumeUpdate
:
(
UInt16
)
volume
{
TraceS
(
@"======>>>> 当前音量:%d"
,
volume
);
}
#pragma mark - meeting set
-
(
NIMNetCallMeeting
*
)
makeMeeting
...
...
MutiFaceDemo/Application/loginViewController/LoginViewController.m
查看文件 @
cf5e9be6
...
...
@@ -10,11 +10,11 @@
#import <NIMSDK/NIMSDK.h>
#import "MutiFaceViewController.h"
#import "ImageShowViewController.h"
#import "CHFacesignWebView.h"
#import "CHSameScreenAttachment.h"
#import "NTESCustomSysNotificationSender.h"
#import "CHPIngAttachment.h"
#import "YUNXINDemoViewController.h"
@interface
LoginViewController
()
<
CHFacesignWebViewDelegate
>
@interface
LoginViewController
()
@property
(
nonatomic
,
strong
)
UIView
*
loginView
;
@property
(
nonatomic
,
strong
)
UIButton
*
user1
;
...
...
@@ -31,12 +31,11 @@
@property
(
nonatomic
,
strong
)
UIButton
*
creatRoomBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
joinRoomBtn
;
//同屏URL展示
@property
(
nonatomic
,
strong
)
CHFacesignWebView
*
webView
;
@property
(
nonatomic
,
strong
)
UILabel
*
noticeLabel
;
@property
(
nonatomic
,
strong
)
NSString
*
otherUid
;
@property
(
nonatomic
,
strong
)
NTESCustomSysNotificationSender
*
sender
;
@end
...
...
@@ -45,8 +44,7 @@
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
[
self
setupUI
];
self
.
sender
=
[[
NTESCustomSysNotificationSender
alloc
]
init
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
sameScreenAction
:
)
name
:
MutiFaceSameScrrenNotification
object
:
nil
];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
pinganAction
:
)
name
:
MutiPingAnNotification
object
:
nil
];
}
-
(
void
)
setupUI
...
...
@@ -63,6 +61,7 @@
[
_roomView
addSubview
:
self
.
textField
];
[
_roomView
addSubview
:
self
.
creatRoomBtn
];
[
_roomView
addSubview
:
self
.
joinRoomBtn
];
[
self
.
view
addSubview
:
self
.
noticeLabel
];
_userView
.
hidden
=
YES
;
_roomView
.
hidden
=
YES
;
...
...
@@ -83,64 +82,21 @@
_roomView
.
hidden
=
YES
;
}
-
(
void
)
sameScreenAction
:
(
NSNotification
*
)
noti
{
NSDictionary
*
attachment
=
noti
.
object
;
NSString
*
action
=
[
attachment
objectForKey
:
@"action"
];
NSDictionary
*
param
=
[
attachment
objectForKey
:
@"param"
];
if
([
action
isEqualToString
:
@"0"
])
{
CGFloat
remoteUesrWidth
=
[
param
[
@"width"
]
floatValue
];
CGFloat
remoteUesrHeight
=
[
param
[
@"height"
]
floatValue
];
[
self
.
webView
updateWebViewWidth
:
remoteUesrWidth
height
:
remoteUesrHeight
];
}
else
if
([
action
isEqualToString
:
@"1"
])
{
[
self
.
webView
show
];
}
else
if
([
action
isEqualToString
:
@"2"
])
{
[
self
.
webView
dismiss
];
}
else
if
([
action
isEqualToString
:
@"3"
])
{
[
self
.
webView
updateViewWithContentY
:[
param
[
@"scrollHeight"
]
floatValue
]
/
SCREEN_DENSITY_SCALE
];
}
else
if
([
action
isEqualToString
:
@"4"
])
{
[
_webView
updateWebViewWithWebAction
:
param
];
}
else
if
([
action
isEqualToString
:
@"11"
])
{
[
_webView
openMark
];
}
else
if
([
action
isEqualToString
:
@"12"
])
{
[
_webView
cancelMark
];
}
else
if
([
action
isEqualToString
:
@"13"
])
{
[
_webView
addMarkWithParam
:
param
];
}
}
-
(
void
)
sendSameScreenMsgWithAction
:
(
NSString
*
)
action
param
:
(
NSDictionary
*
)
param
-
(
void
)
pinganAction
:
(
NSNotification
*
)
noti
{
// CHSameScreenAttachment *attachment = [[CHSameScreenAttachment alloc]init];
// attachment.action = action;
// attachment.param = param;
// NIMMessage *message = [[NIMMessage alloc] init];
// NIMCustomObject *customObject = [[NIMCustomObject alloc] init];
// customObject.attachment = attachment;
// message.messageObject = customObject;
//
// NIMMessageSetting *setting = [[NIMMessageSetting alloc] init];
// setting.historyEnabled = NO;
// setting.roamingEnabled = NO;
// setting.syncEnabled = NO;
// setting.shouldBeCounted = NO;
// setting.apnsEnabled = NO;
// setting.apnsWithPrefix = NO;
// setting.routeEnabled = NO;
// setting.teamReceiptEnabled = NO;
// setting.persistEnable = NO;
// setting.isSessionUpdate = NO;
// message.setting = setting;
//
// BOOL sendSuccess = [[NIMSDK sharedSDK].chatManager sendMessage:message toSession:[NIMSession session:self.otherUid type:NIMSessionTypeP2P] error:nil];
// if (sendSuccess) {
// TraceS(@"发送成功!");
// }else {
// TraceS(@"发送失败!");
// }
NSDictionary
*
dataDic
=
noti
.
object
;
NSInteger
type
=
[[
dataDic
objectForKey
:
@"type"
]
intValue
];
switch
(
type
)
{
case
0
:
{
_noticeLabel
.
text
=
@"PingAnMsgTypeJoin"
;
}
break
;
[
_sender
sendCustomContent
:@{
@"action"
:
action
,
@"param"
:
param
}
toSession
:[
NIMSession
session
:
self
.
otherUid
type
:
NIMSessionTypeP2P
]];
default
:
break
;
}
}
#pragma mark - IBAction
...
...
@@ -189,7 +145,7 @@
[
MBHUDTool
showMessage
:
error
.
domain
];
}
else
{
TraceS
(
@"云信登陆成功"
);
strongSelf
.
otherUid
=
@"hzyw
1361981094084900
"
;
strongSelf
.
otherUid
=
@"hzyw
77846977063892487
"
;
strongSelf
.
userLabel
.
text
=
@"用户3已经登陆"
;
[
strongSelf
updateViewWhenLoginSuccess
];
}
...
...
@@ -208,63 +164,55 @@
-
(
void
)
createRoomBtnTouched
{
NSDictionary
*
dic
=
@{
@"width"
:
@
(
SCREEN_WIDTH
),
@"height"
:
@
((
SCREEN_HEIGHT
-
kSafeButtomHeight
-
100
))};
[
self
sendSameScreenMsgWithAction
:
@"0"
param
:
dic
];
//
NSDictionary *dic = @{@"width":@(SCREEN_WIDTH), @"height":@((SCREEN_HEIGHT - kSafeButtomHeight - 100))};
//
[self sendSameScreenMsgWithAction:@"0" param:dic];
// MutiFaceViewController *vc = [[MutiFaceViewController alloc] init];
// vc.roomName = self.textField.text;
// vc.needCreate = YES;
// [self presentViewController:vc animated:YES completion:nil];
YUNXINDemoViewController
*
vc
=
[[
YUNXINDemoViewController
alloc
]
init
];
vc
.
otherUid
=
@"hzyw77846977063892487"
;
[
self
presentViewController
:
vc
animated
:
YES
completion
:
nil
];
}
-
(
void
)
joinRoomBtnTouched
{
[
self
sendSameScreenMsgWithAction
:
@"1"
param
:@{
@"url"
:
@"http://192.168.70.182/glw/private.html"
}];
[
self
.
webView
show
];
//
[self sendSameScreenMsgWithAction:@"1" param:@{@"url":@"http://192.168.70.182/glw/private.html"}];
//
[self.webView show];
// MutiFaceViewController *vc = [[MutiFaceViewController alloc] init];
// vc.roomName = self.textField.text;
// vc.needCreate = NO;
// vc.modalPresentationStyle = UIModalPresentationFullScreen;
// [self presentViewController:vc animated:YES completion:nil];
}
#pragma mark - CHFacesignWebViewDelegate
-
(
void
)
webViewDidTouchTheShadeView
{
[
self
.
webView
dismiss
];
[
self
sendSameScreenMsgWithAction
:
@"2"
param
:@{}];
}
-
(
void
)
webViewDidViewScroll
:
(
CGFloat
)
contentY
{
[
self
sendSameScreenMsgWithAction
:
@"3"
param
:@{
@"scrollHeight"
:
@
(
contentY
)}];
}
-
(
void
)
webViewDidReceiveWebAction
:
(
NSDictionary
*
)
param
{
[
self
sendSameScreenMsgWithAction
:
@"4"
param
:
param
];
}
-
(
void
)
webViewDidTouchMarkBtn
{
[
self
sendSameScreenMsgWithAction
:
@"11"
param
:@{}];
}
-
(
void
)
webViewDidTouchCancelMarkBtn
{
[
self
sendSameScreenMsgWithAction
:
@"12"
param
:@{}];
}
-
(
void
)
webViewScrawlAction
:
(
NSDictionary
*
)
paramDic
{
[
self
sendSameScreenMsgWithAction
:
@"13"
param
:
paramDic
];
}
-
(
void
)
webViewDidViewBeginDecelerating
{
}
-
(
void
)
webViewDidViewEndDecelerating
{
CHPingAnMsgTypeJoinAttachment
*
attachment
=
[[
CHPingAnMsgTypeJoinAttachment
alloc
]
init
];
attachment
.
extra
=
@{
@"url"
:
@""
,
@"time"
:
@""
};
attachment
.
param
=
@{
@"id"
:
@"123456"
,
@"name"
:
@"zhangsan"
};
NIMMessage
*
message
=
[[
NIMMessage
alloc
]
init
];
NIMCustomObject
*
customObject
=
[[
NIMCustomObject
alloc
]
init
];
customObject
.
attachment
=
attachment
;
message
.
messageObject
=
customObject
;
NIMMessageSetting
*
setting
=
[[
NIMMessageSetting
alloc
]
init
];
setting
.
historyEnabled
=
NO
;
setting
.
roamingEnabled
=
NO
;
setting
.
syncEnabled
=
NO
;
setting
.
shouldBeCounted
=
NO
;
setting
.
apnsEnabled
=
NO
;
setting
.
apnsWithPrefix
=
NO
;
setting
.
routeEnabled
=
NO
;
setting
.
teamReceiptEnabled
=
NO
;
setting
.
persistEnable
=
NO
;
setting
.
isSessionUpdate
=
NO
;
message
.
setting
=
setting
;
BOOL
sendSuccess
=
[[
NIMSDK
sharedSDK
].
chatManager
sendMessage
:
message
toSession
:[
NIMSession
session
:
self
.
otherUid
type
:
NIMSessionTypeP2P
]
error
:
nil
];
if
(
sendSuccess
)
{
TraceS
(
@"发送成功!"
);
_noticeLabel
.
text
=
@"发送成功"
;
}
else
{
TraceS
(
@"发送失败!"
);
_noticeLabel
.
text
=
@"发送失败"
;
}
}
...
...
@@ -418,17 +366,14 @@
return
_joinRoomBtn
;
}
-
(
CHFacesignWebView
*
)
webView
-
(
UILabel
*
)
noticeLabel
{
if
(
!
_webView
)
{
_webView
=
[[
CHFacesignWebView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
SCREEN_HEIGHT
,
SCREEN_WIDTH
,
SCREEN_HEIGHT
)];
[
_webView
updateViewWithWebUrl
:
@"http://192.168.70.182/glw/private.html"
];
_webView
.
delegate
=
self
;
[
self
.
view
addSubview
:
_webView
];
if
(
!
_noticeLabel
)
{
_noticeLabel
=
[[
UILabel
alloc
]
initWithFrame
:
CGRectMake
(
10
,
400
,
200
,
30
)];
_noticeLabel
.
font
=
kFont
(
16
);
}
return
_
webView
;
return
_
noticeLabel
;
}
@end
MutiFaceDemo/PrefixHeader.pch
查看文件 @
cf5e9be6
...
...
@@ -16,6 +16,7 @@
#endif
#define MutiFaceSameScrrenNotification @"MutiFaceSameScrrenNotification"
#define MutiPingAnNotification @"MutiPingAnNotification"
//weakSelf 宏定义
#define CHWEAKSELF __weak __typeof(&*self)weakSelf = self;
...
...
MutiFaceDemo/ThirdPartLibs/NIMVideo/CHCustomMsg/CHPIngAttachment.h
0 → 100644
查看文件 @
cf5e9be6
//
// CHPIngAttachment.h
// MutiFaceDemo
//
// Created by Xu Lichao on 2020/10/13.
// Copyright © 2020 Yuwei. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "NTESCustomAttachmentDefines.h"
NS_ASSUME_NONNULL_BEGIN
@interface
CHPIngAttachment
:
NSObject
<
NIMCustomAttachment
,
NTESCustomAttachmentInfo
>
@property
(
nonatomic
,
strong
)
NSDictionary
*
param
;
@property
(
nonatomic
,
strong
)
NSDictionary
*
extra
;
@end
@interface
CHPingAnMsgTypeJoinAttachment
:
CHPIngAttachment
@end
NS_ASSUME_NONNULL_END
MutiFaceDemo/ThirdPartLibs/NIMVideo/CHCustomMsg/CHPIngAttachment.m
0 → 100644
查看文件 @
cf5e9be6
//
// CHPIngAttachment.m
// MutiFaceDemo
//
// Created by Xu Lichao on 2020/10/13.
// Copyright © 2020 Yuwei. All rights reserved.
//
#import "CHPIngAttachment.h"
@implementation
CHPIngAttachment
@end
@implementation
CHPingAnMsgTypeJoinAttachment
-
(
NSString
*
)
encodeAttachment
{
NSDictionary
*
dict
=
@{
CMType
:
@
(
PingAnMsgTypeJoin
),
CMData
:
@{
CMExtra
:
self
.
extra
,
CMParam
:
self
.
param
}};
NSData
*
data
=
[
NSJSONSerialization
dataWithJSONObject
:
dict
options
:
0
error
:
nil
];
NSString
*
content
=
nil
;
if
(
data
)
{
content
=
[[
NSString
alloc
]
initWithData
:
data
encoding
:
NSUTF8StringEncoding
];
}
return
content
;
}
@end
MutiFaceDemo/ThirdPartLibs/NIMVideo/CHCustomMsg/Misc/NTESCustomAttachmentDecoder.m
查看文件 @
cf5e9be6
...
...
@@ -11,6 +11,7 @@
#import "NSDictionary+NTESJson.h"
#import "CHSnapshotAttachment.h"
#import "CHSameScreenAttachment.h"
#import "CHPIngAttachment.h"
@implementation
NTESCustomAttachmentDecoder
-
(
id
<
NIMCustomAttachment
>
)
decodeAttachment
:(
NSString
*
)
content
...
...
@@ -27,6 +28,14 @@
NSInteger
type
=
[
dict
jsonInteger
:
CMType
];
NSDictionary
*
data
=
[
dict
jsonDict
:
CMData
];
switch
(
type
)
{
case
PingAnMsgTypeJoin
:
{
attachment
=
[[
CHPingAnMsgTypeJoinAttachment
alloc
]
init
];
((
CHPingAnMsgTypeJoinAttachment
*
)
attachment
).
param
=
[
dict
jsonDict
:
CMParam
];
((
CHPingAnMsgTypeJoinAttachment
*
)
attachment
).
extra
=
[
dict
jsonDict
:
CMExtra
];
}
break
;
case
CustomMessageTypeSnapshot
:
{
attachment
=
[[
CHSnapshotAttachment
alloc
]
init
];
...
...
@@ -53,7 +62,7 @@
-
(
BOOL
)
checkAttachment
:(
id
<
NIMCustomAttachment
>
)
attachment
{
BOOL
check
=
NO
;
if
([
attachment
isKindOfClass
:[
CHSnapshotAttachment
class
]]
||
[
attachment
isKindOfClass
:[
CHSameScreenAttachment
class
]])
if
([
attachment
isKindOfClass
:[
CHSnapshotAttachment
class
]]
||
[
attachment
isKindOfClass
:[
CHSameScreenAttachment
class
]]
||
[
attachment
isKindOfClass
:[
CHPingAnMsgTypeJoinAttachment
class
]]
)
{
check
=
YES
;
}
...
...
MutiFaceDemo/ThirdPartLibs/NIMVideo/CHCustomMsg/Misc/NTESCustomAttachmentDefines.h
查看文件 @
cf5e9be6
...
...
@@ -12,12 +12,13 @@
@class
NIMKitBubbleStyleObject
;
typedef
NS_ENUM
(
NSInteger
,
NTESCustomMessageType
){
CustomMessageTypeJanKenPon
=
1
,
//剪子石头布
CustomMessageTypeSnapchat
=
2
,
//阅后即焚
CustomMessageTypeChartlet
=
3
,
//贴图表情
CustomMessageTypeWhiteboard
=
4
,
//白板会话
CustomMessageTypeRedPacket
=
5
,
//红包消息
CustomMessageTypeRedPacketTip
=
6
,
//红包提示消息
PingAnMsgTypeJoin
=
0
,
//成功加入房间
PingAnMsgTypeReject
=
1
,
//拒绝接听:主动拒绝
PingAnMsgTypeTimeout
=
2
,
//拒绝接听:超时未接
PingAnMsgTypeTransfer
=
3
,
//转接
PingAnMsgTypeSnapshot
=
4
,
//通知app截图
PingAnMsgTypeStartAudioClip
=
5
,
//通知app开始录音
PingAnMsgTypeStopAudioClip
=
6
,
//通知app停止录音
//自定义
CustomMessageTypeSnapshot
=
11
,
//截图信息
...
...
@@ -53,7 +54,7 @@ typedef NS_ENUM(NSInteger,NTESCustomMessageType){
//同屏操作
#define CMAction @"action"
#define CMParam @"param"
#define CMExtra @"extra"
#endif
...
...
MutiFaceDemo/ThirdPartLibs/NIMVideo/CHCustomSystemNotification/NTESCustomSysNotificationSender.h
查看文件 @
cf5e9be6
...
...
@@ -25,5 +25,4 @@
-
(
void
)
sendCustomContent
:(
NSDictionary
*
)
content
toSession
:(
NIMSession
*
)
session
;
@end
MutiFaceDemo/ThirdPartLibs/NIMVideo/Util/NTESNotificationCenter.m
查看文件 @
cf5e9be6
...
...
@@ -37,6 +37,7 @@
#import "MBHUDTool.h"
#import "CHSameScreenAttachment.h"
#import "NTESCustomSysNotificationSender.h"
#import "CHPIngAttachment.h"
NSString
*
NTESCustomNotificationCountChanged
=
@"NTESCustomNotificationCountChanged"
;
...
...
@@ -164,7 +165,7 @@ NIMRTSManagerDelegate,NIMChatManagerDelegate,NIMBroadcastManagerDelegate, NIMSig
//如果是自定义类型的消息,type=100 贼为截图
if
(
message
.
messageType
==
NIMMessageTypeCustom
)
{
//
[self dealWithCustomInfo:message];
[
self
dealWithCustomInfo
:
message
];
}
else
if
(
message
.
messageType
==
NIMMessageTypeText
)
{
// if (message.remoteExt.count > 0) {
// [self dealWithMessageInfo:message];
...
...
@@ -177,11 +178,16 @@ NIMRTSManagerDelegate,NIMChatManagerDelegate,NIMBroadcastManagerDelegate, NIMSig
-
(
void
)
dealWithCustomInfo
:
(
NIMMessage
*
)
message
{
NIMCustomObject
*
obj
=
(
NIMCustomObject
*
)
message
.
messageObject
;
if
([
obj
.
attachment
isKindOfClass
:[
CHSameScreenAttachment
class
]])
{
//同屏操作
CHSameScreenAttachment
*
attachment
=
(
CHSameScreenAttachment
*
)
obj
.
attachment
;
TraceS
(
@"收到消息:%@"
,
attachment
.
param
);
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
MutiFaceSameScrrenNotification
object
:
attachment
];
// if ([obj.attachment isKindOfClass:[CHSameScreenAttachment class]]) {
// //同屏操作
// CHSameScreenAttachment *attachment = (CHSameScreenAttachment *)obj.attachment;
// TraceS(@"收到消息:%@",attachment.param);
// [[NSNotificationCenter defaultCenter] postNotificationName:MutiFaceSameScrrenNotification object:attachment];
// }
if
([
obj
.
attachment
isKindOfClass
:[
CHPingAnMsgTypeJoinAttachment
class
]])
{
CHPingAnMsgTypeJoinAttachment
*
attachment
=
(
CHPingAnMsgTypeJoinAttachment
*
)
obj
.
attachment
;
TraceS
(
@"收到消息:%@"
,
attachment
);
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
MutiPingAnNotification
object
:@{
@"type"
:
@0
,
@"attachment"
:
attachment
}];
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或
登录
后发表评论