@@ -23,8 +23,8 @@ var pendingReceivedNotifications = [],
2323 }
2424 } ) ;
2525
26- notificationHandler = Notification . alloc ( ) . init ( ) ;
27- notificationManager = NotificationManager . alloc ( ) . init ( ) ;
26+ notificationHandler = Notification . new ( ) ;
27+ notificationManager = NotificationManager . new ( ) ;
2828} ) ( ) ;
2929
3030LocalNotifications . addOnMessageReceivedCallback = function ( callback ) {
@@ -56,7 +56,7 @@ LocalNotifications.hasPermission = function (arg) {
5656} ;
5757
5858LocalNotifications . _hasPermission = function ( ) {
59- var app = utils . ios . getter ( UIApplication , UIApplication . sharedApplication ) ;
59+ var app = utils . ios . getter ( UIApplication , UIApplication . alloc ) ;
6060 var settings = utils . ios . getter ( app , app . currentUserNotificationSettings ) ;
6161 var types = UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound ;
6262 return ( settings . types & types ) > 0 ;
@@ -85,7 +85,8 @@ LocalNotifications._requestPermission = function (callback) {
8585 callback ( granted != "false" ) ;
8686 } ) ;
8787
88- var app = utils . ios . getter ( UIApplication , UIApplication . sharedApplication ) ;
88+ var app = utils . ios . getter ( UIApplication , UIApplication . alloc ) ;
89+
8990 var settings = utils . ios . getter ( app , app . currentUserNotificationSettings ) ;
9091 var types = settings . types | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound ;
9192 settings = UIUserNotificationSettings . settingsForTypesCategories ( types , null ) ;
@@ -102,7 +103,8 @@ LocalNotifications._schedulePendingNotifications = function () {
102103 notification . fireDate = options . at ? options . at : new Date ( ) ;
103104 notification . alertTitle = options . title ;
104105 notification . alertBody = options . body ;
105- notification . timeZone = NSTimeZone . defaultTimeZone ( ) ;
106+
107+ notification . timeZone = utils . ios . getter ( NSTimeZone , NSTimeZone . defaultTimeZone ) ;
106108 notification . applicationIconBadgeNumber = options . badge ;
107109
108110 // these are sent back to the plugin when a notification is received
@@ -125,15 +127,16 @@ LocalNotifications._schedulePendingNotifications = function () {
125127 // notification.soundName = custom..;
126128 // notification.resumeApplicationInBackground = true;
127129
128- var app = utils . ios . getter ( UIApplication , UIApplication . sharedApplication ) ;
130+ var app = utils . ios . getter ( UIApplication , UIApplication . alloc ) ;
129131 app . scheduleLocalNotification ( notification ) ;
132+
130133 }
131134} ;
132135
133136LocalNotifications . cancel = function ( id ) {
134137 return new Promise ( function ( resolve , reject ) {
135138 try {
136- var app = utils . ios . getter ( UIApplication , UIApplication . sharedApplication ) ;
139+ var app = utils . ios . getter ( UIApplication , UIApplication . alloc ) ;
137140 var scheduled = app . scheduledLocalNotifications ;
138141 for ( var i = 0 , l = scheduled . count ; i < l ; i ++ ) {
139142 var noti = scheduled . objectAtIndex ( i ) ;
@@ -154,7 +157,7 @@ LocalNotifications.cancel = function (id) {
154157LocalNotifications . cancelAll = function ( ) {
155158 return new Promise ( function ( resolve , reject ) {
156159 try {
157- var app = utils . ios . getter ( UIApplication , UIApplication . sharedApplication ) ;
160+ var app = utils . ios . getter ( UIApplication , UIApplication . alloc ) ;
158161 app . cancelAllLocalNotifications ( ) ;
159162 app . applicationIconBadgeNumber = 0 ;
160163 resolve ( ) ;
@@ -168,7 +171,7 @@ LocalNotifications.cancelAll = function () {
168171LocalNotifications . getScheduledIds = function ( ) {
169172 return new Promise ( function ( resolve , reject ) {
170173 try {
171- var app = utils . ios . getter ( UIApplication , UIApplication . sharedApplication ) ;
174+ var app = utils . ios . getter ( UIApplication , UIApplication . alloc ) ;
172175 var scheduledIds = [ ] ;
173176 var scheduled = app . scheduledLocalNotifications ;
174177 for ( var i = 0 , l = scheduled . count ; i < l ; i ++ ) {
@@ -228,4 +231,4 @@ LocalNotifications._getInterval = function(interval) {
228231 }
229232} ;
230233
231- module . exports = LocalNotifications ;
234+ module . exports = LocalNotifications ;
0 commit comments