From 4dc64bb75fa42447b1a778e36105dd5874253f83 Mon Sep 17 00:00:00 2001 From: Azuma Kasumi Date: Mon, 10 Apr 2023 12:08:53 +0900 Subject: [PATCH 1/2] =?UTF-8?q?iPad=E3=81=AEactivityView=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=83=BBsubWebView=E3=81=AE=E5=8B=95=E4=BD=9C=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WebView/View/WebViewController.swift | 48 ++++++++++++++----- 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/AgileWorks/AgileWorks/WebView/View/WebViewController.swift b/AgileWorks/AgileWorks/WebView/View/WebViewController.swift index 4cdd571..4a17a82 100644 --- a/AgileWorks/AgileWorks/WebView/View/WebViewController.swift +++ b/AgileWorks/AgileWorks/WebView/View/WebViewController.swift @@ -18,9 +18,10 @@ class WebViewController: UIViewController { @IBOutlet private var closeButton: UIBarButtonItem! @IBOutlet private var menuButton: UIBarButtonItem! var mainWebView: WKWebView! - var subWebView: WKWebView! // 別ウインドウで開いたときの子ウインドウスタック var subViewStack = SubViewStack() + //subWebView読み込みフラグ + var subWebViewLoadingFlg = false var loadURL: String! var reloadTab = false var showNotification = false @@ -464,17 +465,18 @@ extension WebViewController: WKUIDelegate { func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? { if navigationAction.targetFrame?.isMainFrame != true { - subWebView = WKWebView(frame: self.formView.bounds, configuration: configuration) - subWebView.navigationDelegate = self - subWebView.uiDelegate = self - subViewStack.push(subWebView, superView: mainWebView) - subWebView.load(navigationAction.request) - - //キャンセルボタンの表示 - self.closeButton.title = getDisplayString(key: "Close", comment: "") - self.closeButton.isEnabled = true - - return subWebView + if !subWebViewLoadingFlg { + subWebViewLoadingFlg = true + let subWebView = WKWebView(frame: self.formView.bounds, configuration: configuration) + //読み込むが非表示 + subWebView.isHidden = true + subWebView.navigationDelegate = self + subWebView.uiDelegate = self + subViewStack.push(subWebView, superView: mainWebView) + subWebView.load(navigationAction.request) + + return subWebView + } } return nil } @@ -497,6 +499,15 @@ extension WebViewController: WKNavigationDelegate { download(url: url, saveAs: attachmentFileName) decisionHandler(.cancel) } else { + //subWebViewの場合 + if !subViewStack.isEmpty { + //subWebViewの表示 + webView.isHidden = false + //キャンセルボタンの表示 + self.closeButton.title = getDisplayString(key: "Close", comment: "") + self.closeButton.isEnabled = true + subWebViewLoadingFlg = false + } decisionHandler(.allow) } } @@ -614,9 +625,20 @@ extension WebViewController: WKNavigationDelegate { } DispatchQueue.main.async {[self] in let activityViewController = UIActivityViewController(activityItems: [tempPath], applicationActivities: nil) + //iPadのみ + if UIDevice.current.userInterfaceIdiom == .pad { + let deviceSize = UIScreen.main.bounds + if let popPC = activityViewController.popoverPresentationController { + popPC.sourceRect = CGRect(x: UIScreen.main.bounds.width / 2, y: UIScreen.main.bounds.height / 2, width: 0, height: 0) + popPC.sourceView = self.view + popPC.permittedArrowDirections = UIPopoverArrowDirection(rawValue: 0) + } + } activityViewController.completionWithItemsHandler = { (activityType: UIActivity.ActivityType?, completed: Bool, returnedItems: [Any]?, activityError: Error?) in + //subWebViewを消す self.closeTapped() - + subWebViewLoadingFlg = false + guard completed else { return } -- GitLab From 727f1aec0b3cf5e63eb359564c3bf79a905a8a17 Mon Sep 17 00:00:00 2001 From: Azuma Kasumi Date: Fri, 14 Apr 2023 11:14:03 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E3=82=A2=E3=83=97=E3=83=AA=E3=83=90?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=A2=E3=83=83=E3=83=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AgileWorks/AgileWorks.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj index 10691b2..2c0de42 100644 --- a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj +++ b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj @@ -1822,7 +1822,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 1.0.1; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -1996,7 +1996,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 1.0.0; + MARKETING_VERSION = 1.0.1; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", -- GitLab