Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert making PaywallFooterView an AbstractComposeView #1598

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package com.revenuecat.apitester.kotlin.revenuecatui

import android.content.Context
import android.util.AttributeSet
import androidx.compose.ui.platform.AbstractComposeView
import android.widget.FrameLayout
import com.revenuecat.purchases.Offering
import com.revenuecat.purchases.ui.revenuecatui.ExperimentalPreviewRevenueCatUIPurchasesAPI
import com.revenuecat.purchases.ui.revenuecatui.PaywallListener
Expand All @@ -14,7 +14,7 @@ import com.revenuecat.purchases.ui.revenuecatui.views.PaywallFooterView
private class PaywallFooterViewAPI {

fun checkType(context: Context) {
val paywallFooterView: AbstractComposeView = PaywallFooterView(context)
val paywallFooterView: FrameLayout = PaywallFooterView(context)
}

@Suppress("LongParameterList")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ package com.revenuecat.purchases.ui.revenuecatui.views

import android.content.Context
import android.util.AttributeSet
import androidx.compose.runtime.Composable
import android.widget.FrameLayout
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.AbstractComposeView
import androidx.compose.ui.platform.ComposeView
import com.revenuecat.purchases.CustomerInfo
import com.revenuecat.purchases.Offering
import com.revenuecat.purchases.Package
Expand All @@ -24,7 +24,7 @@ import com.revenuecat.purchases.ui.revenuecatui.fonts.FontProvider
* View that wraps the [PaywallFooter] Composable to display the Paywall Footer through XML layouts and the View system.
*/
@ExperimentalPreviewRevenueCatUIPurchasesAPI
open class PaywallFooterView : AbstractComposeView {
open class PaywallFooterView : FrameLayout {

constructor(context: Context, attrs: AttributeSet?) : super(context, attrs) {
init(context, attrs)
Expand Down Expand Up @@ -123,6 +123,19 @@ open class PaywallFooterView : AbstractComposeView {
.setFontProvider(initialFontProvider)
.setOfferingId(initialOfferingId)
.build()
addView(
ComposeView(context).apply {
setContent {
val paywallOptions by remember {
paywallOptionsState
}
PaywallFooter(
options = paywallOptions,
condensed = initialCondensed,
)
}
},
)
}

@SuppressWarnings("DestructuringDeclarationWithTooManyEntries")
Expand All @@ -133,16 +146,4 @@ open class PaywallFooterView : AbstractComposeView {
this.initialFontProvider = fontProvider
condensed?.let { this.initialCondensed = it }
}

@Composable
override fun Content() {
val paywallOptions by remember {
paywallOptionsState
}

PaywallFooter(
options = paywallOptions,
condensed = initialCondensed,
)
}
}