Github user ligaz commented on a diff in the pull request:
https://github.com/apache/cordova-ios/pull/128#discussion_r24230887
--- Diff: bin/templates/scripts/cordova/lib/push-notifications.js ---
@@ -0,0 +1,82 @@
+(function () {
+ var fs = require('fs'),
+ path = require('path'),
+ exec = require('child_process').exec,
+ PUSH_NOTIFICATIONS_ENABLED_HEADER_FILE =
'PushNotificationsEnabled.h',
+ PUSH_NOTIFICATIONS_ENABLED_HEADER_FILE_CONTENT = '#define
PUSH_NOTIFICATIONS_ENABLED ',
+ EXPANDED_PROVISIONING_PROFILE =
process.env.EXPANDED_PROVISIONING_PROFILE,
+ PATH_TO_MOBILE_PROVISIONS = path.join(process.env.HOME, 'Library',
'MobileDevice', 'Provisioning Profiles'),
+ PROVISIONING_PROFILE_REQUIRED =
process.env.PROVISIONING_PROFILE_REQUIRED,
+ PROVISIONING_PROFILE_UUID_REGEX = new
RegExp('<key>UUID<\/key>[\\s\\S]*<string>' + EXPANDED_PROVISIONING_PROFILE +
'<\/string>');
+
+ function logErrorIfExists(error) {
+ if (error !== null) {
+ console.error('ERROR: ' + error);
+ }
+ }
+
+ function sanitizeMobileProvision(mobileProvision) {
+ if (mobileProvision.indexOf('.mobileprovision') === -1) {
+ mobileProvision += '.mobileprovision';
+ }
+
+ return mobileProvision;
+ }
+
+ function createPushNotificationsEnabledHeaderFile(pushPluginsEnabled) {
+ var cordovaEnablePluginHeaderFileLocation = path.join(__dirname,
'..', '..', process.env.PROJECT_NAME, 'Classes',
PUSH_NOTIFICATIONS_ENABLED_HEADER_FILE);
+ fs.writeFileSync(cordovaEnablePluginHeaderFileLocation,
PUSH_NOTIFICATIONS_ENABLED_HEADER_FILE_CONTENT + pushPluginsEnabled);
+ }
+
+ function
createPushNotificationsEnabledHeaderFileWithMobileProvision(mobileProvision) {
+ var pathToProvisioningProfile =
path.join(PATH_TO_MOBILE_PROVISIONS, sanitizeMobileProvision(mobileProvision));
+
+ exec("security cms -D -i \"" + pathToProvisioningProfile + "\"",
function (error, stdout, stderr) {
+ logErrorIfExists(error);
+ var pushPluginsEnabled =
stdout.indexOf("<key>aps-environment</key>") > -1;
--- End diff --
The variable name should be something like
`hasPushNotificationsEntitlement` :smile:
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]