From 88953263bb3624bfff354e65809a4a0f32bbd950 Mon Sep 17 00:00:00 2001 From: Dominic Go <18517029+dominicstop@users.noreply.github.com> Date: Tue, 17 Oct 2023 19:01:37 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=AB=20Update:=20`RNIContextMenuView`?= =?UTF-8?q?=20-=20Cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/RNIContextMenuView/RNIContextMenuView.swift | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/ios/RNIContextMenuView/RNIContextMenuView.swift b/ios/RNIContextMenuView/RNIContextMenuView.swift index 02968af2..ac13307f 100644 --- a/ios/RNIContextMenuView/RNIContextMenuView.swift +++ b/ios/RNIContextMenuView/RNIContextMenuView.swift @@ -181,14 +181,6 @@ public class RNIContextMenuView: // MARK: - Computed Properties // --------------------------- - private var shouldEnableAttachToParentVC: Bool { - self.cleanupMode == .viewController - }; - - private var shouldEnableCleanup: Bool { - self.cleanupMode != .disabled - }; - var isUsingCustomPreview: Bool { self.previewConfig.previewType == .CUSTOM && self.menuCustomPreviewView != nil @@ -319,7 +311,7 @@ public class RNIContextMenuView: let shouldAttachToParentVC = !self.didAttachToParentVC && !didMoveToNilWindow - && self.shouldEnableAttachToParentVC; + && self.cleanupMode.shouldAttachToParentVC; /// A. Not attached to a parent VC yet @@ -332,7 +324,7 @@ public class RNIContextMenuView: let shouldTriggerCleanup = !self.didAttachToParentVC && didMoveToNilWindow - && !self.shouldEnableAttachToParentVC; + && !self.cleanupMode.shouldAttachToParentVC; if shouldAttachToParentVC { @@ -477,7 +469,7 @@ public class RNIContextMenuView: }; func attachToParentVC(){ - guard self.shouldEnableAttachToParentVC, + guard self.cleanupMode.shouldAttachToParentVC, !self.didAttachToParentVC, // find the nearest parent view controller @@ -1050,7 +1042,7 @@ public class RNIContextMenuView: // -------------------- public func cleanup(){ - guard self.shouldEnableCleanup, + guard self.cleanupMode.shouldEnableCleanup, !self.didTriggerCleanup else { return };