From 01464045b568d4f32ac66c5f8e91c70600623819 Mon Sep 17 00:00:00 2001 From: Azuma Kasumi Date: Thu, 21 Apr 2022 12:12:53 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A2=E3=83=A9=E3=83=BC=E3=83=88=E3=82=A8?= =?UTF-8?q?=E3=83=A9=E3=83=BC=E5=9B=9E=E9=81=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Main/View/MainTabBarViewController.swift | 7 ++++++ .../Wireframe/MainTabBarViewWireframe.swift | 22 +++++++++++++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/AgileWorks/AgileWorks/Main/View/MainTabBarViewController.swift b/AgileWorks/AgileWorks/Main/View/MainTabBarViewController.swift index 48e98eb..dbc1912 100644 --- a/AgileWorks/AgileWorks/Main/View/MainTabBarViewController.swift +++ b/AgileWorks/AgileWorks/Main/View/MainTabBarViewController.swift @@ -81,6 +81,13 @@ extension MainTabBarViewController: UITabBarControllerDelegate { return true } func tabBarController(_ tabBarController: UITabBarController, didSelect viewController: UIViewController) { + //アラートが表示されていたら画面遷移しない + for vc in self.children { + let alert = vc.presentedViewController as? UIAlertController + if alert != nil { + return + } + } // 選択した TabBarController のリロード if let navi = tabBarController.selectedViewController as? UINavigationController { if let webView = navi.viewControllers[navi.viewControllers.count - 1] as? WebViewController { diff --git a/AgileWorks/AgileWorks/Main/Wireframe/MainTabBarViewWireframe.swift b/AgileWorks/AgileWorks/Main/Wireframe/MainTabBarViewWireframe.swift index 12f8b1c..15a43c3 100644 --- a/AgileWorks/AgileWorks/Main/Wireframe/MainTabBarViewWireframe.swift +++ b/AgileWorks/AgileWorks/Main/Wireframe/MainTabBarViewWireframe.swift @@ -22,9 +22,22 @@ class MainTabBarViewWireframeImpl { } extension MainTabBarViewWireframeImpl: MainTabBarViewWireframe { + //アラートが表示されているか確認 + func alertCheck() -> Bool { + //最前面のViewがUIAlertControllerであれば閉じる + let topVC = viewController.children[viewController.selectedIndex].presentedViewController + let alert = topVC as? UIAlertController + if alert != nil { + return true + } + return false + } + //ウィジェットからの起動 func showApprovalDetail(url: String) { - // ウィジェットからの起動 - // 以下、XPoint時のコード + //アラートが表示されていたら画面遷移しない + if alertCheck() { + return + } let workNum = 1 viewController.selectedIndex = workNum @@ -40,6 +53,11 @@ extension MainTabBarViewWireframeImpl: MainTabBarViewWireframe { } // 通知から書類表示 func showDocForm(notificationData: NotificationData) { + //アラートが表示されていたら画面遷移しない + if alertCheck() { + return + } + let modalWebVC = WebViewBuilderImpl().buildVC() // URL , タイトル設定 modalWebVC.loadURL = notificationData.url -- GitLab