@@ -56,7 +56,8 @@ LocalNotifications.hasPermission = function (arg) {
5656} ;
5757
5858LocalNotifications . _hasPermission = function ( ) {
59- var settings = UIApplication . sharedApplication ( ) . currentUserNotificationSettings ( ) ;
59+ var app = utils . ios . getter ( UIApplication , UIApplication . sharedApplication ) ;
60+ var settings = utils . ios . getter ( app , app . currentUserNotificationSettings ) ;
6061 var types = UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound ;
6162 return ( settings . types & types ) > 0 ;
6263} ;
@@ -84,10 +85,11 @@ LocalNotifications._requestPermission = function (callback) {
8485 callback ( granted != "false" ) ;
8586 } ) ;
8687
87- var settings = UIApplication . sharedApplication ( ) . currentUserNotificationSettings ( ) ;
88+ var app = utils . ios . getter ( UIApplication , UIApplication . sharedApplication ) ;
89+ var settings = utils . ios . getter ( app , app . currentUserNotificationSettings ) ;
8890 var types = settings . types | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound ;
8991 settings = UIUserNotificationSettings . settingsForTypesCategories ( types , null ) ;
90- UIApplication . sharedApplication ( ) . registerUserNotificationSettings ( settings ) ;
92+ app . registerUserNotificationSettings ( settings ) ;
9193} ;
9294
9395LocalNotifications . _schedulePendingNotifications = function ( ) {
@@ -123,18 +125,20 @@ LocalNotifications._schedulePendingNotifications = function () {
123125 // notification.soundName = custom..;
124126 // notification.resumeApplicationInBackground = true;
125127
126- UIApplication . sharedApplication ( ) . scheduleLocalNotification ( notification ) ;
128+ var app = utils . ios . getter ( UIApplication , UIApplication . sharedApplication ) ;
129+ app . scheduleLocalNotification ( notification ) ;
127130 }
128131} ;
129132
130133LocalNotifications . cancel = function ( id ) {
131134 return new Promise ( function ( resolve , reject ) {
132135 try {
133- var scheduled = UIApplication . sharedApplication ( ) . scheduledLocalNotifications ;
136+ var app = utils . ios . getter ( UIApplication , UIApplication . sharedApplication ) ;
137+ var scheduled = app . scheduledLocalNotifications ;
134138 for ( var i = 0 , l = scheduled . count ; i < l ; i ++ ) {
135139 var noti = scheduled . objectAtIndex ( i ) ;
136140 if ( id == noti . userInfo . valueForKey ( "id" ) ) {
137- UIApplication . sharedApplication ( ) . cancelLocalNotification ( noti ) ;
141+ app . cancelLocalNotification ( noti ) ;
138142 resolve ( true ) ;
139143 return ;
140144 }
@@ -150,8 +154,9 @@ LocalNotifications.cancel = function (id) {
150154LocalNotifications . cancelAll = function ( ) {
151155 return new Promise ( function ( resolve , reject ) {
152156 try {
153- UIApplication . sharedApplication ( ) . cancelAllLocalNotifications ( ) ;
154- UIApplication . sharedApplication ( ) . applicationIconBadgeNumber = 0 ;
157+ var app = utils . ios . getter ( UIApplication , UIApplication . sharedApplication ) ;
158+ app . cancelAllLocalNotifications ( ) ;
159+ app . applicationIconBadgeNumber = 0 ;
155160 resolve ( ) ;
156161 } catch ( ex ) {
157162 console . log ( "Error in LocalNotifications.cancelAll: " + ex ) ;
@@ -163,8 +168,9 @@ LocalNotifications.cancelAll = function () {
163168LocalNotifications . getScheduledIds = function ( ) {
164169 return new Promise ( function ( resolve , reject ) {
165170 try {
171+ var app = utils . ios . getter ( UIApplication , UIApplication . sharedApplication ) ;
166172 var scheduledIds = [ ] ;
167- var scheduled = UIApplication . sharedApplication ( ) . scheduledLocalNotifications ;
173+ var scheduled = app . scheduledLocalNotifications ;
168174 for ( var i = 0 , l = scheduled . count ; i < l ; i ++ ) {
169175 var noti = scheduled . objectAtIndex ( i ) ;
170176 scheduledIds . push ( noti . userInfo . valueForKey ( "id" ) ) ;
0 commit comments