Gitter migration: Setup redirects (rollout pt. 3)
[gitter.git] / server / event-listeners / apn-feedback-listener.js
blob467abb114f6c18a631c65bc6de462b3d802e6934
1 'use strict';
3 var env = require('gitter-web-env');
4 var errorReporter = env.errorReporter;
6 var installed = false;
7 exports.install = function() {
8 if (installed) return;
9 installed = true;
11 var iosGateway = require('gitter-web-push-gateways/lib/ios/ios-notification-gateway');
12 var pushNotificationService = require('gitter-web-push-notifications');
14 var feedbackEmitter = iosGateway.createFeedbackEmitter();
16 feedbackEmitter.on('deregister', function(deviceTokens) {
17 return pushNotificationService.deregisterIosDevices(deviceTokens).catch(function(err) {
18 errorReporter(err, {}, { module: 'apn-feedback-listener' });
19 });
20 });