presentPaywallIfNeeded method
Future<bool>
presentPaywallIfNeeded(
{ - Offering? offering,
- bool displayCloseButton = false,
- bool isManualReset = false,
- bool isCheckConnection = true,
})
Implementation
Future<bool> presentPaywallIfNeeded({
Offering? offering,
bool displayCloseButton = false,
bool isManualReset = false,
bool isCheckConnection = true,
}) async {
if (isSubscribed) {
return true;
}
if (isCheckConnection) {
if (await InternetManager.instance.isOnline == false) {
return isSubscribed;
}
}
final paywallResult = await RevenueCatUI.presentPaywallIfNeeded(
entitlementId,
offering: offering,
displayCloseButton: displayCloseButton,
);
if (isManualReset) {
final entitlement = (await customerInfo).entitlements.all[entitlementId];
final active = entitlement?.isActive ?? false;
return active;
}
if (paywallResult == PaywallResult.purchased ||
paywallResult == PaywallResult.restored) {
return refreshFromRevenueCat();
}
return isSubscribed;
}