onesignal-expo-plugin
Advanced tools
Comparing version 1.0.0-beta1 to 1.0.0-beta2
@@ -16,3 +16,3 @@ "use strict"; | ||
return (0, config_plugins_1.withEntitlementsPlist)(config, (newConfig) => { | ||
newConfig.modResults['aps-environment'] = mode; | ||
newConfig.modResults["aps-environment"] = mode; | ||
return newConfig; | ||
@@ -26,7 +26,12 @@ }); | ||
const withRemoteNotificationsPermissions = (config) => { | ||
const BACKGROUND_MODE_KEYS = ["external-accessory", "remote-notification"]; | ||
return (0, config_plugins_1.withInfoPlist)(config, (newConfig) => { | ||
newConfig.modResults.UIBackgroundModes = [ | ||
'external-accessory', | ||
'remote-notifications', | ||
]; | ||
if (!Array.isArray(newConfig.modResults.UIBackgroundModes)) { | ||
newConfig.modResults.UIBackgroundModes = []; | ||
} | ||
for (const key of BACKGROUND_MODE_KEYS) { | ||
if (!newConfig.modResults.UIBackgroundModes.includes(key)) { | ||
newConfig.modResults.UIBackgroundModes.push(key); | ||
} | ||
} | ||
return newConfig; | ||
@@ -40,7 +45,9 @@ }); | ||
const withAppGroupPermissions = (config) => { | ||
const APP_GROUP_KEY = "com.apple.security.application-groups"; | ||
return (0, config_plugins_1.withEntitlementsPlist)(config, (newConfig) => { | ||
var _a; | ||
newConfig.modResults['com.apple.security.application-groups'] = [ | ||
`group.${((_a = newConfig === null || newConfig === void 0 ? void 0 : newConfig.ios) === null || _a === void 0 ? void 0 : _a.bundleIdentifier) || ''}.onesignal`, | ||
]; | ||
if (!Array.isArray(newConfig.modResults[APP_GROUP_KEY])) { | ||
newConfig.modResults[APP_GROUP_KEY] = []; | ||
} | ||
newConfig.modResults[APP_GROUP_KEY].push(`group.${((_a = newConfig === null || newConfig === void 0 ? void 0 : newConfig.ios) === null || _a === void 0 ? void 0 : _a.bundleIdentifier) || ""}.onesignal`); | ||
return newConfig; | ||
@@ -47,0 +54,0 @@ }); |
@@ -10,4 +10,4 @@ /** | ||
withInfoPlist, | ||
} from '@expo/config-plugins'; | ||
import { OneSignalPluginProps } from './withOneSignal'; | ||
} from "@expo/config-plugins"; | ||
import { OneSignalPluginProps } from "./withOneSignal"; | ||
@@ -22,6 +22,6 @@ // ---------- ---------- ---------- ---------- | ||
config, | ||
{ mode }, | ||
{ mode } | ||
) => { | ||
return withEntitlementsPlist(config, (newConfig) => { | ||
newConfig.modResults['aps-environment'] = mode; | ||
newConfig.modResults["aps-environment"] = mode; | ||
return newConfig; | ||
@@ -36,9 +36,15 @@ }); | ||
const withRemoteNotificationsPermissions: ConfigPlugin<OneSignalPluginProps> = ( | ||
config, | ||
config | ||
) => { | ||
const BACKGROUND_MODE_KEYS = ["external-accessory", "remote-notification"]; | ||
return withInfoPlist(config, (newConfig) => { | ||
newConfig.modResults.UIBackgroundModes = [ | ||
'external-accessory', | ||
'remote-notifications', | ||
]; | ||
if (!Array.isArray(newConfig.modResults.UIBackgroundModes)) { | ||
newConfig.modResults.UIBackgroundModes = []; | ||
} | ||
for (const key of BACKGROUND_MODE_KEYS) { | ||
if (!newConfig.modResults.UIBackgroundModes.includes(key)) { | ||
newConfig.modResults.UIBackgroundModes.push(key); | ||
} | ||
} | ||
return newConfig; | ||
@@ -53,8 +59,13 @@ }); | ||
const withAppGroupPermissions: ConfigPlugin<OneSignalPluginProps> = ( | ||
config, | ||
config | ||
) => { | ||
const APP_GROUP_KEY = "com.apple.security.application-groups"; | ||
return withEntitlementsPlist(config, (newConfig) => { | ||
newConfig.modResults['com.apple.security.application-groups'] = [ | ||
`group.${newConfig?.ios?.bundleIdentifier || ''}.onesignal`, | ||
]; | ||
if (!Array.isArray(newConfig.modResults[APP_GROUP_KEY])) { | ||
newConfig.modResults[APP_GROUP_KEY] = []; | ||
} | ||
(newConfig.modResults[APP_GROUP_KEY] as Array<any>).push( | ||
`group.${newConfig?.ios?.bundleIdentifier || ""}.onesignal` | ||
); | ||
return newConfig; | ||
@@ -67,3 +78,3 @@ }); | ||
config, | ||
props, | ||
props | ||
) => { | ||
@@ -70,0 +81,0 @@ withAppEnvironment(config, props); |
{ | ||
"name": "onesignal-expo-plugin", | ||
"version": "1.0.0-beta1", | ||
"version": "1.0.0-beta2", | ||
"description": "The OneSignal Expo plugin allows you to use OneSignal without leaving the managed workflow. Developed in collaboration with SweetGreen.", | ||
@@ -25,3 +25,4 @@ "main": "build/withOneSignal.js", | ||
"Karen Grigoryan", | ||
"Rodrigo Gomez-Palacio" | ||
"Rodrigo Gomez-Palacio", | ||
"Charlie Cruzan" | ||
], | ||
@@ -28,0 +29,0 @@ "license": "MIT", |
@@ -37,3 +37,3 @@ <h1 align="center">Welcome to onesignal-expo-plugin 👋</h1> | ||
"plugins": [ | ||
"./node_modules/onesignal-expo-plugin/build/onesignal/withOneSignal.js" | ||
"onesignal-expo-plugin" | ||
] | ||
@@ -40,0 +40,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12959
247