flutter screen_protector plugin
not work with flutter that have SceneDelegate and appDelegate configurations please need you support
user can take screen shot and screen recording
but i want to show him black screen at case screen shoot or screen recording
Marker SceneDelegate
`import UIKit
import Flutter
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene,
willConnectTo session: UISceneSession,
options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
let appDelegate = UIApplication.shared.delegate as! AppDelegate
guard let flutterEngine = appDelegate.flutterEngine else { return }
let flutterViewController = FlutterViewController(engine: flutterEngine,
nibName: nil,
bundle: nil)
let window = UIWindow(windowScene: windowScene)
window.rootViewController = flutterViewController
self.window = window
window.makeKeyAndVisible()
}
}`
Marker info.plist
`UIApplicationSceneManifest
UIApplicationSupportsMultipleScenes
UISceneConfigurations
UIWindowSceneSessionRoleApplication
UISceneConfigurationName
Default Configuration
UISceneDelegateClassName
$(PRODUCT_MODULE_NAME).SceneDelegate
`
Marker AppDelegate
import UIKit
import Flutter
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
var flutterEngine: FlutterEngine?
// MARK: - App Lifecycle
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
self.flutterEngine = FlutterEngine(name: "my_engine")
self.flutterEngine?.run()
GeneratedPluginRegistrant.register(with: self.flutterEngine!)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
override func applicationDidEnterBackground(_ application: UIApplication) {
var bgTask: UIBackgroundTaskIdentifier = UIBackgroundTaskIdentifier(rawValue: 0)
bgTask = application.beginBackgroundTask {
application.endBackgroundTask(bgTask)
bgTask = UIBackgroundTaskIdentifier.invalid
}
}
}
if i use AppDelegate only it work
the screen shot and screen recording are show black screen to user
but after I add SceneDelegate to be updated with os 26.1 Ios
the screen shot and screen recording not show black screen to user