From e8f305c505eb3b5b4973c487d83ccd98d3e2d483 Mon Sep 17 00:00:00 2001 From: sakuntala_motukuri Date: Mon, 15 Jul 2024 12:53:06 -0400 Subject: [PATCH] Rebased onto main branch --- .../playerui/android/reference/assets/info/InfoTest.kt | 6 ++++++ .../playerui/android/reference/assets/info/Info.kt | 2 ++ .../android/src/main/res/layout/info.xml | 10 ++++++++++ plugins/reference-assets/components/src/index.test.tsx | 8 ++++++++ .../reference-assets/mocks/info/info-modal-flow.tsx | 3 +++ 5 files changed, 29 insertions(+) diff --git a/plugins/reference-assets/android/src/androidTest/java/com/intuit/playerui/android/reference/assets/info/InfoTest.kt b/plugins/reference-assets/android/src/androidTest/java/com/intuit/playerui/android/reference/assets/info/InfoTest.kt index 007dda34b..704cb4c9f 100644 --- a/plugins/reference-assets/android/src/androidTest/java/com/intuit/playerui/android/reference/assets/info/InfoTest.kt +++ b/plugins/reference-assets/android/src/androidTest/java/com/intuit/playerui/android/reference/assets/info/InfoTest.kt @@ -22,6 +22,8 @@ class InfoTest : AssetTest("reference-assets") { private fun verifyAndProceed(view: Int, action: PlayerAction? = null) { val infoTitle = currentView?.findViewById(R.id.info_title) ?: throw AssertionError("current view is null") val infoActions = currentView?.findViewById(R.id.info_actions) ?: throw AssertionError("current view is null") + val infoFooter = + currentView?.findViewById(R.id.info_footer) ?: throw AssertionError("current view is null") infoTitle[0].shouldBeView { assertEquals("View $view", text.toString()) @@ -35,6 +37,10 @@ class InfoTest : AssetTest("reference-assets") { blockUntilRendered() } } + + infoFooter[0].shouldBeView { + assertEquals("Footer Text", text.toString()) + } } @Test diff --git a/plugins/reference-assets/android/src/main/java/com/intuit/playerui/android/reference/assets/info/Info.kt b/plugins/reference-assets/android/src/main/java/com/intuit/playerui/android/reference/assets/info/Info.kt index f4b8d650e..67fd45cad 100644 --- a/plugins/reference-assets/android/src/main/java/com/intuit/playerui/android/reference/assets/info/Info.kt +++ b/plugins/reference-assets/android/src/main/java/com/intuit/playerui/android/reference/assets/info/Info.kt @@ -17,6 +17,7 @@ class Info(assetContext: AssetContext) : SuspendableAsset(assetContex val title: RenderableAsset? = null, val primaryInfo: RenderableAsset? = null, val actions: List = emptyList(), + val footer: RenderableAsset? = null, ) override suspend fun initView(data: Data) = LayoutInflater.from(context).inflate(R.layout.info, null).rootView @@ -27,5 +28,6 @@ class Info(assetContext: AssetContext) : SuspendableAsset(assetContex data.actions.filterNotNull().map { it.render() } into findViewById(R.id.info_actions) + data.footer?.render() into findViewById(R.id.info_footer) } } diff --git a/plugins/reference-assets/android/src/main/res/layout/info.xml b/plugins/reference-assets/android/src/main/res/layout/info.xml index 0ce54394a..e299b624b 100644 --- a/plugins/reference-assets/android/src/main/res/layout/info.xml +++ b/plugins/reference-assets/android/src/main/res/layout/info.xml @@ -33,4 +33,14 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/info_primary_info" /> + + diff --git a/plugins/reference-assets/components/src/index.test.tsx b/plugins/reference-assets/components/src/index.test.tsx index 819424182..aa7a1df7b 100644 --- a/plugins/reference-assets/components/src/index.test.tsx +++ b/plugins/reference-assets/components/src/index.test.tsx @@ -100,6 +100,7 @@ describe("JSON serialization", () => { Continue + Footer Text , ) ).jsonValue, @@ -158,6 +159,13 @@ describe("JSON serialization", () => { }, }, ], + footer: { + asset: { + id: "info-view-footer", + type: "text", + value: "Footer Text", + }, + }, }); }); }); diff --git a/plugins/reference-assets/mocks/info/info-modal-flow.tsx b/plugins/reference-assets/mocks/info/info-modal-flow.tsx index b752a49e3..50adab889 100644 --- a/plugins/reference-assets/mocks/info/info-modal-flow.tsx +++ b/plugins/reference-assets/mocks/info/info-modal-flow.tsx @@ -10,6 +10,7 @@ const view1 = ( Continue + Footer Text ); @@ -24,6 +25,7 @@ const view2 = ( Dismiss + Footer Text ); @@ -35,6 +37,7 @@ const view3 = ( Next + Footer Text );