Files
John Molakvoæ fd43a6243d feat(viewer): keep the user's viewer settings
apps/viewer becomes a minimal, always enabled app again, the server side
of the viewer. It keeps the user's viewer settings the way the Files app
keeps its own: a config lexicon declaring them, a UserConfig service
holding what the lexicon cannot say, an OCS endpoint to change one, and the settings handed to the viewer as initial
state. They are the slideshow delay, and the volume of videos and audio
and whether they start muted. Core keeps loading the viewer itself.

It is no longer an abandoned app to clean up after, and continues the
old app's versions at 9.0.0-dev.0, after 8.0.0 in 35.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: John Molakvoæ <14975046+skjnldsv@users.noreply.github.com>
2026-10-14 11:22:36 +02:00

37 lines
979 B
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Viewer\Tests;
use OCA\Viewer\Event\LoadViewer;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Server;
use Test\TestCase;
/**
* Nothing listens to the viewer's event any more, but apps still construct
* it without checking that it exists: that has to keep working until 39.
*/
class LoadViewerTest extends TestCase {
public function testAppsCanStillDispatchIt(): void {
$dispatcher = Server::get(IEventDispatcher::class);
$heard = [];
$listener = static function (Event $event) use (&$heard): void {
$heard[] = $event;
};
$dispatcher->addListener(LoadViewer::class, $listener);
$event = new LoadViewer();
$dispatcher->dispatchTyped($event);
$dispatcher->removeListener(LoadViewer::class, $listener);
$this->assertSame([$event], $heard);
}
}