2929use OCA \Unsplash \Provider \WallhavenCC ;
3030use OCA \Unsplash \Provider \WikimediaCommons ;
3131use OCA \Unsplash \Provider \WikimediaCommonsDaily ;
32+ use OCP \App \IAppManager ;
3233use OCP \Files \IAppData ;
3334use OCP \IConfig ;
3435use Psr \Log \LoggerInterface ;
@@ -63,22 +64,23 @@ class ProviderDefinitions
6364 * @param IConfig $settings
6465 * @param IAppData $appData
6566 */
66- function __construct ($ appName , LoggerInterface $ logger , IConfig $ config , IAppData $ appData )
67+ function __construct ($ appName , LoggerInterface $ logger , IConfig $ config , IAppData $ appData, IAppManager $ appManager )
6768 {
6869
6970 $ this ->appName = $ appName ;
7071 $ this ->config = $ config ;
7172 $ this ->appData = $ appData ;
7273 $ this ->logger = $ logger ;
74+ $ this ->appManager = $ appManager ;
7375
7476 $ tmp = [];
7577 //add all provider to this array. The logic takes care of the rest.
76- $ tmp [] = new UnsplashAPI ($ this ->appName , $ logger , $ this ->config , $ appData , "UnsplashAPI " );
77- $ tmp [] = new NextcloudImage ($ this ->appName , $ logger , $ this ->config , $ appData , "Nextcloud Image " );
78- $ tmp [] = new WikimediaCommons ($ this ->appName , $ logger , $ this ->config , $ appData , "WikimediaCommons " );
79- $ tmp [] = new WikimediaCommonsDaily ($ this ->appName , $ logger , $ this ->config , $ appData , "WikimediaCommons - Picture of the Day " );
80- $ tmp [] = new WallhavenCC ($ this ->appName , $ logger , $ this ->config , $ appData , "WallhavenCC " );
81- $ tmp [] = new BingWallpaperDaily ($ this ->appName , $ logger , $ this ->config , $ appData , "Bing Wallpaper - Picture of the Day " );
78+ $ tmp [] = new UnsplashAPI ($ this ->appName , $ logger , $ this ->config , $ appData , $ appManager , "UnsplashAPI " );
79+ $ tmp [] = new NextcloudImage ($ this ->appName , $ logger , $ this ->config , $ appData , $ appManager , "Nextcloud Image " );
80+ $ tmp [] = new WikimediaCommons ($ this ->appName , $ logger , $ this ->config , $ appData , $ appManager , "WikimediaCommons " );
81+ $ tmp [] = new WikimediaCommonsDaily ($ this ->appName , $ logger , $ this ->config , $ appData , $ appManager , "WikimediaCommons - Picture of the Day " );
82+ $ tmp [] = new WallhavenCC ($ this ->appName , $ logger , $ this ->config , $ appData , $ appManager , "WallhavenCC " );
83+ $ tmp [] = new BingWallpaperDaily ($ this ->appName , $ logger , $ this ->config , $ appData , $ appManager , "Bing Wallpaper - Picture of the Day " );
8284
8385 foreach ($ tmp as &$ value ) {
8486 $ this ->definitions [$ value ->getName ()] = $ value ;
@@ -96,11 +98,11 @@ function getProviderByName($name): Provider
9698
9799 if (!array_key_exists ($ name , $ this ->definitions )) {
98100 $ this ->logger ->warning ("Selected provider ' {$ name }' could not be found. Using Default. Please select an existing provider in the settings! " );
99- return new WikimediaCommonsDaily ($ this ->appName , $ this ->logger , $ this ->config , $ this ->appData , "WikimediaCommons - Picture of the Day " );
101+ return new WikimediaCommonsDaily ($ this ->appName , $ this ->logger , $ this ->config , $ this ->appData , $ this -> appManager , "WikimediaCommons - Picture of the Day " );
100102 }
101103 $ provider = $ this ->definitions [$ name ];
102104 if ($ provider == null ) {
103- return new WikimediaCommonsDaily ($ this ->appName , $ this ->logger , $ this ->config , $ this ->appData , "WikimediaCommons - Picture of the Day " );
105+ return new WikimediaCommonsDaily ($ this ->appName , $ this ->logger , $ this ->config , $ this ->appData , $ this -> appManager , "WikimediaCommons - Picture of the Day " );
104106 }
105107 return $ this ->definitions [$ name ];
106108 }
0 commit comments