From b574ac218be7786b4aef66f7d6aaca916415532c Mon Sep 17 00:00:00 2001 From: Gk40002148 Date: Thu, 17 Feb 2022 16:22:28 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E3=83=8F=E3=83=B3=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=82=AC=E3=83=BC=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC=E5=AE=9F?= =?UTF-8?q?=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AgileWorks.xcodeproj/project.pbxproj | 17 +- .../WebView/View/AgileWorks-Bridging-Header.h | 4 + .../View/MenuTableViewController.swift | 74 ++++++ .../WebView/View/MenuViewController.swift | 81 +++++++ .../WebView/View/WebViewController.storyboard | 218 +++++++++++++++++- .../AgileWorks/en.lproj/Localizable.strings | 6 + .../AgileWorks/ja.lproj/Localizable.strings | 6 + 7 files changed, 394 insertions(+), 12 deletions(-) create mode 100644 AgileWorks/AgileWorks/WebView/View/AgileWorks-Bridging-Header.h create mode 100644 AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift create mode 100644 AgileWorks/AgileWorks/WebView/View/MenuViewController.swift diff --git a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj index 6d7fe24..e9c986c 100644 --- a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj +++ b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj @@ -126,6 +126,8 @@ C535772C2754D12600EAA660 /* WebViewBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = C535772B2754D12600EAA660 /* WebViewBuilder.swift */; }; C535772E2754D5C500EAA660 /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C535772D2754D5C500EAA660 /* WebViewController.swift */; }; C53577372758AC1100EAA660 /* WebViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C53577362758AC1100EAA660 /* WebViewController.storyboard */; }; + C5848EB827BC8EBC00AA796D /* MenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5848EB727BC8EBB00AA796D /* MenuViewController.swift */; }; + C5848EBA27BCE0F100AA796D /* MenuTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5848EB927BCE0F100AA796D /* MenuTableViewController.swift */; }; C5E5A4C827853BEF00668C7D /* QRCodeReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5E5A4C727853BEF00668C7D /* QRCodeReader.swift */; }; CRJ55ZZNLTXIY1R10AXQL1VZ /* LoginViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = VRZQMTKT1ZML0OSDGAKBK8ID /* LoginViewController.storyboard */; }; DO2X5NYERJY3QMXCZGA5H9OJ /* LoginBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = S1PC5HEYRKFTSW5UN7TH5ZBG /* LoginBuilder.swift */; }; @@ -286,6 +288,8 @@ C535772B2754D12600EAA660 /* WebViewBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewBuilder.swift; sourceTree = ""; }; C535772D2754D5C500EAA660 /* WebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewController.swift; sourceTree = ""; }; C53577362758AC1100EAA660 /* WebViewController.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = WebViewController.storyboard; sourceTree = ""; }; + C5848EB727BC8EBB00AA796D /* MenuViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuViewController.swift; sourceTree = ""; }; + C5848EB927BCE0F100AA796D /* MenuTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuTableViewController.swift; sourceTree = ""; }; C5E5A4C727853BEF00668C7D /* QRCodeReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = QRCodeReader.swift; sourceTree = ""; }; CF516C40B9AA44C977664C98 /* Pods_All_AgileWorks.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_All_AgileWorks.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D6OQPE9ANL0AFC3W41FQ3BH6 /* LoginUseCase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginUseCase.swift; sourceTree = ""; }; @@ -390,7 +394,6 @@ children = ( YQKN6GSUCQ782XFYNUG11TN3 /* Builder */, LLI0RGX2ZZLAP3ZAE0TGGV6N /* View */, - PIAYDHEJZ72P2FDRBVTP6B05 /* Wireframe */, ); path = Main; sourceTree = ""; @@ -786,6 +789,8 @@ C535772D2754D5C500EAA660 /* WebViewController.swift */, C53577362758AC1100EAA660 /* WebViewController.storyboard */, C51EF0E82769FA2E00361B38 /* WebViewScriptMessageHandler.swift */, + C5848EB727BC8EBB00AA796D /* MenuViewController.swift */, + C5848EB927BCE0F100AA796D /* MenuTableViewController.swift */, ); path = View; sourceTree = ""; @@ -835,13 +840,6 @@ path = Builder; sourceTree = ""; }; - PIAYDHEJZ72P2FDRBVTP6B05 /* Wireframe */ = { - isa = PBXGroup; - children = ( - ); - path = Wireframe; - sourceTree = ""; - }; PMR9I4OCB5VIBAL7E7LDZF09 /* Presenter */ = { isa = PBXGroup; children = ( @@ -945,6 +943,7 @@ }; BDA1830E23F3FD7F00C9A6DD = { CreatedOnToolsVersion = 11.3.1; + LastSwiftMigration = 1310; }; }; }; @@ -1143,6 +1142,7 @@ BDA1831323F3FD7F00C9A6DD /* AppDelegate.swift in Sources */, BD3E90862474F50B00B449A7 /* IntExtensions.swift in Sources */, 3A1F7CA424A9FDB3006800F2 /* ModalCollectionViewCell.swift in Sources */, + C5848EB827BC8EBC00AA796D /* MenuViewController.swift in Sources */, BDA74C5624501917000D4351 /* Log.swift in Sources */, 85X3ZXEG18PWU7J17GNGF3UG /* SplashPresenter.swift in Sources */, KQWCT9WOHFNQBPP7I7C3OL6Q /* SplashViewController.swift in Sources */, @@ -1188,6 +1188,7 @@ BD7A8008241A16B90040B418 /* LinkManager.swift in Sources */, C535772E2754D5C500EAA660 /* WebViewController.swift in Sources */, C535772C2754D12600EAA660 /* WebViewBuilder.swift in Sources */, + C5848EBA27BCE0F100AA796D /* MenuTableViewController.swift in Sources */, 7604950425380980000D6951 /* FirebaseSupport.swift in Sources */, BDBBF839243C9EA600EEB25D /* GetApprovalsIDEndpoint.swift in Sources */, UMOPI6WFDHHR8CWFUZDQE9U2 /* LoginUseCase.swift in Sources */, diff --git a/AgileWorks/AgileWorks/WebView/View/AgileWorks-Bridging-Header.h b/AgileWorks/AgileWorks/WebView/View/AgileWorks-Bridging-Header.h new file mode 100644 index 0000000..1b2cb5d --- /dev/null +++ b/AgileWorks/AgileWorks/WebView/View/AgileWorks-Bridging-Header.h @@ -0,0 +1,4 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + diff --git a/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift b/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift new file mode 100644 index 0000000..84a14e1 --- /dev/null +++ b/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift @@ -0,0 +1,74 @@ +// +// MenuTableViewController.swift +// AgileWorks +// +// Created by Gk40002148 on 2022/02/16. +// Copyright © 2022 ATLED CORP. All rights reserved. +// + +import UIKit + +class MenuTableViewController: UITableViewController { + @IBOutlet private var profileCell: UITableViewCell! + @IBOutlet private var profileLabel: UILabel! + @IBOutlet private var logoutCell: UITableViewCell! + @IBOutlet private var logoutLabel: UILabel! + @IBOutlet private var licenseCell: UITableViewCell! + @IBOutlet private var licenseLabel: UILabel! + @IBOutlet private var openLicenseCell: UITableViewCell! + @IBOutlet private var openLicenseLable: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + self.tableView.separatorColor = UIColor(named: NSLocalizedString("SeparatorColor", comment: "")) + self.setup() + } + + override func viewDidLayoutSubviews() { + if let indexPathforSelectRow = self.tableView.indexPathForSelectedRow { + self.tableView.deselectRow(at: indexPathforSelectRow, animated: true) + } + } + + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + // 各セルタップ時の処理 + if let staticIndexPath = tableView.indexPath(for: self.profileCell), staticIndexPath == indexPath { + self.pushToProfile() + } else if let staticIndexPath = tableView.indexPath(for: self.logoutCell), staticIndexPath == indexPath { + self.logout() + } else if let staticIndexPath = tableView.indexPath(for: self.licenseCell), staticIndexPath == indexPath { + self.pushToLicense() + } else if let staticIndexPath = tableView.indexPath(for: self.openLicenseCell), staticIndexPath == indexPath { + self.pushToOpenLicense() + } + } + + // 各種セットアップ + private func setup() { + // 各ラベル設定 + self.profileLabel.text = NSLocalizedString("ProfileTitle", comment: "") + self.logoutLabel.text = NSLocalizedString("LogoutTitle", comment: "") + self.licenseLabel.text = NSLocalizedString("LicenseTitle", comment: "") + self.openLicenseLable.text = NSLocalizedString("OpenLicenseTitle", comment: "") + } + // プロファイルセルタップ処理 + private func pushToProfile() { + // プロファイルタップ時処理 + print("プロファイル タップ") + } + // ログアウトセルタップ処理 + private func logout() { + // ログアウトタップ時処理 + print("ログアウト タップ") + } + // ライセンスセルタップ処理 + private func pushToLicense() { + // ライセンスタップ時処理 + print("ライセンス タップ") + } + // オープンソースライセンスセルタップ処理 + private func pushToOpenLicense() { + // オープンソースライセンスタップ時処理 + print("オープンソースライセンス タップ") + } +} diff --git a/AgileWorks/AgileWorks/WebView/View/MenuViewController.swift b/AgileWorks/AgileWorks/WebView/View/MenuViewController.swift new file mode 100644 index 0000000..7e1cdcc --- /dev/null +++ b/AgileWorks/AgileWorks/WebView/View/MenuViewController.swift @@ -0,0 +1,81 @@ +// +// MenuViewController.swift +// AgileWorks +// +// Created by Gk40002148 on 2022/02/16. +// Copyright © 2022 ATLED CORP. All rights reserved. +// + +import UIKit + +class MenuViewController: UIViewController { + @IBOutlet private var menuView: UIView! + @IBOutlet private var nameLabel: UILabel! + + override func viewDidLoad() { + super.viewDidLoad() + + self.setup() + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + // メニューの位置を取得 + let menuPos = self.menuView.layer.position + // 初期位置を画面の外側にセットするため、メニュー幅分マイナス + self.menuView.layer.position.x = -self.menuView.frame.width + // 表示時のアニメーションセット + UIView.animate( + withDuration: 0.5, + delay: 0, + options: .curveEaseOut, + animations: { + self.menuView.layer.position.x = menuPos.x + }, + completion: { _ in + }) + } + + override func touchesEnded(_ touches: Set, with event: UIEvent?) { + super.touchesEnded(touches, with: event) + for touch in touches where touch.view?.tag == 1 { + // メニューエリア外タップ時の処理 + UIView.animate( + withDuration: 0.2, + delay: 0, + options: .curveEaseIn, + animations: { + self.menuView.layer.position.x = -self.menuView.frame.width + }, + completion: { _ in + self.dismiss(animated: true, completion: nil) + }) + } + } + + // 各種セットアップ + private func setup() { + // セッション情報取得 + loadSessionInfo { result in + switch result { + case .success(let response): + let userName = response.user.name + DispatchQueue.main.async { + self.nameLabel.text = userName + } + case .failure: + DispatchQueue.main.async { + self.nameLabel.text = "" + } + } + } + } + + // セッション情報取得 + private func loadSessionInfo(completion: @escaping (Result) -> Void) { + let sessionEndpoint = GetSessionEndpoint() + Session.send(sessionEndpoint) { result in + completion(result) + } + } +} diff --git a/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard b/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard index f2dd256..290c63b 100644 --- a/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard +++ b/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard @@ -4,6 +4,7 @@ + @@ -62,19 +63,24 @@ - + + - - - + + + + + + + @@ -86,6 +92,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -107,13 +303,27 @@ + + + + + + + + + + + + + + diff --git a/AgileWorks/AgileWorks/en.lproj/Localizable.strings b/AgileWorks/AgileWorks/en.lproj/Localizable.strings index bbb3e6c..741005d 100644 --- a/AgileWorks/AgileWorks/en.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/en.lproj/Localizable.strings @@ -30,6 +30,12 @@ "SearchTitle" = "検索"; "CheckConnectButton" = "接続確認"; +// SideMenu +"ProfileTitle" = "プロファイル"; +"LogoutTitle" = "ログアウト"; +"LicenseTitle" = "ライセンス"; +"OpenLicenseTitle" = "オープンソースライセンス"; + // Approval "ApprovalTitle" = "承認一覧"; "ApprovalData" = "%1$@ (%2$@)"; diff --git a/AgileWorks/AgileWorks/ja.lproj/Localizable.strings b/AgileWorks/AgileWorks/ja.lproj/Localizable.strings index 056488b..105c25b 100644 --- a/AgileWorks/AgileWorks/ja.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/ja.lproj/Localizable.strings @@ -30,6 +30,12 @@ "SearchTitle" = "検索"; "CheckConnectButton" = "接続確認"; +// SideMenu +"ProfileTitle" = "プロファイル"; +"LogoutTitle" = "ログアウト"; +"LicenseTitle" = "ライセンス"; +"OpenLicenseTitle" = "オープンソースライセンス"; + // Approval "ApprovalTitle" = "承認一覧"; "ApprovalData" = "%1$@ (%2$@)"; -- GitLab From c2761029ccedbb0b6d3efbbc44120a8e293a5a47 Mon Sep 17 00:00:00 2001 From: Gk40002148 Date: Thu, 17 Feb 2022 17:30:01 +0900 Subject: [PATCH 2/2] =?UTF-8?q?=E3=83=A1=E3=83=8B=E3=83=A5=E3=83=BC?= =?UTF-8?q?=E3=82=A2=E3=82=A4=E3=82=B3=E3=83=B3=E8=89=B2=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard | 1 + 1 file changed, 1 insertion(+) diff --git a/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard b/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard index 290c63b..b7eb59c 100644 --- a/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard +++ b/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard @@ -76,6 +76,7 @@ + -- GitLab