diff --git a/appinfo/info.xml b/appinfo/info.xml index 3be8542..51cc168 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -11,7 +11,7 @@ - 1.2.2 + 1.3.0 agpl Robin Appelman NotifyPush @@ -27,7 +27,7 @@ Once the app is installed, the push binary needs to be setup. You can either use https://github.com/nextcloud/notify_push/issues - + diff --git a/lib/Controller/TestController.php b/lib/Controller/TestController.php index 0c09748..4bc12b1 100644 --- a/lib/Controller/TestController.php +++ b/lib/Controller/TestController.php @@ -16,27 +16,16 @@ use OCP\AppFramework\Http\DataDisplayResponse; use OCP\AppFramework\Http\DataResponse; use OCP\IAppConfig; -use OCP\IConfig; use OCP\IRequest; class TestController extends Controller { - private $config; - private $appConfig; - private $queue; - private $appManager; - public function __construct( IRequest $request, - IConfig $config, - IAppConfig $appConfig, - IQueue $queue, - IAppManager $appManager, + private IAppConfig $appConfig, + private IQueue $queue, + private IAppManager $appManager, ) { parent::__construct('notify_push', $request); - $this->config = $config; - $this->appConfig = $appConfig; - $this->queue = $queue; - $this->appManager = $appManager; } /** @@ -47,12 +36,8 @@ public function __construct( public function cookie(): DataResponse { // starting with 32, the app config does some internal caching // that interferes with the quick set+get from this test. - // unfortunately the api to clear the cache is 29+ only, and we still support 27 - if (method_exists($this->appConfig, 'clearCache')) { - /** @psalm-suppress UndefinedInterfaceMethod */ - $this->appConfig->clearCache(); - } - return new DataResponse((int)$this->config->getAppValue('notify_push', 'cookie', '0')); + $this->appConfig->clearCache(); + return new DataResponse($this->appConfig->getValueInt('notify_push', 'cookie')); } /** diff --git a/lib/SelfTest.php b/lib/SelfTest.php index e0f8e43..f6a27f2 100644 --- a/lib/SelfTest.php +++ b/lib/SelfTest.php @@ -13,6 +13,7 @@ use OCA\NotifyPush\Queue\RedisQueue; use OCP\App\IAppManager; use OCP\Http\Client\IClientService; +use OCP\IAppConfig; use OCP\IConfig; use OCP\IDBConnection; use Symfony\Component\Console\Output\OutputInterface; @@ -28,6 +29,7 @@ class SelfTest { public function __construct( IClientService $clientService, private IConfig $config, + private IAppConfig $appConfig, private IQueue $queue, private IDBConnection $connection, private IAppManager $appManager, @@ -55,7 +57,7 @@ public function test(string $server, OutputInterface $output, bool $ignoreProxyE } $this->queue->push('notify_test_cookie', $this->cookie); - $this->config->setAppValue('notify_push', 'cookie', (string)$this->cookie); + $this->appConfig->setValueInt('notify_push', 'cookie', $this->cookie); try { $retrievedCookie = (int)$this->client->get($server . '/test/cookie', ['nextcloud' => ['allow_local_address' => true], 'verify' => false])->getBody();