Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
orzuionut committed Jun 15, 2021
1 parent 9cbdf2d commit ff57605
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
use OCP\Files\Config\ICachedMountInfo;
use OCP\Files\Config\IUserMountCache;

class Listener {
class ActivityListener {
/** @var IManager */
protected $activityManager;

Expand Down
4 changes: 2 additions & 2 deletions w2g2/lib/Activity/EventHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

namespace OCA\w2g2\Activity;

use OCA\w2g2\Activity\Listener as ActivityListener;
use OCA\w2g2\Notification\Listener as NotificationListener;
use OCA\w2g2\Activity\ActivityListener;
use OCA\w2g2\Notification\NotificationListener;

class EventHandler {
private $activityListener;
Expand Down
33 changes: 31 additions & 2 deletions w2g2/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

namespace OCA\w2g2\AppInfo;

use OCA\w2g2\Activity\ActivityListener;
use OCA\w2g2\Activity\EventHandler;
use OCA\w2g2\File;
use OCA\w2g2\Notification\NotificationListener;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
Expand All @@ -17,14 +20,12 @@
use OCA\w2g2\Service\AdminService;
use OCA\w2g2\Service\ConfigService;
use OCA\w2g2\Service\LockService;
use OCA\w2g2\Service\UserService;
use OCA\w2g2\Db\AdminMapper;
use OCA\w2g2\Db\CategoryMapper;
use OCA\w2g2\Db\ConfigMapper;
use OCA\w2g2\Db\FavoriteMapper;
use OCA\w2g2\Db\FileMapper;
use OCA\w2g2\Db\GroupFolderMapper;
use OCA\w2g2\Db\Lock;
use OCA\w2g2\Db\LockMapper;

class Application extends App implements IBootstrap
Expand All @@ -40,6 +41,7 @@ public function __construct()
$this->registerMappers($container);
$this->registerServices($container);
$this->registerControllers($container);
$this->registerVarious($container);
}

public function boot(IBootContext $context): void
Expand Down Expand Up @@ -177,4 +179,31 @@ protected function registerMappers($container)
);
});
}

protected function registerVarious($container)
{
$container->registerService('ActivityListener', function(ContainerInterface $c){
return new ActivityListener(
$c->get('IManager'),
$c->get('IUserSession'),
$c->get('IAppManager'),
$c->get('IUserMountCache')
);
});

$container->registerService('NotificationListener', function(ContainerInterface $c){
return new NotificationListener(
$c->get('IManager'),
$c->get('IUserManager'),
$c->get('FavoriteMapper')
);
});

$container->registerService('EventHandler', function(ContainerInterface $c){
return new EventHandler(
$c->get('ActivityListener'),
$c->get('NotificationListener')
);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use OCA\w2g2\Activity\FileLockEvent;
use OCA\w2g2\Db\FavoriteMapper;

class Listener {
class NotificationListener {
/** @var IManager */
protected $notificationManager;

Expand All @@ -22,7 +22,7 @@ class Listener {
* @param IManager $notificationManager
* @param IUserManager $userManager
*/
public function __construct(IManager $notificationManager, IUserManager $userManager, FavoriteMapper $favoriteMapper)
public function __construct(IManager $notificationManager, IUserManager $userManager, FavoriteMapper $favoriteMapper)
{
$this->notificationManager = $notificationManager;
$this->userManager = $userManager;
Expand Down
2 changes: 1 addition & 1 deletion w2g2/lib/Service/LockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function __construct(

$this->currentUser = UserService::get();

$this->uiMessage = new UIMessage();
$this->uiMessage = new UIMessage($this->configMapper);
}

public function lock($fileId, $fileType)
Expand Down

0 comments on commit ff57605

Please sign in to comment.