33angular . module ( 'notifications' , [ ] ) .
44 factory ( '$notification' , [ '$timeout' , function ( $timeout ) {
55
6- console . log ( 'notification service online' ) ;
6+ // console.log('notification service online');
77 var notifications = JSON . parse ( localStorage . getItem ( '$notifications' ) ) || [ ] ,
88 queue = [ ] ;
99
@@ -75,7 +75,7 @@ angular.module('notifications', []).
7575
7676 requestHtml5ModePermissions : function ( ) {
7777 if ( window . webkitNotifications ) {
78- console . log ( 'notifications are available' ) ;
78+ // console.log('notifications are available');
7979 if ( window . webkitNotifications . checkPermission ( ) === 0 ) {
8080 return true ;
8181 }
@@ -97,6 +97,11 @@ angular.module('notifications', []).
9797 }
9898 } ,
9999
100+ setSetting : function ( key , value ) {
101+ settings [ key ] = value ;
102+ return settings ;
103+ } ,
104+
100105
101106 /* ============ QUERYING RELATED METHODS ============*/
102107
@@ -112,7 +117,7 @@ angular.module('notifications', []).
112117 /* ============== NOTIFICATION METHODS ==============*/
113118
114119 info : function ( title , content , userData ) {
115- console . log ( title , content ) ;
120+ // console.log(title, content);
116121 return this . awesomeNotify ( 'info' , 'info' , title , content , userData ) ;
117122 } ,
118123
@@ -142,29 +147,30 @@ angular.module('notifications', []).
142147 return this . makeNotification ( type , false , icon , title , content , userData ) ;
143148 } ,
144149
145- notify : function ( image , title , content , userData ) {
150+ notify : function ( image , title , content , userData , notificationClass ) {
146151 // Wraps the makeNotification method for displaying notifications with images
147152 // rather than icons
148- return this . makeNotification ( 'custom' , image , true , title , content , userData ) ;
153+ return this . makeNotification ( 'custom' , image , true , title , content , userData , notificationClass ) ;
149154 } ,
150155
151- makeNotification : function ( type , image , icon , title , content , userData ) {
156+ makeNotification : function ( type , image , icon , title , content , userData , notificationClass ) {
152157 var notification = {
153158 'type' : type ,
154159 'image' : image ,
155160 'icon' : icon ,
156161 'title' : title ,
157162 'content' : content ,
158163 'timestamp' : + new Date ( ) ,
159- 'userData' : userData
164+ 'userData' : userData ,
165+ 'notificationClass' : notificationClass
160166 } ;
161167 notifications . push ( notification ) ;
162168
163169 if ( settings . html5Mode ) {
164170 html5Notify ( image , title , content , function ( ) {
165- console . log ( "inner on display function" ) ;
171+ // console.log("inner on display function");
166172 } , function ( ) {
167- console . log ( "inner on close function" ) ;
173+ // console.log("inner on close function");
168174 } ) ;
169175 }
170176 else {
@@ -212,9 +218,8 @@ angular.module('notifications', []).
212218 * Finally, the directive should have its own controller for
213219 * handling all of the notifications from the notification service
214220 */
215- console . log ( 'this is a new directive' ) ;
216221 var html =
217- '<div class="dr-notification-wrapper" ng-repeat="noti in queue">' +
222+ '<div class="dr-notification-wrapper {{ noti.notificationClass }} " ng-repeat="noti in queue">' +
218223 '<div class="dr-notification-close-btn" ng-click="removeNotification(noti)">' +
219224 '<i class="icon-remove"></i>' +
220225 '</div>' +
0 commit comments