diff --git a/.github/workflows/fix-php-code-style-issues.yml b/.github/workflows/fix-php-code-style-issues.yml index 7c6a4c2d..33b9e59c 100644 --- a/.github/workflows/fix-php-code-style-issues.yml +++ b/.github/workflows/fix-php-code-style-issues.yml @@ -20,20 +20,20 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: ref: ${{ github.head_ref || github.sha }} - name: Check PHP code style issues if: github.event_name == 'push' - uses: aglipanci/laravel-pint-action@2.5 + uses: aglipanci/laravel-pint-action@2.6 with: verboseMode: true testMode: true - name: Fix PHP code style issues if: github.event_name == 'pull_request' - uses: aglipanci/laravel-pint-action@2.5 + uses: aglipanci/laravel-pint-action@2.6 - name: Commit changes if: github.event_name == 'pull_request' diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 871c602f..c777c5cd 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -18,7 +18,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 68e6ca9b..a6487696 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -21,7 +21,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Setup PHP uses: shivammathur/setup-php@v2 diff --git a/.github/workflows/update-changelog.yml b/.github/workflows/update-changelog.yml index 859924d6..700d4809 100644 --- a/.github/workflows/update-changelog.yml +++ b/.github/workflows/update-changelog.yml @@ -13,7 +13,7 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v5 with: ref: main diff --git a/src/App.php b/src/App.php index 8c06ad1c..0ebb54b8 100644 --- a/src/App.php +++ b/src/App.php @@ -34,6 +34,21 @@ public function isHidden(): bool return $this->client->get('app/is-hidden')->json('is_hidden'); } + public function getLocale(): string + { + return $this->client->get('app/locale')->json('locale'); + } + + public function getLocaleCountryCode(): string + { + return $this->client->get('app/locale-country-code')->json('locale_country_code'); + } + + public function getSystemLocale(): string + { + return $this->client->get('app/system-locale')->json('system_locale'); + } + public function version(): string { return $this->client->get('app/version')->json('version'); diff --git a/src/Facades/App.php b/src/Facades/App.php index 8754580e..6c0b8410 100644 --- a/src/Facades/App.php +++ b/src/Facades/App.php @@ -10,6 +10,9 @@ * @method static void focus() * @method static void hide() * @method static bool isHidden() + * @method static string getLocale() + * @method static string getLocaleCountryCode() + * @method static string getSystemLocale() * @method static string version() * @method static int badgeCount($count = null) * @method static void addRecentDocument(string $path) diff --git a/src/Facades/Window.php b/src/Facades/Window.php index f73e2164..0c8b1f84 100644 --- a/src/Facades/Window.php +++ b/src/Facades/Window.php @@ -17,6 +17,10 @@ * @method static void reload($id = null) * @method static void maximize($id = null) * @method static void minimize($id = null) + * @method static void zoomFactor(float $zoomFactor = 1.0) + * @method static void preventLeaveDomain(bool $preventLeaveDomain = true) + * @method static void preventLeavePage(bool $preventLeavePage = true): self + * @method static void suppressNewWindows() */ class Window extends Facade { diff --git a/src/Windows/Window.php b/src/Windows/Window.php index 92af58b5..a35fb262 100644 --- a/src/Windows/Window.php +++ b/src/Windows/Window.php @@ -68,6 +68,14 @@ class Window protected array $webPreferences = []; + protected float $zoomFactor = 1.0; + + protected bool $preventLeaveDomain = false; + + protected bool $preventLeavePage = false; + + protected bool $suppressNewWindows = false; + public function __construct(string $id) { $this->id = $id; @@ -326,6 +334,41 @@ public function webPreferences(array $preferences): static return $this; } + public function zoomFactor(float $zoomFactor = 1.0): self + { + $this->zoomFactor = $zoomFactor; + + if (! $this instanceof PendingOpenWindow) { + $this->client->post('window/set-zoom-factor', [ + 'id' => $this->id, + 'zoomFactor' => $zoomFactor, + ]); + } + + return $this; + } + + public function preventLeaveDomain(bool $preventLeaveDomain = true): self + { + $this->preventLeaveDomain = $preventLeaveDomain; + + return $this; + } + + public function preventLeavePage(bool $preventLeavePage = true): self + { + $this->preventLeavePage = $preventLeavePage; + + return $this; + } + + public function suppressNewWindows(): self + { + $this->suppressNewWindows = true; + + return $this; + } + public function toArray() { return [ @@ -364,6 +407,10 @@ public function toArray() 'autoHideMenuBar' => $this->autoHideMenuBar, 'transparent' => $this->transparent, 'webPreferences' => $this->webPreferences, + 'zoomFactor' => $this->zoomFactor, + 'preventLeaveDomain' => $this->preventLeaveDomain, + 'preventLeavePage' => $this->preventLeavePage, + 'suppressNewWindows' => $this->suppressNewWindows, ]; }