I’m currently launching Paywall from inside a Fragment like this:
class PaywallFragment: Fragment(), PaywallResultHandler, SlidePolicy {
private lateinit var paywallActivityLauncher: PaywallActivityLauncher
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
paywallActivityLauncher = PaywallActivityLauncher(this, this)
}
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
launchPaywall()
return super.onCreateView(inflater, container, savedInstanceState)
}
override fun onResume() {
super.onResume()
}
private fun launchPaywall() {
Purchases.sharedInstance.getOfferings(object : ReceiveOfferingsCallback {
override fun onError(error: PurchasesError) {
Timber.e(error.message)
}
override fun onReceived(offerings: Offerings) {
val currentOffering = offerings.current
currentOffering?.let { offering ->
paywallActivityLauncher.launch(offering)
}
}
})
}
override fun onActivityResult(result: PaywallResult) {
}
override val isPolicyRespected: Boolean get() = true
override fun onUserIllegallyRequestedNextPage() {
//
}
companion object {
fun newInstance(): PaywallFragment {
return PaywallFragment()
}
}
}
The problem is - this is launching an activity from inside a Fragment. I want to show this paywall as a fragment during the onboarding phase (inside the onboarding activity as one of the slides). I don’t see any support on the SDK to achieve that. Is it possible?
Note that I’m not using Jetpack Compose on my project.