From 864126642e360e97ba263b859153e751787a31ab Mon Sep 17 00:00:00 2001 From: Azuma Kasumi Date: Fri, 14 Apr 2023 11:12:33 +0900 Subject: [PATCH 1/3] =?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=BCUI?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Strings/Chinese-Simplified.strings | 3 + .../Strings/Chinese-Traditional.strings | 3 + AgileWorks/AgileWorks/Strings/English.strings | 3 + .../AgileWorks/Strings/Japanese.strings | 3 + .../Strings/en.lproj/Localizable.strings | 3 + .../Strings/ja.lproj/Localizable.strings | 3 + .../Strings/zh-Hans.lproj/Localizable.strings | 3 + .../Strings/zh-Hant.lproj/Localizable.strings | 3 + .../View/MenuTableViewController.swift | 16 +++- .../WebView/View/MenuViewController.swift | 5 +- .../WebView/View/WebViewController.storyboard | 75 ++++++++++++++----- 11 files changed, 96 insertions(+), 24 deletions(-) diff --git a/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings b/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings index f39da1e..7d800c1 100644 --- a/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings +++ b/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings @@ -56,6 +56,9 @@ // Open License "OpenLicenseViewTitle" = "开放许可证"; +//server +"ServerTitle" = "接続先サーバー"; + // Notification "DocOverrideConfirm" = "由通知点选的文件已经显示了。\n你想放弃当前的编辑并显示一个新的文件吗?"; diff --git a/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings b/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings index de02fa7..4168400 100644 --- a/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings +++ b/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings @@ -56,6 +56,9 @@ // Open License "OpenLicenseViewTitle" = "開放許可證"; +//server +"ServerTitle" = "接続先サーバー"; + // Notification "DocOverrideConfirm" = "由通知點選的文件已經顯示了。 \n你想放棄當前的編輯並顯示一個新的文件嗎?"; diff --git a/AgileWorks/AgileWorks/Strings/English.strings b/AgileWorks/AgileWorks/Strings/English.strings index e4bc950..527ffdb 100644 --- a/AgileWorks/AgileWorks/Strings/English.strings +++ b/AgileWorks/AgileWorks/Strings/English.strings @@ -56,6 +56,9 @@ // Open License "OpenLicenseViewTitle" = "Open license"; +//server +"ServerTitle" = "接続先サーバー"; + // Notification "DocOverrideConfirm" = "A document by a notification tap is already displayed.\nDo you want to discard the current edits and display a new document?"; diff --git a/AgileWorks/AgileWorks/Strings/Japanese.strings b/AgileWorks/AgileWorks/Strings/Japanese.strings index a4fb0de..471ddc0 100644 --- a/AgileWorks/AgileWorks/Strings/Japanese.strings +++ b/AgileWorks/AgileWorks/Strings/Japanese.strings @@ -56,6 +56,9 @@ // Open License "OpenLicenseViewTitle" = "オープンソースライセンス"; +//server +"ServerTitle" = "接続先サーバー"; + // Notification "DocOverrideConfirm" = "既に通知タップによる書類が表示されています。\n現在の編集内容を破棄し、新たな書類を表示しますか?"; diff --git a/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings index e017363..7f2918a 100644 --- a/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings @@ -56,6 +56,9 @@ // Open License "OpenLicenseViewTitle" = "Open license"; +//server +"ServerTitle" = "接続先サーバー"; + // Notification "DocOverrideConfirm" = "A document by a notification tap is already displayed.\nDo you want to discard the current edits and display a new document?"; diff --git a/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings index 31e6319..529cfff 100644 --- a/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings @@ -56,6 +56,9 @@ // Open License "OpenLicenseViewTitle" = "オープンソースライセンス"; +//server +"ServerTitle" = "接続先サーバー"; + // Notification "DocOverrideConfirm" = "既に通知タップによる書類が表示されています。\n現在の編集内容を破棄し、新たな書類を表示しますか?"; diff --git a/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings index 6dc7b16..19b2444 100644 --- a/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings @@ -56,6 +56,9 @@ // Open License "OpenLicenseViewTitle" = "开放许可证"; +//server +"ServerTitle" = "接続先サーバー"; + // Notification "DocOverrideConfirm" = "由通知点选的文件已经显示了。\n你想放弃当前的编辑并显示一个新的文件吗?"; diff --git a/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings index 6e180c6..a4898c3 100644 --- a/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings @@ -56,6 +56,9 @@ // Open License "OpenLicenseViewTitle" = "開放許可證"; +//server +"ServerTitle" = "接続先サーバー"; + // Notification "DocOverrideConfirm" = "由通知點選的文件已經顯示了。 \n你想放棄當前的編輯並顯示一個新的文件嗎?"; diff --git a/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift b/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift index 77850b6..137b310 100644 --- a/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift +++ b/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift @@ -16,8 +16,10 @@ class MenuTableViewController: UITableViewController { @IBOutlet private var licenseCell: UITableViewCell! @IBOutlet private var licenseLabel: UILabel! @IBOutlet private var openLicenseCell: UITableViewCell! - @IBOutlet private var openLicenseLable: UILabel! - + @IBOutlet private var openLicenseLabel: UILabel! + @IBOutlet private var serverCell: UITableViewCell! + @IBOutlet private var serverLabel: UILabel! + override func viewDidLoad() { super.viewDidLoad() self.tableView.separatorColor = UIColor(named: getDisplayString(key: "SeparatorColor", comment: "")) @@ -40,6 +42,8 @@ class MenuTableViewController: UITableViewController { self.pushToLicense() } else if let staticIndexPath = tableView.indexPath(for: self.openLicenseCell), staticIndexPath == indexPath { self.pushToOpenLicense() + } else if let staticIndecPath = tableView.indexPath(for: self.serverCell), staticIndecPath == indexPath { + self.pushToServer() } // メニュークローズ if let parent = self.parent as? MenuViewController { @@ -53,7 +57,8 @@ class MenuTableViewController: UITableViewController { self.profileLabel.text = getDisplayString(key: "ProfileTitle", comment: "") self.logoutLabel.text = getDisplayString(key: "LogoutTitle", comment: "") self.licenseLabel.text = getDisplayString(key: "LicenseTitle", comment: "") - self.openLicenseLable.text = getDisplayString(key: "OpenLicenseTitle", comment: "") + self.openLicenseLabel.text = getDisplayString(key: "OpenLicenseTitle", comment: "") + self.serverLabel.text = getDisplayString(key: "ServerTitle", comment: "") } // プロファイルセルタップ処理 private func pushToProfile() { @@ -107,4 +112,9 @@ class MenuTableViewController: UITableViewController { self.tableView.deselectRow(at: indexPath, animated: true) } } + + //接続先サーバーセルタップ処理 + private func pushToServer() { + + } } diff --git a/AgileWorks/AgileWorks/WebView/View/MenuViewController.swift b/AgileWorks/AgileWorks/WebView/View/MenuViewController.swift index ba97475..07e6ba3 100644 --- a/AgileWorks/AgileWorks/WebView/View/MenuViewController.swift +++ b/AgileWorks/AgileWorks/WebView/View/MenuViewController.swift @@ -11,7 +11,7 @@ import UIKit class MenuViewController: UIViewController { @IBOutlet private var menuView: UIView! @IBOutlet private var nameLabel: UILabel! - + @IBOutlet private var serverLabel: UILabel! override func viewDidLoad() { super.viewDidLoad() @@ -61,14 +61,17 @@ class MenuViewController: UIViewController { // 各種セットアップ private func setup() { self.nameLabel.text = "" + self.serverLabel.text = "" // セッション情報取得 loadSessionInfo { result in switch result { case .success(let response): let userName = response.user.name + let serverName = "サーバー識別名" //TODO response.server.name let sessionId = response.sessionId DispatchQueue.main.async { self.nameLabel.text = userName + self.serverLabel.text = serverName KeychainDataStore().writeSessionID(sessionID: sessionId) } case .failure: diff --git a/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard b/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard index 19d9eca..897f2d6 100644 --- a/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard +++ b/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard @@ -1,9 +1,9 @@ - + - + @@ -20,15 +20,15 @@ - + -- GitLab From 2816ec0b782a4c4795be6fe71b96f89dcc0058a8 Mon Sep 17 00:00:00 2001 From: Azuma Kasumi Date: Tue, 18 Apr 2023 14:09:12 +0900 Subject: [PATCH 2/3] =?UTF-8?q?=E3=83=A2=E3=83=BC=E3=83=80=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E8=A1=A8=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AgileWorks.xcodeproj/project.pbxproj | 40 +++++++++ .../Builder/ServerSwitchingBuilder.swift | 32 +++++++ .../View/MordalViewController.swift | 23 +++++ .../View/ServerSwitchingViewController.swift | 86 +++++++++++++++++++ .../serverSwitchingViewController.storyboard | 57 ++++++++++++ .../View/MenuTableViewController.swift | 8 ++ 6 files changed, 246 insertions(+) create mode 100644 AgileWorks/AgileWorks/ServerSwitching/Builder/ServerSwitchingBuilder.swift create mode 100644 AgileWorks/AgileWorks/ServerSwitching/View/MordalViewController.swift create mode 100644 AgileWorks/AgileWorks/ServerSwitching/View/ServerSwitchingViewController.swift create mode 100644 AgileWorks/AgileWorks/ServerSwitching/View/serverSwitchingViewController.storyboard diff --git a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj index 10691b2..5c044bc 100644 --- a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj +++ b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj @@ -43,6 +43,10 @@ 75917FB527C371390051E201 /* StringsUtility.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75917FB227C371390051E201 /* StringsUtility.swift */; }; 75917FB627C372C80051E201 /* XCGLoggerExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = BD8D55D82420609000A667B0 /* XCGLoggerExtensions.swift */; }; 75917FB727C373060051E201 /* UserDefaultsExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDAB1F6C240D0D0000EA15FD /* UserDefaultsExtensions.swift */; }; + 75BC052D29ECE87500E21941 /* ServerSwitchingBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75BC052C29ECE87500E21941 /* ServerSwitchingBuilder.swift */; }; + 75BC052F29ECE8AC00E21941 /* ServerSwitchingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75BC052E29ECE8AC00E21941 /* ServerSwitchingViewController.swift */; }; + 75BC053229ED087000E21941 /* ServerSwitchingViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 75BC053129ED087000E21941 /* ServerSwitchingViewController.storyboard */; }; + 75BC053429EDA23700E21941 /* MordalViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75BC053329EDA23700E21941 /* MordalViewController.swift */; }; 75EDD2272806618A0068B4BC /* WidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EDD2262806618A0068B4BC /* WidgetView.swift */; }; 75EDD2282806618A0068B4BC /* WidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EDD2262806618A0068B4BC /* WidgetView.swift */; }; 75EDD2292806618A0068B4BC /* WidgetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EDD2262806618A0068B4BC /* WidgetView.swift */; }; @@ -244,6 +248,10 @@ 75917F9F27BDF2050051E201 /* Chinese-Simplified.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = "Chinese-Simplified.strings"; sourceTree = ""; }; 75917FA127BDF2250051E201 /* Chinese-Traditional.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = "Chinese-Traditional.strings"; sourceTree = ""; }; 75917FB227C371390051E201 /* StringsUtility.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringsUtility.swift; sourceTree = ""; }; + 75BC052C29ECE87500E21941 /* ServerSwitchingBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerSwitchingBuilder.swift; sourceTree = ""; }; + 75BC052E29ECE8AC00E21941 /* ServerSwitchingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerSwitchingViewController.swift; sourceTree = ""; }; + 75BC053129ED087000E21941 /* ServerSwitchingViewController.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = ServerSwitchingViewController.storyboard; sourceTree = ""; }; + 75BC053329EDA23700E21941 /* MordalViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MordalViewController.swift; sourceTree = ""; }; 75EDD2262806618A0068B4BC /* WidgetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WidgetView.swift; sourceTree = ""; }; 75EF9CAC27E9E983003178A3 /* WidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = WidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 75EF9CAD27E9E983003178A3 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; }; @@ -481,6 +489,33 @@ path = Strings; sourceTree = ""; }; + 75BC052729ECE1FB00E21941 /* ServerSwitching */ = { + isa = PBXGroup; + children = ( + 75BC052829ECE2F500E21941 /* Builder */, + 75BC052929ECE30900E21941 /* View */, + ); + path = ServerSwitching; + sourceTree = ""; + }; + 75BC052829ECE2F500E21941 /* Builder */ = { + isa = PBXGroup; + children = ( + 75BC052C29ECE87500E21941 /* ServerSwitchingBuilder.swift */, + ); + path = Builder; + sourceTree = ""; + }; + 75BC052929ECE30900E21941 /* View */ = { + isa = PBXGroup; + children = ( + 75BC052E29ECE8AC00E21941 /* ServerSwitchingViewController.swift */, + 75BC053129ED087000E21941 /* ServerSwitchingViewController.storyboard */, + 75BC053329EDA23700E21941 /* MordalViewController.swift */, + ); + path = View; + sourceTree = ""; + }; 75EF9CB127E9E983003178A3 /* WidgetExtension */ = { isa = PBXGroup; children = ( @@ -790,6 +825,7 @@ C57DCAA727C8954B000A2ABC /* Profile */, 76AE52DB25D358D700AFA45A /* License */, C50CF78A27D86D760042C210 /* OpenLicense */, + 75BC052729ECE1FB00E21941 /* ServerSwitching */, BDEB7D8D23F5293800EFAF31 /* Podfile */, BDA1832823F406A600C9A6DD /* README.md */, 75917F9A27BDEC880051E201 /* Strings */, @@ -1181,6 +1217,7 @@ C599740F27D9E64E006F5AAC /* OpenLicenseDetailViewController.storyboard in Resources */, BDA1833123F41A4C00C9A6DD /* Images.xcassets in Resources */, BDA1831F23F3FD8000C9A6DD /* LaunchScreen.storyboard in Resources */, + 75BC053229ED087000E21941 /* ServerSwitchingViewController.storyboard in Resources */, C59C21FE282E318100DDF5CC /* License-ja.rtf in Resources */, BDA1831C23F3FD8000C9A6DD /* Assets.xcassets in Resources */, 76AE52D725D358A800AFA45A /* License.rtf in Resources */, @@ -1370,6 +1407,7 @@ BDBBF838243C9EA300EEB25D /* GetApprovalsEndpoint.swift in Sources */, BD7DC0F224C0608800C3FBED /* ErrorResponse.swift in Sources */, C52221BC27FD67EA00494390 /* SubViewStack.swift in Sources */, + 75BC052F29ECE8AC00E21941 /* ServerSwitchingViewController.swift in Sources */, BD7A8007241A16B90040B418 /* DeepLinkParser.swift in Sources */, BD7A8009241A16B90040B418 /* NotificationParser.swift in Sources */, BDEE85F82408A887006A6BF7 /* MainTabBarViewController.swift in Sources */, @@ -1389,6 +1427,8 @@ BD86A6B124067EB3007B48F1 /* APIResult.swift in Sources */, BDAB1F71240D0E5C00EA15FD /* GetSessionEndpoint.swift in Sources */, BDAABA1D24A3627B0077EC69 /* DeviceResponse.swift in Sources */, + 75BC053429EDA23700E21941 /* MordalViewController.swift in Sources */, + 75BC052D29ECE87500E21941 /* ServerSwitchingBuilder.swift in Sources */, BDA1832B23F4079400C9A6DD /* RootViewController.swift in Sources */, C57DCAAE27C89823000A2ABC /* ProfileViewController.swift in Sources */, OZPVEGK5OCQVK53RHNWXAVSG /* LoginViewController.swift in Sources */, diff --git a/AgileWorks/AgileWorks/ServerSwitching/Builder/ServerSwitchingBuilder.swift b/AgileWorks/AgileWorks/ServerSwitching/Builder/ServerSwitchingBuilder.swift new file mode 100644 index 0000000..c40d8c9 --- /dev/null +++ b/AgileWorks/AgileWorks/ServerSwitching/Builder/ServerSwitchingBuilder.swift @@ -0,0 +1,32 @@ +// +// ServerSwitchingBuilder.swift +// AgileWorks +// +// Created by Azuma Kasumi on 2023/04/17. +// Copyright © 2023 ATLED CORP. All rights reserved. +// + +import UIKit + +protocol ServerSwitchingBuilder { + func build() -> UIViewController +} + +struct ServerSwitchingBuilderImpl: ServerSwitchingBuilder { + let identifier = "ServerSwitchingViewController" + + func build() -> UIViewController { + let viewController = storyboard() + + return viewController + } +} + +extension ServerSwitchingBuilderImpl { + private func storyboard() -> ServerSwitchingViewController { + let storyboard = UIStoryboard(name: identifier, bundle: Bundle.main) + let viewController = storyboard.instantiateViewController(withIdentifier: identifier) as! ServerSwitchingViewController + return viewController + } +} + diff --git a/AgileWorks/AgileWorks/ServerSwitching/View/MordalViewController.swift b/AgileWorks/AgileWorks/ServerSwitching/View/MordalViewController.swift new file mode 100644 index 0000000..8474044 --- /dev/null +++ b/AgileWorks/AgileWorks/ServerSwitching/View/MordalViewController.swift @@ -0,0 +1,23 @@ +// +// MordalViewController.swift +// AgileWorks +// +// Created by Azuma Kasumi on 2023/04/18. +// Copyright © 2023 ATLED CORP. All rights reserved. +// + +import UIKit +import FloatingPanel + +class MordalViewController: UIViewController { + override func viewDidLoad() { + super.viewDidLoad() + + // Do any additional setup after loading the view. + } + + static func fromStoryboard(_ storyboard: UIStoryboard = UIStoryboard(name: "ServerSwitchingViewController", bundle: nil)) -> MordalViewController { + let controller = storyboard.instantiateViewController(withIdentifier: "MordalViewController") as! MordalViewController + return controller + } +} diff --git a/AgileWorks/AgileWorks/ServerSwitching/View/ServerSwitchingViewController.swift b/AgileWorks/AgileWorks/ServerSwitching/View/ServerSwitchingViewController.swift new file mode 100644 index 0000000..dee57e5 --- /dev/null +++ b/AgileWorks/AgileWorks/ServerSwitching/View/ServerSwitchingViewController.swift @@ -0,0 +1,86 @@ +// +// ServerSwitchingViewController.swift +// AgileWorks +// +// Created by Azuma Kasumi on 2023/04/17. +// Copyright © 2023 ATLED CORP. All rights reserved. +// + +import UIKit +import FloatingPanel + +class ServerSwitchingViewController: UIViewController, UIGestureRecognizerDelegate { + let fpc = FloatingPanelController() + + override func viewDidLoad() { + super.viewDidLoad() + + //モーダル外の背景色 + self.view.backgroundColor = UIColor.lightGray.withAlphaComponent(0.3) + + //タップ検知 + let tapGesture = UITapGestureRecognizer(target: self, action: #selector(tapped(_:))) + tapGesture.delegate = self + self.view.addGestureRecognizer(tapGesture) + + //モーダルの設定 + fpc.delegate = self + //角丸 + fpc.surfaceView.cornerRadius = 24.0 + //下スワイプで閉じる + fpc.isRemovalInteractionEnabled = true + let mordalVC = MordalViewController.fromStoryboard() + self.view.addSubview(fpc.view) + fpc.set(contentViewController: mordalVC) + fpc.addPanel(toParent: self) + } + + func closeView() { + self.dismiss(animated: true, completion: nil) + } + + //モーダル外タップで閉じる + @objc func tapped(_ sender: UITapGestureRecognizer) { + closeView() + } + + func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldReceive touch: UITouch) -> Bool { + if touch.view == self.view { + return true + } + return false + } +} + +extension ServerSwitchingViewController: FloatingPanelControllerDelegate { + // カスタマイズしたレイアウトに変更 + func floatingPanel(_ vc: FloatingPanelController, layoutFor newCollection: UITraitCollection) -> FloatingPanelLayout? { + return CustomFloatingPanelLayout() + } + //モーダルがスワイプ削除される + func floatingPanelDidEndDraggingToRemove(_ vc: FloatingPanelController, withVelocity velocity: CGPoint){ + closeView() + } +} + +class CustomFloatingPanelLayout: FloatingPanelLayout { + // 初期位置 + var initialPosition: FloatingPanelPosition { + return .half + } + + // カスタマイズした高さ + func insetFor(position: FloatingPanelPosition) -> CGFloat? { + switch position { + case .full: return 16.0 + case .half: return 350.0 + case .tip: return 44.0 + default: return nil + } + } + + // サポートする位置 + var supportedPositions: Set { + return [.full, .half] + } +} diff --git a/AgileWorks/AgileWorks/ServerSwitching/View/serverSwitchingViewController.storyboard b/AgileWorks/AgileWorks/ServerSwitching/View/serverSwitchingViewController.storyboard new file mode 100644 index 0000000..5a74d63 --- /dev/null +++ b/AgileWorks/AgileWorks/ServerSwitching/View/serverSwitchingViewController.storyboard @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift b/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift index 137b310..368a19e 100644 --- a/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift +++ b/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift @@ -115,6 +115,14 @@ class MenuTableViewController: UITableViewController { //接続先サーバーセルタップ処理 private func pushToServer() { + let serverSwitching = ServerSwitchingBuilderImpl().build() + serverSwitching.modalPresentationStyle = .overFullScreen + serverSwitching.modalTransitionStyle = .crossDissolve + self.present(serverSwitching, animated: false, completion: nil) + // セルの選択解除 + if let indexPath = self.tableView.indexPath(for: self.serverCell) { + self.tableView.deselectRow(at: indexPath, animated: true) + } } } -- GitLab From 441c9001b89d2c275972146d9dd14d8d2f46b6ea Mon Sep 17 00:00:00 2001 From: Azuma Kasumi Date: Tue, 25 Apr 2023 10:32:58 +0900 Subject: [PATCH 3/3] =?UTF-8?q?=E7=AB=AF=E6=9C=AB=E5=9B=9E=E8=BB=A2?= =?UTF-8?q?=E6=99=82=E3=81=AE=E3=83=A2=E3=83=BC=E3=83=80=E3=83=AB=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E8=AA=BF=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/ServerSwitchingViewController.swift | 52 +++++++++++++------ .../serverSwitchingViewController.storyboard | 1 + 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/AgileWorks/AgileWorks/ServerSwitching/View/ServerSwitchingViewController.swift b/AgileWorks/AgileWorks/ServerSwitching/View/ServerSwitchingViewController.swift index dee57e5..3ebe6b9 100644 --- a/AgileWorks/AgileWorks/ServerSwitching/View/ServerSwitchingViewController.swift +++ b/AgileWorks/AgileWorks/ServerSwitching/View/ServerSwitchingViewController.swift @@ -64,23 +64,43 @@ extension ServerSwitchingViewController: FloatingPanelControllerDelegate { } class CustomFloatingPanelLayout: FloatingPanelLayout { - // 初期位置 - var initialPosition: FloatingPanelPosition { - return .half - } + // 初期位置 + var initialPosition: FloatingPanelPosition { + return .half + } // カスタマイズした高さ - func insetFor(position: FloatingPanelPosition) -> CGFloat? { - switch position { - case .full: return 16.0 - case .half: return 350.0 - case .tip: return 44.0 - default: return nil - } - } + func insetFor(position: FloatingPanelPosition) -> CGFloat? { + switch position { + case .full: return 16.0 + case .half: return 350.0 + case .tip: return 44.0 + default: return nil + } + } + + func prepareLayout(surfaceView: UIView, in view: UIView) -> [NSLayoutConstraint]{ + var screenHeight = UIScreen.main.bounds.height + var screenWidth = UIScreen.main.bounds.width + var mordalWidth = screenWidth + //iPad + if UIDevice.current.userInterfaceIdiom == .pad { + mordalWidth = 500 + } else { //iPhone + //端末が横向き + if screenWidth > screenHeight { + mordalWidth = screenHeight + } + } - // サポートする位置 - var supportedPositions: Set { - return [.full, .half] - } + return [ + surfaceView.centerXAnchor.constraint(equalTo: view.centerXAnchor), + surfaceView.widthAnchor.constraint(equalToConstant: mordalWidth), + ] + } + + // サポートするモーダルサイズ + var supportedPositions: Set { + return [.half] + } } diff --git a/AgileWorks/AgileWorks/ServerSwitching/View/serverSwitchingViewController.storyboard b/AgileWorks/AgileWorks/ServerSwitching/View/serverSwitchingViewController.storyboard index 5a74d63..7f04f14 100644 --- a/AgileWorks/AgileWorks/ServerSwitching/View/serverSwitchingViewController.storyboard +++ b/AgileWorks/AgileWorks/ServerSwitching/View/serverSwitchingViewController.storyboard @@ -41,6 +41,7 @@ + -- GitLab