25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

40 lines
964 B

  1. /**
  2. * Created by Benny on 04.05.2015.
  3. */
  4. "use strict";
  5. var TB = TB || {};
  6. TB.Ext = TB.Ext || {};
  7. /**
  8. * Push Notification via Phonegap Push Plugin
  9. * https://github.com/phonegap-build/PushPlugin
  10. */
  11. TB.Ext.Push = {
  12. SENDER_ID : null,
  13. deviceId : null,
  14. setDeviceId : function( deviceId ) {
  15. TB.Ext.Push.deviceId = deviceId;
  16. if ( TB.Client.isLoggedIn() ) {
  17. TB.Ext.Push.register();
  18. }
  19. },
  20. register : function() {
  21. if ( TB.Env.platform != 'WEB' && TB.Ext.Push.deviceId ) {
  22. TB.Service.request( 'Account', 'registerDevice', { reg_id : TB.Ext.Push.deviceId, platform : TB.Env.platform } );
  23. }
  24. },
  25. onReceive : function( data ) {
  26. var pd = TB.Controller.getPageDataFromUrl();
  27. if ( pd && pd.c && "News" == pd.c ) {
  28. TB.Controller.reload();
  29. } else {
  30. TB.Controller.do( 'News' );
  31. }
  32. }
  33. };