diff --git a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj index c44003a2fbf7402080a19366daaf4f2b7979707e..5dc1836f4af12e8d6d65b5302cdb1dddfe585874 100644 --- a/AgileWorks/AgileWorks.xcodeproj/project.pbxproj +++ b/AgileWorks/AgileWorks.xcodeproj/project.pbxproj @@ -21,6 +21,7 @@ 7549FC9127EAF42C00FF9E0C /* Japanese.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917F9B27BDF0F10051E201 /* Japanese.strings */; }; 7549FC9227EAF42C00FF9E0C /* Chinese-Simplified.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917F9F27BDF2050051E201 /* Chinese-Simplified.strings */; }; 7549FC9327EAF42C00FF9E0C /* Chinese-Traditional.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917FA127BDF2250051E201 /* Chinese-Traditional.strings */; }; + 756C7E7B282B6A5700C24F4D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 756C7E7A282B6A5700C24F4D /* Assets.xcassets */; }; 75917F9C27BDF0F10051E201 /* Japanese.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917F9B27BDF0F10051E201 /* Japanese.strings */; }; 75917F9E27BDF1C30051E201 /* English.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917F9D27BDF1C30051E201 /* English.strings */; }; 75917FA027BDF2050051E201 /* Chinese-Simplified.strings in Resources */ = {isa = PBXBuildFile; fileRef = 75917F9F27BDF2050051E201 /* Chinese-Simplified.strings */; }; @@ -229,9 +230,8 @@ 3AF4A84624A06A73006C0C0A /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; 3AF4A84824A06AD0006C0C0A /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/Localizable.strings; sourceTree = ""; }; 7503F77D27EAF7E00074A76E /* WidgetExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = WidgetExtension.entitlements; sourceTree = ""; }; - 75917F9027BD315A0051E201 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/MainInterface.strings"; sourceTree = ""; }; + 756C7E7A282B6A5700C24F4D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 75917F9227BD315A0051E201 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; - 75917F9427BD317D0051E201 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/MainInterface.strings"; sourceTree = ""; }; 75917F9627BD317E0051E201 /* zh-Hant */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant"; path = "zh-Hant.lproj/Localizable.strings"; sourceTree = ""; }; 75917F9B27BDF0F10051E201 /* Japanese.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = Japanese.strings; sourceTree = ""; }; 75917F9D27BDF1C30051E201 /* English.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = English.strings; sourceTree = ""; }; @@ -434,6 +434,7 @@ BD285CAF24D2ACA300DC712E /* View */, 3127EE13241A2A9500535CC7 /* Info.plist */, BD10D30624E38C2F00A0DFDC /* TodayExtension-Production.entitlements */, + 756C7E7A282B6A5700C24F4D /* Assets.xcassets */, ); path = TodayExtension; sourceTree = ""; @@ -1112,6 +1113,7 @@ 75917FA927C36D220051E201 /* Chinese-Simplified.strings in Resources */, 75917FAA27C36D220051E201 /* Chinese-Traditional.strings in Resources */, 75917FA727C36D0C0051E201 /* Japanese.strings in Resources */, + 756C7E7B282B6A5700C24F4D /* Assets.xcassets in Resources */, 3127EE12241A2A9500535CC7 /* TodayViewController.storyboard in Resources */, BD6DE26F24D1079700C1479E /* Localizable.strings in Resources */, ); diff --git a/AgileWorks/AgileWorks.xcodeproj/xcshareddata/xcschemes/TodayExtension-Production.xcscheme b/AgileWorks/AgileWorks.xcodeproj/xcshareddata/xcschemes/TodayExtension-Production.xcscheme index 375ce7f3f98af40d370336a6ba9c47b7835bd915..43bfd4ab952e974b3c50287d3e4c37eeea1dd7c0 100644 --- a/AgileWorks/AgileWorks.xcodeproj/xcshareddata/xcschemes/TodayExtension-Production.xcscheme +++ b/AgileWorks/AgileWorks.xcodeproj/xcshareddata/xcschemes/TodayExtension-Production.xcscheme @@ -37,6 +37,14 @@ + + + + - + + + + + - + + + diff --git a/AgileWorks/AgileWorks.xcodeproj/xcshareddata/xcschemes/WidgetExtension.xcscheme b/AgileWorks/AgileWorks.xcodeproj/xcshareddata/xcschemes/WidgetExtension.xcscheme index dc3e129052c54d4d1125541627d7f92c76e52d8e..77046f55610274104c1cb4106c683ce9d4a72f8a 100644 --- a/AgileWorks/AgileWorks.xcodeproj/xcshareddata/xcschemes/WidgetExtension.xcscheme +++ b/AgileWorks/AgileWorks.xcodeproj/xcshareddata/xcschemes/WidgetExtension.xcscheme @@ -81,12 +81,12 @@ + isEnabled = "YES"> + isEnabled = "NO"> Bool { + row == rowCnt() - 1 && entry.approvalItems.count % 2 != 0 + } + 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() { + if let status = getStatus(code: approvalItem.code) { return Configuration.shared.awURL + "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/Mobile#docList_" + status } else { return Configuration.shared.awURL + "/" + (KeychainDataStore().readContextPath() ?? "") + "/Broker/Mobile#work" @@ -247,7 +225,7 @@ struct LinkView: View { //遷移先URLはアプリ側で設定するためURL末尾のステータスのみ設定(iOS13) func getStatusURL() -> String { //スキーム+ステータスで設定 - if let status = getStatus() { + if let status = getStatus(code: approvalItem.code) { return urlScheme + status } return urlScheme + "nil" @@ -309,10 +287,47 @@ struct FailureWidgetView: View { .foregroundColor(Color.textColor) } } +func checkApprovalItems(approvalItems: [ApprovalItem]) -> [ApprovalItem] { + var result = [ApprovalItem]() + for item in approvalItems { + if getStatus(code: item.code) != nil { + result.append(item) + } + } + return result +} + +//URLの末尾に設定するステータスを返す +func getStatus(code: String) -> String? { + var status: String? + + switch 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 +} extension Color { static let backgroundColor = Color("WidgetBackgroundColor") static let widgetBoxColor = Color("WidgetBoxColor") static let textColor = Color("WidgetTextColor") } - diff --git a/AgileWorks/TodayExtension/Assets.xcassets/Contents.json b/AgileWorks/TodayExtension/Assets.xcassets/Contents.json new file mode 100644 index 0000000000000000000000000000000000000000..73c00596a7fca3f3d4bdd64053b69d86745f9e10 --- /dev/null +++ b/AgileWorks/TodayExtension/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/AgileWorks/TodayExtension/Assets.xcassets/WidgetBackgroundColor.colorset/Contents.json b/AgileWorks/TodayExtension/Assets.xcassets/WidgetBackgroundColor.colorset/Contents.json new file mode 100644 index 0000000000000000000000000000000000000000..12ac8cffe54debaebd414f7388b725fd7f3939bf --- /dev/null +++ b/AgileWorks/TodayExtension/Assets.xcassets/WidgetBackgroundColor.colorset/Contents.json @@ -0,0 +1,28 @@ +{ + "colors" : [ + { + "color" : { + "platform" : "ios", + "reference" : "systemGray6Color" + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "platform" : "ios", + "reference" : "systemGray6Color" + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/AgileWorks/TodayExtension/Assets.xcassets/WidgetBoxColor.colorset/Contents.json b/AgileWorks/TodayExtension/Assets.xcassets/WidgetBoxColor.colorset/Contents.json new file mode 100644 index 0000000000000000000000000000000000000000..ca5bf100d095aa42f9902ebc18db5e26977e3c76 --- /dev/null +++ b/AgileWorks/TodayExtension/Assets.xcassets/WidgetBoxColor.colorset/Contents.json @@ -0,0 +1,28 @@ +{ + "colors" : [ + { + "color" : { + "platform" : "ios", + "reference" : "systemBackgroundColor" + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "platform" : "ios", + "reference" : "systemGray5Color" + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/AgileWorks/TodayExtension/Assets.xcassets/WidgetTextColor.colorset/Contents.json b/AgileWorks/TodayExtension/Assets.xcassets/WidgetTextColor.colorset/Contents.json new file mode 100644 index 0000000000000000000000000000000000000000..1effc4f12791cdbc123f53d64a8dfb0fd1e56e23 --- /dev/null +++ b/AgileWorks/TodayExtension/Assets.xcassets/WidgetTextColor.colorset/Contents.json @@ -0,0 +1,28 @@ +{ + "colors" : [ + { + "color" : { + "platform" : "universal", + "reference" : "labelColor" + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "platform" : "universal", + "reference" : "labelColor" + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/AgileWorks/TodayExtension/View/TodayViewController.swift b/AgileWorks/TodayExtension/View/TodayViewController.swift index 7869ee89fd3cb47bdfc6e6d468b0d9f0e9aafa6a..304cc9db857c823dd13ec20222bd47d346d3056a 100644 --- a/AgileWorks/TodayExtension/View/TodayViewController.swift +++ b/AgileWorks/TodayExtension/View/TodayViewController.swift @@ -30,8 +30,8 @@ class TodayViewController: UIViewController, NCWidgetProviding { var rootView: StatusCheckWidgetView switch result { case .success(let response): - self.approvalItems = response.items - rootView = StatusCheckWidgetView(entry: EntryData(approvalItems: self.approvalItems, message: nil, viewController: self)) + self.approvalItems = checkApprovalItems(approvalItems: response.items) + rootView = StatusCheckWidgetView(entry: EntryData(approvalItems: self.approvalItems, message: nil, viewController: self)) completionHandler(.newData) case .nodate(let message): rootView = StatusCheckWidgetView(entry: EntryData(approvalItems: [ApprovalItem](), message: message, viewController: self)) diff --git a/AgileWorks/WidgetExtension/WidgetExtension.swift b/AgileWorks/WidgetExtension/WidgetExtension.swift index cef85e7c841de40ff0dba573051b743810735a88..df3ebdf15d2eee10004fd44e40634007875eaa6b 100644 --- a/AgileWorks/WidgetExtension/WidgetExtension.swift +++ b/AgileWorks/WidgetExtension/WidgetExtension.swift @@ -29,7 +29,7 @@ struct Provider: TimelineProvider { DispatchQueue.main.async { switch result { case .success(let response): - entries.append(SimpleEntry(date: entryDate, approvalItems: response.items, message: nil)) + entries.append(SimpleEntry(date: entryDate, approvalItems: checkApprovalItems(approvalItems: response.items), message: nil)) case .nodate(let message): entries.append(SimpleEntry(date: entryDate, approvalItems: previewItems(), message: message)) case .failure(let message):