Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ArtificialOwl committed Jul 29, 2019
2 parents 3e2b54e + 9534f14 commit 563bcaf
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
namespace OCA\Files_FullTextSearch_Tesseract\AppInfo;


use OCA\Files_FullTextSearch_Tesseract\Service\ConfigService;
use OCA\Files_FullTextSearch_Tesseract\Service\TesseractService;
use OCP\AppFramework\App;
use OCP\AppFramework\QueryException;
Expand All @@ -50,6 +51,8 @@ class Application extends App {
/** @var TesseractService */
private $tesseractService;

/** @var ConfigService */
private $configService;

/**
* @param array $params
Expand All @@ -61,6 +64,7 @@ public function __construct(array $params = []) {

$c = $this->getContainer();
$this->tesseractService = $c->query(TesseractService::class);
$this->configService = $c->query(ConfigService::class);
}


Expand All @@ -69,6 +73,12 @@ public function __construct(array $params = []) {
*/
public function registerFilesExtension() {
$eventDispatcher = \OC::$server->getEventDispatcher();
$eventDispatcher->addListener(
'\OCA\Files_FullTextSearch::onGetConfig',
function(GenericEvent $e) {
$this->configService->onGetConfig($e);
}
);
$eventDispatcher->addListener(
'\OCA\Files_FullTextSearch::onFileIndexing',
function(GenericEvent $e) {
Expand Down
16 changes: 16 additions & 0 deletions lib/Service/ConfigService.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

use OCA\Files_FullTextSearch_Tesseract\AppInfo\Application;
use OCP\IConfig;
use Symfony\Component\EventDispatcher\GenericEvent;


/**
Expand Down Expand Up @@ -80,6 +81,21 @@ public function __construct(IConfig $config, $userId, MiscService $miscService)
}


public function onGetConfig(GenericEvent $e) {
/** @var array $config */
$config = $e->getArgument('config');
$config['files_fulltextsearch_tesseract'] =
[
'version' => $this->getAppValue('installed_version'),
'enabled' => $this->getAppValue(self::TESSERACT_ENABLED),
'psm' => $this->getAppValue(self::TESSERACT_PSM),
'lang' => $this->getAppValue(self::TESSERACT_LANG),
'pdf' => $this->getAppValue(self::TESSERACT_PDF),
];
$e->setArgument('config', $config);
}


/**
* @return array
*/
Expand Down

0 comments on commit 563bcaf

Please sign in to comment.