expo-finance-kit
Version:
Native Expo module for Apple FinanceKit - Access financial data from Apple Card and other accounts
33 lines (32 loc) • 1.78 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const config_plugins_1 = require("@expo/config-plugins");
const withInfoPlist_1 = require("./withInfoPlist");
const withEntitlements_1 = require("./withEntitlements");
const withAppGroups_1 = require("./withAppGroups");
const withBackgroundModes_1 = require("./withBackgroundModes");
const withBackgroundDeliveryExtension_1 = require("./withBackgroundDeliveryExtension");
const withExpoFinanceKit = (config, options = {}) => {
const { usageDescription = "This app needs access to your financial data to display account balances and transactions.", appGroupIdentifier = options.appGroupIdentifier || `group.${config.ios?.bundleIdentifier || 'com.expo.financekit'}`, enableBackgroundDelivery = true, backgroundModes = ["remote-notification", "processing"], } = options;
// Add Info.plist entries
config = (0, withInfoPlist_1.withInfoPlist)(config, { usageDescription });
// Add entitlements
config = (0, withEntitlements_1.withEntitlements)(config, {
appGroupIdentifier,
enableBackgroundDelivery
});
// Configure app groups
if (enableBackgroundDelivery) {
config = (0, withAppGroups_1.withAppGroups)(config, { appGroupIdentifier });
}
// Add background modes
if (enableBackgroundDelivery && backgroundModes.length > 0) {
config = (0, withBackgroundModes_1.withBackgroundModes)(config, { backgroundModes });
}
// Add background extension
if (enableBackgroundDelivery) {
config = (0, withBackgroundDeliveryExtension_1.withBackgroundDeliveryExtension)(config, { appGroupIdentifier });
}
return config;
};
exports.default = (0, config_plugins_1.createRunOncePlugin)(withExpoFinanceKit, 'expo-finance-kit');