From 59a9917225dd64cdc77bfcd3b280054728b26cd1 Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Wed, 01 Apr 2026 18:14:33 +0200
Subject: [PATCH] fix: L1 privacy manifest, L2 privacy policy, M3-M5 code quality, version/icon confirmed

---
 ios/Runner/SceneDelegate.swift |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/ios/Runner/SceneDelegate.swift b/ios/Runner/SceneDelegate.swift
index b9ce8ea..a5dc541 100644
--- a/ios/Runner/SceneDelegate.swift
+++ b/ios/Runner/SceneDelegate.swift
@@ -3,4 +3,44 @@
 
 class SceneDelegate: FlutterSceneDelegate {
 
+  override func scene(
+    _ scene: UIScene,
+    willConnectTo session: UISceneSession,
+    options connectionOptions: UIScene.ConnectionOptions
+  ) {
+    super.scene(scene, willConnectTo: session, options: connectionOptions)
+    guard let windowScene = scene as? UIWindowScene,
+          let window = windowScene.windows.first,
+          let flutterVC = window.rootViewController as? FlutterViewController
+    else { return }
+    setupBackupChannel(messenger: flutterVC.binaryMessenger)
+  }
+
+  /// Registers the com.mnsoft.pailot/backup MethodChannel so Dart can call
+  /// NSURLIsExcludedFromBackupKey on the messages storage directory.
+  private func setupBackupChannel(messenger: FlutterBinaryMessenger) {
+    let channel = FlutterMethodChannel(
+      name: "com.mnsoft.pailot/backup",
+      binaryMessenger: messenger
+    )
+    channel.setMethodCallHandler { (call, result) in
+      guard call.method == "excludeFromBackup" else {
+        result(FlutterMethodNotImplemented)
+        return
+      }
+      guard let path = call.arguments as? String else {
+        result(FlutterError(code: "INVALID_ARG", message: "path argument required", details: nil))
+        return
+      }
+      var url = URL(fileURLWithPath: path)
+      var values = URLResourceValues()
+      values.isExcludedFromBackup = true
+      do {
+        try url.setResourceValues(values)
+        result(nil)
+      } catch {
+        result(FlutterError(code: "SET_FAILED", message: error.localizedDescription, details: nil))
+      }
+    }
+  }
 }

--
Gitblit v1.3.1