@onekeyfe/react-native-native-list 6.7.0-alpha.354 → 6.7.0-alpha.362

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +0 -7
  2. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +7 -240
  3. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +4 -7
  4. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +3 -6
  5. package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +0 -12
  6. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +7 -87
  7. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +1 -135
  8. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +14 -43
  9. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +0 -25
  10. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +2 -17
  11. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +0 -22
  12. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +0 -2
  13. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +0 -2
  14. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +2 -3
  15. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +0 -69
  16. package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +1 -55
  17. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +21 -585
  18. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +0 -1
  19. package/docs/ROW_TEMPLATES.md +9 -60
  20. package/docs/SPEC.md +5 -317
  21. package/docs/STYLE_SPEC.md +0 -6
  22. package/ios/HybridNativeList.swift +0 -10
  23. package/ios/NativeListAccessoryStack.swift +37 -220
  24. package/ios/NativeListActivityDetailsView.swift +8 -18
  25. package/ios/NativeListActivityRenderer.swift +2 -8
  26. package/ios/NativeListDataRowRenderer.swift +8 -105
  27. package/ios/NativeListDesignAssets.swift +0 -3
  28. package/ios/NativeListIdentityRenderer.swift +4 -119
  29. package/ios/NativeListLeadingVisual.swift +14 -49
  30. package/ios/NativeListMessageRenderer.swift +1 -34
  31. package/ios/NativeListModels.swift +2 -16
  32. package/ios/NativeListRendererRegistry.swift +0 -1
  33. package/ios/NativeListResolvedText.swift +1 -2
  34. package/ios/NativeListRowHost.swift +0 -14
  35. package/ios/NativeListSectionHeaderRenderer.swift +0 -88
  36. package/ios/RNCNativeListView.swift +29 -331
  37. package/ios/tests/NativeListActivityPresentationTests.swift +0 -56
  38. package/ios/tests/NativeListLifecycleTests.swift +3 -890
  39. package/lib/module/NativeList.js +21 -39
  40. package/lib/module/NativeList.web.js +4 -51
  41. package/lib/module/models.js +0 -1
  42. package/lib/module/selection.js +1 -1
  43. package/lib/module/validation.js +8 -320
  44. package/lib/module/web/NativeListWebEngine.js +18 -373
  45. package/lib/module/web/templates/ActivityRowRenderer.js +7 -8
  46. package/lib/module/web/templates/DataRowRenderer.js +5 -40
  47. package/lib/module/web/templates/IdentityRowRenderer.js +4 -90
  48. package/lib/module/web/templates/MessageRowRenderer.js +2 -18
  49. package/lib/module/web/templates/RowContainerStyle.js +0 -1
  50. package/lib/module/web/templates/RowRendererRegistry.js +0 -3
  51. package/lib/module/web/templates/SectionHeaderRowRenderer.js +2 -36
  52. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +0 -9
  53. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +0 -2
  54. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +0 -5
  55. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +0 -6
  56. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +0 -7
  57. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +0 -6
  58. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +0 -1
  59. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +0 -11
  60. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +0 -2
  61. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +0 -2
  62. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +0 -2
  63. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +0 -3
  64. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +0 -1
  65. package/lib/typescript/src/NativeList.nitro.d.ts +0 -1
  66. package/lib/typescript/src/NativeList.types.d.ts +0 -8
  67. package/lib/typescript/src/models.d.ts +9 -101
  68. package/lib/typescript/src/validation.d.ts +0 -10
  69. package/lib/typescript/src/web/NativeListWebEngine.d.ts +0 -26
  70. package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
  71. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +3 -9
  72. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +0 -9
  73. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +0 -2
  74. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +0 -5
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +0 -6
  76. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +0 -7
  77. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +0 -6
  78. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +0 -1
  79. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +0 -11
  80. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +0 -2
  81. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +0 -2
  82. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +0 -2
  83. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +0 -3
  84. package/nitrogen/generated/shared/json/NativeListConfig.json +0 -1
  85. package/package.json +3 -3
  86. package/react-native-native-list.podspec +0 -1
  87. package/src/NativeList.nitro.ts +0 -1
  88. package/src/NativeList.tsx +24 -72
  89. package/src/NativeList.types.ts +0 -9
  90. package/src/NativeList.web.tsx +8 -72
  91. package/src/models.ts +3 -113
  92. package/src/selection.ts +0 -1
  93. package/src/validation.ts +6 -721
  94. package/src/web/NativeListWebEngine.ts +19 -568
  95. package/src/web/templates/ActivityRowRenderer.ts +6 -14
  96. package/src/web/templates/DataRowRenderer.ts +20 -93
  97. package/src/web/templates/IdentityRowRenderer.ts +5 -150
  98. package/src/web/templates/MessageRowRenderer.ts +7 -23
  99. package/src/web/templates/RowContainerStyle.ts +0 -2
  100. package/src/web/templates/RowRendererRegistry.ts +1 -11
  101. package/src/web/templates/SectionHeaderRowRenderer.ts +4 -47
  102. package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +0 -102
  103. package/ios/NativeListButtonGroupRenderer.swift +0 -89
  104. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/Contents.json +0 -15
  105. package/ios/Resources/NativeListIcons.xcassets/onekey_crypto_coin_outline.imageset/icon.svg +0 -4
  106. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/Contents.json +0 -15
  107. package/ios/Resources/NativeListIcons.xcassets/onekey_gas_solid.imageset/icon.svg +0 -3
  108. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/Contents.json +0 -15
  109. package/ios/Resources/NativeListIcons.xcassets/onekey_refresh_ccw_outline.imageset/icon.svg +0 -3
  110. package/lib/module/web/templates/ButtonGroupRowRenderer.js +0 -47
  111. package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +0 -14
  112. package/src/web/templates/ButtonGroupRowRenderer.ts +0 -58
@@ -6,7 +6,7 @@ final class NativeListDataRowCell: NativeListRendererCell {
6
6
  fonts: NativeListFontFamilies
7
7
  ) -> CGFloat? {
8
8
  let secondary = item.data.dictionaries("columns").contains {
9
- !nativeListDataColumnText($0, "secondaryText").isEmpty
9
+ !$0.string("secondaryText").isEmpty
10
10
  }
11
11
  return secondary ? 60 : layout == "table" ? 48 : 56
12
12
  }
@@ -14,7 +14,6 @@ final class NativeListDataRowCell: NativeListRendererCell {
14
14
  private let visual = NativeListLeadingVisual()
15
15
  private let favorite = UIImageView()
16
16
  private let accessories = NativeListAccessoryStack()
17
- private let trailingAccessories = NativeListAccessoryStack()
18
17
  private let columns = UIStackView()
19
18
  private let cells = (0..<4).map { _ in NativeListTableColumnView() }
20
19
  private var rowConstraints: [NSLayoutConstraint] = []
@@ -35,13 +34,10 @@ final class NativeListDataRowCell: NativeListRendererCell {
35
34
  columns.alignment = .center
36
35
  columns.spacing = 8
37
36
  cells.forEach(columns.addArrangedSubview)
38
- [favorite, visual, accessories, columns, trailingAccessories].forEach(root.addArrangedSubview)
37
+ [favorite, visual, accessories, columns].forEach(root.addArrangedSubview)
39
38
  accessories.onAction = { [weak self] key, view, slot, target in
40
39
  self?.emitAction(key, from: view, source: "trailingAccessory", slot: slot, target: target)
41
40
  }
42
- trailingAccessories.onAction = { [weak self] key, view, slot, target in
43
- self?.emitAction(key, from: view, source: "trailingAccessory", slot: slot, target: target)
44
- }
45
41
  }
46
42
  required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") }
47
43
  override func bindContent(
@@ -90,11 +86,6 @@ final class NativeListDataRowCell: NativeListRendererCell {
90
86
  item, descriptors: descriptors, theme: theme, style: accessoryStyle,
91
87
  checkboxState: checkboxState, fonts: fonts)
92
88
  accessories.isHidden = descriptors.isEmpty
93
- let trailing = data.dictionaries("trailing")
94
- trailingAccessories.bind(
95
- item, descriptors: trailing, theme: theme, style: style,
96
- checkboxState: checkboxState, fonts: fonts)
97
- trailingAccessories.isHidden = trailing.isEmpty
98
89
  NSLayoutConstraint.deactivate(rowConstraints)
99
90
  rowConstraints = [
100
91
  favorite.widthAnchor.constraint(equalToConstant: 20),
@@ -102,12 +93,6 @@ final class NativeListDataRowCell: NativeListRendererCell {
102
93
  visual.widthAnchor.constraint(equalToConstant: CGFloat(image.double("width", default: 40))),
103
94
  visual.heightAnchor.constraint(equalToConstant: CGFloat(image.double("height", default: 40))),
104
95
  ]
105
- if !trailing.isEmpty {
106
- // UIStackView has no intrinsic width of its own. Reserve the controls' fitted
107
- // width so extra space goes to the weighted columns instead of this stack.
108
- rowConstraints.append(trailingAccessories.widthAnchor.constraint(equalToConstant:
109
- trailingAccessories.systemLayoutSizeFitting(UIView.layoutFittingCompressedSize).width))
110
- }
111
96
  let values = Array(data.dictionaries("columns").prefix(4))
112
97
  for (index, cell) in cells.enumerated() {
113
98
  cell.isHidden = index >= values.count
@@ -124,8 +109,6 @@ final class NativeListDataRowCell: NativeListRendererCell {
124
109
  cell.applyStyle(style) { label, style in
125
110
  NativeListTextStyles.applyStyledText(label, style, fonts: fonts)
126
111
  }
127
- cell.applySegments(values[index])
128
- cell.bindTitleIcons(values[index], theme: theme)
129
112
  if index > 0 {
130
113
  rowConstraints.append(
131
114
  cell.widthAnchor.constraint(
@@ -139,14 +122,10 @@ final class NativeListDataRowCell: NativeListRendererCell {
139
122
  override func bindSelectionContent(
140
123
  _ item: NativeListItem,
141
124
  checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
142
- ) {
143
- accessories.updateSelection(item, checkboxState: checkboxState)
144
- trailingAccessories.updateSelection(item, checkboxState: checkboxState)
145
- }
125
+ ) { accessories.updateSelection(item, checkboxState: checkboxState) }
146
126
  override func recycleContent() {
147
127
  visual.recycle()
148
128
  accessories.reset()
149
- trailingAccessories.reset()
150
129
  cells.forEach { $0.reset() }
151
130
  }
152
131
  }
@@ -154,8 +133,6 @@ final class NativeListDataRowCell: NativeListRendererCell {
154
133
  private final class NativeListTableColumnView: UIStackView {
155
134
  private let primaryLine = UIStackView()
156
135
  private let primaryLabel = NativeListTextLabel()
157
- private let titleIconView = UIImageView()
158
- private let secondaryTitleIconView = UIImageView()
159
136
  private let badgesStack = UIStackView()
160
137
  private let secondaryLine = UIStackView()
161
138
  private let secondaryLeadingLabel = NativeListTextLabel()
@@ -175,21 +152,11 @@ private final class NativeListTableColumnView: UIStackView {
175
152
  primaryLabel.numberOfLines = 1
176
153
  primaryLabel.lineBreakMode = .byTruncatingTail
177
154
  primaryLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
178
- for icon in [titleIconView, secondaryTitleIconView] {
179
- icon.contentMode = .scaleAspectFit
180
- icon.translatesAutoresizingMaskIntoConstraints = false
181
- icon.widthAnchor.constraint(equalToConstant: 20).isActive = true
182
- icon.heightAnchor.constraint(equalToConstant: 20).isActive = true
183
- icon.setContentHuggingPriority(.required, for: .horizontal)
184
- icon.isHidden = true
185
- }
186
155
  badgesStack.axis = .horizontal
187
156
  badgesStack.alignment = .center
188
157
  badgesStack.spacing = 4
189
158
  badgesStack.setContentCompressionResistancePriority(.required, for: .horizontal)
190
159
  primaryLine.addArrangedSubview(primaryLabel)
191
- primaryLine.addArrangedSubview(titleIconView)
192
- primaryLine.addArrangedSubview(secondaryTitleIconView)
193
160
  primaryLine.addArrangedSubview(badgesStack)
194
161
 
195
162
  secondaryLine.axis = .horizontal
@@ -213,15 +180,6 @@ private final class NativeListTableColumnView: UIStackView {
213
180
 
214
181
  func reset() {
215
182
  linear = false
216
- primaryLine.alignment = .center
217
- for icon in [titleIconView, secondaryTitleIconView] {
218
- icon.image = nil
219
- icon.isHidden = true
220
- icon.accessibilityLabel = nil
221
- icon.isAccessibilityElement = false
222
- }
223
- primaryLine.setCustomSpacing(UIStackView.spacingUseDefault, after: primaryLabel)
224
- primaryLine.setCustomSpacing(UIStackView.spacingUseDefault, after: titleIconView)
225
183
  for label in [primaryLabel, secondaryLeadingLabel, secondaryLabel] {
226
184
  label.rowVerticalAlignment = nil
227
185
  label.rowOffsetY = 0
@@ -244,28 +202,6 @@ private final class NativeListTableColumnView: UIStackView {
244
202
  }
245
203
  }
246
204
 
247
- func bindTitleIcons(_ column: [String: Any], theme: [String: Any]?) {
248
- let descriptors = [column.dictionary("titleIcon"), column.dictionary("secondaryTitleIcon")]
249
- for (index, descriptor) in descriptors.enumerated() {
250
- guard let descriptor else { continue }
251
- let icon = index == 0 ? titleIconView : secondaryTitleIconView
252
- icon.image = nativeListIcon(named: descriptor.string("name"))
253
- icon.tintColor = UIColor(
254
- nativeListHex: descriptor.string("tintColor",
255
- default: theme?["iconSubdued"] as? String ?? "#8D8D8D"),
256
- fallback: .gray)
257
- icon.isHidden = false
258
- let label = descriptor.string("accessibilityLabel")
259
- icon.accessibilityLabel = label.isEmpty ? nil : label
260
- icon.isAccessibilityElement = !label.isEmpty
261
- }
262
- if descriptors.contains(where: { $0 != nil }) {
263
- primaryLine.setCustomSpacing(4, after: primaryLabel)
264
- primaryLine.setCustomSpacing(4, after: titleIconView)
265
- if linear { primaryLine.alignment = .top }
266
- }
267
- }
268
-
269
205
  func bind(
270
206
  column: [String: Any],
271
207
  badges: [[String: Any]],
@@ -292,7 +228,7 @@ private final class NativeListTableColumnView: UIStackView {
292
228
  secondaryLeadingLabel.font = nativeListFont(ofSize: 12, fonts: fonts)
293
229
  secondaryLabel.font = nativeListFont(ofSize: 12, fonts: fonts)
294
230
  primaryLabel.attributedText = line(
295
- nativeListDataColumnText(column, "text"),
231
+ column.string("text"),
296
232
  font: nativeListFont(ofSize: 14, weight: .medium, fonts: fonts),
297
233
  color: textColor(column.string("tone"), theme: theme),
298
234
  height: 20
@@ -325,7 +261,7 @@ private final class NativeListTableColumnView: UIStackView {
325
261
  secondaryLeadingLabel.isHidden = false
326
262
  secondaryLine.isHidden = false
327
263
  }
328
- let secondary = nativeListDataColumnText(column, "secondaryText")
264
+ let secondary = column.string("secondaryText")
329
265
  if !secondary.isEmpty {
330
266
  secondaryLabel.attributedText = line(
331
267
  secondary,
@@ -395,15 +331,14 @@ private final class NativeListTableColumnView: UIStackView {
395
331
  primaryLabel.textAlignment =
396
332
  column.string("alignment") == "end"
397
333
  ? .right : column.string("alignment") == "center" ? .center : .left
398
- let secondary = nativeListDataColumnText(column, "secondaryText")
334
+ let secondary = column.string("secondaryText")
399
335
  let primaryFont = font(primaryStyle, size: 14, weight: .medium)
400
336
  let attributed = NSMutableAttributedString(
401
- string: nativeListDataColumnText(column, "text"),
337
+ string: column.string("text"),
402
338
  attributes: [
403
339
  .font: primaryFont,
404
340
  .foregroundColor: color(primaryStyle, textColor(column.string("tone"), theme: theme)),
405
341
  ])
406
- attributed.setAttributedString(nativeListDataSegments(attributed, column.dictionaries("textSegments")))
407
342
  let primaryLength = attributed.length
408
343
  // Every badge run is the legacy " text " pill: both lead spaces sit inside the badge
409
344
  // background and are its left padding. `titleBadgeGap` adds an exact, unfilled gap between
@@ -443,10 +378,7 @@ private final class NativeListTableColumnView: UIStackView {
443
378
  textColor(column.string("secondaryTone", default: "secondary"), theme: theme)),
444
379
  ]
445
380
  attributes.merge(paragraph(secondaryStyle, font: secondaryFont, spacing: nil)) { $1 }
446
- attributed.append(NSAttributedString(string: "\n", attributes: attributes))
447
- attributed.append(nativeListDataSegments(
448
- NSAttributedString(string: secondary, attributes: attributes),
449
- column.dictionaries("secondaryTextSegments")))
381
+ attributed.append(NSAttributedString(string: "\n\(secondary)", attributes: attributes))
450
382
  lines = min(3, lines + max(1, secondaryStyle.int("lines", default: 1)))
451
383
  }
452
384
  primaryLabel.font = nativeListFont(ofSize: 12, fonts: fonts)
@@ -468,16 +400,6 @@ private final class NativeListTableColumnView: UIStackView {
468
400
  primaryStyle.double("offsetY", default: secondaryStyle.double("offsetY")))
469
401
  }
470
402
 
471
- func applySegments(_ column: [String: Any]) {
472
- guard !linear else { return }
473
- if let text = primaryLabel.attributedText {
474
- primaryLabel.attributedText = nativeListDataSegments(text, column.dictionaries("textSegments"))
475
- }
476
- if let text = secondaryLabel.attributedText {
477
- secondaryLabel.attributedText = nativeListDataSegments(text, column.dictionaries("secondaryTextSegments"))
478
- }
479
- }
480
-
481
403
  func applyStyle(_ style: [String: Any], text: (UILabel, [String: Any]) -> Void) {
482
404
  // The linear single label already mapped its styles onto attributed ranges.
483
405
  guard !linear else { return }
@@ -524,22 +446,3 @@ private final class NativeListTableColumnView: UIStackView {
524
446
  }
525
447
  }
526
448
  }
527
-
528
- private func nativeListDataColumnText(_ column: [String: Any], _ field: String) -> String {
529
- let segments = column.dictionaries("\(field)Segments")
530
- return segments.isEmpty ? column.string(field) : segments.map { $0.string("text") }.joined()
531
- }
532
-
533
- private func nativeListDataSegments(_ fallback: NSAttributedString, _ segments: [[String: Any]]) -> NSAttributedString {
534
- guard !segments.isEmpty, fallback.length > 0 else { return fallback }
535
- let attributes = fallback.attributes(at: 0, effectiveRange: nil)
536
- let result = NSMutableAttributedString(string: "")
537
- for segment in segments {
538
- var runAttributes = attributes
539
- if segment.string("style") == "subscript", let font = attributes[.font] as? UIFont {
540
- runAttributes[.font] = font.withSize(ceil(font.pointSize * 0.6))
541
- }
542
- result.append(NSAttributedString(string: segment.string("text"), attributes: runAttributes))
543
- }
544
- return result
545
- }
@@ -110,9 +110,6 @@ func nativeListIcon(named name: String) -> UIImage? {
110
110
  case "LockSolid": assetName = "onekey_selector_lock_solid"
111
111
  // OneKey patch: official selector icon geometry.
112
112
  case "GlobusOutline": assetName = "onekey_selector_globus_outline"
113
- case "GasSolid": assetName = "onekey_gas_solid"
114
- case "RefreshCcwOutline": assetName = "onekey_refresh_ccw_outline"
115
- case "CryptoCoinOutline": assetName = "onekey_crypto_coin_outline"
116
113
  case "ArrowBottomOutline": assetName = "onekey_arrow_bottom"
117
114
  case "ArrowTopOutline": assetName = "onekey_arrow_top"
118
115
  case "ChartTrendingUpOutline": assetName = "onekey_chart_trending_up"
@@ -12,35 +12,6 @@ final class NativeListIdentityCell: NativeListRendererCell {
12
12
  return item.data.dictionaries("badges").isEmpty ? 68 : 92
13
13
  }
14
14
  if item.data.string("presentation") == "networkSelector" { return 47 }
15
- if item.data.string("contentHeight") == "auto" {
16
- let style = item.data.dictionary("style") ?? [:]
17
- let horizontalPadding = CGFloat(style.double("horizontalPadding", default: layout == "table" ? 16 : 12))
18
- let verticalPadding = CGFloat(style.double("verticalPadding", default: 8))
19
- let imageWidth = CGFloat(style.dictionary("image")?.double("width", default: 40) ?? 40)
20
- let imageHeight = CGFloat(style.dictionary("image")?.double("height", default: 40) ?? 40)
21
- let leadingGap = CGFloat(style.double("leadingGap", default: 12))
22
- let trailingWidth: CGFloat = item.data.dictionaries("trailing").isEmpty ? 0 : 48
23
- let textWidth = max(1, width - horizontalPadding * 2 - imageWidth - leadingGap - trailingWidth - 12)
24
- let title = NativeListResolvedText(
25
- item.data.string("title"), style: style.dictionary("title"), size: 16,
26
- weight: .medium, color: .black, lineHeight: 24,
27
- lines: item.data.int("titleLines", default: 1), fonts: fonts)
28
- let subtitle = NativeListResolvedText(
29
- item.data.string("subtitle"), style: style.dictionary("subtitle"), size: 14,
30
- color: .black, lineHeight: 20,
31
- lines: item.data.int("subtitleLines", default: 1),
32
- breakMode: item.data.int("subtitleLines", default: 1) == 0 ? .byWordWrapping : .byTruncatingTail,
33
- fonts: fonts)
34
- let tertiary = NativeListResolvedText(
35
- item.data.string("tertiary"), style: style.dictionary("tertiary"), size: 14,
36
- color: .black, lineHeight: 20, lines: 1, fonts: fonts)
37
- let textHeight = title.measure(width: textWidth)
38
- + subtitle.measure(width: textWidth)
39
- + tertiary.measure(width: textWidth)
40
- + (item.data.string("subtitle").isEmpty ? 0 : CGFloat(style.double("lineGap", default: 0)))
41
- return max(item.data.string("subtitle").isEmpty ? 56 : 60,
42
- verticalPadding * 2 + max(imageHeight, textHeight))
43
- }
44
15
  return !item.data.string("tertiary").isEmpty
45
16
  ? 72 : !item.data.string("subtitle").isEmpty ? 60 : 56
46
17
  }
@@ -49,7 +20,6 @@ final class NativeListIdentityCell: NativeListRendererCell {
49
20
  private let mainStack = UIStackView()
50
21
  private let titleRowStack = UIStackView()
51
22
  private let titleLabel = NativeListTextLabel()
52
- private let titleIconView = UIImageView()
53
23
  private let subtitleLabel = NativeListTextLabel()
54
24
  private let tertiaryLabel = NativeListTextLabel()
55
25
  private let badgeLabel = NativeListInsetLabel()
@@ -105,17 +75,7 @@ final class NativeListIdentityCell: NativeListRendererCell {
105
75
  titleRowStack.axis = .horizontal
106
76
  titleRowStack.alignment = .center
107
77
  titleRowStack.addArrangedSubview(titleLabel)
108
- titleRowStack.addArrangedSubview(titleIconView)
109
78
  titleRowStack.addArrangedSubview(badgeLabel)
110
- titleIconView.translatesAutoresizingMaskIntoConstraints = false
111
- let titleIconWidth = titleIconView.widthAnchor.constraint(equalToConstant: 20)
112
- titleIconWidth.priority = UILayoutPriority(999)
113
- NSLayoutConstraint.activate([
114
- titleIconWidth,
115
- titleIconView.heightAnchor.constraint(equalToConstant: 20),
116
- ])
117
- titleIconView.contentMode = .scaleAspectFit
118
- titleIconView.setContentHuggingPriority(.required, for: .horizontal)
119
79
  [titleRowStack, subtitleLabel, tertiaryLabel].forEach(mainStack.addArrangedSubview)
120
80
  visual.translatesAutoresizingMaskIntoConstraints = false
121
81
  leadingWidth = visual.widthAnchor.constraint(equalToConstant: 40)
@@ -173,10 +133,6 @@ final class NativeListIdentityCell: NativeListRendererCell {
173
133
  titleRowStack.setCustomSpacing(UIStackView.spacingUseDefault, after: $0)
174
134
  }
175
135
  titleRowStack.spacing = 8
176
- titleIconView.image = nil
177
- titleIconView.isHidden = true
178
- titleIconView.accessibilityLabel = nil
179
- titleIconView.isAccessibilityElement = false
180
136
  titleRowStack.setContentHuggingPriority(.defaultLow, for: .horizontal)
181
137
  titleRowStack.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
182
138
  for label in [titleLabel, subtitleLabel, tertiaryLabel, badgeLabel] {
@@ -209,10 +165,6 @@ final class NativeListIdentityCell: NativeListRendererCell {
209
165
  leadingWidth.constant = 40
210
166
  leadingHeight.constant = 40
211
167
  visual.glyphSize = 18
212
- visual.bitmapBorderWidth =
213
- item.data.dictionary("leading")?.string("borderColor").isEmpty == false
214
- && item.data.dictionary("leading")?.string("borderStyle") != "dashed"
215
- ? 1 : 0
216
168
  fallbackLabel.attributedText = nil
217
169
  fallbackLabel.font = nativeListFont(ofSize: 13, weight: .bold, fonts: fonts)
218
170
  trailingStack.reset()
@@ -223,31 +175,6 @@ final class NativeListIdentityCell: NativeListRendererCell {
223
175
  leadingActionButton.setImage(nil, for: .normal)
224
176
  bindIdentity(item, theme: theme, selected: item.data.bool("selected"), checkboxState)
225
177
  let style = item.data.dictionary("style") ?? [:]
226
- if let titleIcon = item.data.dictionary("titleIcon") {
227
- titleIconView.image = nativeListIcon(named: titleIcon.string("name"))
228
- titleIconView.tintColor = UIColor(
229
- nativeListHex: titleIcon.string("tintColor",
230
- default: theme?["iconSubdued"] as? String ?? "#8D8D8D"),
231
- fallback: .gray)
232
- titleIconView.isHidden = false
233
- let label = titleIcon.string("accessibilityLabel")
234
- titleIconView.accessibilityLabel = label.isEmpty ? nil : label
235
- titleIconView.isAccessibilityElement = !label.isEmpty
236
- titleRowStack.setCustomSpacing(4, after: titleLabel)
237
- }
238
- if let ratio = style["leadingContentMaxWidthRatio"] as? NSNumber,
239
- root.arrangedSubviews.contains(visual)
240
- {
241
- titleLabel.setContentCompressionResistancePriority(.defaultHigh, for: .horizontal)
242
- let visualWidth = CGFloat(style.dictionary("image")?.double("width", default: 40) ?? 40)
243
- let leadingGap = CGFloat(style.double("leadingGap", default: 12))
244
- let constraint = mainStack.widthAnchor.constraint(
245
- lessThanOrEqualTo: root.widthAnchor,
246
- multiplier: CGFloat(ratio.doubleValue),
247
- constant: -(visualWidth + leadingGap))
248
- constraint.isActive = true
249
- selectorConstraints.append(constraint)
250
- }
251
178
  if style["horizontalPadding"] != nil {
252
179
  leftInset = CGFloat(style.double("horizontalPadding"))
253
180
  rightInset = -leftInset
@@ -269,9 +196,7 @@ final class NativeListIdentityCell: NativeListRendererCell {
269
196
  if walletBadgeLine != nil {
270
197
  mainStack.setCustomSpacing(CGFloat(style.double("titleBadgeGap")), after: titleRowStack)
271
198
  } else {
272
- titleRowStack.setCustomSpacing(
273
- CGFloat(style.double("titleBadgeGap")),
274
- after: titleIconView.isHidden ? titleLabel : titleIconView)
199
+ titleRowStack.setCustomSpacing(CGFloat(style.double("titleBadgeGap")), after: titleLabel)
275
200
  }
276
201
  }
277
202
  if style["trailingGap"] != nil { trailingStack.spacing = CGFloat(style.double("trailingGap")) }
@@ -515,37 +440,9 @@ final class NativeListIdentityCell: NativeListRendererCell {
515
440
  }
516
441
  root.addArrangedSubview(mainStack)
517
442
  show(titleLabel, item.data.string("title"), lines: item.data.int("titleLines", default: 1))
518
- let titleSuffixes = item.data.dictionaries("titleSuffixes")
519
- if !titleSuffixes.isEmpty {
520
- titleLabel.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
521
- let minimumTitleWidth = titleLabel.widthAnchor.constraint(greaterThanOrEqualToConstant: 80)
522
- minimumTitleWidth.priority = UILayoutPriority(751)
523
- minimumTitleWidth.isActive = true
524
- selectorConstraints.append(minimumTitleWidth)
525
- for suffix in titleSuffixes {
526
- let label = NativeListTextLabel()
527
- label.font = nativeListFont(ofSize: 12, fonts: fonts)
528
- label.textColor = dataTextColor(suffix.string("tone", default: "secondary"), theme: theme)
529
- label.numberOfLines = 1
530
- label.lineBreakMode = .byTruncatingTail
531
- label.setContentHuggingPriority(.defaultHigh, for: .horizontal)
532
- label.setContentCompressionResistancePriority(UILayoutPriority(749), for: .horizontal)
533
- setLineHeight(label, text: suffix.string("text"), lineHeight: 16)
534
- if let maxWidth = suffix["maxWidth"] as? NSNumber {
535
- let limit = label.widthAnchor.constraint(lessThanOrEqualToConstant: CGFloat(truncating: maxWidth))
536
- limit.isActive = true
537
- selectorConstraints.append(limit)
538
- }
539
- titleRowStack.insertArrangedSubview(label, at: titleRowStack.arrangedSubviews.count - 1)
540
- selectorViews.append(label)
541
- }
542
- }
543
443
  show(
544
444
  subtitleLabel, item.data.string("subtitle"), lines: item.data.int("subtitleLines", default: 1)
545
445
  )
546
- if item.data.int("subtitleLines", default: 1) == 0 {
547
- subtitleLabel.lineBreakMode = .byWordWrapping
548
- }
549
446
  show(tertiaryLabel, item.data.string("tertiary"), lines: 1)
550
447
  if !item.data.string("subtitle").isEmpty, item.data.string("tertiary").isEmpty {
551
448
  mainStack.spacing = 0
@@ -672,17 +569,6 @@ final class NativeListIdentityCell: NativeListRendererCell {
672
569
  trailingStack.axis = .horizontal
673
570
  trailingStack.alignment = .center
674
571
  trailingStack.spacing = 8
675
- } else if accessories.count == 2,
676
- (accessories[0].string("kind") == "valuePair"
677
- && accessories[1].string("kind") == "chevron")
678
- || (accessories[0].string("kind") == "icon"
679
- && accessories[0].string("name") == "RefreshCcwOutline"
680
- && accessories[0].string("actionKey").isEmpty
681
- && accessories[1].string("kind") == "chevron")
682
- {
683
- trailingStack.axis = .horizontal
684
- trailingStack.alignment = .center
685
- trailingStack.spacing = 12
686
572
  } else if accessories.count == 2,
687
573
  accessories[0].string("kind") == "icon",
688
574
  accessories[0].string("name") == "PencilOutline",
@@ -704,13 +590,12 @@ final class NativeListIdentityCell: NativeListRendererCell {
704
590
  trailingStack.isHidden = false
705
591
  if let gap = trailingStack.contentGap { root.setCustomSpacing(gap, after: mainStack) }
706
592
  if let inset = trailingStack.endInset { rightInset = -inset }
707
- if accessories.count == 1,
708
- (item.data.string("presentation") == "accountSelector"
709
- || accessories[0].string("kind") == "valuePair"),
593
+ if item.data.string("presentation") == "accountSelector",
594
+ accessories.count == 1,
710
595
  let accessory = trailingStack.firstVisibleControl
711
596
  {
712
597
  // The vertical trailing stack has no stable intrinsic width, so keep its
713
- // flexible space in the title and subtitle column.
598
+ // flexible space in the account title and subtitle column.
714
599
  let width = trailingStack.widthAnchor.constraint(equalTo: accessory.widthAnchor)
715
600
  width.isActive = true
716
601
  selectorConstraints.append(width)
@@ -21,7 +21,6 @@ final class NativeListLeadingVisual: UIView {
21
21
  private let cornerBackdrop = UIView()
22
22
  private var slots: [NativeListImageSlot] = []
23
23
  private var overlaySlots: [NativeListImageSlot] = []
24
- private var overlayFallbackIcons: [UIImageView] = []
25
24
  private var overlays: [(UIView, [String: Any])] = []
26
25
  private let dashedBorder = CAShapeLayer()
27
26
  private var visual: [String: Any] = [:]
@@ -88,7 +87,6 @@ final class NativeListLeadingVisual: UIView {
88
87
  }
89
88
  let placeholder = theme?.string("strongBackground", default: "#0000000F") ?? "#0000000F"
90
89
  let fallbackIcon = visual.dictionary("fallbackIcon")
91
- let fallbackBackground = fallbackIcon?.string("backgroundColor", default: placeholder) ?? placeholder
92
90
  let sourceFallback =
93
91
  kind != "icon" && !sources.isEmpty
94
92
  && sources[0].0.string("loadingStrategy", default: "none") != "none"
@@ -97,8 +95,7 @@ final class NativeListLeadingVisual: UIView {
97
95
  let restored = fallbackKey.map(NativeListSourceFallbackState.has) ?? false
98
96
  let fallbackData = kind == "icon" ? visual : fallbackIcon
99
97
  fallback.text = String(visual.string("fallbackText").prefix(2))
100
- fallback.textColor = UIColor(
101
- nativeListHex: visual.string("fallbackTextColor", default: "#8D8D8D"), fallback: .gray)
98
+ fallback.textColor = UIColor(nativeListHex: "#8D8D8D", fallback: .gray)
102
99
  icon.image = fallbackData.map { nativeListIcon(named: $0.string("name")) } ?? nil
103
100
  icon.tintColor = UIColor(
104
101
  nativeListHex: fallbackData?.string("tintColor", default: "#646464") ?? "#646464",
@@ -109,9 +106,7 @@ final class NativeListLeadingVisual: UIView {
109
106
  nativeListHex: visual.string(
110
107
  "backgroundColor", default: sources.isEmpty ? placeholder : "#00000000"), fallback: .clear)
111
108
  backgroundColor =
112
- sources.isEmpty && fallbackIcon?["backgroundColor"] != nil || restored
113
- ? UIColor(nativeListHex: fallbackBackground, fallback: .clear)
114
- : sourceFallback ? UIColor(nativeListHex: placeholder, fallback: .clear) : visualBackground
109
+ sourceFallback ? UIColor(nativeListHex: placeholder, fallback: .clear) : visualBackground
115
110
  layer.borderWidth = kind == "icon" ? 1 / UIScreen.main.scale : 0
116
111
  layer.borderColor = UIColor(nativeListHex: "#0000001F", fallback: .clear).cgColor
117
112
  if bitmapBorderWidth > 0 {
@@ -126,7 +121,7 @@ final class NativeListLeadingVisual: UIView {
126
121
  continue
127
122
  }
128
123
  let source = sources[index]
129
- slot.view.isHidden = index > 0 || restored
124
+ slot.view.isHidden = index > 0 || sourceFallback
130
125
  slot.bind(
131
126
  source.0, key: "\(key):leading:\(index)", variant: source.1,
132
127
  fit: index == 0 ? style["contentFit"] as? String : nil, placeholder: placeholder
@@ -141,7 +136,7 @@ final class NativeListLeadingVisual: UIView {
141
136
  }
142
137
  }
143
138
  self.backgroundColor =
144
- loaded ? visualBackground : UIColor(nativeListHex: fallbackBackground, fallback: .clear)
139
+ loaded ? visualBackground : UIColor(nativeListHex: placeholder, fallback: .clear)
145
140
  self.fallback.isHidden = loaded || fallbackIcon != nil
146
141
  self.icon.isHidden = loaded || fallbackIcon == nil
147
142
  }
@@ -163,17 +158,8 @@ final class NativeListLeadingVisual: UIView {
163
158
  overlays.removeAll(keepingCapacity: true)
164
159
  let descriptors = Array(visual.dictionaries("overlays").prefix(2))
165
160
  while overlaySlots.count < descriptors.count { overlaySlots.append(NativeListImageSlot()) }
166
- while overlayFallbackIcons.count < descriptors.count { overlayFallbackIcons.append(UIImageView()) }
167
161
  for (index, data) in descriptors.enumerated() {
168
162
  let frame = index < previousOverlays.count ? previousOverlays[index].0 : UIView()
169
- let fallbackData = data.dictionary("fallbackIcon")
170
- let fallbackGlyph = overlayFallbackIcons[index]
171
- fallbackGlyph.image = fallbackData.flatMap { nativeListIcon(named: $0.string("name")) }
172
- fallbackGlyph.tintColor = UIColor(
173
- nativeListHex: fallbackData?.string("tintColor", default: "#646464") ?? "#646464",
174
- fallback: .darkGray)
175
- fallbackGlyph.contentMode = .scaleAspectFit
176
- fallbackGlyph.isHidden = true
177
163
  frame.clipsToBounds = true
178
164
  frame.backgroundColor = UIColor(
179
165
  nativeListHex: data.string(
@@ -186,9 +172,7 @@ final class NativeListLeadingVisual: UIView {
186
172
  child = slot.view
187
173
  child.isHidden = true
188
174
  slot.bind(image, key: "\(key):overlay:\(index)", placeholder: placeholder) {
189
- [weak child, weak fallbackGlyph] loaded in
190
- child?.isHidden = !loaded
191
- fallbackGlyph?.isHidden = loaded || fallbackData == nil
175
+ [weak child] loaded in child?.isHidden = !loaded
192
176
  }
193
177
  } else if !data.string("text").isEmpty {
194
178
  overlaySlots[index].recycle()
@@ -197,10 +181,7 @@ final class NativeListLeadingVisual: UIView {
197
181
  label.textAlignment = .center
198
182
  // A line-height box is the legacy wallet text badge: regular weight, centered metrics.
199
183
  label.font = nativeListFont(
200
- ofSize: overlayTextFontSize,
201
- weight: NativeListTextStyles.marketFontWeight(
202
- data.string("fontWeight"),
203
- fallback: overlayTextLineHeight == nil ? .medium : .regular),
184
+ ofSize: overlayTextFontSize, weight: overlayTextLineHeight == nil ? .medium : .regular,
204
185
  fonts: fonts)
205
186
  if let line = overlayTextLineHeight {
206
187
  let paragraph = NSMutableParagraphStyle()
@@ -226,9 +207,10 @@ final class NativeListLeadingVisual: UIView {
226
207
  nativeListHex: data.string("tintColor", default: "#646464"), fallback: .darkGray)
227
208
  child = glyph
228
209
  }
229
- frame.subviews.forEach { $0.removeFromSuperview() }
230
- frame.addSubview(child)
231
- if data.dictionary("image") != nil && fallbackData != nil { frame.addSubview(fallbackGlyph) }
210
+ if child.superview !== frame {
211
+ frame.subviews.forEach { $0.removeFromSuperview() }
212
+ frame.addSubview(child)
213
+ }
232
214
  if frame.superview == nil { addSubview(frame) }
233
215
  overlays.append((frame, data))
234
216
  }
@@ -271,16 +253,10 @@ final class NativeListLeadingVisual: UIView {
271
253
  }
272
254
  fallback.frame = bounds
273
255
  let fallbackIcon = visual.dictionary("fallbackIcon")
274
- let explicitFallbackSize: CGFloat? = fallbackIcon.flatMap { data in
275
- guard data["size"] != nil else { return nil }
276
- let size = data.double("size")
277
- return size > 0 ? CGFloat(size) : nil
278
- }
279
256
  let iconSize: CGFloat =
280
- explicitFallbackSize
281
- ?? (!sources.isEmpty && fallbackIcon != nil
257
+ !sources.isEmpty && fallbackIcon != nil
282
258
  ? min(bounds.width, bounds.height)
283
- * (fallbackIcon?.string("name") == "GlobusOutline" ? 1.2 : 1) : glyphSize)
259
+ * (fallbackIcon?.string("name") == "GlobusOutline" ? 1.2 : 1) : glyphSize
284
260
  icon.frame = CGRect(
285
261
  x: (bounds.width - iconSize) / 2, y: (bounds.height - iconSize) / 2, width: iconSize,
286
262
  height: iconSize)
@@ -330,8 +306,7 @@ final class NativeListLeadingVisual: UIView {
330
306
  cornerBackdrop.frame = networkBackdrop.frame
331
307
  corner.frame = cornerBackdrop.frame.insetBy(dx: 1, dy: 1)
332
308
  unread.frame = logical(CGRect(x: bounds.width - 8, y: 0, width: 8, height: 8))
333
- for (index, overlay) in overlays.enumerated() {
334
- let (frame, data) = overlay
309
+ for (frame, data) in overlays {
335
310
  let size = CGFloat(data.double("size", default: 20))
336
311
  // Legacy wallet text badges size to their text (tabular 12pt + 4) at the line height.
337
312
  let textBadgeLine =
@@ -356,19 +331,9 @@ final class NativeListLeadingVisual: UIView {
356
331
  height: height))
357
332
  frame.layer.cornerRadius = min(width, height) / 2
358
333
  let inset = CGFloat(data.double("padding", default: 0))
359
- let contentFrame = frame.bounds.insetBy(
334
+ frame.subviews.first?.frame = frame.bounds.insetBy(
360
335
  dx: data["text"] != nil ? overlayTextHorizontalInset ?? inset : inset,
361
336
  dy: data["text"] != nil && overlayTextHorizontalInset != nil ? 0 : inset)
362
- frame.subviews.forEach { $0.frame = contentFrame }
363
- let slot = overlaySlots[index].view
364
- if data.dictionary("image") != nil {
365
- let circularImage = inset > 0 && width == height
366
- slot.layer.cornerRadius = circularImage ? min(contentFrame.width, contentFrame.height) / 2 : 0
367
- slot.clipsToBounds = circularImage
368
- } else {
369
- slot.layer.cornerRadius = 0
370
- slot.clipsToBounds = false
371
- }
372
337
  }
373
338
  dashedBorder.isHidden = visual.string("borderStyle") != "dashed"
374
339
  dashedBorder.strokeColor =
@@ -29,9 +29,7 @@ enum NativeListMessageRenderer {
29
29
  body = NativeListResolvedText(
30
30
  item.data.string("body"), style: style.dictionary("body"), size: 14,
31
31
  color: nativeListColor(theme, "secondaryText", "#646464"), lineHeight: 20,
32
- lines: item.data.int("bodyLines", default: 3),
33
- breakMode: item.data.int("bodyLines", default: 3) == 0 ? .byWordWrapping : .byTruncatingTail,
34
- fonts: fonts)
32
+ lines: item.data.int("bodyLines", default: 3), fonts: fonts)
35
33
  time = NativeListResolvedText(
36
34
  item.data.string("time"), style: style.dictionary("time"), size: 12,
37
35
  color: nativeListColor(theme, "disabledText", "#8D8D8D"), lineHeight: 16, lines: 1,
@@ -152,11 +150,6 @@ enum NativeListMessageRenderer {
152
150
  }
153
151
 
154
152
  final class NativeListMessageCell: NativeListRendererCell {
155
- private let topWarningBorder = CALayer()
156
- private let bottomWarningBorder = CALayer()
157
- private var warningBorderWidth: CGFloat = 0
158
- private var warningBorderColor = UIColor.clear
159
- private var isInlineWarning = false
160
153
  override class func measure(
161
154
  _ item: NativeListItem, width: CGFloat, theme: [String: Any]?, layout: String,
162
155
  fonts: NativeListFontFamilies
@@ -174,10 +167,6 @@ final class NativeListMessageCell: NativeListRendererCell {
174
167
  _ item: NativeListItem, theme: [String: Any]?, layout: String,
175
168
  checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
176
169
  ) {
177
- let container = item.data.dictionary("style")?.dictionary("container") ?? [:]
178
- isInlineWarning = item.data.string("presentation") == "inlineWarning"
179
- warningBorderWidth = isInlineWarning ? CGFloat(container.double("borderWidth")) : 0
180
- warningBorderColor = UIColor(nativeListHex: container.string("borderColor"), fallback: .clear)
181
170
  let resolved = NativeListMessageRenderer.Resolved(
182
171
  item, theme: theme, layout: layout, fonts: fonts)
183
172
  views.bind(resolved, item: item, theme: theme, fonts: fonts)
@@ -185,27 +174,5 @@ final class NativeListMessageCell: NativeListRendererCell {
185
174
  top: resolved.verticalPadding, left: resolved.horizontalPadding,
186
175
  bottom: resolved.verticalPadding, right: resolved.horizontalPadding)
187
176
  }
188
- override func applyAppearance() {
189
- super.applyAppearance()
190
- if isInlineWarning {
191
- layer.cornerRadius = 0
192
- contentView.layer.cornerRadius = 0
193
- contentView.layer.borderWidth = 0
194
- topWarningBorder.backgroundColor = warningBorderColor.cgColor
195
- bottomWarningBorder.backgroundColor = warningBorderColor.cgColor
196
- if topWarningBorder.superlayer == nil { contentView.layer.addSublayer(topWarningBorder) }
197
- if bottomWarningBorder.superlayer == nil { contentView.layer.addSublayer(bottomWarningBorder) }
198
- } else {
199
- topWarningBorder.removeFromSuperlayer()
200
- bottomWarningBorder.removeFromSuperlayer()
201
- }
202
- }
203
- override func layoutSubviews() {
204
- super.layoutSubviews()
205
- let height = max(0, warningBorderWidth)
206
- topWarningBorder.frame = CGRect(x: 0, y: 0, width: contentView.bounds.width, height: height)
207
- bottomWarningBorder.frame = CGRect(
208
- x: 0, y: contentView.bounds.height - height, width: contentView.bounds.width, height: height)
209
- }
210
177
  override func recycleContent() { views.recycle() }
211
178
  }