Skip to content

Commit

Permalink
Add centered Cell property
Browse files Browse the repository at this point in the history
  • Loading branch information
Hopsaheysa committed Jul 26, 2024
1 parent abf9b32 commit a5d8c4a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ public class WMTTemplates: Codable {
/// Define if the cell should be collapsable
public let collapsable: Collapsable?

/// If value should be centered
public let centered: Bool?

public enum Collapsable: String, Codable {
/// The cell should not be collapsable
case no = "NO"
Expand All @@ -332,7 +335,7 @@ public class WMTTemplates: Codable {
// MARK: - Internals

private enum Keys: String, CodingKey {
case style, name, visibleTitle, canCopy, collapsable
case style, name, visibleTitle, canCopy, collapsable, centered
}

public required init(from decoder: Decoder) throws {
Expand Down Expand Up @@ -382,14 +385,26 @@ public class WMTTemplates: Codable {
} else {
collapsable = nil
}

if c.contains(.centered) {
do {
centered = try c.decode(Bool.self, forKey: .centered)
} catch {
D.error("Failed to decode \(Keys.centered) - \(error), setting to null")
centered = nil
}
} else {
centered = nil
}
}

public init(style: String?, name: AttributeId, visibleTitle: Bool?, canCopy: Bool?, collapsable: Collapsable?) {
public init(style: String?, name: AttributeId, visibleTitle: Bool?, canCopy: Bool?, collapsable: Collapsable?, centered: Bool?) {
self.name = name
self.style = style
self.visibleTitle = visibleTitle
self.canCopy = canCopy
self.collapsable = collapsable
self.centered = centered
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion WultraMobileTokenSDKTests/IntegrationProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class IntegrationProxy {
typealias Callback = (_ error: String?) -> Void

func prepareActivation(pin: String, callback: @escaping Callback) {
WPNLogger.verboseLevel = .debug
WPNLogger.verboseLevel = .all
guard let configPath = Bundle.init(for: IntegrationProxy.self).path(forResource: "config", ofType: "json", inDirectory: "Configs") else {
callback("Config file config.json is not present.")
return
Expand Down
4 changes: 3 additions & 1 deletion WultraMobileTokenSDKTests/OperationUIDataTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class OperationUIDataTests: XCTestCase {
XCTAssertEqual(uiResult.templates?.detail?.sections?[0].title, "operation.money.header")
XCTAssertEqual(uiResult.templates?.detail?.sections?[0].cells?[0].style, nil)
XCTAssertEqual(uiResult.templates?.detail?.sections?[0].cells?[0].name, "operation.amount")
XCTAssertEqual(uiResult.templates?.detail?.sections?[0].cells?[0].centered, true)
XCTAssertEqual(uiResult.templates?.detail?.sections?[0].cells?[0].visibleTitle, false)
XCTAssertEqual(uiResult.templates?.detail?.sections?[0].cells?[0].canCopy, true)
XCTAssertEqual(uiResult.templates?.detail?.sections?[0].cells?[0].collapsable, .no)
Expand Down Expand Up @@ -489,7 +490,8 @@ class OperationUIDataTests: XCTestCase {
"visibleTitle": false,
"style": null,
"canCopy": true,
"collapsable": "NO"
"collapsable": "NO",
"centered": true
},
{
"style": "CONVERSION",
Expand Down

0 comments on commit a5d8c4a

Please sign in to comment.