1import { ConfigPlugin, createRunOncePlugin } from '@expo/config-plugins'; 2 3const pkg = require('expo-task-manager/package.json'); 4 5const withTaskManager: ConfigPlugin = config => { 6 if (!config.ios) config.ios = {}; 7 if (!config.ios.infoPlist) config.ios.infoPlist = {}; 8 if (!config.ios.infoPlist.UIBackgroundModes) config.ios.infoPlist.UIBackgroundModes = []; 9 10 // TODO: Maybe entitlements are needed 11 config.ios.infoPlist.UIBackgroundModes = [ 12 ...new Set(config.ios.infoPlist.UIBackgroundModes.concat(['location', 'fetch'])), 13 ]; 14 15 return config; 16}; 17 18export default createRunOncePlugin(withTaskManager, pkg.name, pkg.version); 19