planIapSlate function
Builds the slate plan for an iap invocation. Mirrors planAuthSlate in
shape; for RevenueCat and Superwall the user can type n to skip a
platform key, which is normalised to the empty string (the stub treats
'' as "leave the configure line commented out with placeholder text").
Implementation
SlatePlan? planIapSlate({required String service, required Prompt prompt}) {
switch (service) {
case 'RevenueCat':
var apple = prompt(appleRevenueCatKeyPrompt);
if (apple == 'n') apple = '';
var android = prompt(androidRevenueCatKeyPrompt);
if (android == 'n') android = '';
final config = NyRevenueCatSlateConfig(
appleAppId: apple,
androidAppId: android,
);
return SlatePlan(
packagesToAdd: const ['purchases_flutter', 'purchases_ui_flutter'],
templates: revenueCatRun(config),
config: config,
);
case 'Superwall':
var apple = prompt(appleSuperwallKeyPrompt);
if (apple == 'n') apple = '';
var android = prompt(androidSuperwallKeyPrompt);
if (android == 'n') android = '';
final config = NySuperwallSlateConfig(
appleApiKey: apple,
androidApiKey: android,
);
return SlatePlan(
packagesToAdd: const ['superwallkit_flutter'],
templates: superwallRun(config),
config: config,
);
default:
return null;
}
}