Skip to content

Commit

Permalink
Support footer presentation in template 3
Browse files Browse the repository at this point in the history
  • Loading branch information
tonidero committed Oct 19, 2023
1 parent 355f6d4 commit c84f4f8
Showing 1 changed file with 36 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
Expand All @@ -26,6 +25,7 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.revenuecat.purchases.paywalls.PaywallData
import com.revenuecat.purchases.ui.revenuecatui.InternalPaywall
import com.revenuecat.purchases.ui.revenuecatui.PaywallMode
import com.revenuecat.purchases.ui.revenuecatui.PaywallOptions
import com.revenuecat.purchases.ui.revenuecatui.UIConstant
import com.revenuecat.purchases.ui.revenuecatui.composables.Footer
Expand All @@ -37,6 +37,7 @@ import com.revenuecat.purchases.ui.revenuecatui.composables.PaywallIconName
import com.revenuecat.purchases.ui.revenuecatui.composables.PurchaseButton
import com.revenuecat.purchases.ui.revenuecatui.data.PaywallState
import com.revenuecat.purchases.ui.revenuecatui.data.PaywallViewModel
import com.revenuecat.purchases.ui.revenuecatui.data.isInFullScreenMode
import com.revenuecat.purchases.ui.revenuecatui.data.processed.TemplateConfiguration
import com.revenuecat.purchases.ui.revenuecatui.data.selectedLocalization
import com.revenuecat.purchases.ui.revenuecatui.data.testdata.MockViewModel
Expand All @@ -57,21 +58,24 @@ internal fun Template3(
viewModel: PaywallViewModel,
) {
Column(
modifier = Modifier.fillMaxSize(),
modifier = Modifier.fillMaxWidth(),
) {
Column(
modifier = Modifier
.weight(1f)
.fillMaxWidth()
.padding(
horizontal = UIConstant.defaultHorizontalPadding,
vertical = UIConstant.defaultVerticalSpacing,
),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(UIConstant.defaultVerticalSpacing, Alignment.Top),
) {
Template3MainContent(state)
if (state.isInFullScreenMode) {
Column(
modifier = Modifier
.weight(1f)
.fillMaxWidth()
.padding(
horizontal = UIConstant.defaultHorizontalPadding,
vertical = UIConstant.defaultVerticalSpacing,
),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(UIConstant.defaultVerticalSpacing, Alignment.Top),
) {
Template3MainContent(state)
}
}

Column(
modifier = Modifier
.align(Alignment.CenterHorizontally)
Expand Down Expand Up @@ -197,3 +201,21 @@ private fun Template3Preview() {
viewModel = MockViewModel(offering = TestData.template3Offering),
)
}

@Preview(showBackground = true)
@Composable
private fun Template3FooterPreview() {
InternalPaywall(
options = PaywallOptions.Builder().build(),
viewModel = MockViewModel(mode = PaywallMode.FOOTER, offering = TestData.template3Offering),
)
}

@Preview(showBackground = true)
@Composable
private fun Template3CondensedFooterPreview() {
InternalPaywall(
options = PaywallOptions.Builder().build(),
viewModel = MockViewModel(mode = PaywallMode.FOOTER_CONDENSED, offering = TestData.template3Offering),
)
}

0 comments on commit c84f4f8

Please sign in to comment.