File tree Expand file tree Collapse file tree 3 files changed +6
-16
lines changed
Expand file tree Collapse file tree 3 files changed +6
-16
lines changed Original file line number Diff line number Diff line change 33namespace Donmo \Roundup \ViewModel \Cart ;
44
55use Donmo \Roundup \Model \Config as DonmoConfig ;
6- use Magento \Framework \App \State ;
76use Magento \Framework \Serialize \Serializer \Json ;
87use Magento \Framework \View \Element \Block \ArgumentInterface ;
98
109class Donmo implements ArgumentInterface
1110{
12- private State $ appState ;
1311 private mixed $ mode ;
1412 private DonmoConfig $ donmoConfig ;
1513 private Json $ json ;
16- public function __construct (State $ appState , DonmoConfig $ donmoConfig , Json $ json )
14+ public function __construct (DonmoConfig $ donmoConfig , Json $ json )
1715 {
18- $ this ->appState = $ appState ;
1916 $ this ->donmoConfig = $ donmoConfig ;
2017 $ this ->mode = $ this ->donmoConfig ->getCurrentMode ();
2118 $ this ->json = $ json ;
2219 }
2320
24- public function getIsAvailable ()
21+ public function getIsActive (): bool
2522 {
26- $ isActive = $ this ->donmoConfig ->getIsActive ();
27-
28- $ modesCompatible =
29- $ this ->appState ->getMode () == State::MODE_PRODUCTION && $ this ->mode == 'live '
30- ||
31- $ this ->appState ->getMode () == State::MODE_DEVELOPER && $ this ->mode == 'test ' ;
32-
33- return ($ isActive && $ modesCompatible );
23+ return $ this ->donmoConfig ->getIsActive ();
3424 }
3525
3626 public function getDonmoConfig (): string
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ class ApiService
2020 public function __construct (
2121 ZendClientFactory $ httpClientFactory ,
2222 Logger $ logger ,
23- DonmoConfig $ donmoConfig,
23+ DonmoConfig $ donmoConfig
2424 ) {
2525 $ this ->client = $ httpClientFactory ->create ();
2626 $ this ->logger = $ logger ;
Original file line number Diff line number Diff line change @@ -7,14 +7,14 @@ use Magento\Framework\View\Element\Template;
77use Donmo \Roundup \Model \Config ;
88
99$ viewModel = $ block ->getViewModel ();
10- $ isAvailable = $ viewModel ->getIsAvailable ();
10+ $ isActive = $ viewModel ->getIsActive ();
1111$ donmoConfig = $ viewModel ->getDonmoConfig ();
1212$ style = "
1313width: 70%;
1414margin: 15px 5px;
1515 "
1616?>
17- <?php if ($ isAvailable ):?>
17+ <?php if ($ isActive ):?>
1818<div id="donmo-component" style="<?= $ style ?> " data-bind="scope:'donmo-component'">
1919 <!-- ko template: getTemplate() --><!-- /ko -->
2020 <script type="text/x-magento-init">
You can’t perform that action at this time.
0 commit comments