First run wizard


#1

Hello everyone,

I would like to do changes on the first run wizard. I would like this one appears when the users go an a other apps than files.
I means for now each times I go on the files apps, the windows of the first run wizard appears (I made a little modification to have that) but I would like this windows open when I go on a other apps not the file one.

I think that I have to modify this part of code for that :

In apps/firstrunwizard/appinfo/app.php

// only load when the file app displays
$eventDispatcher = \OC::$server->getEventDispatcher();
$eventDispatcher->addListener(
'OCA\Files::loadAdditionalScripts',

But I do not understand this line : 'OCA\Files::loadAdditionalScripts',
Because I searched everywhere and I did not find the file or function ' loadAdditionalScripts ' .

If you have some advices/indications/solutions, I will be enjoy to read them.

PS : @PVince81 you created this part of code what do you think about this topic ?


#2

There is currently no hook for when any app is displayed.

I suggest to forget about "loadAdditionalScripts" and simply always load the first run wizard JS and adjust the JS code to make sure it only displays once per app. Then you need to find a way in JS to find out what current app is being displayed.

@butonic I seem to remember that you added a method in the OC namespace for retrieving the id of the current app but somehow I can't find it any more. Has this ever been merged ?
If not then we might want to add this.

Even better would be to extend core to have it inject the current app name into the "html" or "body" tag as attribute.


#3

Do you talk about this method ?
https://doc.owncloud.org/api/classes/OCP.App.ManagerEvent.html#method_getAppID

If yes, I have tried something like that :

use OCP\Util;
use OCP\App\ManagerEvent;

Util::addStyle('firstrunwizard', 'colorbox');
Util::addScript('firstrunwizard', 'jquery.colorbox');
Util::addScript('firstrunwizard', 'firstrunwizard');
Util::addStyle('firstrunwizard', 'firstrunwizard');

// only load when the myapp displays
$idapp = ManagerEvent::getAppID();

if (idapp = "myapp") {
	$config = \OC::$server->getConfig();
	$userSession = \OC::$server->getUserSession();
	$firstRunConfig = new Config($config, $userSession);

	if ($userSession->isLoggedIn() && $firstRunConfig->isEnabled()) {
		Util::addScript( 'firstrunwizard', 'activate');
	}
}

But this line : $idapp = ManagerEvent::getAppID(); seems wrong and I do not know the correct syntax.


#4

if (idapp = "myapp")

This is wrong, this is an assignation, not a comparison.
Change to idapp === "myapp"


#5

Oh yes you're right ! But it is just a mistake when i wrote my message, in my code I did not do this mistake.

The line which break the app is this one : $idapp = ManagerEvent::getAppID();

Any idea ?