/** * Created by Benny on 04.05.2015. */ "use strict"; var TB = TB || {}; TB.Ext = TB.Ext || {}; /** * Push Notification via Phonegap Push Plugin * https://github.com/phonegap-build/PushPlugin */ TB.Ext.Push = { SENDER_ID : null, deviceId : null, setDeviceId : function( deviceId ) { TB.Ext.Push.deviceId = deviceId; if ( TB.Client.isLoggedIn() ) { TB.Ext.Push.register(); } }, register : function() { if ( TB.Env.platform != 'WEB' && TB.Ext.Push.deviceId ) { TB.Service.request( 'Account', 'registerDevice', { reg_id : TB.Ext.Push.deviceId, platform : TB.Env.platform } ); } }, onReceive : function( data ) { var pd = TB.Controller.getPageDataFromUrl(); if ( pd && pd.c && "News" == pd.c ) { TB.Controller.reload(); } else { TB.Controller.do( 'News' ); } } };