From cc0526ff93f95c749287167d701ebb2257c74ccb Mon Sep 17 00:00:00 2001 From: Tan Nguyen Date: Thu, 19 Oct 2023 11:35:55 +0700 Subject: [PATCH] fix: generate callback action --- install.sh | 4 +++- src/Http/Actions/CallbackAction.php | 14 ++++++++++++++ src/Http/Actions/IndexAction.php | 12 ++++++------ src/Services/AppService.php | 17 ----------------- src/Services/CallbackService.php | 7 +++++++ src/Services/SettingService.php | 23 ----------------------- 6 files changed, 30 insertions(+), 47 deletions(-) delete mode 100644 src/Services/AppService.php create mode 100644 src/Services/CallbackService.php delete mode 100644 src/Services/SettingService.php diff --git a/install.sh b/install.sh index 11ae59e..aa635cf 100644 --- a/install.sh +++ b/install.sh @@ -16,4 +16,6 @@ for file in "${json_files[@]}"; do fi done -chmod -R 777 storage/json/*.json +if [[ "$(uname -s -r)" == *"Linux"* && "$(cat /etc/os-release)" == *"Ubuntu"* ]]; then + chmod 777 storage/json/tgn/*.json +fi diff --git a/src/Http/Actions/CallbackAction.php b/src/Http/Actions/CallbackAction.php index 92b9535..e676ae5 100644 --- a/src/Http/Actions/CallbackAction.php +++ b/src/Http/Actions/CallbackAction.php @@ -2,8 +2,22 @@ namespace LbilTech\TelegramGitNotifierApp\Http\Actions; +use LbilTech\TelegramGitNotifier\Bot; +use LbilTech\TelegramGitNotifierApp\Services\CallbackService; + class CallbackAction { + protected Bot $bot; + + protected CallbackService $callbackService; + + public function __construct( + Bot $bot, + ) { + $this->bot = $bot; + $this->callbackService = new CallbackService(); + } + public function __invoke() { } diff --git a/src/Http/Actions/IndexAction.php b/src/Http/Actions/IndexAction.php index d985ea8..a14467d 100644 --- a/src/Http/Actions/IndexAction.php +++ b/src/Http/Actions/IndexAction.php @@ -42,12 +42,12 @@ public function __construct() */ public function __invoke(): void { -// if ($this->bot->isCallback()) { -// $callbackAction = new CallbackAction($this->appService, $this->settingService); -// $callbackAction(); -// return; -// } -// + if ($this->bot->isCallback()) { + $callbackAction = new CallbackAction($this->bot); + $callbackAction(); + return; + } + if ($this->bot->isMessage()) { $commandAction = new CommandAction($this->bot); $commandAction(); diff --git a/src/Services/AppService.php b/src/Services/AppService.php deleted file mode 100644 index ad4443e..0000000 --- a/src/Services/AppService.php +++ /dev/null @@ -1,17 +0,0 @@ -