From d528b75e40c0253ac881c498cd4e539ccfd9e1d5 Mon Sep 17 00:00:00 2001 From: Azuma Kasumi Date: Mon, 9 May 2022 16:43:58 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E3=82=A6=E3=82=A3=E3=82=B8=E3=82=A7?= =?UTF-8?q?=E3=83=83=E3=83=88=E3=81=8C=E3=83=A1=E3=83=83=E3=82=BB=E3=83=BC?= =?UTF-8?q?=E3=82=B8=E3=82=92=E8=A1=A8=E7=A4=BA=E3=81=97=E3=81=A6=E3=81=84?= =?UTF-8?q?=E3=82=8B=E6=99=82=E3=81=AE=E3=83=AA=E3=83=B3=E3=82=AF=E3=82=B8?= =?UTF-8?q?=E3=83=A3=E3=83=B3=E3=83=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AgileWorks/AgileWorks/App/AppDelegate.swift | 8 ++++--- .../Wireframe/MainTabBarViewWireframe.swift | 3 +++ AgileWorks/Common/WidgetView.swift | 24 +++++++++++++------ .../View/TodayViewController.swift | 4 ++-- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/AgileWorks/AgileWorks/App/AppDelegate.swift b/AgileWorks/AgileWorks/App/AppDelegate.swift index 448b09f..5ef589f 100644 --- a/AgileWorks/AgileWorks/App/AppDelegate.swift +++ b/AgileWorks/AgileWorks/App/AppDelegate.swift @@ -78,17 +78,19 @@ class AppDelegate: UIResponder, UIApplicationDelegate { if statusUrl.contains("atled-aw:/") { statusUrl = statusUrl.replacingOccurrences(of:"atled-aw:/", with:"") result = getStatusURL(status: statusUrl) - print(result) return Linker.handleDeeplink(url: result) } return Linker.handleDeeplink(url: url) } func getStatusURL(status: String) -> URL { - if status == "nil" { + if status == "nil" { //アプリを起動するのみ + return URL(string: "atled-aw:/")! + }else if status == "work" { //「仕事」タブを開く return URL(string: Configuration.shared.awURL + "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/Mobile#work")! + }else { //指定した書類状態を開く + return URL(string: Configuration.shared.awURL + "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/Mobile#docList_" + status)! } - return URL(string: Configuration.shared.awURL + "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/Mobile#docList_" + status)! } // Notification受信 diff --git a/AgileWorks/AgileWorks/Main/Wireframe/MainTabBarViewWireframe.swift b/AgileWorks/AgileWorks/Main/Wireframe/MainTabBarViewWireframe.swift index f076f63..783c32f 100644 --- a/AgileWorks/AgileWorks/Main/Wireframe/MainTabBarViewWireframe.swift +++ b/AgileWorks/AgileWorks/Main/Wireframe/MainTabBarViewWireframe.swift @@ -34,6 +34,9 @@ extension MainTabBarViewWireframeImpl: MainTabBarViewWireframe { } //ウィジェットからの起動 func showApprovalDetail(url: String) { + if url == "atled-aw:/" { + return + } //アラートが表示されていたら画面遷移しない if alertCheck() { return diff --git a/AgileWorks/Common/WidgetView.swift b/AgileWorks/Common/WidgetView.swift index 19fadfa..bbcf713 100644 --- a/AgileWorks/Common/WidgetView.swift +++ b/AgileWorks/Common/WidgetView.swift @@ -20,6 +20,8 @@ let share = "SHARE" let shared = "SHARED" let futurePass = "FUTUREPASS" +let urlScheme = "atled-aw://" + //ウィジェット選択のプレビュー画面などで表示させる項目 func previewItems() -> [ApprovalItem] { var items = [ApprovalItem]() @@ -54,7 +56,16 @@ struct StatusCheckWidgetView: View { if entry.message == "-" { StatusBoxView(entry: entry) } else { //ログイン・コネクションエラー - FailureWidgetView(entry: entry) + if #available(iOS 14.0, *) { + FailureWidgetView(entry: entry) + }else { + FailureWidgetView(entry: entry) + .onTapGesture { + if entry.viewController != nil { + entry.viewController!.extensionContext?.open(NSURL(fileURLWithPath: urlScheme + "/nil")as URL, completionHandler: nil) + } + } + } } } } @@ -137,7 +148,7 @@ struct StatusBoxView: View { var body: some View { GeometryReader { geometry in - //ios13・14状態確認ウィジェット + //ios13・14~状態確認ウィジェット if geometry.size.height > kCellDefaultHight { VStack(spacing: 5) { ForEach(0.. String { //スキーム+ステータスで設定 - let urlString = "atled-aw://" - if let status = getStatus() { - return urlString + status - } - return urlString + "nil" + if let status = getStatus() { + return urlScheme + status + } + return urlScheme + "work" } var body: some View { diff --git a/AgileWorks/TodayExtension/View/TodayViewController.swift b/AgileWorks/TodayExtension/View/TodayViewController.swift index 506cb6f..7869ee8 100644 --- a/AgileWorks/TodayExtension/View/TodayViewController.swift +++ b/AgileWorks/TodayExtension/View/TodayViewController.swift @@ -34,10 +34,10 @@ class TodayViewController: UIViewController, NCWidgetProviding { rootView = StatusCheckWidgetView(entry: EntryData(approvalItems: self.approvalItems, message: nil, viewController: self)) completionHandler(.newData) case .nodate(let message): - rootView = StatusCheckWidgetView(entry: EntryData(approvalItems: [ApprovalItem](), message: message, viewController: nil)) + rootView = StatusCheckWidgetView(entry: EntryData(approvalItems: [ApprovalItem](), message: message, viewController: self)) completionHandler(.noData) case .failure(let message): - rootView = StatusCheckWidgetView(entry: EntryData(approvalItems: previewItems(), message: message, viewController: nil)) + rootView = StatusCheckWidgetView(entry: EntryData(approvalItems: previewItems(), message: message, viewController: self)) completionHandler(.failed) } self.callWidgetView(vc: UIHostingController(rootView: rootView)) -- GitLab From 9e1d314b941128a18260d46c5ae91b5aea4dfd6d Mon Sep 17 00:00:00 2001 From: Azuma Kasumi Date: Tue, 10 May 2022 12:34:52 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E3=82=A2=E3=83=97=E3=83=AA=E8=B5=B7?= =?UTF-8?q?=E5=8B=95=E6=99=82=E3=81=AE=E3=83=91=E3=82=B9=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AgileWorks/AgileWorks/App/AppDelegate.swift | 25 ++++++++++++------- .../Wireframe/MainTabBarViewWireframe.swift | 3 ++- AgileWorks/Common/WidgetView.swift | 7 +++--- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/AgileWorks/AgileWorks/App/AppDelegate.swift b/AgileWorks/AgileWorks/App/AppDelegate.swift index 5ef589f..8392a88 100644 --- a/AgileWorks/AgileWorks/App/AppDelegate.swift +++ b/AgileWorks/AgileWorks/App/AppDelegate.swift @@ -73,20 +73,27 @@ class AppDelegate: UIResponder, UIApplicationDelegate { } //ios13の場合 - var statusUrl = url.absoluteString - let result: URL - if statusUrl.contains("atled-aw:/") { - statusUrl = statusUrl.replacingOccurrences(of:"atled-aw:/", with:"") - result = getStatusURL(status: statusUrl) - return Linker.handleDeeplink(url: result) + if url.scheme == urlSchemeName { + var strUrl = url.absoluteString + //指定した書類状態の取得、アプリ起動のみの場合は飛ばす + if strUrl.contains("/") { + let result: URL + var scheme = urlScheme + // 不要な"/"を取り除く + let delIdx = scheme.index(scheme.endIndex, offsetBy: -1) + scheme.remove(at: delIdx) + //scheme以降の取得 + strUrl = strUrl.replacingOccurrences(of: scheme, with: "") + //遷移URLの取得 + result = getStatusURL(status: strUrl) + return Linker.handleDeeplink(url: result) + } } return Linker.handleDeeplink(url: url) } func getStatusURL(status: String) -> URL { - if status == "nil" { //アプリを起動するのみ - return URL(string: "atled-aw:/")! - }else if status == "work" { //「仕事」タブを開く + if status == "nil" { //「仕事」タブを開く return URL(string: Configuration.shared.awURL + "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/Mobile#work")! }else { //指定した書類状態を開く return URL(string: Configuration.shared.awURL + "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/Mobile#docList_" + status)! diff --git a/AgileWorks/AgileWorks/Main/Wireframe/MainTabBarViewWireframe.swift b/AgileWorks/AgileWorks/Main/Wireframe/MainTabBarViewWireframe.swift index 783c32f..8b6e875 100644 --- a/AgileWorks/AgileWorks/Main/Wireframe/MainTabBarViewWireframe.swift +++ b/AgileWorks/AgileWorks/Main/Wireframe/MainTabBarViewWireframe.swift @@ -34,7 +34,8 @@ extension MainTabBarViewWireframeImpl: MainTabBarViewWireframe { } //ウィジェットからの起動 func showApprovalDetail(url: String) { - if url == "atled-aw:/" { + //アプリ起動のみ + if url.contains(urlSchemeName) { return } //アラートが表示されていたら画面遷移しない diff --git a/AgileWorks/Common/WidgetView.swift b/AgileWorks/Common/WidgetView.swift index bbcf713..c848a97 100644 --- a/AgileWorks/Common/WidgetView.swift +++ b/AgileWorks/Common/WidgetView.swift @@ -20,7 +20,8 @@ let share = "SHARE" let shared = "SHARED" let futurePass = "FUTUREPASS" -let urlScheme = "atled-aw://" +let urlSchemeName = "atled-aw" +let urlScheme = urlSchemeName + "://" //ウィジェット選択のプレビュー画面などで表示させる項目 func previewItems() -> [ApprovalItem] { @@ -62,7 +63,7 @@ struct StatusCheckWidgetView: View { FailureWidgetView(entry: entry) .onTapGesture { if entry.viewController != nil { - entry.viewController!.extensionContext?.open(NSURL(fileURLWithPath: urlScheme + "/nil")as URL, completionHandler: nil) + entry.viewController!.extensionContext?.open(NSURL(fileURLWithPath: urlScheme)as URL, completionHandler: nil) } } } @@ -249,7 +250,7 @@ struct LinkView: View { if let status = getStatus() { return urlScheme + status } - return urlScheme + "work" + return urlScheme + "nil" } var body: some View { -- GitLab