1212use OCA \DAV \AppInfo \Application ;
1313use OCA \DAV \Service \ExampleContactService ;
1414use OCA \DAV \Service \ExampleEventService ;
15- use OCP \App \IAppManager ;
1615use OCP \AppFramework \Http \TemplateResponse ;
1716use OCP \AppFramework \Services \IAppConfig ;
1817use OCP \AppFramework \Services \IInitialState ;
@@ -23,38 +22,17 @@ class ExampleContentSettings implements ISettings {
2322 public function __construct (
2423 private readonly IAppConfig $ appConfig ,
2524 private readonly IInitialState $ initialState ,
26- private readonly IAppManager $ appManager ,
2725 private readonly ExampleEventService $ exampleEventService ,
2826 private readonly ExampleContactService $ exampleContactService ,
2927 ) {
3028 }
3129
3230 #[\Override]
3331 public function getForm (): TemplateResponse {
34- $ calendarEnabled = $ this ->appManager ->isEnabledForUser ('calendar ' );
35- $ contactsEnabled = $ this ->appManager ->isEnabledForUser ('contacts ' );
36- $ this ->initialState ->provideInitialState ('calendarEnabled ' , $ calendarEnabled );
37- $ this ->initialState ->provideInitialState ('contactsEnabled ' , $ contactsEnabled );
38-
39- if ($ calendarEnabled ) {
40- $ enableDefaultEvent = $ this ->exampleEventService ->shouldCreateExampleEvent ();
41- $ this ->initialState ->provideInitialState ('create_example_event ' , $ enableDefaultEvent );
42- $ this ->initialState ->provideInitialState (
43- 'has_custom_example_event ' ,
44- $ this ->exampleEventService ->hasCustomExampleEvent (),
45- );
46- }
47-
48- if ($ contactsEnabled ) {
49- $ this ->initialState ->provideInitialState (
50- 'enableDefaultContact ' ,
51- $ this ->exampleContactService ->isDefaultContactEnabled (),
52- );
53- $ this ->initialState ->provideInitialState (
54- 'hasCustomDefaultContact ' ,
55- $ this ->appConfig ->getAppValueBool ('hasCustomDefaultContact ' ),
56- );
57- }
32+ $ this ->initialState ->provideInitialState ('create_example_event ' , $ this ->exampleEventService ->shouldCreateExampleEvent ());
33+ $ this ->initialState ->provideInitialState ('has_custom_example_event ' , $ this ->exampleEventService ->hasCustomExampleEvent ());
34+ $ this ->initialState ->provideInitialState ('enableDefaultContact ' , $ this ->exampleContactService ->isDefaultContactEnabled ());
35+ $ this ->initialState ->provideInitialState ('hasCustomDefaultContact ' , $ this ->appConfig ->getAppValueBool ('hasCustomDefaultContact ' ));
5836
5937 Util::addStyle (Application::APP_ID , 'settings-admin-example-content ' );
6038 Util::addScript (Application::APP_ID , 'settings-admin-example-content ' );
@@ -63,11 +41,6 @@ public function getForm(): TemplateResponse {
6341
6442 #[\Override]
6543 public function getSection (): ?string {
66- if (!$ this ->appManager ->isEnabledForUser ('contacts ' )
67- && !$ this ->appManager ->isEnabledForUser ('calendar ' )) {
68- return null ;
69- }
70-
7144 return 'groupware ' ;
7245 }
7346
0 commit comments