Skip to content

Safe Data Leakage via Application Background Screenshot and Prevent Screenshot for iOS.

License

Notifications You must be signed in to change notification settings

prongbang/ScreenProtectorKit

Repository files navigation

ScreenProtectorKit

Safe Data Leakage via Application Background Screenshot and Prevent Screenshot for iOS.

CocoaPods

pod 'ScreenProtectorKit'

Swift Package Manager

In your Package.swift file, add ScreenProtectorKit dependency to corresponding targets:

let package = Package(
  dependencies: [
    .package(url: "https://github.com/prongbang/ScreenProtectorKit.git", from: "1.3.1"),
  ],
)

How to use

Prevent Screenshot

import ScreenProtectorKit

class AppDelegate: FlutterAppDelegate {

    private lazy var screenProtectorKit = { return ScreenProtectorKit(window: window) }()

    override func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
    
        screenProtectorKit.configurePreventionScreenshot()
    
        return true
    }

    override func applicationDidBecomeActive(_ application: UIApplication) {
        screenProtectorKit.enabledPreventScreenshot()
    }

    override func applicationWillResignActive(_ application: UIApplication) {
        screenProtectorKit.disablePreventScreenshot()
    }
    
}

Blur Background Screenshot

import ScreenProtectorKit

class AppDelegate: FlutterAppDelegate {

    private lazy var screenProtectorKit = { return ScreenProtectorKit(window: window) }()

    override func applicationDidBecomeActive(_ application: UIApplication) {
        screenProtectorKit.disableBlurScreen()
    }

    override func applicationWillResignActive(_ application: UIApplication) {
        screenProtectorKit.enabledBlurScreen()
    }
    
}

Image Background Screenshot

import ScreenProtectorKit

class AppDelegate: FlutterAppDelegate {

    private lazy var screenProtectorKit = { return ScreenProtectorKit(window: window) }()

    override func applicationDidBecomeActive(_ application: UIApplication) {
        screenProtectorKit.disableImageScreen()
    }

    override func applicationWillResignActive(_ application: UIApplication) {
        screenProtectorKit.enabledImageScreen(named: "LaunchImage")
    }
    
}

Color Background Screenshot

import ScreenProtectorKit

class AppDelegate: FlutterAppDelegate {

    private lazy var screenProtectorKit = { return ScreenProtectorKit(window: window) }()

    override func applicationDidBecomeActive(_ application: UIApplication) {
        screenProtectorKit.disableColorScreen()
    }

    override func applicationWillResignActive(_ application: UIApplication) {
        screenProtectorKit.enabledColorScreen(hexColor: "#ffffff")
    }
    
}

Check screen recording

import ScreenProtectorKit

let isRecording = screenProtectorKit.screenIsRecording()