Loading img/crowdcube.png 0 → 100644 +8.12 KiB Loading image diff... lib/Listeners/BeforeTemplateRenderedListener.php +9 −2 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ namespace OCA\EcloudAccounts\Listeners; use OCP\App\IAppManager; use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IInitialState; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use OCP\IConfig; Loading @@ -27,8 +28,9 @@ class BeforeTemplateRenderedListener implements IEventListener { private const SNAPPYMAIL_APP_ID = 'snappymail'; private const SNAPPYMAIL_URL = '/apps/snappymail/'; private const SNAPPYMAIL_AUTOLOGIN_PWD = '1'; public function __construct($appName, IUserSession $userSession, IRequest $request, ISession $session, IConfig $config, IAppManager $appManager, Util $util) { private IInitialState $initialState; private $userId; public function __construct($appName, IUserSession $userSession, IRequest $request, ISession $session, IConfig $config, IAppManager $appManager, Util $util, $userId, IInitialState $initialState) { $this->appName = $appName; $this->userSession = $userSession; $this->request = $request; Loading @@ -36,6 +38,8 @@ class BeforeTemplateRenderedListener implements IEventListener { $this->config = $config; $this->appManager = $appManager; $this->util = $util; $this->initialState = $initialState; $this->userId = $userId; } public function handle(Event $event): void { Loading @@ -53,6 +57,9 @@ class BeforeTemplateRenderedListener implements IEventListener { if (($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) && $event->isLoggedIn()) { // $recoveryEmail = $this->recoveryEmailService->getRecoveryEmail($this->userId); // if ($recoveryEmail === '') { // $unverifiedRecoveryEmail = $this->recoveryEmailService->getUnverifiedRecoveryEmail($this->userId); $userLocation = 'USA'; $this->initialState->provideInitialState('userLocation', $userLocation); $this->util->addStyle($this->appName, 'business-banner'); $this->util->addScript($this->appName, $this->appName . '-business-banner'); // } Loading src/business-banner.js +8 −11 Original line number Diff line number Diff line import { generateUrl } from '@nextcloud/router' import { loadState } from '@nextcloud/initial-state' const unverifiedRecoveryEmail = loadState('ecloud-accounts', 'unverifiedRecoveryEmail') const userLocation = loadState('ecloud-accounts', 'userLocation') const APPLICATION_NAME = 'ecloud-accounts' document.addEventListener('DOMContentLoaded', function() { const newDiv = createNewDiv('business-banner') Loading Loading @@ -125,7 +125,7 @@ function createNewDiv(className) { */ function createImageElement(appName) { const img = document.createElement('img') img.src = generateUrl('/custom_apps/' + appName + '/img/warning.svg') img.src = generateUrl('/custom_apps/' + appName + '/img/crowdcube.png') return img } Loading @@ -135,10 +135,10 @@ function createImageElement(appName) { */ function createTextNode(appName) { const p = document.createElement('p') let labelText = t(appName, 'Please set your recovery email address to use your email account without restrictions.') if (unverifiedRecoveryEmail !== '') { labelText = t(appName, 'Please verify your recovery email address to fully enjoy your murena.io account.') } let labelText = t(appName, 'Own a Part of Murena!') // if (userLocation !== 'USA') { // labelText = t(appName, 'Please verify your recovery email address to fully enjoy your murena.io account.') // } const text = document.createTextNode(labelText) p.appendChild(text) return p Loading @@ -150,12 +150,9 @@ function createTextNode(appName) { */ function createLinkElement(appName) { const link = document.createElement('a') let labelText = t(appName, 'SET RECOVERY EMAIL NOW') if (unverifiedRecoveryEmail !== '') { labelText = t(appName, 'VERIFY RECOVERY EMAIL NOW') } let labelText = t(appName, 'LEARN MORE') link.textContent = labelText link.href = OC.getRootPath() + '/settings/user/security#recovery-email-div' link.href = 'https://murena.com/investors/' link.style.display = 'block' return link } Loading Loading
lib/Listeners/BeforeTemplateRenderedListener.php +9 −2 Original line number Diff line number Diff line Loading @@ -7,6 +7,7 @@ namespace OCA\EcloudAccounts\Listeners; use OCP\App\IAppManager; use OCP\AppFramework\Http\Events\BeforeTemplateRenderedEvent; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Services\IInitialState; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use OCP\IConfig; Loading @@ -27,8 +28,9 @@ class BeforeTemplateRenderedListener implements IEventListener { private const SNAPPYMAIL_APP_ID = 'snappymail'; private const SNAPPYMAIL_URL = '/apps/snappymail/'; private const SNAPPYMAIL_AUTOLOGIN_PWD = '1'; public function __construct($appName, IUserSession $userSession, IRequest $request, ISession $session, IConfig $config, IAppManager $appManager, Util $util) { private IInitialState $initialState; private $userId; public function __construct($appName, IUserSession $userSession, IRequest $request, ISession $session, IConfig $config, IAppManager $appManager, Util $util, $userId, IInitialState $initialState) { $this->appName = $appName; $this->userSession = $userSession; $this->request = $request; Loading @@ -36,6 +38,8 @@ class BeforeTemplateRenderedListener implements IEventListener { $this->config = $config; $this->appManager = $appManager; $this->util = $util; $this->initialState = $initialState; $this->userId = $userId; } public function handle(Event $event): void { Loading @@ -53,6 +57,9 @@ class BeforeTemplateRenderedListener implements IEventListener { if (($event->getResponse()->getRenderAs() === TemplateResponse::RENDER_AS_USER) && $event->isLoggedIn()) { // $recoveryEmail = $this->recoveryEmailService->getRecoveryEmail($this->userId); // if ($recoveryEmail === '') { // $unverifiedRecoveryEmail = $this->recoveryEmailService->getUnverifiedRecoveryEmail($this->userId); $userLocation = 'USA'; $this->initialState->provideInitialState('userLocation', $userLocation); $this->util->addStyle($this->appName, 'business-banner'); $this->util->addScript($this->appName, $this->appName . '-business-banner'); // } Loading
src/business-banner.js +8 −11 Original line number Diff line number Diff line import { generateUrl } from '@nextcloud/router' import { loadState } from '@nextcloud/initial-state' const unverifiedRecoveryEmail = loadState('ecloud-accounts', 'unverifiedRecoveryEmail') const userLocation = loadState('ecloud-accounts', 'userLocation') const APPLICATION_NAME = 'ecloud-accounts' document.addEventListener('DOMContentLoaded', function() { const newDiv = createNewDiv('business-banner') Loading Loading @@ -125,7 +125,7 @@ function createNewDiv(className) { */ function createImageElement(appName) { const img = document.createElement('img') img.src = generateUrl('/custom_apps/' + appName + '/img/warning.svg') img.src = generateUrl('/custom_apps/' + appName + '/img/crowdcube.png') return img } Loading @@ -135,10 +135,10 @@ function createImageElement(appName) { */ function createTextNode(appName) { const p = document.createElement('p') let labelText = t(appName, 'Please set your recovery email address to use your email account without restrictions.') if (unverifiedRecoveryEmail !== '') { labelText = t(appName, 'Please verify your recovery email address to fully enjoy your murena.io account.') } let labelText = t(appName, 'Own a Part of Murena!') // if (userLocation !== 'USA') { // labelText = t(appName, 'Please verify your recovery email address to fully enjoy your murena.io account.') // } const text = document.createTextNode(labelText) p.appendChild(text) return p Loading @@ -150,12 +150,9 @@ function createTextNode(appName) { */ function createLinkElement(appName) { const link = document.createElement('a') let labelText = t(appName, 'SET RECOVERY EMAIL NOW') if (unverifiedRecoveryEmail !== '') { labelText = t(appName, 'VERIFY RECOVERY EMAIL NOW') } let labelText = t(appName, 'LEARN MORE') link.textContent = labelText link.href = OC.getRootPath() + '/settings/user/security#recovery-email-div' link.href = 'https://murena.com/investors/' link.style.display = 'block' return link } Loading