From 5de8efccccc074ddb45a2739dd470f760169e47f Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 5 Nov 2023 09:31:12 -0800 Subject: [PATCH] macos: comment the new views --- .../Paste Protection/PasteProtectionController.swift | 2 ++ .../Features/Paste Protection/PasteProtectionView.swift | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/macos/Sources/Features/Paste Protection/PasteProtectionController.swift b/macos/Sources/Features/Paste Protection/PasteProtectionController.swift index 35087f428..12514d5b7 100644 --- a/macos/Sources/Features/Paste Protection/PasteProtectionController.swift +++ b/macos/Sources/Features/Paste Protection/PasteProtectionController.swift @@ -3,6 +3,8 @@ import Cocoa import SwiftUI import GhosttyKit +/// This initializes an "unsafe paste" warning window. The window itself WILL NOT show automatically +/// and the caller must show the window via showWindow, beginSheet, etc. class PasteProtectionController: NSWindowController { override var windowNibName: NSNib.Name? { "PasteProtection" } diff --git a/macos/Sources/Features/Paste Protection/PasteProtectionView.swift b/macos/Sources/Features/Paste Protection/PasteProtectionView.swift index ef0aff6f0..aa63ae26f 100644 --- a/macos/Sources/Features/Paste Protection/PasteProtectionView.swift +++ b/macos/Sources/Features/Paste Protection/PasteProtectionView.swift @@ -1,16 +1,21 @@ import SwiftUI +/// This delegate is notified of the completion result of the paste protection dialog. protocol PasteProtectionViewDelegate: AnyObject { func pasteProtectionComplete(_ action: PasteProtectionView.Action) } +/// The SwiftUI view for showing a paste protection dialog. struct PasteProtectionView: View { enum Action : String { case cancel case paste } + /// The contents of the paste. let contents: String + + /// Optional delegate to get results. If this is nil, then this view will never close on its own. weak var delegate: PasteProtectionViewDelegate? = nil var body: some View {