Last active
August 29, 2015 14:15
-
-
Save yodarjun/c669a82a8d25b1b57149 to your computer and use it in GitHub Desktop.
Revisions
-
Arjunanand revised this gist
Feb 12, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ /* @ngInject */ function Notification($http, $stateParams) { 'use strict'; var types = { "LIKES_RESPONSE": { -
Arjunanand created this gist
Feb 12, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,52 @@ /* @ngInject */ function Notification($firebase, $http, $stateParams, FirebaseMember, config) { 'use strict'; var types = { "LIKES_RESPONSE": { text: "Someone liked your response!", path: "response" } }; return { push: function(object) { var deviceToken = object.member.deviceToken; var params = { "request": { "application": <YOUR PUSHWOOSH APP ID>, "auth": <YOUR PUSHWOOSH API KEY>, "notifications": [{ "send_date": "now", "ignore_user_timezone": true, "ios_root_params": { "aps": { "route": { "path": types[object.type].path, "params": $stateParams } } }, "content": { "en": types[object.type].text }, "platforms": [1], "ios_category_id": "1", "devices": [deviceToken] }] } }; $http.post('https://cp.pushwoosh.com/json/1.3/createMessage', params).then(success, failure); function success() { console.log("success"); } function failure(error) { window.Raven.captureException(error); } } }; } angular .module('app.services') .factory('Notification', Notification);