88
99use OCA \Theming \AppInfo \Application ;
1010use OCA \Theming \Service \BackgroundService ;
11+ use OCA \Theming \Service \ThemesService ;
1112use OCP \Capabilities \IPublicCapability ;
12- use OCP \IConfig ;
13+ use OCP \Config \IUserConfig ;
14+ use OCP \IAppConfig ;
1315use OCP \IURLGenerator ;
1416use OCP \IUser ;
1517use OCP \IUserSession ;
2123 */
2224class Capabilities implements IPublicCapability {
2325
24- /**
25- * @param ThemingDefaults $theming
26- * @param Util $util
27- * @param IURLGenerator $url
28- * @param IConfig $config
29- */
3026 public function __construct (
3127 protected ThemingDefaults $ theming ,
3228 protected Util $ util ,
3329 protected IURLGenerator $ url ,
34- protected IConfig $ config ,
30+ protected IAppConfig $ appConfig ,
31+ protected IUserConfig $ userConfig ,
3532 protected IUserSession $ userSession ,
33+ protected ThemesService $ themesService ,
3634 ) {
3735 }
3836
@@ -44,6 +42,8 @@ public function __construct(
4442 * name: string,
4543 * productName: string,
4644 * url: string,
45+ * imprintUrl: string,
46+ * privacyUrl: string,
4747 * slogan: string,
4848 * color: string,
4949 * color-text: string,
@@ -57,14 +57,21 @@ public function __construct(
5757 * background-default: bool,
5858 * logoheader: string,
5959 * favicon: string,
60+ * primaryColor: string,
61+ * backgroundColor: string,
62+ * defaultPrimaryColor: string,
63+ * defaultBackgroundColor: string,
64+ * inverted: bool,
65+ * cacheBuster: string,
66+ * enabledThemes: list<string>,
6067 * },
6168 * }
6269 */
6370 public function getCapabilities () {
6471 $ color = $ this ->theming ->getDefaultColorPrimary ();
6572 $ colorText = $ this ->util ->invertTextColor ($ color ) ? '#000000 ' : '#ffffff ' ;
6673
67- $ backgroundLogo = $ this ->config -> getAppValue ('theming ' , 'backgroundMime ' , '' );
74+ $ backgroundLogo = $ this ->appConfig -> getValueString ('theming ' , 'backgroundMime ' , '' );
6875 $ backgroundColor = $ this ->theming ->getColorBackground ();
6976 $ backgroundText = $ this ->theming ->getTextColorBackground ();
7077 $ backgroundPlain = $ backgroundLogo === 'backgroundColor ' || ($ backgroundLogo === '' && $ backgroundColor !== BackgroundService::DEFAULT_COLOR );
@@ -80,7 +87,7 @@ public function getCapabilities() {
8087 $ color = $ this ->theming ->getColorPrimary ();
8188 $ colorText = $ this ->theming ->getTextColorPrimary ();
8289
83- $ backgroundImage = $ this ->config -> getUserValue ($ user ->getUID (), Application::APP_ID , 'background_image ' , BackgroundService::BACKGROUND_DEFAULT );
90+ $ backgroundImage = $ this ->userConfig -> getValueString ($ user ->getUID (), Application::APP_ID , 'background_image ' , BackgroundService::BACKGROUND_DEFAULT );
8491 if ($ backgroundImage === BackgroundService::BACKGROUND_CUSTOM ) {
8592 $ backgroundPlain = false ;
8693 $ background = $ this ->url ->linkToRouteAbsolute ('theming.userTheme.getBackground ' );
@@ -98,6 +105,8 @@ public function getCapabilities() {
98105 'name ' => $ this ->theming ->getName (),
99106 'productName ' => $ this ->theming ->getProductName (),
100107 'url ' => $ this ->theming ->getBaseUrl (),
108+ 'imprintUrl ' => $ this ->theming ->getImprintUrl (),
109+ 'privacyUrl ' => $ this ->theming ->getPrivacyUrl (),
101110 'slogan ' => $ this ->theming ->getSlogan (),
102111 'color ' => $ color ,
103112 'color-text ' => $ colorText ,
@@ -111,6 +120,13 @@ public function getCapabilities() {
111120 'background-default ' => !$ this ->util ->isBackgroundThemed (),
112121 'logoheader ' => $ this ->url ->getAbsoluteURL ($ this ->theming ->getLogo ()),
113122 'favicon ' => $ this ->url ->getAbsoluteURL ($ this ->theming ->getLogo ()),
123+ 'primaryColor ' => $ color ,
124+ 'backgroundColor ' => $ backgroundColor ,
125+ 'defaultPrimaryColor ' => $ this ->theming ->getDefaultColorPrimary (),
126+ 'defaultBackgroundColor ' => $ this ->theming ->getDefaultColorBackground (),
127+ 'inverted ' => $ this ->util ->invertTextColor ($ color ),
128+ 'cacheBuster ' => $ this ->util ->getCacheBuster (),
129+ 'enabledThemes ' => $ this ->themesService ->getEnabledThemes (),
114130 ],
115131 ];
116132 }
0 commit comments