@onekeyfe/react-native-native-list 6.7.0-3 → 6.7.0-30
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.
- package/README.md +4 -0
- package/android/src/main/java/com/onekey/nativelist/HybridNativeList.kt +14 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListAccessoryStack.kt +250 -9
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityDetailsView.kt +35 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListActivityRenderer.kt +25 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListAdapter.kt +17 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListButtonGroupRenderer.kt +102 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListContainerSlotAdapter.kt +12 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListDataRowRenderer.kt +102 -7
- package/android/src/main/java/com/onekey/nativelist/NativeListGeneratedIcons.kt +47 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListIdentityRenderer.kt +225 -11
- package/android/src/main/java/com/onekey/nativelist/NativeListLeadingVisual.kt +152 -33
- package/android/src/main/java/com/onekey/nativelist/NativeListMarketRenderer.kt +92 -28
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaPreviewSlot.kt +66 -31
- package/android/src/main/java/com/onekey/nativelist/NativeListMediaTileRenderer.kt +1 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListMessageRenderer.kt +25 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListModels.kt +149 -3
- package/android/src/main/java/com/onekey/nativelist/NativeListPrimitives.kt +120 -287
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRegistry.kt +2 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListRendererRowView.kt +7 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListResolvedText.kt +3 -2
- package/android/src/main/java/com/onekey/nativelist/NativeListSectionHeaderRenderer.kt +69 -0
- package/android/src/main/java/com/onekey/nativelist/NativeListTextView.kt +55 -1
- package/android/src/main/java/com/onekey/nativelist/NativeListView.kt +1953 -117
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListActivityHostClipPolicyTest.kt +35 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListIdentityTrailingAxisTest.kt +36 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingSlotFrameTest.kt +68 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListLeadingVisualClipPolicyTest.kt +44 -0
- package/android/src/test/java/com/margelo/nitro/nativelist/NativeListPressPolicyTest.kt +10 -0
- package/docs/ROW_TEMPLATES.md +70 -11
- package/docs/SPEC.md +1170 -13
- package/docs/STYLE_SPEC.md +11 -0
- package/ios/HybridNativeList.swift +21 -2
- package/ios/NativeListAccessoryStack.swift +237 -51
- package/ios/NativeListActivityDetailsView.swift +30 -11
- package/ios/NativeListActivityRenderer.swift +8 -2
- package/ios/NativeListButtonGroupRenderer.swift +89 -0
- package/ios/NativeListDataRowRenderer.swift +167 -30
- package/ios/NativeListDesignAssets.swift +13 -75
- package/ios/NativeListGeneratedIcons.swift +55 -0
- package/ios/NativeListIconBinding.swift +171 -0
- package/ios/NativeListIdentityRenderer.swift +256 -39
- package/ios/NativeListLeadingVisual.swift +127 -28
- package/ios/NativeListMarketRenderer.swift +120 -31
- package/ios/NativeListMediaPreviewSlot.swift +122 -61
- package/ios/NativeListMediaTileRenderer.swift +7 -3
- package/ios/NativeListMessageRenderer.swift +34 -1
- package/ios/NativeListMetricCardRenderer.swift +4 -2
- package/ios/NativeListModels.swift +42 -2
- package/ios/NativeListRendererRegistry.swift +1 -0
- package/ios/NativeListResolvedText.swift +2 -1
- package/ios/NativeListRowHost.swift +14 -0
- package/ios/NativeListSectionHeaderRenderer.swift +100 -4
- package/ios/RNCNativeListView.swift +1052 -58
- package/ios/tests/NativeListAccessoryStackTests.swift +101 -0
- package/ios/tests/NativeListAccountSelectorLayoutTests.swift +96 -0
- package/ios/tests/NativeListActivityPresentationTests.swift +153 -0
- package/ios/tests/NativeListIdentityTitleIconLayoutTests.swift +81 -0
- package/ios/tests/NativeListLeadingVisualPairBackdropTests.swift +50 -0
- package/ios/tests/NativeListLifecycleTests.swift +2798 -3
- package/ios/tests/NativeListMarketMetricsTests.swift +117 -0
- package/ios/tests/NativeListMediaVisibilityTests.swift +26 -1
- package/ios/tests/NativeListSharedIconTests.swift +236 -0
- package/lib/module/NativeList.js +221 -36
- package/lib/module/NativeList.web.js +167 -46
- package/lib/module/index.js +1 -1
- package/lib/module/models.js +3 -0
- package/lib/module/selection.js +1 -1
- package/lib/module/validation.js +1246 -48
- package/lib/module/web/NativeListGeneratedIcons.js +31 -0
- package/lib/module/web/NativeListWebEngine.js +513 -274
- package/lib/module/web/templates/ActivityRowRenderer.js +120 -87
- package/lib/module/web/templates/ButtonGroupRowRenderer.js +47 -0
- package/lib/module/web/templates/DataRowRenderer.js +40 -5
- package/lib/module/web/templates/IdentityRowRenderer.js +158 -6
- package/lib/module/web/templates/MarketTableRowRenderer.js +37 -19
- package/lib/module/web/templates/MediaTileRowRenderer.js +4 -14
- package/lib/module/web/templates/MessageRowRenderer.js +18 -2
- package/lib/module/web/templates/RowContainerStyle.js +1 -0
- package/lib/module/web/templates/RowRendererRegistry.js +3 -0
- package/lib/module/web/templates/SectionHeaderRowRenderer.js +36 -2
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
- package/lib/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
- package/lib/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
- package/lib/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
- package/lib/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
- package/lib/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
- package/lib/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
- package/lib/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
- package/lib/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
- package/lib/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
- package/lib/typescript/src/NativeList.d.ts +3 -3
- package/lib/typescript/src/NativeList.nitro.d.ts +2 -0
- package/lib/typescript/src/NativeList.types.d.ts +20 -2
- package/lib/typescript/src/index.d.ts +2 -2
- package/lib/typescript/src/models.d.ts +126 -17
- package/lib/typescript/src/validation.d.ts +20 -0
- package/lib/typescript/src/web/NativeListGeneratedIcons.d.ts +2 -0
- package/lib/typescript/src/web/NativeListWebEngine.d.ts +32 -1
- package/lib/typescript/src/web/templates/ButtonGroupRowRenderer.d.ts +14 -0
- package/lib/typescript/src/web/templates/IdentityRowRenderer.d.ts +1 -1
- package/lib/typescript/src/web/templates/MessageRowRenderer.d.ts +9 -3
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.cpp +26 -0
- package/nitrogen/generated/android/c++/JHybridNativeListSpec.hpp +4 -0
- package/nitrogen/generated/android/c++/views/JHybridNativeListStateUpdater.cpp +10 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nativelist/HybridNativeListSpec.kt +20 -0
- package/nitrogen/generated/ios/c++/HybridNativeListSpecSwift.hpp +14 -0
- package/nitrogen/generated/ios/c++/views/HybridNativeListComponent.mm +12 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridNativeListSpec_cxx.swift +43 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.cpp +4 -0
- package/nitrogen/generated/shared/c++/HybridNativeListSpec.hpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.cpp +4 -0
- package/nitrogen/generated/shared/c++/views/HybridNativeListComponent.hpp +6 -0
- package/nitrogen/generated/shared/json/NativeListConfig.json +2 -0
- package/package.json +16 -10
- package/react-native-native-list.podspec +2 -6
- package/scripts/generate-icons.mjs +150 -0
- package/scripts/generate-icons.test.mjs +288 -0
- package/scripts/native-list-icons.json +260 -0
- package/src/NativeList.nitro.ts +2 -0
- package/src/NativeList.tsx +416 -89
- package/src/NativeList.types.ts +24 -2
- package/src/NativeList.web.tsx +295 -89
- package/src/index.ts +2 -0
- package/src/models.ts +263 -144
- package/src/selection.ts +1 -0
- package/src/validation.ts +3013 -152
- package/src/web/NativeListGeneratedIcons.ts +28 -0
- package/src/web/NativeListWebEngine.ts +816 -343
- package/src/web/templates/ActivityRowRenderer.ts +178 -141
- package/src/web/templates/ButtonGroupRowRenderer.ts +58 -0
- package/src/web/templates/DataRowRenderer.ts +93 -20
- package/src/web/templates/IdentityRowRenderer.ts +231 -6
- package/src/web/templates/MarketTableRowRenderer.ts +56 -33
- package/src/web/templates/MediaTileRowRenderer.ts +4 -17
- package/src/web/templates/MessageRowRenderer.ts +23 -7
- package/src/web/templates/RowContainerStyle.ts +2 -0
- package/src/web/templates/RowRendererRegistry.ts +11 -1
- package/src/web/templates/SectionHeaderRowRenderer.ts +47 -4
- package/ios/Resources/NativeListIcons.xcassets/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_bottom.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_arrow_top.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_badge_verified_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chart_trending_up.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_checked.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_checkbox_indeterminate.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_bottom.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_grabber_ver.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_right_small.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_chevron_top.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_dot_hor.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_drag.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_error_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_image_square_waves.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_info_circle.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_minus_circle_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_pencil.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_circle.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_plus_small.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_questionmark_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_account_error_custom.imageset/icon.svg +0 -14
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_all_networks_solid.imageset/icon.svg +0 -12
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_apple_brand.imageset/icon.svg +0 -6
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_bot_illus.imageset/icon.svg +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_crossed_small_solid.imageset/icon.svg +0 -3
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_globus_outline.imageset/icon.svg +0 -7
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_google_illus.imageset/icon.svg +0 -18
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/Contents.json +0 -15
- package/ios/Resources/NativeListIcons.xcassets/onekey_selector_lock_solid.imageset/icon.svg +0 -7
- package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_shield_exclamation.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_speaker_promote.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_star_solid.imageset/icon.svg +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/Contents.json +0 -1
- package/ios/Resources/NativeListIcons.xcassets/onekey_swap_hor.imageset/icon.svg +0 -1
|
@@ -26,6 +26,8 @@ import com.facebook.react.modules.network.OkHttpClientProvider
|
|
|
26
26
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
27
27
|
import okhttp3.JavaNetCookieJar
|
|
28
28
|
import org.json.JSONObject
|
|
29
|
+
import com.margelo.nitro.onekeyimage.OneKeyMediaPreviewCache
|
|
30
|
+
import java.util.UUID
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
33
|
* Uses Media3 like native Video, but never starts playback or requests audio focus. A player
|
|
@@ -35,9 +37,10 @@ import org.json.JSONObject
|
|
|
35
37
|
internal class NativeListMediaPreviewSlot(private val context: ThemedReactContext) {
|
|
36
38
|
val view: FrameLayout = object : FrameLayout(context) {
|
|
37
39
|
override fun onAttachedToWindow() { super.onAttachedToWindow(); observeViewport(); updateVisibility() }
|
|
38
|
-
override fun onDetachedFromWindow() { stopObservingViewport();
|
|
40
|
+
override fun onDetachedFromWindow() { stopObservingViewport(); cancelPreview(); super.onDetachedFromWindow() }
|
|
41
|
+
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) { super.onSizeChanged(w, h, oldw, oldh); updateVisibility() }
|
|
39
42
|
override fun onWindowVisibilityChanged(visibility: Int) { super.onWindowVisibilityChanged(visibility); updateVisibility() }
|
|
40
|
-
override fun onVisibilityAggregated(isVisible: Boolean) { super.onVisibilityAggregated(isVisible); if (isVisible) updateVisibility() else
|
|
43
|
+
override fun onVisibilityAggregated(isVisible: Boolean) { super.onVisibilityAggregated(isVisible); if (isVisible) updateVisibility() else cancelPreview() }
|
|
41
44
|
}
|
|
42
45
|
private val image = NativeListImageSlot(context)
|
|
43
46
|
private val video = AspectRatioFrameLayout(context)
|
|
@@ -51,6 +54,10 @@ internal class NativeListMediaPreviewSlot(private val context: ThemedReactContex
|
|
|
51
54
|
private var completion: ((Boolean) -> Unit)? = null
|
|
52
55
|
private var pendingCompletion: Runnable? = null
|
|
53
56
|
private var player: ExoPlayer? = null
|
|
57
|
+
private var subscription: OneKeyMediaPreviewCache.Subscription? = null
|
|
58
|
+
private var extractionLease: UUID? = null
|
|
59
|
+
private var requestedEdge: Int? = null
|
|
60
|
+
private val previewCache by lazy { OneKeyMediaPreviewCache.get(context) }
|
|
54
61
|
private var resumeVideo: (() -> Unit)? = null
|
|
55
62
|
private var viewportObserver: ViewTreeObserver? = null
|
|
56
63
|
private val visibleRect = Rect()
|
|
@@ -99,7 +106,7 @@ internal class NativeListMediaPreviewSlot(private val context: ThemedReactContex
|
|
|
99
106
|
val candidate = candidateGeneration
|
|
100
107
|
resumeVideo = null
|
|
101
108
|
stopObservingViewport()
|
|
102
|
-
|
|
109
|
+
cancelPreview()
|
|
103
110
|
if (attempt >= order.size) {
|
|
104
111
|
result = false
|
|
105
112
|
completion?.invoke(false)
|
|
@@ -133,8 +140,36 @@ internal class NativeListMediaPreviewSlot(private val context: ThemedReactContex
|
|
|
133
140
|
val uri = source.optString("uri")
|
|
134
141
|
if (uri.isBlank()) { finished(false); return }
|
|
135
142
|
val headers = source.optJSONObject("headers")?.let { values -> values.keys().asSequence().associateWith { values.optString(it) } } ?: emptyMap()
|
|
143
|
+
val fitKey = if ((fit ?: source.optString("contentFit")) == "cover") "cover" else "contain"
|
|
136
144
|
resumeVideo = start@{
|
|
137
|
-
if (epoch != token || candidateGeneration != candidate ||
|
|
145
|
+
if (epoch != token || candidateGeneration != candidate || subscription != null || frame.drawable != null ||
|
|
146
|
+
video.width <= 0 || video.height <= 0) return@start
|
|
147
|
+
val edge = OneKeyMediaPreviewCache.targetEdge(maxOf(view.width, view.height))
|
|
148
|
+
requestedEdge = edge
|
|
149
|
+
subscription = previewCache.request(uri, headers, edge, fitKey, source.optString("cachePolicy", "memory-disk"),
|
|
150
|
+
onImage = { still ->
|
|
151
|
+
if (epoch == token && candidateGeneration == candidate) {
|
|
152
|
+
subscription = null
|
|
153
|
+
video.setAspectRatio(still.width.toFloat() / still.height)
|
|
154
|
+
frame.setImageBitmap(still); frame.visibility = View.VISIBLE
|
|
155
|
+
stopObservingViewport(); finished(true)
|
|
156
|
+
}
|
|
157
|
+
}, onExtract = { lease ->
|
|
158
|
+
if (epoch == token && candidateGeneration == candidate) {
|
|
159
|
+
extractionLease = lease
|
|
160
|
+
updateVisibility()
|
|
161
|
+
if (extractionLease == lease && requestedEdge == edge) startPlayer(uri, headers, token, candidate, edge, lease)
|
|
162
|
+
}
|
|
163
|
+
}, onRevoked = { extractionLease = null; releasePlayer() },
|
|
164
|
+
onFailure = {
|
|
165
|
+
if (epoch == token && candidateGeneration == candidate) { subscription = null; finished(false) }
|
|
166
|
+
})
|
|
167
|
+
}
|
|
168
|
+
observeViewport()
|
|
169
|
+
updateVisibility()
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
private fun startPlayer(uri: String, headers: Map<String, String>, token: Int, candidate: Int, edge: Int, lease: UUID) {
|
|
138
173
|
playerGeneration++
|
|
139
174
|
val generation = playerGeneration
|
|
140
175
|
try {
|
|
@@ -158,10 +193,11 @@ internal class NativeListMediaPreviewSlot(private val context: ThemedReactContex
|
|
|
158
193
|
next.addListener(object : Player.Listener {
|
|
159
194
|
override fun onRenderedFirstFrame() {
|
|
160
195
|
if (playerGeneration != generation) return
|
|
161
|
-
|
|
162
|
-
|
|
196
|
+
captureFirstFrame(token, candidate, generation, FIRST_FRAME_CAPTURE_ATTEMPTS, edge, lease)
|
|
197
|
+
}
|
|
198
|
+
override fun onPlayerError(error: PlaybackException) {
|
|
199
|
+
view.post { if (playerGeneration == generation) previewCache.fail(lease) }
|
|
163
200
|
}
|
|
164
|
-
override fun onPlayerError(error: PlaybackException) { if (playerGeneration == generation) finished(false, generation) }
|
|
165
201
|
override fun onVideoSizeChanged(size: VideoSize) {
|
|
166
202
|
if (playerGeneration == generation && size.height > 0) video.setAspectRatio(size.width * size.pixelWidthHeightRatio / size.height)
|
|
167
203
|
}
|
|
@@ -170,39 +206,26 @@ internal class NativeListMediaPreviewSlot(private val context: ThemedReactContex
|
|
|
170
206
|
next.prepare()
|
|
171
207
|
next.pause()
|
|
172
208
|
} catch (_: Exception) {
|
|
173
|
-
|
|
174
|
-
finished(false)
|
|
209
|
+
previewCache.fail(lease)
|
|
175
210
|
}
|
|
176
|
-
}
|
|
177
|
-
observeViewport()
|
|
178
|
-
updateVisibility()
|
|
179
211
|
}
|
|
180
212
|
|
|
181
|
-
/**
|
|
182
|
-
|
|
183
|
-
* retried on later frames. If no frame can be copied the paused player stays attached.
|
|
184
|
-
*/
|
|
185
|
-
private fun captureFirstFrame(token: Int, candidate: Int, generation: Int, attemptsLeft: Int) {
|
|
213
|
+
/** TextureView requires UI access; request bounded pixels before background encoding. */
|
|
214
|
+
private fun captureFirstFrame(token: Int, candidate: Int, generation: Int, attemptsLeft: Int, edge: Int, lease: UUID) {
|
|
186
215
|
view.postOnAnimation {
|
|
187
216
|
if (epoch != token || candidateGeneration != candidate || playerGeneration != generation) return@postOnAnimation
|
|
188
|
-
// Releasing first would make the queued success completion drop itself as stale.
|
|
189
|
-
if (result != true) {
|
|
190
|
-
captureFirstFrame(token, candidate, generation, attemptsLeft)
|
|
191
|
-
return@postOnAnimation
|
|
192
|
-
}
|
|
193
217
|
val still = if (texture.isAvailable && texture.width > 0 && texture.height > 0) {
|
|
194
|
-
|
|
218
|
+
val scale = minOf(1.0, edge.toDouble() / maxOf(texture.width, texture.height))
|
|
219
|
+
runCatching { texture.getBitmap(maxOf(1, (texture.width * scale).toInt()), maxOf(1, (texture.height * scale).toInt())) }.getOrNull()
|
|
195
220
|
} else null
|
|
196
221
|
if (still == null || !hasVisiblePixels(still)) {
|
|
197
222
|
still?.recycle()
|
|
198
|
-
if (attemptsLeft > 1) captureFirstFrame(token, candidate, generation, attemptsLeft - 1)
|
|
223
|
+
if (attemptsLeft > 1) captureFirstFrame(token, candidate, generation, attemptsLeft - 1, edge, lease)
|
|
224
|
+
else previewCache.fail(lease)
|
|
199
225
|
return@postOnAnimation
|
|
200
226
|
}
|
|
201
|
-
frame.setImageBitmap(still)
|
|
202
|
-
frame.visibility = View.VISIBLE
|
|
203
|
-
resumeVideo = null
|
|
204
|
-
stopObservingViewport()
|
|
205
227
|
releasePlayer()
|
|
228
|
+
previewCache.complete(lease, still)
|
|
206
229
|
}
|
|
207
230
|
}
|
|
208
231
|
|
|
@@ -213,7 +236,7 @@ internal class NativeListMediaPreviewSlot(private val context: ThemedReactContex
|
|
|
213
236
|
}
|
|
214
237
|
|
|
215
238
|
private fun observeViewport() {
|
|
216
|
-
if (viewportObserver != null || resumeVideo == null || !view.isAttachedToWindow) return
|
|
239
|
+
if (viewportObserver != null || resumeVideo == null || frame.drawable != null || !view.isAttachedToWindow) return
|
|
217
240
|
view.viewTreeObserver.takeIf { it.isAlive }?.let {
|
|
218
241
|
it.addOnScrollChangedListener(scrollListener)
|
|
219
242
|
it.addOnGlobalLayoutListener(layoutListener)
|
|
@@ -230,6 +253,13 @@ internal class NativeListMediaPreviewSlot(private val context: ThemedReactContex
|
|
|
230
253
|
viewportObserver = null
|
|
231
254
|
}
|
|
232
255
|
private fun updateVisibility() {
|
|
256
|
+
requestedEdge?.let { previous ->
|
|
257
|
+
if (video.width > 0 && video.height > 0 && OneKeyMediaPreviewCache.targetEdge(maxOf(view.width, view.height)) != previous) {
|
|
258
|
+
cancelPreview(); requestedEdge = null
|
|
259
|
+
frame.setImageDrawable(null); frame.visibility = View.GONE; result = null
|
|
260
|
+
observeViewport()
|
|
261
|
+
}
|
|
262
|
+
}
|
|
233
263
|
var ancestor: View? = view
|
|
234
264
|
var opaque = true
|
|
235
265
|
while (ancestor != null) {
|
|
@@ -238,7 +268,11 @@ internal class NativeListMediaPreviewSlot(private val context: ThemedReactContex
|
|
|
238
268
|
}
|
|
239
269
|
if (opaque && view.isAttachedToWindow && view.windowVisibility == View.VISIBLE && view.isShown &&
|
|
240
270
|
view.getGlobalVisibleRect(visibleRect) && !visibleRect.isEmpty) resumeVideo?.invoke()
|
|
241
|
-
else
|
|
271
|
+
else cancelPreview()
|
|
272
|
+
}
|
|
273
|
+
private fun cancelPreview() {
|
|
274
|
+
val previous = subscription; subscription = null
|
|
275
|
+
previewCache.cancel(previous); extractionLease = null; releasePlayer()
|
|
242
276
|
}
|
|
243
277
|
private fun releasePlayer() {
|
|
244
278
|
playerGeneration++
|
|
@@ -251,11 +285,12 @@ internal class NativeListMediaPreviewSlot(private val context: ThemedReactContex
|
|
|
251
285
|
pendingCompletion = null
|
|
252
286
|
resumeVideo = null
|
|
253
287
|
stopObservingViewport()
|
|
254
|
-
|
|
288
|
+
cancelPreview()
|
|
255
289
|
image.recycle()
|
|
256
290
|
image.view.visibility = View.VISIBLE
|
|
257
291
|
video.visibility = View.GONE
|
|
258
292
|
video.setAspectRatio(0f)
|
|
293
|
+
requestedEdge = null
|
|
259
294
|
frame.setImageDrawable(null)
|
|
260
295
|
frame.visibility = View.GONE
|
|
261
296
|
identity = null; result = null; completion = null
|
|
@@ -138,7 +138,7 @@ internal class NativeListMediaTileRowView(context: ThemedReactContext, fonts: Na
|
|
|
138
138
|
val state = item.json.optString("imageState")
|
|
139
139
|
errorIcon.visibility = if (state == "error") VISIBLE else GONE
|
|
140
140
|
errorIcon.iconName = "ImageSquareWavesOutline"
|
|
141
|
-
errorIcon.tintColor =
|
|
141
|
+
errorIcon.tintColor = tint("disabledText", "#8C8C8C")
|
|
142
142
|
errorIcon.useSourceScale = sourceScale
|
|
143
143
|
errorIcon.layoutParams = FrameLayout.LayoutParams(dp(24), dp(24), Gravity.CENTER)
|
|
144
144
|
val media = item.json.optJSONObject("media")
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
package com.margelo.nitro.nativelist
|
|
2
2
|
|
|
3
3
|
import android.graphics.Color
|
|
4
|
+
import android.graphics.Canvas
|
|
4
5
|
import android.graphics.Outline
|
|
6
|
+
import android.graphics.Paint
|
|
5
7
|
import android.graphics.drawable.GradientDrawable
|
|
6
8
|
import android.view.Gravity
|
|
7
9
|
import android.view.View
|
|
@@ -211,6 +213,7 @@ internal class NativeListMessageRowView(context: ThemedReactContext, fonts: Nati
|
|
|
211
213
|
NativeListRendererRowView(context, fonts) {
|
|
212
214
|
override val assetFields = listOf("leading", "thumbnail")
|
|
213
215
|
private val views = NativeListMessageRenderer.Views(context, fonts)
|
|
216
|
+
private val warningBorderPaint = Paint(Paint.ANTI_ALIAS_FLAG)
|
|
214
217
|
|
|
215
218
|
override fun bindContent(
|
|
216
219
|
item: NativeListItem,
|
|
@@ -229,5 +232,27 @@ internal class NativeListMessageRowView(context: ThemedReactContext, fonts: Nati
|
|
|
229
232
|
|
|
230
233
|
override fun recycleContent() = views.recycle()
|
|
231
234
|
|
|
235
|
+
override fun appearance() {
|
|
236
|
+
super.appearance()
|
|
237
|
+
if (boundItem?.json?.optString("presentation") == "inlineWarning") {
|
|
238
|
+
foreground = null
|
|
239
|
+
clipToOutline = false
|
|
240
|
+
(background as? GradientDrawable)?.cornerRadius = 0f
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
override fun dispatchDraw(canvas: Canvas) {
|
|
245
|
+
super.dispatchDraw(canvas)
|
|
246
|
+
val item = boundItem ?: return
|
|
247
|
+
if (item.json.optString("presentation") != "inlineWarning") return
|
|
248
|
+
val container = item.json.optJSONObject("style")?.optJSONObject("container") ?: return
|
|
249
|
+
val borderWidth = container.optDouble("borderWidth", 0.0).toFloat()
|
|
250
|
+
if (borderWidth <= 0) return
|
|
251
|
+
val pixels = (borderWidth * resources.displayMetrics.density).coerceAtLeast(1f)
|
|
252
|
+
warningBorderPaint.color = parseNativeListColor(container.optString("borderColor", "#00000000"))
|
|
253
|
+
canvas.drawRect(0f, 0f, width.toFloat(), pixels, warningBorderPaint)
|
|
254
|
+
canvas.drawRect(0f, height - pixels, width.toFloat(), height.toFloat(), warningBorderPaint)
|
|
255
|
+
}
|
|
256
|
+
|
|
232
257
|
override fun disposeContent() = views.dispose()
|
|
233
258
|
}
|
|
@@ -4,6 +4,7 @@ import org.json.JSONArray
|
|
|
4
4
|
import org.json.JSONObject
|
|
5
5
|
import java.nio.ByteBuffer
|
|
6
6
|
import java.security.MessageDigest
|
|
7
|
+
import kotlin.math.roundToInt
|
|
7
8
|
import java.util.Locale
|
|
8
9
|
|
|
9
10
|
internal data class NativeSelectionTarget(val scope: String, val key: String?)
|
|
@@ -13,7 +14,7 @@ internal fun isNativeListRowPressEnabled(
|
|
|
13
14
|
variant: String,
|
|
14
15
|
disabled: Boolean,
|
|
15
16
|
pressDisabled: Boolean,
|
|
16
|
-
): Boolean = !disabled && !pressDisabled && (type != "system" || variant == "retry")
|
|
17
|
+
): Boolean = !disabled && !pressDisabled && type != "buttonGroup" && (type != "system" || variant == "retry")
|
|
17
18
|
|
|
18
19
|
internal fun isNativeListWholeRowInteractive(
|
|
19
20
|
type: String,
|
|
@@ -27,6 +28,118 @@ internal fun isNativeListWholeRowInteractive(
|
|
|
27
28
|
pressDisabled = pressDisabled,
|
|
28
29
|
)
|
|
29
30
|
|
|
31
|
+
/**
|
|
32
|
+
* A trailing text accessory (value, value pair, progress, radio, switch) owns its
|
|
33
|
+
* tap only when it carries an action key; otherwise the touch belongs to the row
|
|
34
|
+
* press, so a value such as a network balance is part of the row's hit area.
|
|
35
|
+
*/
|
|
36
|
+
internal fun isNativeListTrailingTextClickable(actionKey: String?): Boolean = !actionKey.isNullOrEmpty()
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A leading visual lays these badges past its own frame: the token network image
|
|
40
|
+
* with its backdrop, a `cornerIcon`, and every overlay (their default offset
|
|
41
|
+
* already overhangs; iOS stops clipping for the same descriptors). Android clips
|
|
42
|
+
* a child to its own bounds whenever its parent clips children, so the host row
|
|
43
|
+
* must stop clipping, or the badge is cut flat (OK-65694).
|
|
44
|
+
*/
|
|
45
|
+
internal fun nativeListLeadingVisualOverhangsFrame(
|
|
46
|
+
kind: String,
|
|
47
|
+
sourceCount: Int,
|
|
48
|
+
hasCornerIcon: Boolean,
|
|
49
|
+
overlayCount: Int,
|
|
50
|
+
): Boolean = kind == "token" && sourceCount > 1 || hasCornerIcon || overlayCount > 0
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Whether an Activity row host (and, for a rich `amounts` row, the details view
|
|
54
|
+
* with its nested columns) clips its children and padding for this bind. One
|
|
55
|
+
* row view serves both the legacy row and the rich row and is reused across
|
|
56
|
+
* binds, so clipping is derived from the bound item alone and applied on every
|
|
57
|
+
* bind: a row whose bound leading visual lays a badge past its frame
|
|
58
|
+
* ([nativeListLeadingVisualOverhangsFrame]) opts out, whether that visual sits
|
|
59
|
+
* on the host (legacy row, OK-66071) or on the details view (rich row,
|
|
60
|
+
* OK-66275); a row without such a badge clips again even when the view it
|
|
61
|
+
* reuses last showed one.
|
|
62
|
+
*/
|
|
63
|
+
internal fun nativeListActivityHostClips(leadingOverhangs: Boolean): Boolean = !leadingOverhangs
|
|
64
|
+
|
|
65
|
+
internal data class NativeListSlotFrame(val x: Int, val y: Int, val width: Int, val height: Int)
|
|
66
|
+
|
|
67
|
+
/** Side of one member of an Activity token pair inside a [frame]-unit box (24 in 40). */
|
|
68
|
+
internal fun nativeListLeadingPairMemberSize(frame: Int): Int = (frame * 0.6f).roundToInt()
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Frame of image source [index] of a leading visual inside its [width]×[height]
|
|
72
|
+
* box (SPEC "Activity leading pair", OK-66071). [networkIndex] is the token
|
|
73
|
+
* `networkImage` badge and [pairIndex] the Activity `secondaryLeading` token;
|
|
74
|
+
* either is null when absent. A pair draws the primary at the top-left and the
|
|
75
|
+
* secondary at the bottom-right, both [nativeListLeadingPairMemberSize] wide and
|
|
76
|
+
* the secondary inset by its [pairRing]; the badge keeps its corner geometry
|
|
77
|
+
* above them. A lone token, or a token with only a badge, fills the box. Any
|
|
78
|
+
* other multi-source visual (stackedImages) steps 0.72-sized images diagonally.
|
|
79
|
+
*/
|
|
80
|
+
internal fun nativeListLeadingSlotFrame(
|
|
81
|
+
index: Int,
|
|
82
|
+
sourceCount: Int,
|
|
83
|
+
networkIndex: Int?,
|
|
84
|
+
pairIndex: Int?,
|
|
85
|
+
width: Int,
|
|
86
|
+
height: Int,
|
|
87
|
+
badgeSize: Int,
|
|
88
|
+
badgeOverhang: Int,
|
|
89
|
+
pairRing: Int,
|
|
90
|
+
): NativeListSlotFrame {
|
|
91
|
+
if (index == networkIndex)
|
|
92
|
+
return NativeListSlotFrame(
|
|
93
|
+
width - badgeSize + badgeOverhang,
|
|
94
|
+
height - badgeSize + badgeOverhang,
|
|
95
|
+
badgeSize,
|
|
96
|
+
badgeSize,
|
|
97
|
+
)
|
|
98
|
+
if (pairIndex != null) {
|
|
99
|
+
val member = nativeListLeadingPairMemberSize(height)
|
|
100
|
+
return if (index == pairIndex)
|
|
101
|
+
NativeListSlotFrame(width - member - pairRing, height - member - pairRing, member, member)
|
|
102
|
+
else NativeListSlotFrame(0, 0, member, member)
|
|
103
|
+
}
|
|
104
|
+
if (sourceCount == 1 || networkIndex != null) return NativeListSlotFrame(0, 0, width, height)
|
|
105
|
+
val side = (height * 0.72f).roundToInt()
|
|
106
|
+
val x = (index * (width - side).toFloat() / maxOf(1, sourceCount - 1)).roundToInt()
|
|
107
|
+
return NativeListSlotFrame(x, (height - side) / 2, side, side)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
internal data class NativeListTrailingDescriptor(
|
|
111
|
+
val kind: String,
|
|
112
|
+
val name: String = "",
|
|
113
|
+
val actionKey: String = "",
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Identity trailing accessories stack vertically unless they form one of the
|
|
118
|
+
* pairs every platform lays out side by side. The `valuePair` + `DotVerSolid`
|
|
119
|
+
* menu icon pair (the Swap token selector's balance and row menu) matches
|
|
120
|
+
* iOS `configureTrailingStack`; stacking it put the menu under the balance and
|
|
121
|
+
* clipped both inside the fixed row height on Android only.
|
|
122
|
+
*/
|
|
123
|
+
internal fun nativeListIdentityTrailingIsHorizontal(
|
|
124
|
+
accessories: List<NativeListTrailingDescriptor>,
|
|
125
|
+
): Boolean {
|
|
126
|
+
val kinds = accessories.map { it.kind }
|
|
127
|
+
if (kinds.containsAll(listOf("value", "checkbox"))) return true
|
|
128
|
+
if (accessories.size != 2) return false
|
|
129
|
+
val (first, second) = accessories
|
|
130
|
+
return kinds == listOf("valuePair", "menu") ||
|
|
131
|
+
kinds == listOf("valuePair", "chevron") ||
|
|
132
|
+
(kinds == listOf("valuePair", "icon") &&
|
|
133
|
+
second.name == "DotVerSolid" &&
|
|
134
|
+
second.actionKey == "menu") ||
|
|
135
|
+
(kinds == listOf("icon", "chevron") &&
|
|
136
|
+
first.name == "RefreshCcwOutline" &&
|
|
137
|
+
first.actionKey.isEmpty()) ||
|
|
138
|
+
(kinds == listOf("icon", "icon") &&
|
|
139
|
+
first.name == "PencilOutline" &&
|
|
140
|
+
second.name == "DragOutline")
|
|
141
|
+
}
|
|
142
|
+
|
|
30
143
|
internal fun resolveNativeListSelectorBackgroundColor(
|
|
31
144
|
rowType: String,
|
|
32
145
|
styleBackgroundColor: String?,
|
|
@@ -57,7 +170,7 @@ private fun updateLengthPrefixed(digest: MessageDigest, value: String) {
|
|
|
57
170
|
}
|
|
58
171
|
|
|
59
172
|
// Template type alone partitions reuse; data keys and styles never select a renderer.
|
|
60
|
-
internal enum class NativeListRendererKey { MESSAGE, RAIL, MEDIA_TILE, ACTION, SYSTEM, ACTIVITY, DATA_ROW, METRIC_CARD, MARKET, IDENTITY, SECTION_HEADER, WALLET_GROUP }
|
|
173
|
+
internal enum class NativeListRendererKey { MESSAGE, RAIL, MEDIA_TILE, ACTION, SYSTEM, ACTIVITY, DATA_ROW, METRIC_CARD, MARKET, IDENTITY, SECTION_HEADER, WALLET_GROUP, BUTTON_GROUP }
|
|
61
174
|
|
|
62
175
|
internal data class NativeListItem(
|
|
63
176
|
val key: String,
|
|
@@ -142,6 +255,8 @@ internal data class NativeListItem(
|
|
|
142
255
|
|
|
143
256
|
internal data class NativeListConfig(
|
|
144
257
|
val generation: Int,
|
|
258
|
+
val structuralTransition: StructuralTransition?,
|
|
259
|
+
val disclosure: Disclosure?,
|
|
145
260
|
val layout: String,
|
|
146
261
|
val orientation: String,
|
|
147
262
|
val gridColumns: Int,
|
|
@@ -168,9 +283,36 @@ internal data class NativeListConfig(
|
|
|
168
283
|
val fixedFooter: NativeListItem?,
|
|
169
284
|
val items: List<NativeListItem>,
|
|
170
285
|
) {
|
|
286
|
+
internal data class StructuralTransition(
|
|
287
|
+
val id: String,
|
|
288
|
+
val durationMs: Long,
|
|
289
|
+
val anchorKey: String?,
|
|
290
|
+
)
|
|
291
|
+
internal data class Disclosure(
|
|
292
|
+
val expanded: Boolean,
|
|
293
|
+
val expandedTrailingInset: Double,
|
|
294
|
+
)
|
|
171
295
|
companion object {
|
|
172
296
|
fun parse(snapshotJson: String): NativeListConfig {
|
|
173
297
|
val root = JSONObject(snapshotJson)
|
|
298
|
+
val transition = root.optJSONObject("structuralTransition")
|
|
299
|
+
val structuralTransition = transition?.optString("id")?.takeIf(String::isNotEmpty)?.let { id ->
|
|
300
|
+
StructuralTransition(
|
|
301
|
+
id = id,
|
|
302
|
+
durationMs = transition.optDouble("durationMs", 220.0).coerceIn(0.0, 2000.0).toLong(),
|
|
303
|
+
anchorKey = transition.optString("anchorKey").takeIf(String::isNotEmpty),
|
|
304
|
+
)
|
|
305
|
+
}
|
|
306
|
+
val disclosureJson = root.optJSONObject("disclosure")
|
|
307
|
+
require(!root.has("disclosure") || disclosureJson != null) { "Invalid disclosure" }
|
|
308
|
+
val disclosure = disclosureJson?.let { value ->
|
|
309
|
+
require(value.opt("expanded") is Boolean) { "Invalid disclosure.expanded" }
|
|
310
|
+
require(!value.has("expandedTrailingInset") ||
|
|
311
|
+
value.opt("expandedTrailingInset") is Number) { "Invalid disclosure.expandedTrailingInset" }
|
|
312
|
+
val inset = value.optDouble("expandedTrailingInset", 0.0)
|
|
313
|
+
require(inset.isFinite() && inset >= 0.0) { "Invalid disclosure.expandedTrailingInset" }
|
|
314
|
+
Disclosure(value.getBoolean("expanded"), inset)
|
|
315
|
+
}
|
|
174
316
|
require(root.getInt("schemaVersion") == 1) { "Unsupported schemaVersion" }
|
|
175
317
|
val layout = root.getJSONObject("layout")
|
|
176
318
|
val selection = root.optJSONObject("selection")
|
|
@@ -193,6 +335,8 @@ internal data class NativeListConfig(
|
|
|
193
335
|
val fixedFooter = root.optJSONObject("fixedFooter")?.let(NativeListItem::parse)
|
|
194
336
|
return NativeListConfig(
|
|
195
337
|
generation = root.getInt("generation"),
|
|
338
|
+
structuralTransition = structuralTransition,
|
|
339
|
+
disclosure = disclosure,
|
|
196
340
|
layout = layout.getString("kind"),
|
|
197
341
|
orientation = layout.optString("orientation", "vertical"),
|
|
198
342
|
gridColumns = layout.optInt("gridColumns", 1).coerceIn(1, 7),
|
|
@@ -235,7 +379,9 @@ internal fun mergeRow(original: JSONObject, changes: JSONObject): JSONObject {
|
|
|
235
379
|
val keys = changes.keys()
|
|
236
380
|
while (keys.hasNext()) {
|
|
237
381
|
val key = keys.next()
|
|
238
|
-
if (key != "key" && key != "type")
|
|
382
|
+
if (key != "key" && key != "type") {
|
|
383
|
+
if (changes.isNull(key)) result.remove(key) else result.put(key, changes.get(key))
|
|
384
|
+
}
|
|
239
385
|
}
|
|
240
386
|
return result
|
|
241
387
|
}
|