安全管控
协作中台 SDK 支持安全管控的集成,安全管控功能如下:
- 支持对图片、视频、相机等预览入口进行人为管控,用于企业的安全管理
- 支持当APP管控状态变更时,能够通知SDK管控当前页面,满足多种复杂安全管控场景
接口定义
KIMSafetyControlPublicCapability
:
方法 | 参数 | 返回值 | 说明 |
---|---|---|---|
willOpenLocalFile(callback: @escaping (Bool) -> Void) |
| void |
|
willOpenLocalFileManager(callback: @escaping (Bool) -> Void) |
| void |
|
willOpenImage(callback: @escaping (_ allow: Bool) -> Void) |
| void |
|
willOpenVideo(callback: @escaping (Bool) -> Void) |
| void |
|
willOpenPhotoAlbum(callback: @escaping (Bool) -> Void) |
| void |
|
willOpenCamera(callback: @escaping (Bool) -> Void) |
| void |
|
willPostProcessCapturedImage(image: UIImage, callback: @escaping (_ processedImage: UIImage) -> Void) |
| void |
|
willOpenCloudFile(callback: @escaping (Bool) -> Void) |
| void |
|
willOpenWebView(url: String, callback: @escaping (Bool) -> Void) |
| void |
|
willOpenWebApp(appId: String, callback: @escaping (Bool) -> Void) |
| void |
|
triggerSafeControlCheck() | - | void |
|
代码示例
- 实现
KIMSafetyControlPublicCapability
协议,实现对应管控方法方法:
Swift
class UserCustomSafetyControl: KIMSafetyControlPublicCapability {
func willOpenImage(callback: @escaping (_ allow: Bool) -> Void) {
// 由用户自行决定是否有权限打开图片
if allow {
// 允许打开图片预览
callback(true)
} else {
// 拦截图片打开预览
callback(false)
alert("安全管控:禁止打开图片")
}
}
func willOpenVideo(callback: @escaping (Bool) -> Void) {
...
}
func willOpenCloudFile(callback: @escaping (Bool) -> Void) {
...
}
func willOpenPhotoAlbum(callback: @escaping (Bool) -> Void) {
...
}
func willOpenCamera(callback: @escaping (Bool) -> Void) {
...
}
func willOpenLocalFileManager(callback: @escaping (Bool) -> Void) {
...
}
func willOpenLocalFile(callback: @escaping (Bool) -> Void) {
...
}
func willOpenWebView(url: String, callback: @escaping (Bool) -> Void) {
...
}
}
- 当安全管控状态变更时,触发安全管控权限变更,检查当前页面的管控:
Swift
// 场景:预览时走出了园区或应用从后台进入前台时获取到管控状态为不允许查看,调用该接口触发预览页面的关闭操作
KIM.shared.triggerSafeControlCheck()