@onekeyfe/react-native-native-list 6.7.0-5 → 6.7.0-50

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 (214) hide show
  1. package/README.md +312 -375
  2. package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
  3. package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +250 -9
  4. package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +35 -7
  5. package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +25 -3
  6. package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +17 -1
  7. package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +102 -0
  8. package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +12 -0
  9. package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +102 -7
  10. package/android/src/main/java/com/onekey/nativelist/NativeListGeneratedIcons.kt +47 -0
  11. package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +225 -11
  12. package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +152 -33
  13. package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +92 -28
  14. package/android/src/main/java/com/onekey/nativelist/NativeListMediaPlaceholderView.kt +244 -0
  15. package/android/src/main/java/com/onekey/nativelist/NativeListMediaPreviewSlot.kt +66 -31
  16. package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +32 -11
  17. package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
  18. package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +149 -3
  19. package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +120 -287
  20. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
  21. package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +7 -0
  22. package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +3 -2
  23. package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
  24. package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +55 -1
  25. package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1978 -136
  26. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +35 -0
  27. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +36 -0
  28. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingSlotFrameTest.kt +68 -0
  29. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingVisualClipPolicyTest.kt +44 -0
  30. package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +10 -0
  31. package/docs/ROW_TEMPLATES.md +74 -13
  32. package/docs/SPEC.md +1232 -16
  33. package/docs/STYLE_SPEC.md +14 -0
  34. package/ios/HybridNativeList.swift +21 -2
  35. package/ios/NativeListAccessoryStack.swift +237 -51
  36. package/ios/NativeListActivityDetailsView.swift +30 -11
  37. package/ios/NativeListActivityRenderer.swift +8 -2
  38. package/ios/NativeListButtonGroupRenderer.swift +89 -0
  39. package/ios/NativeListDataRowRenderer.swift +167 -30
  40. package/ios/NativeListDesignAssets.swift +13 -75
  41. package/ios/NativeListGeneratedIcons.swift +55 -0
  42. package/ios/NativeListIconBinding.swift +171 -0
  43. package/ios/NativeListIdentityRenderer.swift +256 -39
  44. package/ios/NativeListLeadingVisual.swift +127 -28
  45. package/ios/NativeListMarketRenderer.swift +120 -31
  46. package/ios/NativeListMediaPlaceholderView.swift +189 -0
  47. package/ios/NativeListMediaPreviewSlot.swift +122 -61
  48. package/ios/NativeListMediaTileRenderer.swift +15 -11
  49. package/ios/NativeListMessageRenderer.swift +34 -1
  50. package/ios/NativeListMetricCardRenderer.swift +4 -2
  51. package/ios/NativeListModels.swift +42 -2
  52. package/ios/NativeListRendererRegistry.swift +1 -0
  53. package/ios/NativeListResolvedText.swift +2 -1
  54. package/ios/NativeListRowHost.swift +14 -0
  55. package/ios/NativeListSectionHeaderRenderer.swift +100 -4
  56. package/ios/RNCNativeListView.swift +1093 -59
  57. package/ios/tests/NativeListAccessoryStackTests.swift +101 -0
  58. package/ios/tests/NativeListAccountSelectorLayoutTests.swift +96 -0
  59. package/ios/tests/NativeListActivityPresentationTests.swift +153 -0
  60. package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
  61. package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
  62. package/ios/tests/NativeListLifecycleTests.swift +2915 -4
  63. package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
  64. package/ios/tests/NativeListMediaVisibilityTests.swift +26 -1
  65. package/ios/tests/NativeListSharedIconTests.swift +236 -0
  66. package/lib/module/NativeList.js +236 -38
  67. package/lib/module/NativeList.web.js +167 -46
  68. package/lib/module/index.js +1 -1
  69. package/lib/module/models.js +3 -0
  70. package/lib/module/selection.js +1 -1
  71. package/lib/module/validation.js +1246 -48
  72. package/lib/module/web/NativeListGeneratedIcons.js +31 -0
  73. package/lib/module/web/NativeListWebEngine.js +513 -275
  74. package/lib/module/web/templates/ActivityRowRenderer.js +12 -31
  75. package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
  76. package/lib/module/web/templates/DataRowRenderer.js +40 -5
  77. package/lib/module/web/templates/IdentityRowRenderer.js +158 -6
  78. package/lib/module/web/templates/MarketTableRowRenderer.js +36 -19
  79. package/lib/module/web/templates/MediaTileRowRenderer.js +84 -25
  80. package/lib/module/web/templates/MessageRowRenderer.js +18 -2
  81. package/lib/module/web/templates/RowContainerStyle.js +1 -0
  82. package/lib/module/web/templates/RowRendererRegistry.js +3 -0
  83. package/lib/module/web/templates/SectionHeaderRowRenderer.js +36 -2
  84. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  85. package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  86. package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  87. package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  88. package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  89. package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  90. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  91. package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  92. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  93. package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  94. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  95. package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  96. package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  97. package/lib/typescript/src/NativeList.d.ts +3 -3
  98. package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
  99. package/lib/typescript/src/NativeList.types.d.ts +20 -2
  100. package/lib/typescript/src/index.d.ts +2 -2
  101. package/lib/typescript/src/models.d.ts +126 -17
  102. package/lib/typescript/src/validation.d.ts +20 -0
  103. package/lib/typescript/src/web/NativeListGeneratedIcons.d.ts +2 -0
  104. package/lib/typescript/src/web/NativeListWebEngine.d.ts +32 -1
  105. package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
  106. package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
  107. package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +9 -3
  108. package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
  109. package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
  110. package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
  111. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
  112. package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
  113. package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
  114. package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
  115. package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
  116. package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
  117. package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
  118. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
  119. package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
  120. package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
  121. package/package.json +16 -10
  122. package/react-native-native-list.podspec +2 -6
  123. package/scripts/generate-icons.mjs +150 -0
  124. package/scripts/generate-icons.test.mjs +288 -0
  125. package/scripts/native-list-icons.json +260 -0
  126. package/src/NativeList.nitro.ts +2 -0
  127. package/src/NativeList.tsx +439 -91
  128. package/src/NativeList.types.ts +24 -2
  129. package/src/NativeList.web.tsx +295 -89
  130. package/src/index.ts +2 -0
  131. package/src/models.ts +263 -144
  132. package/src/selection.ts +1 -0
  133. package/src/validation.ts +3013 -152
  134. package/src/web/NativeListGeneratedIcons.ts +28 -0
  135. package/src/web/NativeListWebEngine.ts +818 -343
  136. package/src/web/templates/ActivityRowRenderer.ts +29 -59
  137. package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
  138. package/src/web/templates/DataRowRenderer.ts +93 -20
  139. package/src/web/templates/IdentityRowRenderer.ts +231 -6
  140. package/src/web/templates/MarketTableRowRenderer.ts +53 -33
  141. package/src/web/templates/MediaTileRowRenderer.ts +90 -28
  142. package/src/web/templates/MessageRowRenderer.ts +23 -7
  143. package/src/web/templates/RowContainerStyle.ts +2 -0
  144. package/src/web/templates/RowRendererRegistry.ts +11 -1
  145. package/src/web/templates/SectionHeaderRowRenderer.ts +47 -4
  146. package/ios/Resources/NativeListIcons.xcassets/Contents.json +0 -1
  147. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +0 -1
  148. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +0 -1
  149. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +0 -1
  150. package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +0 -1
  151. package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/Contents.json +0 -1
  152. package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/icon.svg +0 -1
  153. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +0 -1
  154. package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +0 -1
  155. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +0 -1
  156. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +0 -1
  157. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +0 -1
  158. package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +0 -1
  159. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +0 -1
  160. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +0 -1
  161. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +0 -1
  162. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +0 -1
  163. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +0 -1
  164. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +0 -1
  165. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +0 -1
  166. package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +0 -1
  167. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +0 -1
  168. package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +0 -1
  169. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +0 -1
  170. package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +0 -1
  171. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +0 -1
  172. package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +0 -1
  173. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +0 -1
  174. package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +0 -1
  175. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +0 -1
  176. package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +0 -1
  177. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +0 -1
  178. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +0 -1
  179. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +0 -1
  180. package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +0 -1
  181. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +0 -1
  182. package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +0 -1
  183. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +0 -1
  184. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +0 -1
  185. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +0 -1
  186. package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +0 -1
  187. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +0 -1
  188. package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +0 -1
  189. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/Contents.json +0 -15
  190. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/icon.svg +0 -14
  191. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/Contents.json +0 -15
  192. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/icon.svg +0 -12
  193. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/Contents.json +0 -15
  194. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/icon.svg +0 -6
  195. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/Contents.json +0 -15
  196. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/icon.svg +0 -15
  197. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/Contents.json +0 -15
  198. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/icon.svg +0 -3
  199. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/Contents.json +0 -15
  200. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/icon.svg +0 -7
  201. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/Contents.json +0 -15
  202. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/icon.svg +0 -18
  203. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/Contents.json +0 -15
  204. package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/icon.svg +0 -7
  205. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +0 -1
  206. package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +0 -1
  207. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +0 -1
  208. package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +0 -1
  209. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +0 -1
  210. package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +0 -1
  211. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +0 -1
  212. package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +0 -1
  213. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +0 -1
  214. package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +0 -1
@@ -153,6 +153,7 @@ resolved colors; `style.color` does not resolve application color-token names.
153
153
  | `bgApp` | `background` | List ground |
154
154
  | `bg` | `rowBackground` | Row ground |
155
155
  | `bgActive` | `rowSelectedBackground`, `rowPressedBackground` | Selected / pressed row |
156
+ | `bgHover` | `rowHoverBackground` (optional Web) | Hovered row; omission uses pressed color |
156
157
  | `bgSubdued` | `subduedBackground` | Card and group ground |
157
158
  | `bgStrong` | `strongBackground` | Chip / badge ground |
158
159
  | `bgInverse` | `inverseBackground` | Inverted ground |
@@ -269,6 +270,11 @@ Each cell describes the same public contract on **Web + iOS + Android**.
269
270
  | `action` | title, value | padding, leadingGap, trailingGap, image |
270
271
  | `system` | title, message, actionText | padding, lineGap |
271
272
 
273
+ `identity.style.leadingContentMaxWidthRatio` optionally caps the leading
274
+ visual, gap and title content to a finite fraction in `(0, 1]` of the row's
275
+ inner width. Omission retains the existing width behavior. This lets a
276
+ same-row trailing text button keep its own space while long titles truncate.
277
+
272
278
  Market additionally exposes `titleBadgeLayout: inline`, `contentTrailingGap`,
273
279
  `subtitleTrailingPadding`, `changeWidth`, `changeHeight`, `changeCornerRadius`, preserving
274
280
  its existing template-specific style surface on every platform.
@@ -529,6 +535,9 @@ defaults applied when `style` is absent.
529
535
  | image radius | 10 | 10 | dp(10) | 10px **=** |
530
536
  | tile radius | 16 | 16 | 16 | 16px **=** |
531
537
  | network badge | 14 | 14×14, r7 | dp(14), circle | 14px, r50% **=** |
538
+ | placeholder glyph | 28% of width, max 44 | CAShapeLayer | Canvas path | inline SVG **=** |
539
+ | loading sheen | 60% wide, -12°, 1.6s | CAKeyframeAnimation | `postInvalidateOnAnimation` | CSS keyframes **=** |
540
+ | failed hatch | 1 / 7, 135°, 4.5% | CAShapeLayer + radial mask | `saveLayer` + `DST_IN` | repeating gradient + mask **=** |
532
541
 
533
542
  ### metricCard
534
543
 
@@ -629,6 +638,11 @@ the list's general section mechanism.
629
638
  | Reorder preview | no | — | — | r12, shadow `0 4px 24px` |
630
639
  | Reorder count badge | no | 24 h, r12, 12 semibold | dp(24), r dp(12), sp(12) semibold | 24px, r12, 12/22/600 |
631
640
 
641
+ Pinned section headers draw no separator or shadow on any platform. The pinned
642
+ overlay paints the header's own row background, which is what hides the rows
643
+ scrolling underneath it; a list that wants a visible boundary supplies it through
644
+ the header row's style, not through container chrome.
645
+
632
646
  The section index rail is three separate constant sets for one control; Android's
633
647
  `sectionIndexDp()` deliberately never follows the source-scale switch.
634
648
 
@@ -27,17 +27,22 @@ final class HybridNativeList: HybridNativeListSpec {
27
27
  }
28
28
 
29
29
  var containerSlotHeightsJson: String = "[]" {
30
+ didSet { if containerSlotHeightsJson != oldValue { slotHeightsChanged = true } }
31
+ }
32
+
33
+ var sidecarLayoutJson: String = "" {
30
34
  didSet {
31
- guard containerSlotHeightsJson != oldValue else { return }
35
+ guard sidecarLayoutJson != oldValue else { return }
32
36
  runOnMain { [weak self] in
33
37
  guard let self else { return }
34
- self.hostView?.setContainerSlotHeightsJson(self.containerSlotHeightsJson)
38
+ self.hostView?.setSidecarLayoutJson(self.sidecarLayoutJson)
35
39
  }
36
40
  }
37
41
  }
38
42
 
39
43
  private var fontsChanged = false
40
44
  private var snapshotChanged = false
45
+ private var slotHeightsChanged = false
41
46
 
42
47
  var fontFamiliesJson: String = "{}" {
43
48
  didSet { if fontFamiliesJson != oldValue { fontsChanged = true } }
@@ -75,11 +80,16 @@ final class HybridNativeList: HybridNativeListSpec {
75
80
 
76
81
  func afterUpdate() {
77
82
  let fonts = fontsChanged ? fontFamiliesJson : nil
83
+ let slotHeights = slotHeightsChanged ? containerSlotHeightsJson : nil
78
84
  let snapshot = snapshotChanged ? snapshotJson : nil
79
85
  fontsChanged = false
86
+ slotHeightsChanged = false
80
87
  snapshotChanged = false
81
88
  runOnMain { [weak self] in
82
89
  if let fonts { self?.hostView?.setFontFamiliesJson(fonts) }
90
+ if let slotHeights {
91
+ self?.hostView?.setContainerSlotHeightsJson(slotHeights, followedBySnapshot: snapshot != nil)
92
+ }
83
93
  if let snapshot { self?.hostView?.applySnapshotJson(snapshot) }
84
94
  }
85
95
  }
@@ -109,6 +119,14 @@ final class HybridNativeList: HybridNativeListSpec {
109
119
  var onSelectionDelta: ((_ payloadJson: String) -> Void)?
110
120
  var onReorder: ((_ payloadJson: String) -> Void)?
111
121
  var onEndReached: ((_ payloadJson: String) -> Void)?
122
+ var onStructuralTransitionSettled: ((_ payloadJson: String) -> Void)? {
123
+ didSet {
124
+ runOnMain { [weak self] in
125
+ guard let self else { return }
126
+ self.hostView?.onStructuralTransitionSettled = self.onStructuralTransitionSettled
127
+ }
128
+ }
129
+ }
112
130
  var onVisibleRangeChanged: ((_ payloadJson: String) -> Void)? {
113
131
  didSet {
114
132
  runOnMain { [weak self] in
@@ -222,6 +240,7 @@ final class HybridNativeList: HybridNativeListSpec {
222
240
  onSelectionDelta = nil
223
241
  onReorder = nil
224
242
  onEndReached = nil
243
+ onStructuralTransitionSettled = nil
225
244
  onVisibleRangeChanged = nil
226
245
  onScrollPositionThresholdChange = nil
227
246
  hostView.dispose()
@@ -1,14 +1,74 @@
1
1
  import UIKit
2
2
 
3
3
  // OneKey patch: explicit summary actions use the source text's physical-pixel line box.
4
- final class NativeListAccessoryButton: UIButton {
4
+ final class NativeListAccessoryButton: NativeListIconButton {
5
5
  var pressedBackgroundColor: UIColor?
6
+ var normalBackgroundColor: UIColor = .clear
7
+ var fixedTextLineHeight: CGFloat?
6
8
  var rowTextOffsetY: CGFloat = 0
9
+ var helpBindingGeneration = 0
10
+ private var helpTrackingGeneration = 0
11
+ override func beginTracking(_ touch: UITouch, with event: UIEvent?) -> Bool {
12
+ helpTrackingGeneration = helpBindingGeneration
13
+ return super.beginTracking(touch, with: event)
14
+ }
15
+ override func endTracking(_ touch: UITouch?, with event: UIEvent?) {
16
+ guard helpTrackingGeneration == helpBindingGeneration else {
17
+ cancelTracking(with: event)
18
+ return
19
+ }
20
+ super.endTracking(touch, with: event)
21
+ }
22
+ var helpPrimaryLineOnly = false
23
+ var showsHelpUnderline = false
24
+ let helpAnchor = UIView()
25
+ private let helpUnderline = CAShapeLayer()
26
+
27
+ override func point(inside point: CGPoint, with event: UIEvent?) -> Bool {
28
+ if helpPrimaryLineOnly { return helpAnchor.frame.contains(point) }
29
+ return super.point(inside: point, with: event)
30
+ }
31
+
32
+ private func layoutHelp() {
33
+ guard helpPrimaryLineOnly || showsHelpUnderline else {
34
+ helpUnderline.isHidden = true
35
+ return
36
+ }
37
+ guard let titleLabel else { return }
38
+ if helpAnchor.superview == nil {
39
+ helpAnchor.isUserInteractionEnabled = false
40
+ helpAnchor.isAccessibilityElement = false
41
+ addSubview(helpAnchor)
42
+ helpUnderline.fillColor = UIColor.clear.cgColor
43
+ helpUnderline.lineWidth = 1
44
+ helpUnderline.lineDashPattern = [3, 2]
45
+ helpAnchor.layer.addSublayer(helpUnderline)
46
+ }
47
+ var frame = titleLabel.frame
48
+ if helpPrimaryLineOnly, let text = attributedTitle(for: .normal) {
49
+ let range = (text.string as NSString).range(of: "\n")
50
+ let primary = text.attributedSubstring(from: NSRange(location: 0, length: range.location == NSNotFound ? text.length : range.location))
51
+ let width = min(frame.width, ceil(primary.size().width))
52
+ frame.origin.x += frame.width - width
53
+ frame.size.width = width
54
+ let paragraph = primary.length > 0 ? primary.attribute(.paragraphStyle, at: 0, effectiveRange: nil) as? NSParagraphStyle : nil
55
+ frame.size.height = paragraph?.minimumLineHeight ?? 20
56
+ }
57
+ helpAnchor.frame = frame
58
+ let text = attributedTitle(for: .normal)
59
+ let color = text.flatMap { $0.length > 0 ? $0.attribute(.foregroundColor, at: 0, effectiveRange: nil) as? UIColor : nil }
60
+ helpUnderline.strokeColor = (color ?? titleColor(for: .normal))?.cgColor
61
+ helpUnderline.isHidden = !showsHelpUnderline
62
+ let path = UIBezierPath()
63
+ path.move(to: CGPoint(x: 0, y: frame.height - 1))
64
+ path.addLine(to: CGPoint(x: frame.width, y: frame.height - 1))
65
+ helpUnderline.path = path.cgPath
66
+ }
7
67
 
8
68
  override var isHighlighted: Bool {
9
69
  didSet {
10
70
  guard let pressedBackgroundColor else { return }
11
- backgroundColor = isHighlighted ? pressedBackgroundColor : .clear
71
+ backgroundColor = isHighlighted ? pressedBackgroundColor : normalBackgroundColor
12
72
  }
13
73
  }
14
74
 
@@ -32,6 +92,13 @@ final class NativeListAccessoryButton: UIButton {
32
92
  }
33
93
  }
34
94
 
95
+ func clearTitlesForReuse() {
96
+ UIView.performWithoutAnimation {
97
+ super.setAttributedTitle(nil, for: .normal)
98
+ super.setTitle(nil, for: .normal)
99
+ }
100
+ }
101
+
35
102
  var selectorSummaryLineHeight: CGFloat? {
36
103
  didSet {
37
104
  invalidateIntrinsicContentSize()
@@ -52,6 +119,11 @@ final class NativeListAccessoryButton: UIButton {
52
119
 
53
120
  override var intrinsicContentSize: CGSize {
54
121
  var size = super.intrinsicContentSize
122
+ if let fixedTextLineHeight {
123
+ size.width += 2
124
+ size.height = fixedTextLineHeight + contentEdgeInsets.top + contentEdgeInsets.bottom + 2
125
+ return size
126
+ }
55
127
  guard selectorSummaryLineHeight != nil || marketLineHeight != nil,
56
128
  let title = attributedTitle(for: .normal)
57
129
  else { return size }
@@ -71,6 +143,10 @@ final class NativeListAccessoryButton: UIButton {
71
143
  defer {
72
144
  if let titleLabel {
73
145
  var frame = titleLabel.frame
146
+ if let fixedTextLineHeight {
147
+ frame.size.height = fixedTextLineHeight
148
+ frame.origin.y = (bounds.height - fixedTextLineHeight) / 2
149
+ }
74
150
  if contentVerticalAlignment == .top {
75
151
  frame.origin.y = contentEdgeInsets.top
76
152
  } else if contentVerticalAlignment == .bottom {
@@ -79,6 +155,7 @@ final class NativeListAccessoryButton: UIButton {
79
155
  frame.origin.y += rowTextOffsetY
80
156
  titleLabel.frame = frame
81
157
  }
158
+ layoutHelp()
82
159
  }
83
160
  if let lineHeight = marketLineHeight, let titleLabel, let title = attributedTitle(for: .normal)
84
161
  {
@@ -120,13 +197,15 @@ final class NativeListAccessoryButton: UIButton {
120
197
  final class NativeListAccessoryStack: UIStackView {
121
198
  var fonts = NativeListFontFamilies()
122
199
  private let accessoryButtons = (0..<2).map { _ in NativeListAccessoryButton(type: .system) }
123
- private let checkboxButton = UIButton(type: .system)
200
+ private let checkboxButton = NativeListIconButton(type: .system)
124
201
  private let spinner = UIActivityIndicatorView(style: .medium)
125
202
  private var accessoryActions: [(String, NativeSelectionTarget?)] = []
126
203
  private var checkboxAction: (String, NativeSelectionTarget?)?
127
204
  private var boundCheckboxData: [String: Any]?
128
205
  private var boundCheckboxTarget: NativeSelectionTarget?
129
206
  private var semanticValueButtons: [UIButton] = []
207
+ private var valuePairSubscriptRanges: [ObjectIdentifier: [(NSRange, Bool)]] = [:]
208
+ private var tertiaryIconButtons: Set<ObjectIdentifier> = []
130
209
  private var accessorySizeConstraints: [NSLayoutConstraint] = []
131
210
  private var currentItem: NativeListItem?
132
211
  private var currentTheme: [String: Any]?
@@ -171,6 +250,8 @@ final class NativeListAccessoryStack: UIStackView {
171
250
  checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String,
172
251
  fonts: NativeListFontFamilies
173
252
  ) {
253
+ let iconUpdate = NativeListIconUpdate(self)
254
+ defer { iconUpdate.finish() }
174
255
  self.fonts = fonts
175
256
  reset()
176
257
  currentItem = item
@@ -210,14 +291,19 @@ final class NativeListAccessoryStack: UIStackView {
210
291
  }
211
292
  }
212
293
  func anchorInset(for view: UIView) -> CGFloat {
213
- currentItem?.data.string("presentation") == "accountSelector"
214
- && accessoryButtons.contains { $0 === view } && view.bounds.width == 38 ? 7 : 0
294
+ guard accessoryButtons.contains(where: { $0 === view }), view.bounds.width == 38 else {
295
+ return 0
296
+ }
297
+ if tertiaryIconButtons.contains(ObjectIdentifier(view)) { return 7 }
298
+ return currentItem?.data.string("presentation") == "accountSelector" ? 7 : 0
215
299
  }
216
300
  func reset() {
217
301
  NSLayoutConstraint.deactivate(accessorySizeConstraints)
218
302
  accessorySizeConstraints.removeAll()
219
303
  accessoryActions.removeAll()
220
304
  semanticValueButtons.removeAll()
305
+ valuePairSubscriptRanges.removeAll()
306
+ tertiaryIconButtons.removeAll()
221
307
  checkboxAction = nil
222
308
  boundCheckboxData = nil
223
309
  boundCheckboxTarget = nil
@@ -225,8 +311,8 @@ final class NativeListAccessoryStack: UIStackView {
225
311
  contentGap = nil
226
312
  currentItem = nil
227
313
  for (index, button) in accessoryButtons.enumerated() {
228
- button.setAttributedTitle(nil, for: .normal)
229
- button.setTitle(nil, for: .normal)
314
+ button.tag = index
315
+ button.clearTitlesForReuse()
230
316
  button.setImage(nil, for: .normal)
231
317
  button.setImage(nil, for: .disabled)
232
318
  button.titleLabel?.font = nativeListFont(
@@ -236,14 +322,23 @@ final class NativeListAccessoryStack: UIStackView {
236
322
  button.contentHorizontalAlignment = .center
237
323
  button.contentVerticalAlignment = .center
238
324
  button.rowTextOffsetY = 0
325
+ button.helpBindingGeneration += 1
326
+ button.helpPrimaryLineOnly = false
327
+ button.showsHelpUnderline = false
239
328
  button.transform = .identity
240
329
  button.marketLineHeight = nil
241
330
  button.selectorSummaryLineHeight = nil
242
331
  button.backgroundColor = .clear
243
332
  button.pressedBackgroundColor = nil
333
+ button.normalBackgroundColor = .clear
334
+ button.fixedTextLineHeight = nil
335
+ button.contentEdgeInsets = .zero
336
+ button.layer.borderWidth = 0
337
+ button.layer.borderColor = nil
244
338
  button.layer.cornerRadius = 0
245
339
  button.isHidden = true
246
340
  button.isEnabled = true
341
+ button.isUserInteractionEnabled = true
247
342
  button.alpha = 1
248
343
  button.accessibilityIdentifier = nil
249
344
  button.accessibilityLabel = nil
@@ -253,9 +348,13 @@ final class NativeListAccessoryStack: UIStackView {
253
348
  spinner.alpha = 1
254
349
  }
255
350
  @objc private func pressed(_ button: UIButton) {
256
- guard accessoryActions.indices.contains(button.tag) else { return }
257
- let action = accessoryActions[button.tag]
258
- if !action.0.isEmpty { onAction?(action.0, button, button.tag, action.1) }
351
+ guard let controlIndex = accessoryButtons.firstIndex(where: { $0 === button }),
352
+ accessoryActions.indices.contains(controlIndex) else { return }
353
+ let action = accessoryActions[controlIndex]
354
+ if !action.0.isEmpty {
355
+ let anchor = accessoryButtons[controlIndex]
356
+ onAction?(action.0, anchor.helpPrimaryLineOnly ? anchor.helpAnchor : button, button.tag, action.1)
357
+ }
259
358
  }
260
359
  @objc private func checkboxPressed() {
261
360
  if let action = checkboxAction { onAction?(action.0, checkboxButton, nil, action.1) }
@@ -267,8 +366,42 @@ final class NativeListAccessoryStack: UIStackView {
267
366
  _ checkboxState: (NativeListItem, NativeSelectionTarget?, String) -> String
268
367
  ) {
269
368
  var textIndex = 0
270
- for accessory in accessories.prefix(2) {
369
+ for (slot, accessory) in accessories.prefix(2).enumerated() {
370
+ let controlIndex = textIndex
271
371
  switch accessory.string("kind") {
372
+ case "button":
373
+ showAccessory(
374
+ textIndex, accessory.string("label"),
375
+ action: accessory.bool("disabled") || item.data.bool("disabled")
376
+ ? nil : (accessory.string("actionKey"), nil))
377
+ let button = accessoryButtons[textIndex]
378
+ button.titleLabel?.font = nativeListFont(ofSize: 14, weight: .medium, fonts: fonts)
379
+ button.fixedTextLineHeight = 20
380
+ button.contentEdgeInsets = UIEdgeInsets(top: 4, left: 10, bottom: 4, right: 10)
381
+ button.layer.borderWidth = 1
382
+ button.layer.borderColor = UIColor.clear.cgColor
383
+ button.layer.cornerRadius = 15
384
+ button.backgroundColor = UIColor(
385
+ nativeListHex: accessory.string("backgroundColor",
386
+ default: theme?["strongBackground"] as? String ?? "#F0F0F0"),
387
+ fallback: .clear)
388
+ button.normalBackgroundColor = button.backgroundColor ?? .clear
389
+ button.pressedBackgroundColor = UIColor(
390
+ nativeListHex: accessory.string("pressedBackgroundColor",
391
+ default: theme?["rowPressedBackground"] as? String ?? "#E4E4E4"),
392
+ fallback: .clear)
393
+ button.setTitleColor(
394
+ UIColor(
395
+ nativeListHex: accessory.string("textColor",
396
+ default: theme?["primaryText"] as? String ?? "#202020"),
397
+ fallback: .darkGray),
398
+ for: .normal)
399
+ button.accessibilityIdentifier = accessory.string("testID")
400
+ button.accessibilityLabel =
401
+ accessory.string("accessibilityLabel", default: accessory.string("label"))
402
+ button.isEnabled = !item.data.bool("disabled") && !accessory.bool("disabled")
403
+ button.alpha = button.isEnabled ? 1 : 0.4
404
+ textIndex += 1
272
405
  case "value":
273
406
  showAccessory(textIndex, accessory.string("text"))
274
407
  semanticValueButtons.append(accessoryButtons[textIndex])
@@ -325,6 +458,7 @@ final class NativeListAccessoryStack: UIStackView {
325
458
  textIndex += 1
326
459
  default: break
327
460
  }
461
+ if textIndex > controlIndex { accessoryButtons[controlIndex].tag = slot }
328
462
  }
329
463
  }
330
464
 
@@ -369,10 +503,7 @@ final class NativeListAccessoryStack: UIStackView {
369
503
  state == "indeterminate"
370
504
  ? "CheckboxIndeterminateCustom"
371
505
  : "CheckboxCheckedCustom"
372
- checkboxButton.setImage(
373
- state == "unchecked" ? nil : nativeListIcon(named: glyphName),
374
- for: .normal
375
- )
506
+ checkboxButton.bindIcon(state == "unchecked" ? nil : glyphName)
376
507
  checkboxButton.tintColor = checkboxIconColor
377
508
  // A disabled ListItem already applies 0.5 to its complete content. Avoid
378
509
  // multiplying that opacity on the nested control a second time.
@@ -391,6 +522,11 @@ final class NativeListAccessoryStack: UIStackView {
391
522
  guard accessoryButtons.indices.contains(index), !value.isEmpty else { return }
392
523
  let button = accessoryButtons[index]
393
524
  button.isHidden = false
525
+ // A text accessory without an action is display only. As an enabled
526
+ // UIControl it still claimed the touch, so a tap on a row value such as
527
+ // a network balance never reached the cell and the row did not select
528
+ // (OK-65494). Let those touches fall through to the row press.
529
+ button.isUserInteractionEnabled = action != nil
394
530
  button.setTitle(value, for: .normal)
395
531
  button.setContentHuggingPriority(.required, for: .horizontal)
396
532
  button.setContentCompressionResistancePriority(.required, for: .horizontal)
@@ -405,54 +541,81 @@ final class NativeListAccessoryStack: UIStackView {
405
541
  theme: [String: Any]?
406
542
  ) {
407
543
  guard accessoryButtons.indices.contains(index) else { return }
408
- let primary = accessory.string("primary")
409
- let secondary = accessory.string("secondary")
544
+ let primarySegments = accessory.dictionaries("primaryTextSegments")
545
+ let secondarySegments = accessory.dictionaries("secondaryTextSegments")
546
+ let primary = primarySegments.isEmpty
547
+ ? accessory.string("primary") : primarySegments.map { $0.string("text") }.joined()
548
+ let secondary = secondarySegments.isEmpty
549
+ ? accessory.string("secondary") : secondarySegments.map { $0.string("text") }.joined()
410
550
  guard !primary.isEmpty || !secondary.isEmpty else { return }
411
551
  let button = accessoryButtons[index]
552
+ // Value pairs never carry an action; the row owns their touches.
553
+ button.isUserInteractionEnabled = false
412
554
  let text = NSMutableAttributedString()
413
555
  let primaryParagraph = NSMutableParagraphStyle()
414
556
  primaryParagraph.alignment = .right
415
557
  primaryParagraph.minimumLineHeight = 20
416
558
  primaryParagraph.maximumLineHeight = 20
417
- text.append(
418
- NSAttributedString(
419
- string: primary,
420
- attributes: [
421
- .font: nativeListFont(ofSize: 16, weight: .medium, fonts: fonts),
422
- .foregroundColor: accessoryTextColor(
423
- accessory.string("primaryTone"),
424
- defaultTone: "primary",
425
- theme: theme
426
- ),
427
- .paragraphStyle: primaryParagraph,
428
- ]
429
- ))
559
+ var subscriptRanges: [(NSRange, Bool)] = []
560
+ appendValuePairLine(
561
+ to: text, fallback: primary, segments: primarySegments, fontSize: 16,
562
+ weight: .medium,
563
+ color: accessoryTextColor(accessory.string("primaryTone"), defaultTone: "primary", theme: theme),
564
+ paragraph: primaryParagraph, isPrimary: true, subscriptRanges: &subscriptRanges)
430
565
  if !primary.isEmpty, !secondary.isEmpty { text.append(NSAttributedString(string: "\n")) }
431
566
  let secondaryParagraph = NSMutableParagraphStyle()
432
567
  secondaryParagraph.alignment = .right
433
568
  secondaryParagraph.minimumLineHeight = 20
434
569
  secondaryParagraph.maximumLineHeight = 20
435
- text.append(
436
- NSAttributedString(
437
- string: secondary,
438
- attributes: [
439
- .font: nativeListFont(ofSize: 14, fonts: fonts),
440
- .foregroundColor: accessoryTextColor(
441
- accessory.string("secondaryTone"),
442
- defaultTone: "secondary",
443
- theme: theme
444
- ),
445
- .paragraphStyle: secondaryParagraph,
446
- ]
447
- ))
570
+ appendValuePairLine(
571
+ to: text, fallback: secondary, segments: secondarySegments, fontSize: 14,
572
+ weight: .regular,
573
+ color: accessoryTextColor(accessory.string("secondaryTone"), defaultTone: "secondary", theme: theme),
574
+ paragraph: secondaryParagraph, isPrimary: false, subscriptRanges: &subscriptRanges)
448
575
  button.isHidden = false
449
576
  button.titleLabel?.numberOfLines = 2
450
577
  button.contentHorizontalAlignment = .trailing
451
578
  button.setAttributedTitle(text, for: .normal)
579
+ valuePairSubscriptRanges[ObjectIdentifier(button)] = subscriptRanges
452
580
  button.setContentHuggingPriority(.required, for: .horizontal)
453
581
  button.setContentCompressionResistancePriority(.required, for: .horizontal)
454
582
  while accessoryActions.count <= index { accessoryActions.append(("", nil)) }
455
583
  accessoryActions[index] = ("", nil)
584
+ if let help = accessory.dictionary("primaryHelp") {
585
+ button.helpPrimaryLineOnly = true
586
+ button.showsHelpUnderline = help.string("underline") == "dashed"
587
+ button.isUserInteractionEnabled = help.string("presentation") == "popover"
588
+ accessoryActions[index] = (help.string("presentation") == "popover" ? help.string("actionKey") : "", nil)
589
+ button.setNeedsLayout()
590
+ }
591
+ }
592
+
593
+ private func appendValuePairLine(
594
+ to text: NSMutableAttributedString,
595
+ fallback: String,
596
+ segments: [[String: Any]],
597
+ fontSize: CGFloat,
598
+ weight: NativeListFontWeight,
599
+ color: UIColor,
600
+ paragraph: NSParagraphStyle,
601
+ isPrimary: Bool,
602
+ subscriptRanges: inout [(NSRange, Bool)]
603
+ ) {
604
+ let runs = segments.isEmpty ? [["text": fallback]] : segments
605
+ for run in runs {
606
+ let content = run.string("text")
607
+ let isSubscript = run.string("style") == "subscript"
608
+ let start = text.length
609
+ text.append(NSAttributedString(string: content, attributes: [
610
+ .font: nativeListFont(
611
+ ofSize: isSubscript ? ceil(fontSize * 0.6) : fontSize, weight: weight, fonts: fonts),
612
+ .foregroundColor: color,
613
+ .paragraphStyle: paragraph,
614
+ ]))
615
+ if isSubscript && text.length > start {
616
+ subscriptRanges.append((NSRange(location: start, length: text.length - start), isPrimary))
617
+ }
618
+ }
456
619
  }
457
620
 
458
621
  private func showMenuAccessory(
@@ -500,16 +663,26 @@ final class NativeListAccessoryStack: UIStackView {
500
663
  ? nativeListColor(currentTheme, "iconSubdued", "#8D8D8D")
501
664
  : UIColor(nativeListHex: data.string("tintColor", default: "#646464"), fallback: .darkGray)
502
665
  button.tintColor = tintColor
503
- if let image = nativeListIcon(named: data.string("name")) {
504
- button.setImage(image, for: .normal)
505
- button.setImage(
506
- image.withTintColor(tintColor, renderingMode: .alwaysOriginal),
507
- for: .disabled
508
- )
509
- }
666
+ let isDecorativeRefresh =
667
+ data.string("name") == "RefreshCcwOutline" && data.string("actionKey").isEmpty
668
+ button.bindIcon(data.string("name"), size: isDecorativeRefresh ? CGSize(width: 16, height: 16) : nil)
510
669
  let isDrillIn = data.string("kind") == "chevron"
670
+ let isTertiary = data.string("buttonStyle") == "tertiary"
671
+ if data.string("kind") == "icon" && isTertiary {
672
+ tertiaryIconButtons.insert(ObjectIdentifier(button))
673
+ }
511
674
  let isAccountIcon = currentItem?.data.string("presentation") == "accountSelector" && !isDrillIn
512
- let size: CGFloat = isDrillIn ? 24 : isAccountIcon && !isAccountCreate ? 38 : 36
675
+ button.isUserInteractionEnabled = !isDecorativeRefresh
676
+ let size: CGFloat =
677
+ isDecorativeRefresh ? 16 : isDrillIn ? 24 : isTertiary || isAccountIcon && !isAccountCreate ? 38 : 36
678
+ if isTertiary {
679
+ button.pressedBackgroundColor = nativeListColor(
680
+ currentTheme, "rowPressedBackground", "#E8E8E8")
681
+ button.layer.borderWidth = 1
682
+ button.layer.borderColor = UIColor.clear.cgColor
683
+ button.layer.cornerRadius = 19
684
+ button.contentEdgeInsets = UIEdgeInsets(top: 6, left: 6, bottom: 6, right: 6)
685
+ }
513
686
  if isAccountCreate { button.layer.cornerRadius = 8 }
514
687
  if isAccountIcon && !isAccountCreate && !data.string("actionKey").isEmpty {
515
688
  button.pressedBackgroundColor = nativeListColor(
@@ -647,6 +820,19 @@ final class NativeListAccessoryStack: UIStackView {
647
820
  }
648
821
  button.titleLabel?.font = font
649
822
  attributed.addAttributes(attributes, range: NSRange(location: 0, length: attributed.length))
823
+ if style["fontSize"] != nil,
824
+ let ranges = valuePairSubscriptRanges[ObjectIdentifier(button)]
825
+ {
826
+ for (range, isPrimary) in ranges {
827
+ let weight = style["fontWeight"] == nil
828
+ ? (isPrimary ? NativeListFontWeight.medium : NativeListFontWeight.regular)
829
+ : marketFontWeight(style.string("fontWeight"), fallback: .regular)
830
+ attributed.addAttribute(
831
+ .font,
832
+ value: nativeListFont(ofSize: ceil(size * 0.6), weight: weight, fonts: fonts),
833
+ range: range)
834
+ }
835
+ }
650
836
  button.setAttributedTitle(attributed, for: .normal)
651
837
  }
652
838
 
@@ -70,8 +70,10 @@ final class NativeListActivityDetailsView: UIStackView {
70
70
  let verticalPadding = CGFloat(style.double("verticalPadding", default: 8))
71
71
  let lineGap = CGFloat(style.double("lineGap"))
72
72
  let gap = CGFloat(style.double("leadingGap", default: 12))
73
+ let hideLeading = data.bool("hideLeading")
73
74
  let imageWidth = CGFloat(image.double("width", default: 40))
74
75
  let imageHeight = CGFloat(image.double("height", default: 40))
76
+ let leadingWidth = hideLeading ? 0 : imageWidth + gap
75
77
  let mainWidth = max(0, width - horizontalPadding * 2)
76
78
 
77
79
  let amounts = data.dictionaries("amounts").map { amount -> (width: CGFloat, height: CGFloat) in
@@ -112,10 +114,11 @@ final class NativeListActivityDetailsView: UIStackView {
112
114
  let feeColumn = data.dictionary("fee") == nil ? 0 : gap + feeWidth
113
115
  let identityWidth: CGFloat
114
116
  if table {
115
- let shared = (mainWidth - imageWidth - gap * 2 - feeColumn) / 2
116
- identityWidth = min(mainWidth * 0.42, shared)
117
+ let hasFee = data.dictionary("fee") != nil
118
+ let columnWidth = max(0, mainWidth - gap * (hasFee ? 2 : 1)) / (hasFee ? 2.6 : 2)
119
+ identityWidth = columnWidth - leadingWidth
117
120
  } else {
118
- identityWidth = mainWidth - imageWidth - gap * 2 - feeColumn - min(amountsWidth, mainWidth * 0.5)
121
+ identityWidth = mainWidth - leadingWidth - gap - feeColumn - min(amountsWidth, mainWidth * 0.5)
119
122
  }
120
123
 
121
124
  let title = NativeListResolvedText(data.string("title"), style: style.dictionary("title"), size: 16,
@@ -140,7 +143,7 @@ final class NativeListActivityDetailsView: UIStackView {
140
143
  return max(height, ceil(sizingButton.intrinsicContentSize.height))
141
144
  } + 8
142
145
  }
143
- return max(imageHeight, identityHeight, amountsHeight, feeHeight) + actionsHeight + verticalPadding * 2
146
+ return max(hideLeading ? 0 : imageHeight, identityHeight, amountsHeight, feeHeight) + actionsHeight + verticalPadding * 2
144
147
  }
145
148
 
146
149
  func bind(_ item: NativeListItem, theme: [String: Any]?, fonts: NativeListFontFamilies) {
@@ -150,20 +153,36 @@ final class NativeListActivityDetailsView: UIStackView {
150
153
  let image = style.dictionary("image") ?? [:]
151
154
  let table = data.string("presentation") == "table"
152
155
  let gap = CGFloat(style.double("leadingGap", default: 12))
156
+ let hideLeading = data.bool("hideLeading")
153
157
  main.spacing = gap
154
158
  identity.spacing = CGFloat(style.double("lineGap"))
155
159
  amounts.spacing = CGFloat(style.double("trailingGap", default: 2))
156
160
  titleLine.spacing = CGFloat(style.double("titleBadgeGap", default: 4))
157
161
  NSLayoutConstraint.deactivate(dimensions)
162
+ let visualWidth = visual.widthAnchor.constraint(equalToConstant: CGFloat(image.double("width", default: 40)))
163
+ if hideLeading { visualWidth.priority = UILayoutPriority(999) }
158
164
  dimensions = [
159
- visual.widthAnchor.constraint(equalToConstant: CGFloat(image.double("width", default: 40))),
165
+ visualWidth,
160
166
  visual.heightAnchor.constraint(equalToConstant: CGFloat(image.double("height", default: 40))),
161
- amounts.widthAnchor.constraint(lessThanOrEqualTo: main.widthAnchor, multiplier: table ? 0.42 : 0.5),
162
167
  ]
163
- if table { dimensions.append(amounts.widthAnchor.constraint(equalTo: identity.widthAnchor)) }
168
+ if table {
169
+ // The leading visual belongs to identity, so its visibility cannot shift amounts.
170
+ let leadingWidth = hideLeading ? 0 : CGFloat(image.double("width", default: 40)) + gap
171
+ dimensions.append(amounts.widthAnchor.constraint(equalTo: identity.widthAnchor, constant: leadingWidth))
172
+ if data.dictionary("fee") != nil {
173
+ dimensions.append(fee.widthAnchor.constraint(equalTo: amounts.widthAnchor, multiplier: 0.6))
174
+ }
175
+ } else {
176
+ dimensions.append(amounts.widthAnchor.constraint(lessThanOrEqualTo: main.widthAnchor, multiplier: 0.5))
177
+ }
164
178
  NSLayoutConstraint.activate(dimensions)
165
- visual.bind(data.dictionary("leading") ?? [:], style: image, key: item.key, theme: theme,
166
- isUnread: false, secondaryVisual: data.dictionary("secondaryLeading"), fonts: fonts)
179
+ visual.isHidden = hideLeading
180
+ if hideLeading {
181
+ visual.recycle()
182
+ } else {
183
+ visual.bind(data.dictionary("leading") ?? [:], style: image, key: item.key, theme: theme,
184
+ isUnread: false, secondaryVisual: data.dictionary("secondaryLeading"), fonts: fonts)
185
+ }
167
186
  NativeListResolvedText(data.string("title"), style: style.dictionary("title"), size: 16,
168
187
  weight: .medium, color: nativeListColor(theme, "primaryText", "#202020"), lineHeight: 24,
169
188
  lines: 1, fonts: fonts
@@ -225,7 +244,7 @@ final class NativeListActivityDetailsView: UIStackView {
225
244
  let actionData = data.dictionaries("footerActions")
226
245
  actionKeys = actionData.map { $0.string("key") }
227
246
  actions.isHidden = actionData.isEmpty
228
- actions.directionalLayoutMargins = NSDirectionalEdgeInsets(top: 0, leading: CGFloat(image.double("width", default: 40)) + gap, bottom: 0, trailing: 0)
247
+ actions.directionalLayoutMargins = NSDirectionalEdgeInsets(top: 0, leading: hideLeading ? 0 : CGFloat(image.double("width", default: 40)) + gap, bottom: 0, trailing: 0)
229
248
  for (index, descriptor) in actionData.enumerated() {
230
249
  let button = UIButton(type: .system); button.tag = index
231
250
  button.setTitle(descriptor.string("label"), for: .normal)
@@ -249,7 +268,7 @@ final class NativeListActivityDetailsView: UIStackView {
249
268
  onAction?(actionKeys[button.tag], button, "footerAction", button.tag)
250
269
  }
251
270
  func recycle() {
252
- visual.recycle(); amountViews.forEach { $0.recycle() }; actionKeys = []; descriptionKey = ""
271
+ visual.recycle(); visual.isHidden = false; amountViews.forEach { $0.recycle() }; actionKeys = []; descriptionKey = ""
253
272
  }
254
273
  }
255
274