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

Create CustomerCenterView for hybrid usage #2170

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
@@ -0,0 +1,33 @@
package com.revenuecat.purchases.ui.revenuecatui.views

import android.content.Context
import android.util.AttributeSet
import androidx.compose.runtime.Composable
import androidx.compose.ui.platform.AbstractComposeView
import com.revenuecat.purchases.ui.revenuecatui.customercenter.CustomerCenter

/**
* View that wraps the [CustomerCenter] Composable to display the Customer Center through the View system.
*/
class CustomerCenterView : AbstractComposeView {

constructor(context: Context, attrs: AttributeSet?) : super(context, attrs)

constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)

constructor(
context: Context,
dismissHandler: (CustomerCenterView) -> Unit,
) : super(context) {
this.dismissHandler = dismissHandler
}

private var dismissHandler: ((CustomerCenterView) -> Unit) = {}

@Composable
override fun Content() {
CustomerCenter {
dismissHandler(this)
}
}
}