3535use OCP \AppFramework \Http \JSONResponse ;
3636use OCP \AppFramework \Http \NotFoundResponse ;
3737use OCP \AppFramework \Http \TemplateResponse ;
38+ use OCP \App \IAppManager ;
3839use OCP \Dashboard \IManager ;
3940use OCP \Dashboard \IWidget ;
4041use OCP \Dashboard \RegisterWidgetEvent ;
@@ -49,6 +50,8 @@ class DashboardController extends Controller {
4950 private $ inititalStateService ;
5051 /** @var IEventDispatcher */
5152 private $ eventDispatcher ;
53+ /** @var IAppManager */
54+ private $ appManager ;
5255 /** @var IManager */
5356 private $ dashboardManager ;
5457 /** @var IConfig */
@@ -65,6 +68,7 @@ public function __construct(
6568 IRequest $ request ,
6669 IInitialStateService $ initialStateService ,
6770 IEventDispatcher $ eventDispatcher ,
71+ IAppManager $ appManager ,
6872 IManager $ dashboardManager ,
6973 IConfig $ config ,
7074 BackgroundService $ backgroundService ,
@@ -74,6 +78,7 @@ public function __construct(
7478
7579 $ this ->inititalStateService = $ initialStateService ;
7680 $ this ->eventDispatcher = $ eventDispatcher ;
81+ $ this ->appManager = $ appManager ;
7782 $ this ->dashboardManager = $ dashboardManager ;
7883 $ this ->config = $ config ;
7984 $ this ->backgroundService = $ backgroundService ;
@@ -109,6 +114,11 @@ public function index(): TemplateResponse {
109114 // It does not matter if some statuses are missing from the array, missing ones are considered enabled
110115 $ statuses = ($ statuses && count ($ statuses ) > 0 ) ? $ statuses : ['weather ' => true ];
111116
117+ // if theming app is enabled and wants to override default, we pass it
118+ $ themingDefaultBackground = $ this ->appManager ->isEnabledForUser ('theming ' )
119+ ? $ this ->config ->getAppValue ('theming ' , 'backgroundMime ' , '' )
120+ : '' ;
121+ $ this ->inititalStateService ->provideInitialState ('dashboard ' , 'themingDefaultBackground ' , $ themingDefaultBackground );
112122 $ this ->inititalStateService ->provideInitialState ('dashboard ' , 'panels ' , $ widgets );
113123 $ this ->inititalStateService ->provideInitialState ('dashboard ' , 'statuses ' , $ statuses );
114124 $ this ->inititalStateService ->provideInitialState ('dashboard ' , 'layout ' , $ userLayout );
0 commit comments