I need to pass activity to `Composable` for billing stuff like the code bellow ```@Composable intern...
m
I need to pass activity to
Composable
for billing stuff like the code bellow
Copy code
@Composable
internal fun BillingScreen(activity: Activity, billingClient: BillingClient)
is this a bad idea?
a
This is bad, very bad. Why do you need to pass it to the composable.?? It should be the other way around.
Instead only pass the required state to render the ui.
m
to start purchaseflow of billingClient it needs an activity instance
a
but compose is just for ui, your purchase flow should start in activity/viewmodel and should be triggered by events from ui
☝🏻 1
☝️ 1
c
@Mjahangiry75
Copy code
@Composable
internal fun BillingScreen(navigationAction: () -> Unit, billingClient: BillingClient)
then when something is clicked in BillingScreen you send that event up to your activity or navHost or whatever and it can handle the navigation.