From 614e8c3fec51be9881bfb905dd6369e541865f40 Mon Sep 17 00:00:00 2001 From: jonnwon Date: Wed, 17 Apr 2024 20:24:44 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20ShareExtension=EC=8B=9C=20present=20?= =?UTF-8?q?=EB=90=98=EC=96=B4=20=EC=9E=88=EB=8A=94=20view=EA=B0=80=20?= =?UTF-8?q?=EC=9E=88=EB=8A=94=20=EA=B2=BD=EC=9A=B0=20=EB=B2=84=EA=B7=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 이미 present된 view가 있는 경우 ShareExtension시 북마크 추가화면이 뜨지 않는 버그 수정 --- iBox/Sources/BoxList/BoxListViewController.swift | 5 ++--- .../Extension/UIViewController+Extension.swift | 15 +++++---------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/iBox/Sources/BoxList/BoxListViewController.swift b/iBox/Sources/BoxList/BoxListViewController.swift index 147e668..5acb884 100644 --- a/iBox/Sources/BoxList/BoxListViewController.swift +++ b/iBox/Sources/BoxList/BoxListViewController.swift @@ -12,11 +12,10 @@ class BoxListViewController: BaseViewController, BaseViewController var shouldPresentModalAutomatically: Bool = false { didSet { if shouldPresentModalAutomatically { - // shouldPresentModalAutomatically가 true로 설정될 때 함수 호출 - if findAddBookmarkView() == nil { + if findAddBookmarkViewController() == false { + dismiss(animated: false) self.addButtonTapped() } - // 함수 호출 후 shouldPresentModalAutomatically를 false로 설정 shouldPresentModalAutomatically = false } } diff --git a/iBox/Sources/Extension/UIViewController+Extension.swift b/iBox/Sources/Extension/UIViewController+Extension.swift index 5277a9d..51b6343 100644 --- a/iBox/Sources/Extension/UIViewController+Extension.swift +++ b/iBox/Sources/Extension/UIViewController+Extension.swift @@ -19,16 +19,11 @@ extension UIViewController { return nil } - func findAddBookmarkView() -> Bool? { - var responder: UIResponder? = self - while let nextResponder = responder?.next { - if let viewController = nextResponder as? AddBookmarkView { - return true - } - responder = nextResponder + func findAddBookmarkViewController() -> Bool { + if let navigationController = presentedViewController as? UINavigationController, + let _ = navigationController.topViewController as? AddBookmarkViewController { + return true } - return nil + return false } - - }