Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static _createProvider(apnsArgs) {
// if using certificate, then topic must be defined
if (!APNS._validateAPNArgs(apnsArgs)) {
throw new Parse.Error(Parse.Error.PUSH_MISCONFIGURED, 'topic is mssing for %j', apnsArgs);
}
let provider = new apn.Provider(apnsArgs);
// Sets the topic on this provider
provider.topic = apnsArgs.topic;
// Set the priority of the providers, prod cert has higher priority
if (apnsArgs.production) {
provider.priority = 0;
} else {
provider.priority = 1;
}
return provider;
}
constructor(settings) {
try {
this.connection = new apn.Provider(settings);
} catch (e) {
this.connectionError = e;
this.connection = null;
}
}