@@ -221,47 +221,48 @@ The code for the Push Plugin for NativeScript.
221221
222222``` javascript
223223 var pushPlugin = require (" nativescript-push-notifications" );
224- var self = this ;
225- var iosSettings = {
226- badge: true ,
227- sound: true ,
228- alert: true ,
229- interactiveSettings: {
230- actions: [{
231- identifier: ' READ_IDENTIFIER' ,
232- title: ' Read' ,
233- activationMode: " foreground" ,
234- destructive: false ,
235- authenticationRequired: true
236- }, {
237- identifier: ' CANCEL_IDENTIFIER' ,
238- title: ' Cancel' ,
239- activationMode: " foreground" ,
240- destructive: true ,
241- authenticationRequired: true
242- }],
243- categories: [{
244- identifier: ' READ_CATEGORY' ,
245- actionsForDefaultContext: [' READ_IDENTIFIER' , ' CANCEL_IDENTIFIER' ],
246- actionsForMinimalContext: [' READ_IDENTIFIER' , ' CANCEL_IDENTIFIER' ]
247- }]
248- },
249- notificationCallbackIOS : function (data ) {
250- self .set (" message" , " " + JSON .stringify (data));
251- }
252- };
253-
254- pushPlugin .register (iosSettings, function (data ) {
255- self .set (" message" , " " + JSON .stringify (data));
256-
257- // Register the interactive settings
258- if (settings .interactiveSettings ) {
259- pushPlugin .registerUserNotificationSettings (function () {
260- alert (' Successfully registered for interactive push.' );
261- }, function (err ) {
262- alert (' Error registering for interactive push: ' + JSON .stringify (err));
263- });
264- }, function () { });
224+ var self = this ;
225+ var iosSettings = {
226+ badge: true ,
227+ sound: true ,
228+ alert: true ,
229+ interactiveSettings: {
230+ actions: [{
231+ identifier: ' READ_IDENTIFIER' ,
232+ title: ' Read' ,
233+ activationMode: " foreground" ,
234+ destructive: false ,
235+ authenticationRequired: true
236+ }, {
237+ identifier: ' CANCEL_IDENTIFIER' ,
238+ title: ' Cancel' ,
239+ activationMode: " foreground" ,
240+ destructive: true ,
241+ authenticationRequired: true
242+ }],
243+ categories: [{
244+ identifier: ' READ_CATEGORY' ,
245+ actionsForDefaultContext: [' READ_IDENTIFIER' , ' CANCEL_IDENTIFIER' ],
246+ actionsForMinimalContext: [' READ_IDENTIFIER' , ' CANCEL_IDENTIFIER' ]
247+ }]
248+ },
249+ notificationCallbackIOS : function (data ) {
250+ self .set (" message" , " " + JSON .stringify (data));
251+ }
252+ };
253+
254+ pushPlugin .register (iosSettings, function (data ) {
255+ self .set (" message" , " " + JSON .stringify (data));
256+
257+ // Register the interactive settings
258+ if (iosSettings .interactiveSettings ) {
259+ pushPlugin .registerUserNotificationSettings (function () {
260+ alert (' Successfully registered for interactive push.' );
261+ }, function (err ) {
262+ alert (' Error registering for interactive push: ' + JSON .stringify (err));
263+ });
264+ }
265+ }, function () { });
265266```
266267
267268- Run the code
0 commit comments