diff --git a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj index 08573d34da6453b09f34b88486570a9becb6cb1f..853fc4bfabd6ecb67f3fa3e7deb4f5d41d6f3882 100644 --- a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj +++ b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj @@ -142,6 +142,9 @@ BDEA2CD6246CDF2300D3E15F /* KeychainDataStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDEA2CD4246CDAEF00D3E15F /* KeychainDataStore.swift */; }; BDEB7D8E23F5293900EFAF31 /* Podfile in Resources */ = {isa = PBXBuildFile; fileRef = BDEB7D8D23F5293800EFAF31 /* Podfile */; }; BDEE85F82408A887006A6BF7 /* MainTabBarViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BDEE85F72408A887006A6BF7 /* MainTabBarViewController.swift */; }; + C50CF78E27D86DC90042C210 /* OpenLicenseBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = C50CF78D27D86DC90042C210 /* OpenLicenseBuilder.swift */; }; + C50CF79027D870720042C210 /* OpenLicenseViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C50CF78F27D870720042C210 /* OpenLicenseViewController.storyboard */; }; + C50CF79227D8708B0042C210 /* OpenLicenseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C50CF79127D8708B0042C210 /* OpenLicenseViewController.swift */; }; C51EF0E92769FA2E00361B38 /* WebViewScriptMessageHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = C51EF0E82769FA2E00361B38 /* WebViewScriptMessageHandler.swift */; }; C5285D3927CCB3C8006A9182 /* ProfileTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5285D3827CCB3C8006A9182 /* ProfileTableViewCell.swift */; }; C535772C2754D12600EAA660 /* WebViewBuilder.swift in Sources */ = {isa = PBXBuildFile; fileRef = C535772B2754D12600EAA660 /* WebViewBuilder.swift */; }; @@ -152,6 +155,10 @@ C57DCAB027C8AEFC000A2ABC /* ProfileTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C57DCAAF27C8AEFC000A2ABC /* ProfileTableViewController.swift */; }; C5848EB827BC8EBC00AA796D /* MenuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5848EB727BC8EBB00AA796D /* MenuViewController.swift */; }; C5848EBA27BCE0F100AA796D /* MenuTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5848EB927BCE0F100AA796D /* MenuTableViewController.swift */; }; + C599740827D992A5006F5AAC /* OpenLicenseTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C599740727D992A5006F5AAC /* OpenLicenseTableViewController.swift */; }; + C599740B27D992E9006F5AAC /* OpenLicenseTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = C599740A27D992E9006F5AAC /* OpenLicenseTableViewCell.swift */; }; + C599740D27D9E634006F5AAC /* OpenLicenseDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C599740C27D9E633006F5AAC /* OpenLicenseDetailViewController.swift */; }; + C599740F27D9E64E006F5AAC /* OpenLicenseDetailViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C599740E27D9E64E006F5AAC /* OpenLicenseDetailViewController.storyboard */; }; 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 */; }; @@ -319,6 +326,9 @@ BDEB7D8D23F5293800EFAF31 /* Podfile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; BDEB7D8F23F530A400EFAF31 /* KeychainAccess.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = KeychainAccess.framework; sourceTree = BUILT_PRODUCTS_DIR; }; BDEE85F72408A887006A6BF7 /* MainTabBarViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainTabBarViewController.swift; sourceTree = ""; }; + C50CF78D27D86DC90042C210 /* OpenLicenseBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenLicenseBuilder.swift; sourceTree = ""; }; + C50CF78F27D870720042C210 /* OpenLicenseViewController.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = OpenLicenseViewController.storyboard; sourceTree = ""; }; + C50CF79127D8708B0042C210 /* OpenLicenseViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenLicenseViewController.swift; sourceTree = ""; }; C51EF0E82769FA2E00361B38 /* WebViewScriptMessageHandler.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewScriptMessageHandler.swift; sourceTree = ""; }; C5285D3827CCB3C8006A9182 /* ProfileTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileTableViewCell.swift; sourceTree = ""; }; C535772B2754D12600EAA660 /* WebViewBuilder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewBuilder.swift; sourceTree = ""; }; @@ -329,6 +339,10 @@ C57DCAAF27C8AEFC000A2ABC /* ProfileTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileTableViewController.swift; 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 = ""; }; + C599740727D992A5006F5AAC /* OpenLicenseTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenLicenseTableViewController.swift; sourceTree = ""; }; + C599740A27D992E9006F5AAC /* OpenLicenseTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenLicenseTableViewCell.swift; sourceTree = ""; }; + C599740C27D9E633006F5AAC /* OpenLicenseDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenLicenseDetailViewController.swift; sourceTree = ""; }; + C599740E27D9E64E006F5AAC /* OpenLicenseDetailViewController.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = OpenLicenseDetailViewController.storyboard; 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 = ""; }; @@ -790,6 +804,7 @@ C57DCAA727C8954B000A2ABC /* Profile */, 3107AA7B243B369900F23BFB /* Form */, 76AE52DB25D358D700AFA45A /* License */, + C50CF78A27D86D760042C210 /* OpenLicense */, BDEB7D8D23F5293800EFAF31 /* Podfile */, BDA1832823F406A600C9A6DD /* README.md */, 75917F9A27BDEC880051E201 /* Strings */, @@ -819,12 +834,42 @@ path = WebClient; sourceTree = ""; }; - C5285D3727CCB3A1006A9182 /* Cell */ = { + C5285D3727CCB3A1006A9182 /* Cell */ = { + isa = PBXGroup; + children = ( + C5285D3827CCB3C8006A9182 /* ProfileTableViewCell.swift */, + ); + path = Cell; + sourceTree = ""; + }; + C50CF78A27D86D760042C210 /* OpenLicense */ = { isa = PBXGroup; children = ( - C5285D3827CCB3C8006A9182 /* ProfileTableViewCell.swift */, + C50CF78B27D86D8A0042C210 /* Builder */, + C599740927D992B1006F5AAC /* Cell */, + C50CF78C27D86D950042C210 /* View */, ); - path = Cell; + path = OpenLicense; + sourceTree = ""; + }; + C50CF78B27D86D8A0042C210 /* Builder */ = { + isa = PBXGroup; + children = ( + C50CF78D27D86DC90042C210 /* OpenLicenseBuilder.swift */, + ); + path = Builder; + sourceTree = ""; + }; + C50CF78C27D86D950042C210 /* View */ = { + isa = PBXGroup; + children = ( + C50CF78F27D870720042C210 /* OpenLicenseViewController.storyboard */, + C50CF79127D8708B0042C210 /* OpenLicenseViewController.swift */, + C599740727D992A5006F5AAC /* OpenLicenseTableViewController.swift */, + C599740C27D9E633006F5AAC /* OpenLicenseDetailViewController.swift */, + C599740E27D9E64E006F5AAC /* OpenLicenseDetailViewController.storyboard */, + ); + path = View; sourceTree = ""; }; C53577282754D02400EAA660 /* WebView */ = { @@ -856,6 +901,14 @@ path = View; sourceTree = ""; }; + C599740927D992B1006F5AAC /* Cell */ = { + isa = PBXGroup; + children = ( + C599740A27D992E9006F5AAC /* OpenLicenseTableViewCell.swift */, + ); + path = Cell; + sourceTree = ""; + }; C57DCAA727C8954B000A2ABC /* Profile */ = { isa = PBXGroup; children = ( @@ -1082,7 +1135,9 @@ buildActionMask = 2147483647; files = ( C53577372758AC1100EAA660 /* WebViewController.storyboard in Resources */, + C50CF79027D870720042C210 /* OpenLicenseViewController.storyboard in Resources */, BDEB7D8E23F5293900EFAF31 /* Podfile in Resources */, + C599740F27D9E64E006F5AAC /* OpenLicenseDetailViewController.storyboard in Resources */, BDA1833123F41A4C00C9A6DD /* Images.xcassets in Resources */, BDA1831F23F3FD8000C9A6DD /* LaunchScreen.storyboard in Resources */, BDA1831C23F3FD8000C9A6DD /* Assets.xcassets in Resources */, @@ -1257,6 +1312,7 @@ BD7A8009241A16B90040B418 /* NotificationParser.swift in Sources */, BDEE85F82408A887006A6BF7 /* MainTabBarViewController.swift in Sources */, BD71FA4B24C15FEE00C054C9 /* FormBuilder.swift in Sources */, + C599740827D992A5006F5AAC /* OpenLicenseTableViewController.swift in Sources */, 3AA9579E2463B14700AD05DC /* SearchRequest.swift in Sources */, 761F49E2255511A1007708D8 /* NumberUtility.swift in Sources */, 76D1C0DF25E38D0A004DF611 /* GetServiceInfoEndpoint.swift in Sources */, @@ -1268,6 +1324,7 @@ BD6C1AE624A474050057756F /* GetDeviceEndpoint.swift in Sources */, BD71FA3E24C140F900C054C9 /* MainTabBarViewBuilder.swift in Sources */, R6H04H001ZF9O1R6J8L87VB3 /* LoginPresenter.swift in Sources */, + C599740D27D9E634006F5AAC /* OpenLicenseDetailViewController.swift in Sources */, BD86A6B124067EB3007B48F1 /* APIResult.swift in Sources */, BDAB1F71240D0E5C00EA15FD /* GetSessionEndpoint.swift in Sources */, 3AA9579C2463AB2700AD05DC /* PostSearchItemEndpoint.swift in Sources */, @@ -1282,6 +1339,7 @@ C57DCAB027C8AEFC000A2ABC /* ProfileTableViewController.swift in Sources */, 3A1F975424AF2D6700AE6A42 /* ModalFullCollectionViewController.swift in Sources */, BD8D55D92420609000A667B0 /* XCGLoggerExtensions.swift in Sources */, + C599740B27D992E9006F5AAC /* OpenLicenseTableViewCell.swift in Sources */, 76AE533325D37B0200AFA45A /* LicenseViewPresenter.swift in Sources */, 76CEA0542511A36E0074837A /* WfAction.swift in Sources */, 76AE530725D3652400AFA45A /* LicenseViewBuilder.swift in Sources */, @@ -1303,12 +1361,14 @@ 3AED7EE42449387600FC6BCC /* SearchResponse.swift in Sources */, 76AE530025D3626800AFA45A /* LicenseViewController.swift in Sources */, BDAB1F6D240D0D0000EA15FD /* UserDefaultsExtensions.swift in Sources */, + C50CF78E27D86DC90042C210 /* OpenLicenseBuilder.swift in Sources */, 76C7AA02250B05CA000A0FE6 /* SubWebViewStack.swift in Sources */, BD969631240C9CD400521925 /* SessionInfo.swift in Sources */, BD928CCE2407500400ED04C2 /* UserDefaultsDataStore.swift in Sources */, BD5061B4242866780014F3FA /* Configuration.swift in Sources */, 76AE52DD25D35CDC00AFA45A /* LicenseUtility.swift in Sources */, BDAB1F6F240D0D1400EA15FD /* APIEndpoint.swift in Sources */, + C50CF79227D8708B0042C210 /* OpenLicenseViewController.swift in Sources */, 761F4A49255D15DA007708D8 /* AppShared.swift in Sources */, BD6C1AEA24A4775C0057756F /* UIDeviceExtensions.swift in Sources */, BD72589F240E69E000928CE9 /* OAuthService.swift in Sources */, diff --git a/AgileWorks/AgileWorks/License/Builder/LicenseViewBuilder.swift b/AgileWorks/AgileWorks/License/Builder/LicenseViewBuilder.swift index 38c1fde6e74b54e4b1f259bd4ae654c36c7782ab..d682c1b843aead895e4d4f6fbf4fb2b8a3a7d789 100644 --- a/AgileWorks/AgileWorks/License/Builder/LicenseViewBuilder.swift +++ b/AgileWorks/AgileWorks/License/Builder/LicenseViewBuilder.swift @@ -17,7 +17,7 @@ struct LicenseViewBuilderImpl: LicenseViewBuilder { func build(nextTarget: LicenseViewSwitchTarget) -> LicenseViewController { let viewController = storyboard() - viewController.inject(presenter: LicenseViewPresenterImpl(nextTarget: nextTarget)) + viewController.inject(presenter: LicenseViewPresenterImpl(nextTarget: nextTarget, view: viewController)) return viewController } } diff --git a/AgileWorks/AgileWorks/License/Presenter/LicenseViewPresenter.swift b/AgileWorks/AgileWorks/License/Presenter/LicenseViewPresenter.swift index cec6663f35e128f5397bd2855ab6c731e7d1e4b6..bc30bd871edc35de781ae9e539e11b4ef3c1ec17 100644 --- a/AgileWorks/AgileWorks/License/Presenter/LicenseViewPresenter.swift +++ b/AgileWorks/AgileWorks/License/Presenter/LicenseViewPresenter.swift @@ -7,36 +7,53 @@ // import Foundation +import UIKit protocol LicenseViewPresenter { func licenseContent() -> NSAttributedString + func acceptLabel() -> String func onAccepted() } enum LicenseViewSwitchTarget { case mainScreen case logout + case close } class LicenseViewPresenterImpl: LicenseViewPresenter { + let view: UIViewController? private let nextTarget: LicenseViewSwitchTarget - init(nextTarget: LicenseViewSwitchTarget) { + init(nextTarget: LicenseViewSwitchTarget, view: UIViewController) { self.nextTarget = nextTarget + self.view = view } func licenseContent() -> NSAttributedString { return readLicenseContents() } + func acceptLabel() -> String { + if nextTarget == .close { + return localizadString(key: "Close", comment: "") + } else { + return localizadString(key: "LicenseAccept", comment: "") + } + } + func onAccepted() { - writeAcceptedLicenseVersionToCurrentVersion() + if nextTarget != .close { + writeAcceptedLicenseVersionToCurrentVersion() + } switch nextTarget { case .mainScreen: AppDelegate.shared.rootViewController.switchToMainScreen() case .logout: AppDelegate.shared.rootViewController.switchToLogout() + case .close: + view!.dismiss(animated: true, completion: nil) } } } diff --git a/AgileWorks/AgileWorks/License/View/LicenseViewController.storyboard b/AgileWorks/AgileWorks/License/View/LicenseViewController.storyboard index 1f0b825958ad06142f996cde5c365fd942a970be..d6cbf076b41409cac972ccb8a84525aad2a666af 100644 --- a/AgileWorks/AgileWorks/License/View/LicenseViewController.storyboard +++ b/AgileWorks/AgileWorks/License/View/LicenseViewController.storyboard @@ -1,9 +1,9 @@ - + - + @@ -12,7 +12,7 @@ - + @@ -52,7 +52,9 @@ + + diff --git a/AgileWorks/AgileWorks/License/View/LicenseViewController.swift b/AgileWorks/AgileWorks/License/View/LicenseViewController.swift index bb30baee8d281157c666cad082f0ec484d3217d6..69ec9b74c20242933cc0dcbff77346195dff070a 100644 --- a/AgileWorks/AgileWorks/License/View/LicenseViewController.swift +++ b/AgileWorks/AgileWorks/License/View/LicenseViewController.swift @@ -11,6 +11,8 @@ import UIKit class LicenseViewController: UIViewController { private var presenter: LicenseViewPresenter! + @IBOutlet private var licenseTitle: UILabel! + @IBOutlet private var acceptButton: UIButton! @IBOutlet private var licenseContentsText: UITextView! func inject(presenter: LicenseViewPresenter) { @@ -20,6 +22,8 @@ class LicenseViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() licenseContentsText.attributedText = presenter.licenseContent() + acceptButton.setTitle(presenter.acceptLabel(), for: .normal) + licenseTitle.text = localizadString(key: "LicenseViewTitle", comment: "") } @IBAction private func onAcceptButtonTouched(_ sender: UIButton) { diff --git a/AgileWorks/AgileWorks/OpenLicense/Builder/OpenLicenseBuilder.swift b/AgileWorks/AgileWorks/OpenLicense/Builder/OpenLicenseBuilder.swift new file mode 100644 index 0000000000000000000000000000000000000000..0b7c039440d6c96edae46a61d8672f64fd4ddc82 --- /dev/null +++ b/AgileWorks/AgileWorks/OpenLicense/Builder/OpenLicenseBuilder.swift @@ -0,0 +1,44 @@ +// +// OpenLicenseBuilder.swift +// AgileWorks +// +// Created by Gk40002148 on 2022/03/09. +// Copyright © 2022 ATLED CORP. All rights reserved. +// + +import UIKit + +protocol OpenLicenseBuilder { + func build() -> UINavigationController +} + +struct OpenLicenseBuilderImpl: OpenLicenseBuilder { + let naviIdentifier = "OpenLicenseNavigationController" + let identifier = "OpenLicenseViewController" + + func build() -> UINavigationController { + let viewController = storyboard() + + let naviController = storyboardNavigation() + naviController.setViewControllers([viewController], animated: false) + + return naviController + } +} + +extension OpenLicenseBuilderImpl { + private func storyboardNavigation() -> UINavigationController { + let storyboard = mainStoryboard() + let viewController = storyboard.instantiateViewController(withIdentifier: naviIdentifier) as! UINavigationController + return viewController + } + private func storyboard() -> OpenLicenseViewController { + let storyboard = UIStoryboard(name: identifier, bundle: Bundle.main) + let viewController = storyboard.instantiateViewController(withIdentifier: identifier) as! OpenLicenseViewController + return viewController + } + private func mainStoryboard() -> UIStoryboard { + let storyboard = UIStoryboard(name: identifier, bundle: nil) + return storyboard + } +} diff --git a/AgileWorks/AgileWorks/OpenLicense/Cell/OpenLicenseTableViewCell.swift b/AgileWorks/AgileWorks/OpenLicense/Cell/OpenLicenseTableViewCell.swift new file mode 100644 index 0000000000000000000000000000000000000000..206c90a4e0e3bda8d5aeebf6c6b7c70f43f6a0c2 --- /dev/null +++ b/AgileWorks/AgileWorks/OpenLicense/Cell/OpenLicenseTableViewCell.swift @@ -0,0 +1,23 @@ +// +// OpenLicenseTableViewCell.swift +// AgileWorks +// +// Created by Gk40002148 on 2022/03/10. +// Copyright © 2022 ATLED CORP. All rights reserved. +// + +import UIKit + +class OpenLicenseTableViewCell: UITableViewCell { + @IBOutlet private var license: UILabel! + + override func awakeFromNib() { + super.awakeFromNib() + } + override func setSelected(_ selected: Bool, animated: Bool) { + super.setSelected(selected, animated: animated) + } + func configure(license: String) { + self.license.text = license + } +} diff --git a/AgileWorks/AgileWorks/OpenLicense/View/OpenLicenseDetailViewController.storyboard b/AgileWorks/AgileWorks/OpenLicense/View/OpenLicenseDetailViewController.storyboard new file mode 100644 index 0000000000000000000000000000000000000000..ceb75981ec93d90c5271e30615e42d0f83583254 --- /dev/null +++ b/AgileWorks/AgileWorks/OpenLicense/View/OpenLicenseDetailViewController.storyboard @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AgileWorks/AgileWorks/OpenLicense/View/OpenLicenseDetailViewController.swift b/AgileWorks/AgileWorks/OpenLicense/View/OpenLicenseDetailViewController.swift new file mode 100644 index 0000000000000000000000000000000000000000..e8cdf45d43262572d4538d54fe59da993bd7f1f8 --- /dev/null +++ b/AgileWorks/AgileWorks/OpenLicense/View/OpenLicenseDetailViewController.swift @@ -0,0 +1,25 @@ +// +// OpenLicenseDetailViewController.swift +// AgileWorks +// +// Created by Gk40002148 on 2022/03/10. +// Copyright © 2022 ATLED CORP. All rights reserved. +// + +import UIKit + +class OpenLicenseDetailViewController: UIViewController { + @IBOutlet private var detailContentsText: UITextView! + private var contentsText: String! + let stringAttributes: [NSAttributedString.Key: Any] = [ + .font: UIFont.systemFont(ofSize: 12) + ] + + func inject(contentsText: String) { + self.contentsText = contentsText + } + override func viewDidLoad() { + super.viewDidLoad() + detailContentsText.attributedText = NSAttributedString(string: contentsText, attributes: stringAttributes) + } +} diff --git a/AgileWorks/AgileWorks/OpenLicense/View/OpenLicenseTableViewController.swift b/AgileWorks/AgileWorks/OpenLicense/View/OpenLicenseTableViewController.swift new file mode 100644 index 0000000000000000000000000000000000000000..b14cf31510917341182b0dfa928f4c32b29a0089 --- /dev/null +++ b/AgileWorks/AgileWorks/OpenLicense/View/OpenLicenseTableViewController.swift @@ -0,0 +1,90 @@ +// +// OpenLicenseTableViewController.swift +// AgileWorks +// +// Created by Gk40002148 on 2022/03/10. +// Copyright © 2022 ATLED CORP. All rights reserved. +// + +import UIKit + +class OpenLicenseTableViewController: UITableViewController { + // 共通のパス + private let licensePlistPath = "./Settings.bundle/com.mono0926.LicensePlist" + private let fileManager = FileManager.default + // com.mono0926.LicensePlist OSS ファイル名 一覧 + private var openLicenseList: [String] = [] + // OSS 詳細 + // key : ファイル名 + // val : 詳細 + private var contentsList: [String: String] = [:] + + override func viewDidLoad() { + super.viewDidLoad() + self.setupLibraryList() + } + // Section 数設定 + override func numberOfSections(in tableView: UITableView) -> Int { + return 1 + } + // List 行数設定 + override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return openLicenseList.count + } + // Cell 高さ設定 + override func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return 40 + } + // Cell 生成 + override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let cell = tableView.dequeueReusableCell(withIdentifier: "OpenLicenseTableViewCell") as! OpenLicenseTableViewCell + + cell.configure(license: openLicenseList[indexPath.row]) + return cell + } + // Cell 選択時処理 + override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { + let storyboard = UIStoryboard(name: "OpenLicenseDetailViewController", bundle: nil) + let viewController = storyboard.instantiateViewController(withIdentifier: "OpenLicenseDetailViewController") as! OpenLicenseDetailViewController + // OSS 名を取得し、詳細情報を表示 + let licenseName = openLicenseList[indexPath.row] + viewController.inject(contentsText: contentsList[licenseName] ?? "") + self.navigationController?.pushViewController(viewController, animated: true) + // Cell 選択解除 + self.tableView.deselectRow(at: indexPath, animated: true) + } + // OSS 一覧取得 + private func setupLibraryList() { + if let path: String = Bundle.main.path(forResource: licensePlistPath, ofType: "") { + do { + // OSS PList 一覧取得 + let files = try fileManager.contentsOfDirectory(atPath: path) + files.forEach { + var libraryName = "" + var libraryDetail = "" + + // .plistが含まれるため、名前だけにする + let temp = $0.split(separator: ".") + libraryName = String(temp.first ?? "") + + let searchPath = licensePlistPath + "/" + $0 + + let filePath = Bundle.main.path(forResource: searchPath, ofType: nil) + // OSS 詳細取得 + if let infoList = NSMutableDictionary(contentsOfFile: filePath!) { + let data = infoList.value(forKeyPath: "PreferenceSpecifiers") as? [[String: String]] + if let footerData = data![0]["FooterText"] { + libraryDetail = String(describing: footerData) + } + } + openLicenseList.append(libraryName) + contentsList[libraryName] = libraryDetail + } + // OSS をアルファベット順にソート + openLicenseList.sort { $0.lowercased() < $1.lowercased() } + } catch { + log.e(error) + } + } + } +} diff --git a/AgileWorks/AgileWorks/OpenLicense/View/OpenLicenseViewController.storyboard b/AgileWorks/AgileWorks/OpenLicense/View/OpenLicenseViewController.storyboard new file mode 100644 index 0000000000000000000000000000000000000000..9f542356b598923a77d4330cccfbb102cfdd2fc3 --- /dev/null +++ b/AgileWorks/AgileWorks/OpenLicense/View/OpenLicenseViewController.storyboard @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AgileWorks/AgileWorks/OpenLicense/View/OpenLicenseViewController.swift b/AgileWorks/AgileWorks/OpenLicense/View/OpenLicenseViewController.swift new file mode 100644 index 0000000000000000000000000000000000000000..2768d16be096a06379f32bdc86b6c6e2d5554316 --- /dev/null +++ b/AgileWorks/AgileWorks/OpenLicense/View/OpenLicenseViewController.swift @@ -0,0 +1,28 @@ +// +// OpenLicenseViewController.swift +// AgileWorks +// +// Created by Gk40002148 on 2022/03/09. +// Copyright © 2022 ATLED CORP. All rights reserved. +// + +import UIKit + +class OpenLicenseViewController: UIViewController { + @IBOutlet private var closeButton: UIButton! + + override func viewDidLoad() { + super.viewDidLoad() + + closeButton.setTitle(localizadString(key: "Close", comment: ""), for: .normal) + } + + override func viewWillAppear(_ animated: Bool) { + super.viewWillAppear(animated) + self.navigationItem.title = localizadString(key: "OpenLicenseViewTitle", comment: "") + } + + @IBAction private func onCloseButtonTouched(_ sender: UIButton) { + dismiss(animated: true, completion: nil) + } +} diff --git a/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist.latest_result.txt b/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist.latest_result.txt index 3f7308fd9d65c77c1d8b0aadf917ea13bbae5601..a90e920a1795b46d64b10679682cdb102bf8aa3f 100644 --- a/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist.latest_result.txt +++ b/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist.latest_result.txt @@ -7,6 +7,10 @@ name: Crashlytics, nameSpecified: body: Fabric: Copyright 20… version: 3.14.0 +name: DropDown, nameSpecified: +body: The MIT License (MIT… +version: 2.3.13 + name: Fabric, nameSpecified: body: Fabric: Copyright 20… version: 1.10.2 @@ -55,6 +59,12 @@ body: … version: 4.3.0 +name: FloatingPanel, nameSpecified: +body: MIT License + +Copyrig… +version: 1.7.5 + name: GoogleAppMeasurement, nameSpecified: body: Copyright 2020 Googl… version: 6.3.0 @@ -74,6 +84,10 @@ body: … version: 6.5.1 +name: KeychainAccess, nameSpecified: +body: The MIT License (MIT… +version: 4.1.0 + name: LicensePlist, nameSpecified: body: MIT License diff --git a/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist.plist b/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist.plist index da9941eb756c90b7636d3d5309898c0a9a74b09f..286cfd7787174424a28bf4a354cc85ef73cadf7e 100644 --- a/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist.plist +++ b/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist.plist @@ -26,6 +26,14 @@ Type PSChildPaneSpecifier + + File + com.mono0926.LicensePlist/DropDown + Title + DropDown + Type + PSChildPaneSpecifier + File com.mono0926.LicensePlist/Fabric @@ -106,6 +114,14 @@ Type PSChildPaneSpecifier + + File + com.mono0926.LicensePlist/FloatingPanel + Title + FloatingPanel + Type + PSChildPaneSpecifier + File com.mono0926.LicensePlist/GoogleAppMeasurement @@ -138,6 +154,14 @@ Type PSChildPaneSpecifier + + File + com.mono0926.LicensePlist/KeychainAccess + Title + KeychainAccess + Type + PSChildPaneSpecifier + File com.mono0926.LicensePlist/LicensePlist diff --git a/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist/DropDown.plist b/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist/DropDown.plist new file mode 100644 index 0000000000000000000000000000000000000000..8b1525f934ecbea3b3158da1d83777fad0adf737 --- /dev/null +++ b/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist/DropDown.plist @@ -0,0 +1,35 @@ + + + + + PreferenceSpecifiers + + + FooterText + The MIT License (MIT) + +Copyright (c) 2014 kevin-hirsch + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + Type + PSGroupSpecifier + + + + diff --git a/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist/FloatingPanel.plist b/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist/FloatingPanel.plist new file mode 100644 index 0000000000000000000000000000000000000000..f3d65a6bf465fddf92625d29b67947a88a7f3a93 --- /dev/null +++ b/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist/FloatingPanel.plist @@ -0,0 +1,35 @@ + + + + + PreferenceSpecifiers + + + FooterText + MIT License + +Copyright (c) 2018 Shin Yamamoto + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + Type + PSGroupSpecifier + + + + diff --git a/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist/KeychainAccess.plist b/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist/KeychainAccess.plist new file mode 100644 index 0000000000000000000000000000000000000000..194ceb6784ac9b0647dcfa11a972b07b52b887d7 --- /dev/null +++ b/AgileWorks/AgileWorks/Settings.bundle/com.mono0926.LicensePlist/KeychainAccess.plist @@ -0,0 +1,37 @@ + + + + + PreferenceSpecifiers + + + FooterText + The MIT License (MIT) + +Copyright (c) 2014 kishikawa katsumi + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + + Type + PSGroupSpecifier + + + + diff --git a/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings b/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings index 586c5c769b1ba4a19521dd107a6a3c73798c92af..aff780d68edbe42d925ab17308518297ee9fa934 100644 --- a/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings +++ b/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings @@ -49,6 +49,13 @@ "RoleNameTitle" = "职位"; "CloseButton" = "关闭"; +// License +"LicenseViewTitle" = "许可证"; +"LicenseAccept" = "利用許諾に同意します"; + +// Open License +"OpenLicenseViewTitle" = "开放许可证"; + // Approval "ApprovalTitle" = "承認一覧"; "ApprovalData" = "%1$@ (%2$@)"; diff --git a/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings b/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings index 2bf44849e4d71051991b7122d65632591da6f537..58f58101b5ae86f8db52aa26a025ce87eb2e4140 100644 --- a/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings +++ b/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings @@ -49,6 +49,13 @@ "RoleNameTitle" = "職位"; "CloseButton" = "關閉"; +// License +"LicenseViewTitle" = "授權"; +"LicenseAccept" = "利用許諾に同意します"; + +// Open License +"OpenLicenseViewTitle" = "開放許可證"; + // Approval "ApprovalTitle" = "承認一覧"; "ApprovalData" = "%1$@ (%2$@)"; diff --git a/AgileWorks/AgileWorks/Strings/English.strings b/AgileWorks/AgileWorks/Strings/English.strings index d7bdfbb669d62a85ef99fdc68172adc81d9cddc5..5d6317b6932ee6cc4176c02fc74cf65e1ce0ce3f 100644 --- a/AgileWorks/AgileWorks/Strings/English.strings +++ b/AgileWorks/AgileWorks/Strings/English.strings @@ -49,6 +49,13 @@ "RoleNameTitle" = "Role"; "CloseButton" = "Close"; +// License +"LicenseViewTitle" = "License"; +"LicenseAccept" = "利用許諾に同意します"; + +// Open License +"OpenLicenseViewTitle" = "Open license"; + // Approval "ApprovalTitle" = "承認一覧"; "ApprovalData" = "%1$@ (%2$@)"; diff --git a/AgileWorks/AgileWorks/Strings/Japanese.strings b/AgileWorks/AgileWorks/Strings/Japanese.strings index f5150d9f6af9fb63b0787b4053cb279ff4daaa3d..8c8c1d070f2540f16ca1189c198922b844ac42f2 100644 --- a/AgileWorks/AgileWorks/Strings/Japanese.strings +++ b/AgileWorks/AgileWorks/Strings/Japanese.strings @@ -49,6 +49,13 @@ "RoleNameTitle" = "ロール"; "CloseButton" = "閉じる"; +// License +"LicenseViewTitle" = "利用許諾"; +"LicenseAccept" = "利用許諾に同意します"; + +// Open License +"OpenLicenseViewTitle" = "オープンソースライセンス"; + // Approval "ApprovalTitle" = "承認一覧"; "ApprovalData" = "%1$@ (%2$@)"; diff --git a/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings index 43c5413ab063e505729696dbb347d780d898569d..0fb1fd3bf9a1b5dd9ac89a2f9b42d032712a7229 100644 --- a/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings @@ -49,6 +49,13 @@ "RoleNameTitle" = "Role"; "CloseButton" = "Close"; +// License +"LicenseViewTitle" = "License"; +"LicenseAccept" = "利用許諾に同意します"; + +// Open License +"OpenLicenseViewTitle" = "Open license"; + // Approval "ApprovalTitle" = "承認一覧"; "ApprovalData" = "%1$@ (%2$@)"; diff --git a/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings index e50e467e78e928e1dc333364a3ce225281ece980..aaea5220bdd3cb457af23e665b25e6ee136cfed8 100644 --- a/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings @@ -49,6 +49,13 @@ "RoleNameTitle" = "ロール"; "CloseButton" = "閉じる"; +// License +"LicenseViewTitle" = "利用許諾"; +"LicenseAccept" = "利用許諾に同意します"; + +// Open License +"OpenLicenseViewTitle" = "オープンソースライセンス"; + // Approval "ApprovalTitle" = "承認一覧"; "ApprovalData" = "%1$@ (%2$@)"; diff --git a/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings index a0b19935da293dd9dab2b079f94912016b91ed67..85862b004dc03466be9edc146d5151429a540532 100644 --- a/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings @@ -49,6 +49,13 @@ "RoleNameTitle" = "职位"; "CloseButton" = "关闭"; +// License +"LicenseViewTitle" = "许可证"; +"LicenseAccept" = "利用許諾に同意します"; + +// Open License +"OpenLicenseViewTitle" = "开放许可证"; + // Approval "ApprovalTitle" = "承認一覧"; "ApprovalData" = "%1$@ (%2$@)"; diff --git a/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings index ec466385e198fb74bd68236bdf125c74140f1767..4613b550a162950985aae413192bc4650521e85e 100644 --- a/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings @@ -49,6 +49,13 @@ "RoleNameTitle" = "職位"; "CloseButton" = "關閉"; +// License +"LicenseViewTitle" = "授權"; +"LicenseAccept" = "利用許諾に同意します"; + +// Open License +"OpenLicenseViewTitle" = "開放許可證"; + // Approval "ApprovalTitle" = "承認一覧"; "ApprovalData" = "%1$@ (%2$@)"; diff --git a/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift b/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift index 36562a8cca5dd0b0cba3331c5ae00650b1aed907..55d1e8b23630832617e791693a437f675e67eb67 100644 --- a/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift +++ b/AgileWorks/AgileWorks/WebView/View/MenuTableViewController.swift @@ -82,11 +82,25 @@ class MenuTableViewController: UITableViewController { // ライセンスセルタップ処理 private func pushToLicense() { // ライセンスタップ時処理 - print("ライセンス タップ") + let license = LicenseViewBuilderImpl().build(nextTarget: .close) + license.modalPresentationStyle = .overFullScreen + license.modalTransitionStyle = .crossDissolve + self.present(license, animated: false, completion: nil) + // セルの選択解除 + if let indexPath = self.tableView.indexPath(for: self.licenseCell) { + self.tableView.deselectRow(at: indexPath, animated: true) + } } // オープンソースライセンスセルタップ処理 private func pushToOpenLicense() { // オープンソースライセンスタップ時処理 - print("オープンソースライセンス タップ") + let openLicense = OpenLicenseBuilderImpl().build() + openLicense.modalPresentationStyle = .overFullScreen + openLicense.modalTransitionStyle = .crossDissolve + self.present(openLicense, animated: false, completion: nil) + // セルの選択解除 + if let indexPath = self.tableView.indexPath(for: self.openLicenseCell) { + self.tableView.deselectRow(at: indexPath, animated: true) + } } }