Example #1
0
    public function onGadgetExport(ExportPackageEvent $event)
    {
        $appId = $this->container->get('keosu_core.curapp')->getCurApp();
        $em = $this->container->get('doctrine')->getManager();
        $app = $em->getRepository('KeosuCoreBundle:App')->find($appId);
        if (isset($app->getConfigPackages()[KeosuGadgetPushNotificationBundle::PACKAGE_NAME]['enablePush']) && $app->getConfigPackages()[KeosuGadgetPushNotificationBundle::PACKAGE_NAME]['enablePush'] === true) {
            $googleGcmProjectNumber = $app->getConfigPackages()[KeosuGadgetPushNotificationBundle::PACKAGE_NAME]['googleGcmProjectNumber'];
            $event->addToJsInit('
var pushNotificationData = { senderID : \'' . $googleGcmProjectNumber . '\'};
');
        }
    }
Example #2
0
    function onGadgetExport(ExportPackageEvent $event)
    {
        $em = $this->container->get('doctrine')->getManager();
        $appId = $this->container->get('keosu_core.curapp')->getcurapp();
        $app = $em->getRepository('KeosuCoreBundle:App')->find($appId);
        $configPackages = $app->getConfigPackages();
        $fbAppId = $configPackages[KeosuGadgetFaceBookBundle::PLUGIN_NAME]['fbAppId'];
        if ($fbAppId != null) {
            $event->addToJsInit('
				document.addEventListener(\'deviceready\',function(){
					FB.init({
						appId:' . $fbAppId . ',
						nativeInterface:CDV.FB,
						useCacheDialogs:false
					});
				});');
        }
    }