Skip to content
Merged
Changes from 1 commit
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 @@ -122,9 +122,9 @@ class PaywallActivityLauncher(resultCaller: ActivityResultCaller, resultHandler:
}

@InternalRevenueCatAPI
@JvmSynthetic
@JvmOverloads
fun launch(
offeringIdentifier: String,
offeringIdentifier: String?,
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is required to be able to call launch without an offering identifier. I can't use the launch that accepts an Offering because I need the presentedOfferingContext as parameter

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I think presentedOfferingContext should always be null if the offering identifier/offering is null right? If so, I think we should be able to use that one?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, ok, so if offering and presentedOfferingContext are null, call the one with Offering. Otherwise this one. Good to know!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to pick your brain:

  • If I remove ? and keep the @JvmOverloads, there are two conflicting APIs in Java since launcher.launch(null, null) could be launch(Offering,ParcelizableFontProvider) and launch(String,PresentedOfferingContext)
  • If I don't use @JvmOverloads I can't use the defaults in the optional parameters in launch and launchIfNeeded

Any ideas besides creating new calls? Or migrating this to Kotlin lol

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I know what to do! @JvmName("launchWithOfferingId")

presentedOfferingContext: PresentedOfferingContext,
fontProvider: ParcelizableFontProvider? = null,
shouldDisplayDismissButton: Boolean = DEFAULT_DISPLAY_DISMISS_BUTTON,
Expand Down Expand Up @@ -247,10 +247,10 @@ class PaywallActivityLauncher(resultCaller: ActivityResultCaller, resultHandler:

@Suppress("LongParameterList")
@InternalRevenueCatAPI
@JvmSynthetic
@JvmOverloads
fun launchIfNeeded(
requiredEntitlementIdentifier: String,
offeringIdentifier: String,
offeringIdentifier: String?,
presentedOfferingContext: PresentedOfferingContext,
fontProvider: ParcelizableFontProvider? = null,
shouldDisplayDismissButton: Boolean = DEFAULT_DISPLAY_DISMISS_BUTTON,
Expand All @@ -264,10 +264,12 @@ class PaywallActivityLauncher(resultCaller: ActivityResultCaller, resultHandler:
launchPaywallWithArgs(
PaywallActivityArgs(
requiredEntitlementIdentifier = requiredEntitlementIdentifier,
offeringIdAndPresentedOfferingContext = OfferingSelection.IdAndPresentedOfferingContext(
offeringId = offeringIdentifier,
presentedOfferingContext = presentedOfferingContext,
),
offeringIdAndPresentedOfferingContext = offeringIdentifier?.let {
OfferingSelection.IdAndPresentedOfferingContext(
offeringId = it,
presentedOfferingContext = presentedOfferingContext,
)
},
fontProvider = fontProvider,
shouldDisplayDismissButton = shouldDisplayDismissButton,
edgeToEdge = edgeToEdge,
Expand Down