Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php | ||
namespace Neon\Laravel; | ||
|
||
use Coyote\Services\Guest; | ||
use Illuminate\Foundation\Application; | ||
use Neon\Persistence\System; | ||
|
||
readonly class CoyoteSystem implements System | ||
{ | ||
public function __construct(private Application $application) | ||
{ | ||
} | ||
|
||
// This logic is copied-and-pasted from ViewServiceProvider, | ||
// please, in the future extract common pieces between them. | ||
// we don't mind coupling with coyote here. | ||
|
||
public function darkTheme(): bool | ||
{ | ||
/** @var Guest $guest */ | ||
$guest = $this->application[Guest::class]; | ||
return $guest->getSetting('lastColorScheme', | ||
$this->legacyLastColorScheme()) === 'dark'; | ||
} | ||
|
||
private function legacyLastColorScheme(): ?string | ||
{ | ||
/** @var Guest $guest */ | ||
$guest = $this->application[Guest::class]; | ||
return $guest->getSetting('dark.theme', true) ? 'dark' : 'light'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php | ||
namespace Neon\Persistence; | ||
|
||
interface System | ||
{ | ||
public function darkTheme(): bool; | ||
} |