Skip to content

Commit 072e2eb

Browse files
committed
Expose launch and launchIfNeeded to Java (#2695)
Required for RevenueCat/purchases-unity#649
1 parent eb73463 commit 072e2eb

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

ui/revenuecatui/src/main/kotlin/com/revenuecat/purchases/ui/revenuecatui/activity/PaywallActivityLauncher.kt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,9 @@ class PaywallActivityLauncher(resultCaller: ActivityResultCaller, resultHandler:
121121
)
122122
}
123123

124+
@JvmName("launchWithOfferingId")
124125
@InternalRevenueCatAPI
125-
@JvmSynthetic
126+
@JvmOverloads
126127
fun launch(
127128
offeringIdentifier: String,
128129
presentedOfferingContext: PresentedOfferingContext,
@@ -245,9 +246,10 @@ class PaywallActivityLauncher(resultCaller: ActivityResultCaller, resultHandler:
245246
}
246247
}
247248

249+
@JvmName("launchIfNeededWithOfferingId")
248250
@Suppress("LongParameterList")
249251
@InternalRevenueCatAPI
250-
@JvmSynthetic
252+
@JvmOverloads
251253
fun launchIfNeeded(
252254
requiredEntitlementIdentifier: String,
253255
offeringIdentifier: String,
@@ -264,10 +266,12 @@ class PaywallActivityLauncher(resultCaller: ActivityResultCaller, resultHandler:
264266
launchPaywallWithArgs(
265267
PaywallActivityArgs(
266268
requiredEntitlementIdentifier = requiredEntitlementIdentifier,
267-
offeringIdAndPresentedOfferingContext = OfferingSelection.IdAndPresentedOfferingContext(
268-
offeringId = offeringIdentifier,
269-
presentedOfferingContext = presentedOfferingContext,
270-
),
269+
offeringIdAndPresentedOfferingContext = offeringIdentifier?.let {
270+
OfferingSelection.IdAndPresentedOfferingContext(
271+
offeringId = it,
272+
presentedOfferingContext = presentedOfferingContext,
273+
)
274+
},
271275
fontProvider = fontProvider,
272276
shouldDisplayDismissButton = shouldDisplayDismissButton,
273277
edgeToEdge = edgeToEdge,

0 commit comments

Comments
 (0)