config->getAppValue(self::APP_ID, 'enabled', 'yes') === 'yes'; } public function listenNotifications(): bool { return $this->config->getAppValue(self::APP_ID, 'listen_notifications', 'yes') === 'yes'; } public function getFirebaseProjectId(): string { return trim($this->config->getAppValue(self::APP_ID, 'firebase_project_id', '')); } public function getFirebaseCredentials(): string { return trim($this->config->getAppValue(self::APP_ID, 'firebase_credentials', '')); } public function isFirebaseConfigured(): bool { return $this->getFirebaseProjectId() !== '' && $this->getFirebaseCredentials() !== ''; } public function getApiSecret(): string { $secret = trim($this->config->getAppValue(self::APP_ID, 'api_secret', '')); if ($secret === '') { $secret = $this->secureRandom->generate(48, ISecureRandom::CHAR_ALPHANUMERIC); $this->config->setAppValue(self::APP_ID, 'api_secret', $secret); } return $secret; } public function regenerateApiSecret(): string { $secret = $this->secureRandom->generate(48, ISecureRandom::CHAR_ALPHANUMERIC); $this->config->setAppValue(self::APP_ID, 'api_secret', $secret); return $secret; } public function isSourceEnabled(string $source): bool { $raw = $this->config->getAppValue(self::APP_ID, 'enabled_sources', '*'); $raw = trim($raw); if ($raw === '' || $raw === '*') { return true; } $parts = array_map('trim', explode(',', strtolower($raw))); return in_array(strtolower($source), $parts, true); } public function getDefaultClickUrl(): string { $configured = trim($this->config->getAppValue(self::APP_ID, 'default_click_url', '')); if ($configured !== '') { return rtrim($configured, '/'); } return rtrim($this->urlGenerator->getAbsoluteURL(''), '/'); } public function verifyApiSecret(?string $provided): bool { if ($provided === null || $provided === '') { return false; } return hash_equals($this->getApiSecret(), $provided); } }