From 51e62ece26684816df2aef30fdd3f1cf8b1df720 Mon Sep 17 00:00:00 2001 From: yggverse Date: Sat, 3 Aug 2024 16:50:31 +0300 Subject: [PATCH] fix active option detection --- src/Entity/Browser/Container/Page/Auth.php | 74 ++++++++++++---------- 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/src/Entity/Browser/Container/Page/Auth.php b/src/Entity/Browser/Container/Page/Auth.php index 07006fad..f124e3b5 100644 --- a/src/Entity/Browser/Container/Page/Auth.php +++ b/src/Entity/Browser/Container/Page/Auth.php @@ -190,48 +190,52 @@ class Auth // Listen for user chose if (GtkResponseType::OK == $this->gtk->run()) { - // Get active option + // Find active option foreach ($this->_options as $id => $option) { - // Auth - if ($id) + if ($option->get_active()) { - // @TODO activate existing record - } - - // Generate new identity - else - { - // Detect driver - switch (true) + // Auth + if ($id) { - case mb_strtolower( - parse_url( - $this->page->navbar->request->getValue(), - PHP_URL_SCHEME - ) - ) == 'gemini': - - // Init identity model - $identity = new Gemini; - - // Add new auth record - $this->page->container->browser->database->auth->add( - $this->page->container->browser->database->identity->add( - $identity->crt(), - $identity->key(), - $this->_name->get_text() ? $this->_name->get_text() : null - ), - $this->page->navbar->request->getValue() - ); - - break; - - default: + // @TODO activate existing record + } - throw new Exception; + // Generate new identity + else + { + // Detect driver + switch (true) + { + case mb_strtolower( + parse_url( + $this->page->navbar->request->getValue(), + PHP_URL_SCHEME + ) + ) == 'gemini': + + // Init identity model + $identity = new Gemini; + + // Add new auth record + $this->page->container->browser->database->auth->add( + $this->page->container->browser->database->identity->add( + $identity->crt(), + $identity->key(), + $this->_name->get_text() ? $this->_name->get_text() : null + ), + $this->page->navbar->request->getValue() + ); + + break; + + default: + + throw new Exception; + } } } + } $this->gtk->destroy();