|
6 | 6 | * @author Joas Schilling <coding@schilljs.com> |
7 | 7 | * @author Morris Jobke <hey@morrisjobke.de> |
8 | 8 | * @author Vincent Petry <vincent@nextcloud.com> |
| 9 | + * @author Carl Schwan <carl@carlschwan.eu> |
9 | 10 | * |
10 | 11 | * @license AGPL-3.0 |
11 | 12 | * |
|
24 | 25 | */ |
25 | 26 | namespace OCA\Files; |
26 | 27 |
|
| 28 | +use OC\NavigationManager; |
| 29 | +use OCP\App\IAppManager; |
| 30 | +use OCP\IConfig; |
| 31 | +use OCP\IGroupManager; |
| 32 | +use OCP\INavigationManager; |
| 33 | +use OCP\IURLGenerator; |
| 34 | +use OCP\IUserSession; |
| 35 | +use OCP\L10N\IFactory; |
| 36 | +use OCP\Server; |
| 37 | + |
27 | 38 | class App { |
28 | | - /** |
29 | | - * @var \OCP\INavigationManager |
30 | | - */ |
31 | | - private static $navigationManager; |
| 39 | + private static ?INavigationManager $navigationManager = null; |
32 | 40 |
|
33 | 41 | /** |
34 | 42 | * Returns the app's navigation manager |
35 | | - * |
36 | | - * @return \OCP\INavigationManager |
37 | 43 | */ |
38 | | - public static function getNavigationManager() { |
| 44 | + public static function getNavigationManager(): INavigationManager { |
39 | 45 | // TODO: move this into a service in the Application class |
40 | 46 | if (self::$navigationManager === null) { |
41 | | - self::$navigationManager = new \OC\NavigationManager( |
42 | | - \OC::$server->getAppManager(), |
43 | | - \OC::$server->getURLGenerator(), |
44 | | - \OC::$server->getL10NFactory(), |
45 | | - \OC::$server->getUserSession(), |
46 | | - \OC::$server->getGroupManager(), |
47 | | - \OC::$server->getConfig() |
| 47 | + self::$navigationManager = new NavigationManager( |
| 48 | + Server::get(IAppManager::class), |
| 49 | + Server::get(IUrlGenerator::class), |
| 50 | + Server::get(IFactory::class), |
| 51 | + Server::get(IUserSession::class), |
| 52 | + Server::get(IGroupManager::class), |
| 53 | + Server::get(IConfig::class) |
48 | 54 | ); |
49 | 55 | self::$navigationManager->clear(false); |
50 | 56 | } |
51 | 57 | return self::$navigationManager; |
52 | 58 | } |
53 | 59 |
|
54 | | - public static function extendJsConfig($settings) { |
| 60 | + public static function extendJsConfig($settings): void { |
55 | 61 | $appConfig = json_decode($settings['array']['oc_appconfig'], true); |
56 | 62 |
|
57 | | - $maxChunkSize = (int)\OC::$server->getConfig()->getAppValue('files', 'max_chunk_size', 10 * 1024 * 1024); |
| 63 | + $maxChunkSize = (int)Server::get(IConfig::class)->getAppValue('files', 'max_chunk_size', (string)(10 * 1024 * 1024)); |
58 | 64 | $appConfig['files'] = [ |
59 | 65 | 'max_chunk_size' => $maxChunkSize |
60 | 66 | ]; |
|
0 commit comments