2016-03-31 33 views
0

Uygulamada daha önce büyük bir revizyon gerçekleştirilmeden önce çalışan bildirimleri olan mevcut bir Telerik AppBuilder uygulamasına sahibim. Uygulamaya Cordova 3.7.0 kullanır ve kaynak kodu burada bulunabilir: localisements eklentisi uygulamak için çalışıyor: https://github.com/katzer/cordova-plugin-local-notifications. Telerik'in "Verified Plugins" Belgeleri'nde belirtilen talimatları kullanarak kurdum. Ancak artık çalışmıyor. Çeşitli uyarılar sayesinde, uyarı (windows.plugins) ve uyarı (cordova.plugins) her zaman tanımsızdır (alert (windows.plugins.notifications) ve bunların tüm permütasyonları). Window.plugins öğesinin her zaman tanımlanmamış ve kullanımdan kaldırılacağını söyleyen diğer yanıtların yanıtlarını gördüm, ancak window.plugins [PLUGIN_NAME] var olacaktı. Ancak, bu durum böyle görünmüyor ve bunun yerine javascript'i bozuyor. Aşağıda kod akımıCordova/Window.plugins undefined

define(['jQuery', 'base64'], function ($, base64) { 

.... 

var that = this; 
that.alert("starting"); 
document.addEventListener("deviceready", function() { 
that.alert(JSON.stringify(window.plugins)); 
}, false); 

.... 

} 

kullanılıyor önceden işleyen kod oldu

 if (that.hasNotificationPlugin()) { 
      that.clearNotifications(function() { 
       console.info('Setting notifications'); 
       // Schedule notifications for each day from the schedule 
       $.each(data.DeliveryDaysThisWeek, function (i, day) { 
        var dow = day.DayOfWeek; 
        // Schedule notifications for each store within a day 
        $.each(day.Stores, function (i, store) { 
         // Only schedule the notification if the user 
         // hasn't disabled notifications for this store 
         if (that.get('notification' + store.StoreId) !== 'false') { 
          var cutoffDate = new Date(store.CutOffDateTime); 
          var cutoffString = $.format.date(cutoffDate, 'h:mm a'); 

          // Schedule it 30 minutes before the cutoff time 
          // or using the user defined time 
          var time = parseInt(that.get('notificationTime')); 
          if (isNaN(time)) { 
           that.set('notificationTime', "30"); 
           time = 30; 
          } 

          var notifDate = new Date(cutoffDate.getTime() - time * 60 * 1000); 
          // Only schedule it if it's in the future 
          if (notifDate > new Date()) { 
           window.plugin.notification.local.add({ 
            id: (dow * 100000 + store.DeliveryTimes[0].DeliveryTimeId).toString(), 
            date: notifDate, 
            message: "The cutoff time is almost up! Place your order by " + cutoffString, 
            title: store.Store.Restaurant.RestaurantName.trim(), 
            json: JSON.stringify({StoreId: store.StoreId}), 
            icon: 'icon' 
           }); 

that.alert (mesaj) navigator.notificaiton.alert için bir kısayol işlevidir (mesaj, yanlış, "COMPANY_NAME") ve iyi çalışıyor.

cevap