diff --git a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj index e6f9caf6dd3feebff2503ad851e7996c70360ef1..c44003a2fbf7402080a19366daaf4f2b7979707e 100644 --- a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj +++ b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj @@ -9,7 +9,7 @@ /* Begin PBXBuildFile section */ 3127EE0C241A2A9500535CC7 /* NotificationCenter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3127EE0B241A2A9500535CC7 /* NotificationCenter.framework */; }; 3127EE0F241A2A9500535CC7 /* TodayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3127EE0E241A2A9500535CC7 /* TodayViewController.swift */; }; - 3127EE12241A2A9500535CC7 /* MainInterface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3127EE10241A2A9500535CC7 /* MainInterface.storyboard */; }; + 3127EE12241A2A9500535CC7 /* TodayViewController.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3127EE10241A2A9500535CC7 /* TodayViewController.storyboard */; }; 3127EE16241A2A9500535CC7 /* TodayExtension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 3127EE0A241A2A9500535CC7 /* TodayExtension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 3127EE1B241A2B4D00535CC7 /* TodayViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3127EE0E241A2A9500535CC7 /* TodayViewController.swift */; }; 31AA002F24347BBD000177B4 /* ApprovalResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31AA002E24347BBD000177B4 /* ApprovalResponse.swift */; }; @@ -41,6 +41,9 @@ 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 */; }; + 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 */; }; 75EF9CAE27E9E983003178A3 /* WidgetKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 75EF9CAD27E9E983003178A3 /* WidgetKit.framework */; }; 75EF9CB027E9E983003178A3 /* SwiftUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 75EF9CAF27E9E983003178A3 /* SwiftUI.framework */; }; 75EF9CB327E9E983003178A3 /* WidgetExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75EF9CB227E9E983003178A3 /* WidgetExtension.swift */; }; @@ -220,7 +223,7 @@ 3127EE0A241A2A9500535CC7 /* TodayExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = TodayExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; }; 3127EE0B241A2A9500535CC7 /* NotificationCenter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NotificationCenter.framework; path = System/Library/Frameworks/NotificationCenter.framework; sourceTree = SDKROOT; }; 3127EE0E241A2A9500535CC7 /* TodayViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodayViewController.swift; sourceTree = ""; }; - 3127EE11241A2A9500535CC7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/MainInterface.storyboard; sourceTree = ""; }; + 3127EE11241A2A9500535CC7 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/TodayViewController.storyboard; sourceTree = ""; }; 3127EE13241A2A9500535CC7 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 31AA002E24347BBD000177B4 /* ApprovalResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ApprovalResponse.swift; sourceTree = ""; }; 3AF4A84624A06A73006C0C0A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; @@ -235,6 +238,7 @@ 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 = ""; }; + 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; }; 75EF9CAF27E9E983003178A3 /* SwiftUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwiftUI.framework; path = System/Library/Frameworks/SwiftUI.framework; sourceTree = SDKROOT; }; @@ -571,6 +575,7 @@ BDAB1F6A240D0CA800EA15FD /* WebClient */, 7604950325380980000D6951 /* FirebaseSupport.swift */, C5E5A4C727853BEF00668C7D /* QRCodeReader.swift */, + 75EDD2262806618A0068B4BC /* WidgetView.swift */, ); path = Common; sourceTree = ""; @@ -599,7 +604,7 @@ isa = PBXGroup; children = ( 3127EE0E241A2A9500535CC7 /* TodayViewController.swift */, - 3127EE10241A2A9500535CC7 /* MainInterface.storyboard */, + 3127EE10241A2A9500535CC7 /* TodayViewController.storyboard */, ); path = View; sourceTree = ""; @@ -1107,7 +1112,7 @@ 75917FA927C36D220051E201 /* Chinese-Simplified.strings in Resources */, 75917FAA27C36D220051E201 /* Chinese-Traditional.strings in Resources */, 75917FA727C36D0C0051E201 /* Japanese.strings in Resources */, - 3127EE12241A2A9500535CC7 /* MainInterface.storyboard in Resources */, + 3127EE12241A2A9500535CC7 /* TodayViewController.storyboard in Resources */, BD6DE26F24D1079700C1479E /* Localizable.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -1271,6 +1276,7 @@ 75917FB427C371390051E201 /* StringsUtility.swift in Sources */, BDA74C52245016AC000D4351 /* XCGLoggerExtensions.swift in Sources */, BD1B50DD244DABF900783FB5 /* OAuthService.swift in Sources */, + 75EDD2282806618A0068B4BC /* WidgetView.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1287,6 +1293,7 @@ 75EF9CCC27E9ED3B003178A3 /* ApprovalResponse.swift in Sources */, 75EF9CCB27E9ED28003178A3 /* Configuration.swift in Sources */, 75EF9CCA27E9ED21003178A3 /* APIResult.swift in Sources */, + 75EDD2292806618A0068B4BC /* WidgetView.swift in Sources */, 75EF9CC827E9ED18003178A3 /* UserDefaultsDataStore.swift in Sources */, 75EF9CC927E9ED18003178A3 /* UserDefaultsExtensions.swift in Sources */, 75EF9CC727E9ECF9003178A3 /* APIEndpoint.swift in Sources */, @@ -1342,6 +1349,7 @@ OHC9HIGNQ5ITYM0SNOFLOAKA /* SplashBuilder.swift in Sources */, WOGRE70TXZTZ79X4CG8A8TJA /* SplashUseCase.swift in Sources */, C51EF0E92769FA2E00361B38 /* WebViewScriptMessageHandler.swift in Sources */, + 75EDD2272806618A0068B4BC /* WidgetView.swift in Sources */, 764D0E1B2580ABCB00AB6617 /* URLAuthenticationUtility.swift in Sources */, BD6C1AE824A475430057756F /* DeleteDeviceEndpoint.swift in Sources */, BD6C1AE624A474050057756F /* GetDeviceEndpoint.swift in Sources */, @@ -1416,14 +1424,12 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ - 3127EE10241A2A9500535CC7 /* MainInterface.storyboard */ = { + 3127EE10241A2A9500535CC7 /* TodayViewController.storyboard */ = { isa = PBXVariantGroup; children = ( 3127EE11241A2A9500535CC7 /* Base */, - 75917F9027BD315A0051E201 /* zh-Hans */, - 75917F9427BD317D0051E201 /* zh-Hant */, ); - name = MainInterface.storyboard; + name = TodayViewController.storyboard; sourceTree = ""; }; 3AF4A84724A06A73006C0C0A /* Localizable.strings */ = { @@ -1465,7 +1471,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 4TWZNUHVN6; INFOPLIST_FILE = TodayExtension/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1656,7 +1662,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 4TWZNUHVN6; INFOPLIST_FILE = ShareExtension/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1681,7 +1687,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 4TWZNUHVN6; INFOPLIST_FILE = ShareExtension/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1745,7 +1751,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -1765,7 +1771,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 4TWZNUHVN6; INFOPLIST_FILE = AgileWorks/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1849,7 +1855,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 4TWZNUHVN6; INFOPLIST_FILE = TodayExtension/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1913,7 +1919,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SDKROOT = iphoneos; @@ -1933,7 +1939,7 @@ CURRENT_PROJECT_VERSION = 1; DEVELOPMENT_TEAM = 4TWZNUHVN6; INFOPLIST_FILE = AgileWorks/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", diff --git a/AgileWorks/AgileWorks/App/AppDelegate.swift b/AgileWorks/AgileWorks/App/AppDelegate.swift index c0f6a1e3bebad1bae0506350739ee5d35f8e15b1..448b09fda637360529a604ec9bd9fbc47a322db0 100644 --- a/AgileWorks/AgileWorks/App/AppDelegate.swift +++ b/AgileWorks/AgileWorks/App/AppDelegate.swift @@ -71,9 +71,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate { if let authorizationFlow = OAuthService.currentAuthorizationFlow, authorizationFlow.resumeExternalUserAgentFlow(with: url) { OAuthService.currentAuthorizationFlow = nil } + + //ios13の場合 + var statusUrl = url.absoluteString + let result: URL + 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" { + return URL(string: Configuration.shared.awURL + "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/Mobile#work")! + } + return URL(string: Configuration.shared.awURL + "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/Mobile#docList_" + status)! + } + // Notification受信 func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable: Any]) { if let messageID = userInfo[gcmMessageIDKey] { diff --git a/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings b/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings index ef1a6f56524febe2be5fee7572a231bd673cd98d..7ccf656dec41af88a8e7dc5fad551286fcd6221f 100644 --- a/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings +++ b/AgileWorks/AgileWorks/Strings/Chinese-Simplified.strings @@ -99,7 +99,7 @@ "IncorrectPassphrase" = "パスフレーズが違います。"; "CertificateImportError" = "証明書のインポート中にエラーが発生しました。"; -// WidgetExtension +// Widget Status "Draft" = "下書き"; "RequestApplication" = "申請依頼"; "RequestApproval" = "承認依頼"; @@ -110,6 +110,7 @@ "Shared" = "共有された"; "FuturePass" = "回付予定"; +//WidgetExtension "StatusCheckWidgetName" = "状況確認ウィジェット"; "StatusCheckWidgetDescription" = "状況確認ウィジェットの説明"; "ApprovalWidgetName" = "承認待ちウィジェット"; diff --git a/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings b/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings index d2b384124a458b5e11e434fcfa88290f37574752..e4fe1d0b99905901aac42bded81e0802c1c86691 100644 --- a/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings +++ b/AgileWorks/AgileWorks/Strings/Chinese-Traditional.strings @@ -99,7 +99,7 @@ "IncorrectPassphrase" = "パスフレーズが違います。"; "CertificateImportError" = "証明書のインポート中にエラーが発生しました。"; -// WidgetExtension +// Widget Status "Draft" = "下書き"; "RequestApplication" = "申請依頼"; "RequestApproval" = "承認依頼"; @@ -110,6 +110,7 @@ "Shared" = "共有された"; "FuturePass" = "回付予定"; +//WidgetExtension "StatusCheckWidgetName" = "状況確認ウィジェット"; "StatusCheckWidgetDescription" = "状況確認ウィジェットの説明"; "ApprovalWidgetName" = "承認待ちウィジェット"; diff --git a/AgileWorks/AgileWorks/Strings/English.strings b/AgileWorks/AgileWorks/Strings/English.strings index 5f0f00dcf4e5275c83c4f068edd503fff027d6a5..10b73d03af2fc727881fc76261995e8037ecd5d7 100644 --- a/AgileWorks/AgileWorks/Strings/English.strings +++ b/AgileWorks/AgileWorks/Strings/English.strings @@ -99,7 +99,7 @@ "IncorrectPassphrase" = "パスフレーズが違います。"; "CertificateImportError" = "証明書のインポート中にエラーが発生しました。"; -// WidgetExtension +// Widget Status "Draft" = "下書き"; "RequestApplication" = "申請依頼"; "RequestApproval" = "承認依頼"; @@ -110,6 +110,7 @@ "Shared" = "共有された"; "FuturePass" = "回付予定"; +//WidgetExtension "StatusCheckWidgetName" = "状況確認ウィジェット"; "StatusCheckWidgetDescription" = "状況確認ウィジェットの説明"; "ApprovalWidgetName" = "承認待ちウィジェット"; diff --git a/AgileWorks/AgileWorks/Strings/Japanese.strings b/AgileWorks/AgileWorks/Strings/Japanese.strings index 8c2cc201cec7bb08d3c9ee3119d225968b6be333..d4d38d1935c03397fd70572fdb465a65d8972db5 100644 --- a/AgileWorks/AgileWorks/Strings/Japanese.strings +++ b/AgileWorks/AgileWorks/Strings/Japanese.strings @@ -99,7 +99,7 @@ "IncorrectPassphrase" = "パスフレーズが違います。"; "CertificateImportError" = "証明書のインポート中にエラーが発生しました。"; -// WidgetExtension +// Widget Status "Draft" = "下書き"; "RequestApplication" = "申請依頼"; "RequestApproval" = "承認依頼"; @@ -110,6 +110,7 @@ "Shared" = "共有された"; "FuturePass" = "回付予定"; +//WidgetExtension "StatusCheckWidgetName" = "状況確認ウィジェット"; "StatusCheckWidgetDescription" = "状況確認ウィジェットの説明"; "ApprovalWidgetName" = "承認待ちウィジェット"; diff --git a/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings index a4dce0479d0e10754f7ba95490ce61fa6c2e9cf7..a6e3ca1163a427cca3fcfd82b78340826e7f0dc6 100644 --- a/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/en.lproj/Localizable.strings @@ -99,7 +99,7 @@ "IncorrectPassphrase" = "パスフレーズが違います。"; "CertificateImportError" = "証明書のインポート中にエラーが発生しました。"; -// WidgetExtension +// Widget Status "Draft" = "下書き"; "RequestApplication" = "申請依頼"; "RequestApproval" = "承認依頼"; @@ -110,6 +110,7 @@ "Shared" = "共有された"; "FuturePass" = "回付予定"; +//WidgetExtension "StatusCheckWidgetName" = "状況確認ウィジェット"; "StatusCheckWidgetDescription" = "状況確認ウィジェットの説明"; "ApprovalWidgetName" = "承認待ちウィジェット"; diff --git a/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings index e7e919a03d6916f439f8137d6e28fcbb86a4a8d5..91960b3307875fc3affa2003854347d414904618 100644 --- a/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/ja.lproj/Localizable.strings @@ -99,7 +99,7 @@ "IncorrectPassphrase" = "パスフレーズが違います。"; "CertificateImportError" = "証明書のインポート中にエラーが発生しました。"; -// WidgetExtension +// Widget Status "Draft" = "下書き"; "RequestApplication" = "申請依頼"; "RequestApproval" = "承認依頼"; @@ -110,6 +110,7 @@ "Shared" = "共有された"; "FuturePass" = "回付予定"; +//WidgetExtension "StatusCheckWidgetName" = "状況確認ウィジェット"; "StatusCheckWidgetDescription" = "状況確認ウィジェットの説明"; "ApprovalWidgetName" = "承認待ちウィジェット"; diff --git a/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings index 39b212a889dee3f22d5fb966a42f3cd134307f72..0b3bf6c2aaa671d283a83178e9df7e80624fa83c 100644 --- a/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/zh-Hans.lproj/Localizable.strings @@ -99,7 +99,7 @@ "IncorrectPassphrase" = "パスフレーズが違います。"; "CertificateImportError" = "証明書のインポート中にエラーが発生しました。"; -// WidgetExtension +// Widget Status "Draft" = "下書き"; "RequestApplication" = "申請依頼"; "RequestApproval" = "承認依頼"; @@ -110,6 +110,7 @@ "Shared" = "共有された"; "FuturePass" = "回付予定"; +//WidgetExtension "StatusCheckWidgetName" = "状況確認ウィジェット"; "StatusCheckWidgetDescription" = "状況確認ウィジェットの説明"; "ApprovalWidgetName" = "承認待ちウィジェット"; diff --git a/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings b/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings index 5369a0ca43779557399a7b69b739716fd9a1e856..f4dc98058b6b4b9e4c3d251213719a15148179a6 100644 --- a/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings +++ b/AgileWorks/AgileWorks/Strings/zh-Hant.lproj/Localizable.strings @@ -99,7 +99,7 @@ "IncorrectPassphrase" = "パスフレーズが違います。"; "CertificateImportError" = "証明書のインポート中にエラーが発生しました。"; -// WidgetExtension +// Widget Status "Draft" = "下書き"; "RequestApplication" = "申請依頼"; "RequestApproval" = "承認依頼"; @@ -110,6 +110,7 @@ "Shared" = "共有された"; "FuturePass" = "回付予定"; +//WidgetExtension "StatusCheckWidgetName" = "状況確認ウィジェット"; "StatusCheckWidgetDescription" = "状況確認ウィジェットの説明"; "ApprovalWidgetName" = "承認待ちウィジェット"; diff --git a/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard b/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard index e5376c3d43e29f6b096e9e07197e06803da4dc3e..4eeaaaa2642d1fc3d9827266aae2d5f393bcb985 100644 --- a/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard +++ b/AgileWorks/AgileWorks/WebView/View/WebViewController.storyboard @@ -1,9 +1,9 @@ - + - + @@ -190,7 +190,7 @@ - + @@ -213,7 +213,7 @@ - + @@ -236,7 +236,7 @@ - + @@ -259,7 +259,7 @@ - + diff --git a/AgileWorks/Common/WidgetView.swift b/AgileWorks/Common/WidgetView.swift new file mode 100644 index 0000000000000000000000000000000000000000..43eec0647f822e95842c70be4b2b30a24a863116 --- /dev/null +++ b/AgileWorks/Common/WidgetView.swift @@ -0,0 +1,295 @@ +// +// WidgetView.swift +// AgileWorks +// +// Created by Azuma Kasumi on 2022/04/13. +// Copyright © 2022 ATLED CORP. All rights reserved. +// + +import SwiftUI + +let kCellDefaultHight: CGFloat = 110 + +let draft = "DRAFT" +let requestApplication = "REQUEST_APPLICATION" +let requestApproval = "REQUEST_APPROVAL" +let remand = "REMAND" +let checkReport = "CHECK_REPORT" +let demand = "DEMAND" +let share = "SHARE" +let shared = "SHARED" +let futurePass = "FUTUREPASS" + +//ウィジェット選択のプレビュー画面などで表示させる項目 +func previewItems() -> [ApprovalItem] { + var items = [ApprovalItem]() + items.append(ApprovalItem(code: draft, name: localizadString(key: "Draft", comment: ""), count: 1)) + items.append(ApprovalItem(code: requestApplication, name: localizadString(key: "RequestApplication", comment: ""), count: 10)) + items.append(ApprovalItem(code: requestApproval, name: localizadString(key: "RequestApproval", comment: ""), count: 35)) + items.append(ApprovalItem(code: remand, name: localizadString(key: "Remand", comment: ""), count: 6)) + items.append(ApprovalItem(code: checkReport, name: localizadString(key: "CheckReport", comment: ""), count: 10)) + items.append(ApprovalItem(code: demand, name: localizadString(key: "Demand", comment: ""), count: 0)) + items.append(ApprovalItem(code: share, name: localizadString(key: "Share", comment: ""), count: 0)) + items.append(ApprovalItem(code: shared, name: localizadString(key: "Shared", comment: ""), count: 0)) + items.append(ApprovalItem(code: futurePass, name: localizadString(key: "FuturePass", comment: ""), count: 0)) + + return items +} + +struct EntryData { + var approvalItems: [ApprovalItem] + var message: String? + var viewController: UIViewController? +} + +//状況確認ウィジェット表示選択 +struct StatusCheckWidgetView: View { + var entry: EntryData + var body: some View { + //API取得成功 + if entry.message == nil { + StatusBoxView(entry: entry) + } else { + //APIサーバーエラー + if entry.message == "-" { + StatusBoxView(entry: entry) + } else { //ログイン・コネクションエラー + FailureWidgetView(entry: entry) + } + } + } +} + +//承認待ちウィジェット表示選択 +struct ApprovalWidgetView: View { + var entry: EntryData + + //「承認依頼」を抜き出す + func findApproval() -> Int? { + for (index, item) in entry.approvalItems.enumerated() where item.code == requestApproval { + return index + } + return nil + } + + var body: some View { + //API取得成功 + if entry.message == nil { + if let num = findApproval() { //「承認依頼」項目あり + if #available(iOS 14.0, *) { + ApprovalItemView(approvalItem: entry.approvalItems[num], message: entry.message) + .widgetURL(URL(string: Configuration.shared.awURL + "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/Mobile#docList_" + "RequestApproval")) + } + } else { //「承認依頼」項目なし + ApprovalItemView(approvalItem: ApprovalItem(code: "", name: "", count: 0), message: "-") + } + } else { + //APIサーバーエラー + if entry.message == "-" { + ApprovalItemView(approvalItem: ApprovalItem(code: "", name: "", count: 0), message: "-") + } else {//ログイン・コネクションエラー + FailureWidgetView(entry: entry) + } + } + } +} + +//書類状況を表示するための各BOXビュー +struct StatusBoxView: View { + var entry: EntryData + + //書類状態の種類をカウント + func rowCnt() -> Int { + var row = entry.approvalItems.count / 2 + if entry.approvalItems.count % 2 != 0 { + row += 1 + } + return row + } + + //boxのサイズ + func boxSize(viewSize: CGSize) -> CGSize { + var box = CGSize() + var row = 1 + if viewSize.height > kCellDefaultHight { + row = rowCnt() + } + box.width = viewSize.width / 2 * 0.9 + box.height = viewSize.height / CGFloat(row) * 0.9 + return box + } + + func backColor() -> Color { + if #available(iOS 14.0, *) { + return Color(UIColor.systemGray6) + } else { + return Color(UIColor.clear) + } + } + + //「承認依頼」を抜き出す + func findApproval() -> Int? { + for (index, item) in entry.approvalItems.enumerated() where item.code == requestApproval { + return index + } + return nil + } + + var body: some View { + GeometryReader { geometry in + //ios13・14状態確認ウィジェット + if geometry.size.height > kCellDefaultHight { + VStack(spacing: 5) { + ForEach(0.. String? { + var status: String? + + switch approvalItem.code { + case draft: + status = "Draft" + case requestApplication: + status = "RequestApplication" + case requestApproval: + status = "RequestApproval" + case remand: + status = "Remand" + case checkReport: + status = "CheckReport" + case demand: + status = "HasDemand" + case share: + status = "Share" + case shared: + status = "Shared" + case futurePass: + status = "FuturePass" + default: + status = nil + } + return status + } + + //遷移先URLの取得(iOS14以降) + func getURL() -> String { + if let status = getStatus() { + return Configuration.shared.awURL + "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/Mobile#docList_" + status + } else { + return Configuration.shared.awURL + "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/Mobile#work" + } + } + + //遷移先URLはアプリ側で設定するためURL末尾のステータスのみ設定(iOS13) + func getStatusURL() -> String { + //スキーム+ステータスで設定 + var urlString = "atled-aw://" + if let status = getStatus() { + return urlString + status + } + return urlString + "nil" + } + var body: some View { + if #available(iOS 14.0, *) { + Link(destination: URL(string: getURL())!, label: { + ApprovalItemView(approvalItem: approvalItem, message: message) + }) + } else { + ApprovalItemView(approvalItem: approvalItem, message: message) + .onTapGesture { + if viewController != nil { + viewController!.extensionContext?.open(NSURL(fileURLWithPath: getStatusURL())as URL, completionHandler: nil) + } + } + } + } +} + +//書類状況の内容を表示するビュー +struct ApprovalItemView: View { + let approvalItem: ApprovalItem + let message: String? + + var body: some View { + GeometryReader { geometry in + HStack(spacing: 0) { + Image(systemName: "folder") + .frame(width: geometry.size.width * 0.3, height: geometry.size.height) + if message == nil { + VStack(alignment: .leading) { + Text(approvalItem.name) + .frame(alignment: .leading) + Text("\(approvalItem.count)").font(.subheadline) + .frame(alignment: .leading) + } + } else { //APIサーバーエラーの場合の表示 + Text(message ?? "-") + } + } + Spacer() + } + .background(Color.white) + .cornerRadius(20) + } +} + +//エラー文言を表示するビュー +struct FailureWidgetView: View { + var entry: EntryData + + var body: some View { + Text(entry.message ?? "") + } +} diff --git a/AgileWorks/TodayExtension/Info.plist b/AgileWorks/TodayExtension/Info.plist index ac11da50991294e8f1ec77e77f14332f5b72c74f..d5ee21614fe0c1110115b16457334cc604ce73fe 100644 --- a/AgileWorks/TodayExtension/Info.plist +++ b/AgileWorks/TodayExtension/Info.plist @@ -32,7 +32,7 @@ NSExtension NSExtensionMainStoryboard - MainInterface + TodayViewController NSExtensionPointIdentifier com.apple.widget-extension diff --git a/AgileWorks/TodayExtension/View/Base.lproj/MainInterface.storyboard b/AgileWorks/TodayExtension/View/Base.lproj/MainInterface.storyboard deleted file mode 100644 index b948543588735304ae44c356990ea270e6c26f76..0000000000000000000000000000000000000000 --- a/AgileWorks/TodayExtension/View/Base.lproj/MainInterface.storyboard +++ /dev/null @@ -1,69 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/AgileWorks/TodayExtension/View/Base.lproj/TodayViewController.storyboard b/AgileWorks/TodayExtension/View/Base.lproj/TodayViewController.storyboard new file mode 100644 index 0000000000000000000000000000000000000000..3511d5e48caac2fafb399220b14390456c7cd3cb --- /dev/null +++ b/AgileWorks/TodayExtension/View/Base.lproj/TodayViewController.storyboard @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AgileWorks/TodayExtension/View/TodayViewController.swift b/AgileWorks/TodayExtension/View/TodayViewController.swift index 45f791406ff98adfb0184436b0b77401c58465bf..d9d5c6db17ca51ebac6e7e293a173594097a892d 100644 --- a/AgileWorks/TodayExtension/View/TodayViewController.swift +++ b/AgileWorks/TodayExtension/View/TodayViewController.swift @@ -7,16 +7,11 @@ // import NotificationCenter +import SwiftUI import UIKit class TodayViewController: UIViewController, NCWidgetProviding { - @IBOutlet private var tableView: UITableView! - @IBOutlet private var messageLabel: UILabel! - - private static let kCellDefaultHight: CGFloat = 110 - private static let kCompactCellCount: CGFloat = 3 - private static var cellHight: CGFloat = kCellDefaultHight / kCompactCellCount - private static var expandedCellCount: CGFloat = 0 + var approvalItems: [ApprovalItem] = [] enum APIResult { case success(T) @@ -24,12 +19,6 @@ class TodayViewController: UIViewController, NCWidgetProviding { case failure(String) } - var approvalItems: [ApprovalItem] = [] { - didSet { - self.tableView.reloadData() - } - } - override func viewDidLoad() { super.viewDidLoad() self.extensionContext?.widgetLargestAvailableDisplayMode = .expanded @@ -38,66 +27,53 @@ class TodayViewController: UIViewController, NCWidgetProviding { func widgetPerformUpdate(completionHandler: (@escaping (NCUpdateResult) -> Void)) { fetch { result in DispatchQueue.main.async { + var rootView: StatusCheckWidgetView switch result { case .success(let response): - self.hideMessage() self.approvalItems = response.items + rootView = StatusCheckWidgetView(entry: EntryData(approvalItems: self.approvalItems, message: nil, viewController: self)) completionHandler(.newData) case .nodate(let message): - self.showMessage(message: message) - self.approvalItems = [] + rootView = StatusCheckWidgetView(entry: EntryData(approvalItems: [ApprovalItem](), message: message, viewController: nil)) completionHandler(.noData) case .failure(let message): - self.showMessage(message: message) - self.approvalItems = [] + rootView = StatusCheckWidgetView(entry: EntryData(approvalItems: previewItems(), message: message, viewController: nil)) completionHandler(.failed) } + self.callWidgetView(vc: UIHostingController(rootView: rootView)) } } } + func callWidgetView(vc: UIViewController) { + self.addChild(vc) + self.view.addSubview(vc.view) + vc.didMove(toParent: self) + + vc.view.translatesAutoresizingMaskIntoConstraints = false + vc.view.heightAnchor.constraint(equalTo: self.view.heightAnchor).isActive = true + vc.view.leftAnchor.constraint(equalTo: self.view.leftAnchor).isActive = true + vc.view.rightAnchor.constraint(equalTo: self.view.rightAnchor).isActive = true + vc.view.centerYAnchor.constraint(equalTo: self.view.centerYAnchor).isActive = true + vc.view.backgroundColor = UIColor.clear + } + func widgetActiveDisplayModeDidChange(_ activeDisplayMode: NCWidgetDisplayMode, withMaximumSize maxSize: CGSize) { if case .compact = activeDisplayMode { - TodayViewController.cellHight = maxSize.height / TodayViewController.kCompactCellCount preferredContentSize = maxSize } else { + var height: CGFloat if !approvalItems.isEmpty { - TodayViewController.expandedCellCount = CGFloat(approvalItems.count) + height = 0 } - let hight = TodayViewController.expandedCellCount * TodayViewController.cellHight - preferredContentSize = CGSize(width: maxSize.width, height: min(maxSize.height, hight)) - } - } - - func hideMessage() { - messageLabel.text = "" - messageLabel.isHidden = true - tableView.separatorStyle = .singleLine - } + let hight = Int(kCellDefaultHight) * approvalItems.count / 2 + approvalItems.count % 2 - func showMessage(message: String) { - messageLabel.text = message - messageLabel.isHidden = false - tableView.separatorStyle = .none - } -} - -extension TodayViewController: UITableViewDataSource { - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return approvalItems.count - } - - func numberOfSections(in tableView: UITableView) -> Int { - return 1 - } - - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - let cell = tableView.dequeueReusableCell(withIdentifier: "todayCell", for: indexPath) - cell.textLabel?.text = approvalItems[indexPath.row].name + " (" + String(approvalItems[indexPath.row].count.toFormattedString()) + ")" - return cell + preferredContentSize = CGSize(width: maxSize.width, height: min(maxSize.height, CGFloat(hight))) + } } } +/* extension TodayViewController: UITableViewDelegate { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { return TodayViewController.cellHight @@ -107,6 +83,7 @@ extension TodayViewController: UITableViewDelegate { self.extensionContext?.open(NSURL(fileURLWithPath: "atled-aw://approvals/" + String(indexPath.row) )as URL, completionHandler: nil) } } + */ extension TodayViewController { func fetch(completion: @escaping (APIResult) -> Void) { diff --git a/AgileWorks/WidgetExtension/WidgetExtension.swift b/AgileWorks/WidgetExtension/WidgetExtension.swift index 9168f3540442e509de7833f0433201d319f4d26a..512f30b2c9c3107d200a70af064e25861febb83b 100644 --- a/AgileWorks/WidgetExtension/WidgetExtension.swift +++ b/AgileWorks/WidgetExtension/WidgetExtension.swift @@ -9,36 +9,9 @@ import WidgetKit import SwiftUI -let draft = "DRAFT" -let requestApplication = "REQUEST_APPLICATION" -let requestApproval = "REQUEST_APPROVAL" -let remand = "REMAND" -let checkReport = "CHECK_REPORT" -let demand = "DEMAND" -let share = "SHARE" -let shared = "SHARED" -let futurePass = "FUTUREPASS" - - -//ウィジェット選択のプレビュー画面などで表示させる項目 -private func previewItems() -> [ApprovalItem]{ - var items = [ApprovalItem]() - items.append(ApprovalItem(code: draft, name: localizadString(key: "Draft", comment: ""), count: 1)) - items.append(ApprovalItem(code: requestApplication, name: localizadString(key: "RequestApplication", comment: ""), count: 10)) - items.append(ApprovalItem(code: requestApproval, name: localizadString(key: "RequestApproval", comment: ""), count: 35)) - items.append(ApprovalItem(code: remand, name: localizadString(key: "Remand", comment: ""), count: 6)) - items.append(ApprovalItem(code: checkReport, name: localizadString(key: "CheckReport", comment: ""), count: 10)) - items.append(ApprovalItem(code: demand, name: localizadString(key: "Demand", comment: ""), count: 0)) - items.append(ApprovalItem(code: share, name: localizadString(key: "Share", comment: ""), count: 0)) - items.append(ApprovalItem(code: shared, name: localizadString(key: "Shared", comment: ""), count: 0)) - items.append(ApprovalItem(code: futurePass, name: localizadString(key: "FuturePass", comment: ""), count: 0)) - - return items -} - struct Provider: TimelineProvider { func placeholder(in context: Context) -> SimpleEntry { - SimpleEntry(date: Date(), approvalItems:previewItems(), message: nil) + SimpleEntry(date: Date(), approvalItems: previewItems(), message: nil) } func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> ()) { @@ -58,9 +31,9 @@ struct Provider: TimelineProvider { case .success(let response): entries.append(SimpleEntry(date: entryDate, approvalItems: response.items, message: nil)) case .nodate(let message): - entries.append(SimpleEntry(date: entryDate, approvalItems: [ApprovalItem](), message: message)) - case .failure(let message): entries.append(SimpleEntry(date: entryDate, approvalItems: previewItems(), message: message)) + case .failure(let message): + entries.append(SimpleEntry(date: entryDate, approvalItems: [ApprovalItem](), message: message)) } let timeline = Timeline(entries: entries, policy: .after(entryDate)) completion(timeline) @@ -74,183 +47,6 @@ struct SimpleEntry: TimelineEntry { var approvalItems: [ApprovalItem] var message: String? } -//状況確認ウィジェット表示選択 -struct StatusCheckWidgetView : View { - var entry: Provider.Entry - var body: some View { - //API取得成功 - if entry.message == nil { - StatusBoxView(entry: entry) - }else { - //APIサーバーエラー - if entry.message == "-" { - StatusBoxView(entry: entry) - }else { //ログイン・コネクションエラー - FailureWidgetView(entry: entry) - } - } - } -} - -//承認待ちウィジェット表示選択 -struct ApprovalWidgetView : View { - var entry: Provider.Entry - - //「承認依頼」を抜き出す - func findApproval() -> Int?{ - for (index, item) in entry.approvalItems.enumerated() { - if item.code == "REQUEST_APPROVAL" { - return index - } - } - return nil - } - - var body: some View { - //API取得成功 - if entry.message == nil { - if let num = findApproval() { //「承認依頼」項目あり - ApprovalItemView(approvalItem: entry.approvalItems[num], message: entry.message) - .widgetURL(URL(string: Configuration.shared.awURL + "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/Mobile#docList_" + "RequestApproval")) - }else { //「承認依頼」項目なし - ApprovalItemView(approvalItem: ApprovalItem(code: "", name: "", count: 0), message: "-") - } - }else { - //APIサーバーエラー - if entry.message == "-" { - ApprovalItemView(approvalItem: ApprovalItem(code: "", name: "", count: 0), message: "-") - }else {//ログイン・コネクションエラー - FailureWidgetView(entry: entry) - } - } - } -} - -//書類状況を表示するための各BOXビュー -struct StatusBoxView : View { - var entry: Provider.Entry - - //書類状態の種類をカウント - func rowCnt() -> Int { - var row = entry.approvalItems.count / 2 - if (entry.approvalItems.count % 2 != 0) { - row += 1 - } - return row - } - - //BOXの右側を表示させるかの条件 - func evenCheck(row: Int) -> Bool { - row < rowCnt()-1 || entry.approvalItems.count % 2 == 0 - } - - var body: some View { - GeometryReader { geometry in - VStack (spacing: 5){ - ForEach(0.. String{ - var url: String = Configuration.shared.awURL + "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/Mobile#docList_" - - switch approvalItem.code { - case draft: - url += "Draft" - case requestApplication: - url += "RequestApplication" - case requestApproval: - url += "RequestApproval" - case remand: - url += "Remand" - case checkReport: - url += "CheckReport" - case demand: - url += "HasDemand" - case share: - url += "Share" - case shared: - url += "Shared" - case futurePass: - url += "FuturePass" - default: - url = Configuration.shared.awURL + "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/Mobile#work" - } - return url - } - - var body: some View { - Link(destination: URL(string: statusUrl())!, label: { - ApprovalItemView(approvalItem: approvalItem, message: message) - }) - } -} - -//書類状況の内容を表示するビュー -struct ApprovalItemView : View { - let approvalItem: ApprovalItem - let message: String? - - var body: some View { - GeometryReader { geometry in - HStack (spacing: 0){ - Image(systemName: "folder") - .frame(width: geometry.size.width * 0.3, height: geometry.size.height) - if message == nil { - VStack (alignment : .leading){ - Text(approvalItem.name) - .frame(alignment: .leading) - Text("\(approvalItem.count)").font(.subheadline) - .frame(alignment: .leading) - } - }else { //APIサーバーエラーの場合の表示 - Text(message ?? "-") - } - } - Spacer() - } - .background(Color.white) - .cornerRadius(20) - } -} - - - -//エラー文言を表示するビュー -struct FailureWidgetView : View { - var entry: Provider.Entry - - var body: some View { - Text(entry.message ?? "") - } -} //状況確認ウィジェット struct StatusCheckWidget: Widget { @@ -258,7 +54,8 @@ struct StatusCheckWidget: Widget { var body: some WidgetConfiguration { StaticConfiguration(kind: kind, provider: Provider()) { entry in - StatusCheckWidgetView(entry: entry) + + StatusCheckWidgetView(entry: EntryData(approvalItems: entry.approvalItems, message: entry.message, viewController: nil)) } .configurationDisplayName(localizadString(key: "StatusCheckWidgetName", comment: "")) .description(localizadString(key: "StatusCheckWidgetDescription", comment: "")) @@ -272,7 +69,7 @@ struct ApprovalWidget: Widget { var body: some WidgetConfiguration { StaticConfiguration(kind: kind, provider: Provider()) { entry in - ApprovalWidgetView(entry: entry) + ApprovalWidgetView(entry: EntryData(approvalItems: entry.approvalItems, message: entry.message, viewController: nil)) } .configurationDisplayName(localizadString(key: "ApprovalWidgetName", comment: "")) .description(localizadString(key: "ApprovalWidgetDescription", comment: "")) @@ -290,9 +87,9 @@ struct WidgetExtension: WidgetBundle { struct WidgetExtension_Previews: PreviewProvider { static var previews: some View { - StatusCheckWidgetView(entry: SimpleEntry(date: Date(), approvalItems: previewItems(), message: nil)) + StatusCheckWidgetView(entry: EntryData(approvalItems: previewItems(), message: nil, viewController: nil)) .previewContext(WidgetPreviewContext(family: .systemLarge)) - ApprovalWidgetView(entry: SimpleEntry(date: Date(), approvalItems: previewItems(), message: nil)) + ApprovalWidgetView(entry: EntryData(approvalItems: previewItems(), message: nil, viewController: nil)) .previewContext(WidgetPreviewContext(family: .systemSmall)) } }