<?php
/**
 * Webkul Software.
 *
 * PHP version 7.0+
 *
 * @category  Webkul
 * @package   Webkul_AppScreenCustomization
 * @author    Webkul <support@webkul.com>
 * @copyright 2010-2019 Webkul Software Private Limited (https://webkul.com)
 * @license   https://store.webkul.com/license.html ASL Licence
 * @link      https://store.webkul.com/license.html
 */

namespace Webkul\AppScreenCustomization\Plugin;

use \Magento\Framework\Controller\ResultFactory;

class Homepagedata
{
    public function __construct (
        \Webkul\AppScreenCustomization\Helper\Data $helper,
        \Magento\Framework\Controller\ResultFactory $resultFactory
    ) {
        $this->helper = $helper;
        $this->_resultFactory = $resultFactory;
    }
    public function afterExecute (
        \Webkul\MobikulApi\Controller\Catalog\HomePageData $subject,
        $result
    ) {
        
        $response = json_decode($result->getRawData());
        $params = $subject->getRequest()->getParams();

        $response->app_logo = $this->helper->getLogo();
        $response->launcher_image = $this->helper->getLauncherImage();
        $response->splashscreen_image = $this->helper->getSplashScreenImage();

        $resultJson = $this->_resultFactory->create(ResultFactory::TYPE_JSON);
        $resultJson->setData($response);
        return $resultJson;
    }
}
