Skip to content

Commit

Permalink
Add video intro to the wizard
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Dec 4, 2019
1 parent cdd6696 commit f31a57c
Show file tree
Hide file tree
Showing 10 changed files with 1,797 additions and 665 deletions.
65 changes: 1 addition & 64 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,66 +1,3 @@
module.exports = {
root: true,
env: {
browser: true,
es6: true,
node: true,
jest: true
},
globals: {
t: true,
n: true,
OC: true,
OCA: true,
Vue: true
},
parserOptions: {
parser: 'babel-eslint',
ecmaVersion: 6
},
extends: [
'eslint:recommended',
'plugin:node/recommended',
'plugin:vue/essential',
'plugin:vue/recommended',
'standard'
],
plugins: ['vue', 'node'],
rules: {
// space before function ()
'space-before-function-paren': ['error', 'never'],
// curly braces always space
'object-curly-spacing': ['error', 'always'],
// stay consistent with array brackets
'array-bracket-newline': ['error', 'consistent'],
// 1tbs brace style
'brace-style': 'error',
// tabs only
indent: ['error', 'tab'],
'no-tabs': 0,
'vue/html-indent': ['error', 'tab'],
// only debug console
'no-console': ['error', { allow: ['error', 'warn', 'debug'] }],
// classes blocks
'padded-blocks': ['error', { classes: 'always' }],
// always have the operator in front
'operator-linebreak': ['error', 'before'],
// ternary on multiline
'multiline-ternary': ['error', 'always-multiline'],
// es6 import/export and require
'node/no-unpublished-require': ['off'],
'node/no-unsupported-features/es-syntax': ['off'],
// space before self-closing elements
'vue/html-closing-bracket-spacing': 'error',
// code spacing with attributes
'vue/max-attributes-per-line': [
'error',
{
singleline: 3,
multiline: {
max: 3,
allowFirstLine: true
}
}
]
}
extends: ['nextcloud']
}
2 changes: 1 addition & 1 deletion js/activate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
document.addEventListener('DOMContentLoaded', function() {
window.OCP.Loader.loadScript('firstrunwizard', 'firstrunwizard.js').then(function() {
OCA.FirstRunWizard.open();
OCA.FirstRunWizard.open(true);
});
});
19 changes: 16 additions & 3 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -51,15 +55,17 @@ public function register() {
}

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();
Expand All @@ -75,6 +81,13 @@ protected function registerScripts() {
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()]);
}
Expand Down
1 change: 0 additions & 1 deletion lib/Controller/WizardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ public function show() {
];

$slides = [
$this->staticSlide('page.intro', $data),
$this->staticSlide('page.values', $data)
];
if ($this->groupManager->isAdmin($this->userId)) {
Expand Down
Loading

0 comments on commit f31a57c

Please sign in to comment.