ScreenCaptureDetector 0.1.1

ScreenCaptureDetector 0.1.1

ADKATech.com LLC 维护。



ScreenCaptureDetector

CI Status Version License Platform


关于


ScreenCaptureDetector 是一款帮助工具,它能够检测应用是否通过镜像屏幕或录制进行捕捉,除截图通知外

  • 当应用被捕捉或镜像时,会在应用上添加一个覆盖层

图片一语胜千言


Alt text

示例

要运行示例项目,请克隆仓库,然后首先从 Example 目录运行 pod install

要求

Swift 5

安装

CocoaPods

ScreenCaptureDetector 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中

pod 'ScreenCaptureDetector'

如何使用

简单地将 ScreenCaptureDetector 导入 AppDelegate 中:import ScreenCaptureDetector

将以下内容添加到 AppDelegate 的 didFinishLaunchingWithOptions 中

///How to use using default instance
let monitor = ScreenCaptureRecordingDetector.createDafaultInstnace()
monitor.startMonitor()

或者“推荐”

1- conform protocol ScreenCaptureDelegate that has 3 optional func :
       func didStartCapture()
       func didEndCapture()
       func didTakeScreenshot()
       
2- passing the conformed class to the init method of ScreenCaptureRecordingDetector
3- calling method startMonitor() to start
4- calling method endMonitor()  to stop 
  

或者

        ///How to use using NotificationCenter
        let monitor = ScreenCaptureRecordingDetector()
        monitor.delegate = nil
        monitor.startMonitor()
        NotificationCenter.default.addObserver(self, selector: #selector(showScreen), name: .screenCapturingStarted, object: nil)
        NotificationCenter.default.addObserver(self, selector: #selector(dimissScreen), name: .screenCapturingEnded, object: nil)
       

或者

        ///How to use using Custom view
        let appDelegate = UIApplication.shared.delegate as? AppDelegate
        let overWindow = appDelegate?.window
        let customView = UIView.init(frame: overWindow?.bounds ?? CGRect.init(x: 0, y: 0, width: 200, height: 200))
        customView.backgroundColor = .yellow
        
        let screenCaptureDelegate = ScreenCaptureDelegateDefaultImpl(suspendView: customView, drawOver: overWindow)
        let monitor = ScreenCaptureRecordingDetector(delegate: screenCaptureDelegate)
        monitor.startMonitor()

环境


Xcode Version 11.3.1
Swift 5.0

贡献🤘


欢迎您提供反馈和帮助以改进此项目。请为您的错误、想法和增强请求创建问题,或者最好是通过创建 PR 直接贡献。😎

在报告问题时,请添加详细说明,如果可能的话,提供一个代码片段或测试用例以便重现您的问题。💥

创建 pull request 时,尽可能遵守当前的编码风格,并为您的代码创建测试以保证提供良好的测试覆盖率💪

作者

amrangry,

网站: https://amrangry.github.io/

Email : [email protected]

许可

ScreenCaptureDetector是在MIT许可证下可用的。有关更多信息,请参阅LICENSE文件。