diff options
Diffstat (limited to 'lib/AppInfo')
-rw-r--r-- | lib/AppInfo/Application.php | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 014c4c6b..920db173 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -23,12 +23,16 @@ namespace OCA\FirstRunWizard\AppInfo; +use OCA\Files\Event\LoadAdditionalScriptsEvent; use OCA\FirstRunWizard\Notification\AppHint; use OCA\FirstRunWizard\Notification\Notifier; use OCP\AppFramework\App; use OCP\AppFramework\Http\TemplateResponse; +use OCP\EventDispatcher\IEventDispatcher; use OCP\IConfig; +use OCP\IInitialStateService; use OCP\IL10N; +use OCP\IServerContainer; use OCP\IUser; use OCP\IUserSession; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -51,15 +55,17 @@ class Application extends App { } protected function registerScripts() { - /** @var EventDispatcherInterface $dispatcher */ - $dispatcher = $this->getContainer()->getServer()->getEventDispatcher(); + /** @var IServerContainer $server */ + $server = $this->getContainer()->getServer(); + /** @var IEventDispatcher $dispatcher */ + $dispatcher = $server->query(IEventDispatcher::class); $dispatcher->addListener(TemplateResponse::EVENT_LOAD_ADDITIONAL_SCRIPTS_LOGGEDIN, function() { \OC_Util::addScript('firstrunwizard', 'about'); }); // Display the first run wizard only on the files app, - $dispatcher->addListener('OCA\Files::loadAdditionalScripts', function() { + $dispatcher->addListener(LoadAdditionalScriptsEvent::class, function() use ($server) { /** @var IUserSession $userSession */ $userSession = $this->getContainer()->query(IUserSession::class); $user = $userSession->getUser(); @@ -75,6 +81,13 @@ class Application extends App { if ($config->getUserValue($user->getUID(), 'firstrunwizard', 'show', '1') !== '0') { \OC_Util::addScript('firstrunwizard', 'activate'); + /** @var IInitialStateService $initialState */ + $initialState = $server->query(IInitialStateService::class); + $initialState->provideLazyInitialState('firstrunwizard', 'hasVideo', function () use ($server) { + $userHome = $server->getUserFolder(); + return $userHome->nodeExists('/Nextcloud intro.mp4'); + }); + $jobList = $this->getContainer()->getServer()->getJobList(); $jobList->add('OCA\FirstRunWizard\Notification\BackgroundJob', ['uid' => $userSession->getUser()->getUID()]); } |