Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EA920179EC for ; Fri, 6 Feb 2015 09:50:42 +0000 (UTC) Received: (qmail 24861 invoked by uid 500); 6 Feb 2015 09:50:42 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 24822 invoked by uid 500); 6 Feb 2015 09:50:42 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 24811 invoked by uid 99); 6 Feb 2015 09:50:42 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Feb 2015 09:50:42 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 0BF54E01D9; Fri, 6 Feb 2015 09:50:42 +0000 (UTC) From: ligaz To: dev@cordova.apache.org Reply-To: dev@cordova.apache.org References: In-Reply-To: Subject: [GitHub] cordova-ios pull request: CB-8084 conform AppDelegate.m with provi... Content-Type: text/plain Message-Id: <20150206095042.0BF54E01D9@git1-us-west.apache.org> Date: Fri, 6 Feb 2015 09:50:42 +0000 (UTC) Github user ligaz commented on a diff in the pull request: https://github.com/apache/cordova-ios/pull/128#discussion_r24230979 --- 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('UUID<\/key>[\\s\\S]*' + 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("aps-environment") > -1; + createPushNotificationsEnabledHeaderFile(pushPluginsEnabled); + }); + } + + function isprovisionUUIDSuitable(provisionContents) { + return PROVISIONING_PROFILE_UUID_REGEX.test(provisionContents); + } + + function findValidMobileProvision(provisions, successCallback, errorCallback) { --- End diff -- If you want to follow the node convention the errorCallback should be passed before the success one. --- 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 infrastructure@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org For additional commands, e-mail: dev-help@cordova.apache.org