Conversation
| @@ -0,0 +1,96 @@ | |||
| module.exports = { | |||
There was a problem hiding this comment.
| OCP\Util::addScript('files_3d', 'loader'); | ||
| $eventDispatcher = \OC::$server->getEventDispatcher(); | ||
| $eventDispatcher->addListener( | ||
| 'OCA\Files::loadAdditionalScripts', |
There was a problem hiding this comment.
Should be LoadViewer
https://github.com/nextcloud/viewer#add-the-viewer-to-your-app
There was a problem hiding this comment.
I'm a bit confused. I don't have (and don't need, I think?) any controllers. I tried to copy the appinfo setup from the viewer app itself, but that doesn't work. Any ideas 😊 ?
There was a problem hiding this comment.
Yes, because you don't have a dedicated page view :)
The mechanism is the same,
You just need to listen to the Viewer event, the files app is firing it
use OCA\Viewer\Event\LoadViewer;
https://github.com/nextcloud/viewer/blob/master/lib/Listener/LoadViewerScript.php
https://github.com/nextcloud/viewer/blob/b16ba3ab0dc81a9e98a88a9917936c527e94cca6/lib/AppInfo/Application.php#L42
There was a problem hiding this comment.
Cleanup your app.php so it query your main Application.php
https://github.com/nextcloud/viewer/blob/master/appinfo/app.php
There was a problem hiding this comment.
I copied the (imo 😅 ) interesting parts from app.php and Application.php from viewer to my app, but that didn't work. I'll push my latest changes tomorrow :)
There was a problem hiding this comment.
Sure, pûsh and i'll have a look :)
| <screenshot>https://github.com/ghraw/v1r0x/files_3d/master/screenshots/screenshot1.png</screenshot> | ||
| <dependencies> | ||
| <nextcloud min-version="14" max-version="16"/> | ||
| <nextcloud min-version="16" max-version="19"/> |
There was a problem hiding this comment.
Please use 17 btw as 16 is EOL in a few weeks ;)
There was a problem hiding this comment.
Actually the Viewer event might be for 18 only, so maybe your new viewer integration should come from 18 and above :)
|
|
||
| export default { | ||
| name: 'Files3d', | ||
| props: ['mime', 'path'], |
There was a problem hiding this comment.
All of those are the available props:
https://github.com/nextcloud/viewer/blob/b16ba3ab0dc81a9e98a88a9917936c527e94cca6/src/mixins/Mime.js#L29-L86
There was a problem hiding this comment.
Alright, thanks. Is the readme outdated? There are only path and mime mentioned
There was a problem hiding this comment.
Well, you theoritecally do'nt really need more than a few, but yes, I guess it needs an update, sorry abou that :)
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@posteo.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@posteo.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@posteo.de>
| $this->mimeTypeDetector = $mimeTypeDetector; | ||
|
|
||
| $server = $this->getContainer()->getServer(); | ||
| $eventDispatcher = $server->query(IEventDispatcher::class); |
There was a problem hiding this comment.
SHould also be injected similarely as IMimeTypeDetector :)
And then move the addServiceListener to the register function I guess :)
There was a problem hiding this comment.
(I think I should cleanup the viewer code too) 🙈
There was a problem hiding this comment.
SHould also be injected similarely as IMimeTypeDetector :)
And then move the addServiceListener to the register function I guess :)
Still doesn't work 🤔
Should the script be loaded on loading any page of my nc instance? or only when opening a supported file
There was a problem hiding this comment.
Should the script be loaded on loading any page of my nc instance? or only when opening a supported file
The script will be loaded on every app that request the Viewer.
So it should be loaded on files
There was a problem hiding this comment.
I'm using latest nc stable release and cloned my app into /apps
There was a problem hiding this comment.
No, old school ;) downloaded the zip and running on local apache (in /var/www/html)
There was a problem hiding this comment.
Yeah, it might not work, as the zip is a stable release and contains far more than just server and viewer :)
I would suggest you checkout the server repo and clone the viewer branch in apps :)
There was a problem hiding this comment.
It works 🎉 I had to clone viewer as well, but now my js file is loaded 🥳
thank you very much! Now I "simply" have to render the files ;)
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
|
|
||
| const APP_ID = 'files_3d'; | ||
|
|
||
| public function __construct() { |
There was a problem hiding this comment.
ALso, I was wrong, you cannot do dependency injection in Application.php :)
It only works after the app is initialized, so in other php classes :)
There was a problem hiding this comment.
So I reverted it back to how it should be
There was a problem hiding this comment.
Makes sense. I was confused why you changed that part :D
|
@skjnldsv one last question :D When trying to parse the file, I don't have a proper link to load the file. Do I have to do something like https://github.com/nextcloud/viewer/blob/b16ba3ab0dc81a9e98a88a9917936c527e94cca6/src/mixins/PreviewUrl.js#L41-L52 to get the file? If so, is there a better solution than copy&pasting all related stuff? |
Good question! |
|
Nice it works!! |
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@posteo.de>
|
Thanks for the quick fix for viewer! I have another last question 😅 |
|
Yep, naturalHeight depends on the main element |
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@posteo.de>
Does 3d models have a standard default viewport? |
|
I totally forgot about 100vh and 100vw! Damn bootstrap :D I thought |
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@posteo.de>
|
@skjnldsv Thanks for your help. Release is finally ready! 🎉 |

Fix #4 #5 #7
Ref #1