Skip to content

Commit

Permalink
fix: 🐛 [JIRA:IOSSDKBUG-414] Lower enumeration cases count (#836)
Browse files Browse the repository at this point in the history
Lower enumeration cases count temporarily to prevent crash
  • Loading branch information
hengyi-zhang authored Oct 25, 2024
1 parent acdaa80 commit ce328d4
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 40 deletions.
52 changes: 27 additions & 25 deletions Sources/FioriThemeManager/Colors/ColorStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1163,30 +1163,30 @@ public enum ColorStyle: String, CaseIterable {
/// (light variant) ![](https://dummyimage.com/48x18/F83030.png&text=+) Hex value: F83030FF
@available(watchOS, unavailable)
case stockDownStroke
/// ChartBad
/// (dark variant) ![](https://dummyimage.com/48x18/F53232.png&text=+) Hex value: F53232FF
/// (light variant) ![](https://dummyimage.com/48x18/F83030.png&text=+) Hex value: F83030FF
@available(watchOS, unavailable)
case chartBad
/// ChartCritical
/// (dark variant) ![](https://dummyimage.com/48x18/E26300.png&text=+) Hex value: E26300FF
/// (light variant) ![](https://dummyimage.com/48x18/DD6100.png&text=+) Hex value: DD6100FF
@available(watchOS, unavailable)
case chartCritical
/// ChartGood
/// (dark variant) ![](https://dummyimage.com/48x18/30914C.png&text=+) Hex value: 30914CFF
/// (light variant) ![](https://dummyimage.com/48x18/30914C.png&text=+) Hex value: 30914CFF
@available(watchOS, unavailable)
case chartGood
/// ChartNeutral
/// (dark variant) ![](https://dummyimage.com/48x18/6F89A1.png&text=+) Hex value: 6F89A1FF
/// (light variant) ![](https://dummyimage.com/48x18/758CA4.png&text=+) Hex value: 758CA4FF
@available(watchOS, unavailable)
case chartNeutral
//
// /// ChartBad
// /// (dark variant) ![](https://dummyimage.com/48x18/F53232.png&text=+) Hex value: F53232FF
// /// (light variant) ![](https://dummyimage.com/48x18/F83030.png&text=+) Hex value: F83030FF
// @available(watchOS, unavailable)
// case chartBad
//
// /// ChartCritical
// /// (dark variant) ![](https://dummyimage.com/48x18/E26300.png&text=+) Hex value: E26300FF
// /// (light variant) ![](https://dummyimage.com/48x18/DD6100.png&text=+) Hex value: DD6100FF
// @available(watchOS, unavailable)
// case chartCritical
//
// /// ChartGood
// /// (dark variant) ![](https://dummyimage.com/48x18/30914C.png&text=+) Hex value: 30914CFF
// /// (light variant) ![](https://dummyimage.com/48x18/30914C.png&text=+) Hex value: 30914CFF
// @available(watchOS, unavailable)
// case chartGood
//
// /// ChartNeutral
// /// (dark variant) ![](https://dummyimage.com/48x18/6F89A1.png&text=+) Hex value: 6F89A1FF
// /// (light variant) ![](https://dummyimage.com/48x18/758CA4.png&text=+) Hex value: 758CA4FF
// @available(watchOS, unavailable)
// case chartNeutral

// MARK: - Map Colors (11 Styles)

Expand Down Expand Up @@ -1642,7 +1642,9 @@ public enum ColorStyle: String, CaseIterable {
.header, .headerBlended, .barTransparent, .contrastElement,
.footer, .cellBackground, .chrome, .chromeSecondary, .chart1, .chart2, .chart3, .chart4,
.chart5, .chart6, .chart7, .chart8, .chart9, .chart10, .chart11, .chart12,
.stockUpStroke, .stockDownStroke, .chartBad, .chartCritical, .chartNeutral, .chartGood, .map1, .map2, .map3, .map4,
.stockUpStroke, .stockDownStroke,
// .chartBad, .chartCritical, .chartNeutral, .chartGood,
.map1, .map2, .map3, .map4,
.map5, .map6, .map7, .map8, .map9, .map10, .customColor1, .customColor2, .customColor3, .customColor4, .customColor5, .customColor6,
.esriEdit, .jouleBrand, .jouleAccent1, .jouleAccent2, .jouleAccent3, .jouleGradient1, .jouleGradient2]
#else
Expand Down
8 changes: 4 additions & 4 deletions Sources/FioriThemeManager/Palettes/PaletteV8.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@ struct PaletteV8: PaletteProvider {
.chart12: HexColor(lightColor: "A68A5BFF", darkColor: "A68A5BFF", contrastLightColor: "B49E78FF", contrastDarkColor: "816246FF"),
.stockUpStroke: HexColor(lightColor: "30914CFF", darkColor: "30914CFF", contrastLightColor: "99CC99FF", contrastDarkColor: "006362FF"),
.stockDownStroke: HexColor(lightColor: "F83030FF", darkColor: "F53232FF", contrastLightColor: "FF7878FF", contrastDarkColor: "AB0000FF"),
.chartBad: HexColor(lightColor: "F83030FF", darkColor: "F53232FF", contrastLightColor: "FF7878FF", contrastDarkColor: "AB0000FF"),
.chartCritical: HexColor(lightColor: "DD6100FF", darkColor: "E26300FF", contrastLightColor: "FFAB1DFF", contrastDarkColor: "5C5C00FF"),
.chartGood: HexColor(lightColor: "30914CFF", darkColor: "30914CFF", contrastLightColor: "99CC99FF", contrastDarkColor: "006362FF"),
.chartNeutral: HexColor(lightColor: "6F89A1FF", darkColor: "758CA4FF", contrastLightColor: "AFAFAFFF", contrastDarkColor: "525252FF"),
// .chartBad: HexColor(lightColor: "F83030FF", darkColor: "F53232FF", contrastLightColor: "FF7878FF", contrastDarkColor: "AB0000FF"),
// .chartCritical: HexColor(lightColor: "DD6100FF", darkColor: "E26300FF", contrastLightColor: "FFAB1DFF", contrastDarkColor: "5C5C00FF"),
// .chartGood: HexColor(lightColor: "30914CFF", darkColor: "30914CFF", contrastLightColor: "99CC99FF", contrastDarkColor: "006362FF"),
// .chartNeutral: HexColor(lightColor: "6F89A1FF", darkColor: "758CA4FF", contrastLightColor: "AFAFAFFF", contrastDarkColor: "525252FF"),
/// Map Colors
.map1: HexColor(lightColor: "2E4A62", darkColor: "2E4A62"),
.map2: HexColor(lightColor: "56840E", darkColor: "56840E"),
Expand Down
22 changes: 11 additions & 11 deletions Tests/FioriSwiftUITests/FioriThemeManager/ThemeManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ class ThemeManagerTests: XCTestCase {

#if !os(watchOS)
func testLatestColorStyle() throws {
XCTAssertEqual(ColorStyle.allCases.count, 216)
XCTAssertEqual(ColorStyle.allCases.count, 212) // 216
}

func testPalette8() throws {
let tm = ThemeManager.shared
tm.setPaletteVersion(.v8)
// following are same as v7
XCTAssertEqual(tm.paletteVersion?.supportedStyles().count, 216)
XCTAssertEqual(tm.paletteVersion?.supportedStyles().count, 212) // 216
XCTAssertEqual(tm.paletteVersion?.obsoletedStyles().count, 0)
XCTAssertEqual(tm.paletteVersion?.newStyles().count, 21)
XCTAssertEqual(tm.paletteVersion?.newStyles().count, 17) // 21
let newStyle_grey1 = tm.hexColor(for: .grey1)
XCTAssertEqual(newStyle_grey1, HexColor(lightColor: "12171CFF", darkColor: "F5F6F7FF", contrastLightColor: "1C242BFF", contrastDarkColor: "EAECEEFF"))
let newStyle_primaryLabel = tm.hexColor(for: .primaryLabel)
Expand Down Expand Up @@ -307,14 +307,14 @@ class ThemeManagerTests: XCTestCase {
XCTAssertEqual(stockUpStroke, HexColor(lightColor: "30914CFF", darkColor: "30914CFF", contrastLightColor: "99CC99FF", contrastDarkColor: "006362FF"))
let stockDownStroke = tm.hexColor(for: .stockDownStroke)
XCTAssertEqual(stockDownStroke, HexColor(lightColor: "F83030FF", darkColor: "F53232FF", contrastLightColor: "FF7878FF", contrastDarkColor: "AB0000FF"))
let chartBad = tm.hexColor(for: .chartBad)
XCTAssertEqual(chartBad, HexColor(lightColor: "F83030FF", darkColor: "F53232FF", contrastLightColor: "FF7878FF", contrastDarkColor: "AB0000FF"))
let chartCritical = tm.hexColor(for: .chartCritical)
XCTAssertEqual(chartCritical, HexColor(lightColor: "DD6100FF", darkColor: "E26300FF", contrastLightColor: "FFAB1DFF", contrastDarkColor: "5C5C00FF"))
let chartGood = tm.hexColor(for: .chartGood)
XCTAssertEqual(chartGood, HexColor(lightColor: "30914CFF", darkColor: "30914CFF", contrastLightColor: "99CC99FF", contrastDarkColor: "006362FF"))
let chartNeutral = tm.hexColor(for: .chartNeutral)
XCTAssertEqual(chartNeutral, HexColor(lightColor: "6F89A1FF", darkColor: "758CA4FF", contrastLightColor: "AFAFAFFF", contrastDarkColor: "525252FF"))
// let chartBad = tm.hexColor(for: .chartBad)
// XCTAssertEqual(chartBad, HexColor(lightColor: "F83030FF", darkColor: "F53232FF", contrastLightColor: "FF7878FF", contrastDarkColor: "AB0000FF"))
// let chartCritical = tm.hexColor(for: .chartCritical)
// XCTAssertEqual(chartCritical, HexColor(lightColor: "DD6100FF", darkColor: "E26300FF", contrastLightColor: "FFAB1DFF", contrastDarkColor: "5C5C00FF"))
// let chartGood = tm.hexColor(for: .chartGood)
// XCTAssertEqual(chartGood, HexColor(lightColor: "30914CFF", darkColor: "30914CFF", contrastLightColor: "99CC99FF", contrastDarkColor: "006362FF"))
// let chartNeutral = tm.hexColor(for: .chartNeutral)
// XCTAssertEqual(chartNeutral, HexColor(lightColor: "6F89A1FF", darkColor: "758CA4FF", contrastLightColor: "AFAFAFFF", contrastDarkColor: "525252FF"))
}

func testPaletteV7() throws {
Expand Down

0 comments on commit ce328d4

Please sign in to comment.