From 4fa57e86882138b22d7c8777ae9642045e45e3f3 Mon Sep 17 00:00:00 2001 From: Agent Date: Sat, 13 Jun 2026 17:12:54 -0400 Subject: [PATCH] feat: send notification to all users when app version is updated --- src/Controllers/AdminController.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Controllers/AdminController.php b/src/Controllers/AdminController.php index f86965b..dc6dcaa 100755 --- a/src/Controllers/AdminController.php +++ b/src/Controllers/AdminController.php @@ -228,6 +228,25 @@ class AdminController } } $this->auditService->log('app_version_updated', 'config', null, ['details' => 'App version config updated']); + + $version = $_POST['app_version'] ?? ''; + $notes = $_POST['release_notes'] ?? ''; + + if (!empty($version)) { + $notificationModel = new Notification(); + $noteId = $notificationModel->create([ + 'user_id' => null, + 'title' => "Version {$version} is now available", + 'message' => "New version {$version} has been released.\n\n" . strip_tags($notes), + 'type' => 'info', + ]); + + $fcm = new FCMService(); + if ($fcm->isConfigured()) { + $fcm->sendToAll("Version {$version} is now available", strip_tags($notes), 'info', $noteId); + } + } + Session::setFlash('success', 'App version updated successfully.'); $this->view->redirect('/admin/app-version'); return;