diff --git a/resources/electron/electron-plugin/dist/server/api/shell.js b/resources/electron/electron-plugin/dist/server/api/shell.js index 0cc894f..5793a6b 100644 --- a/resources/electron/electron-plugin/dist/server/api/shell.js +++ b/resources/electron/electron-plugin/dist/server/api/shell.js @@ -40,8 +40,10 @@ router.delete('/trash-item', (req, res) => __awaiter(void 0, void 0, void 0, fun yield shell.trashItem(path); res.sendStatus(200); } - catch (_a) { - res.status(400).json(); + catch (e) { + res.status(400).json({ + error: e instanceof Error ? e.message : String(e), + }); } })); export default router; diff --git a/resources/electron/electron-plugin/dist/server/api/window.js b/resources/electron/electron-plugin/dist/server/api/window.js index ecb1101..c2b68a1 100644 --- a/resources/electron/electron-plugin/dist/server/api/window.js +++ b/resources/electron/electron-plugin/dist/server/api/window.js @@ -116,8 +116,19 @@ router.post('/always-on-top', (req, res) => { (_a = state.windows[id]) === null || _a === void 0 ? void 0 : _a.setAlwaysOnTop(alwaysOnTop); res.sendStatus(200); }); +router.post('/fullscreen', (req, res) => { + var _a; + const { id, fullscreen } = req.body; + (_a = state.windows[id]) === null || _a === void 0 ? void 0 : _a.setFullScreen(fullscreen); + res.sendStatus(200); +}); router.get('/current', (req, res) => { - const currentWindow = Object.values(state.windows).find((window) => window.id === BrowserWindow.getFocusedWindow().id); + const focused = BrowserWindow.getFocusedWindow(); + if (!focused) { + res.sendStatus(404); + return; + } + const currentWindow = Object.values(state.windows).find((window) => window.id === focused.id); const id = Object.keys(state.windows).find((key) => state.windows[key] === currentWindow); res.json(getWindowData(id)); }); @@ -239,6 +250,18 @@ router.post('/open', (req, res) => { payload: [id], }); }); + window.on('enter-full-screen', () => { + notifyLaravel('events', { + event: 'Native\\Desktop\\Events\\Windows\\WindowFullscreened', + payload: [id], + }); + }); + window.on('leave-full-screen', () => { + notifyLaravel('events', { + event: 'Native\\Desktop\\Events\\Windows\\WindowUnfullscreened', + payload: [id], + }); + }); window.on('show', () => { notifyLaravel('events', { event: 'Native\\Desktop\\Events\\Windows\\WindowShown', diff --git a/src/App.php b/src/App.php index 7633e30..062d1c1 100644 --- a/src/App.php +++ b/src/App.php @@ -37,16 +37,25 @@ public function isHidden(): bool return $this->client->get('app/is-hidden')->json('is_hidden'); } + /** + * @deprecated v3 moves this to System::language(), which v2 does not have yet. + */ public function getLocale(): string { return $this->client->get('app/locale')->json('locale'); } + /** + * @deprecated v3 moves this to System::region(), which v2 does not have yet. + */ public function getLocaleCountryCode(): string { return $this->client->get('app/locale-country-code')->json('locale_country_code'); } + /** + * @deprecated v3 moves this to System::locale(), which v2 does not have yet. + */ public function getSystemLocale(): string { return $this->client->get('app/system-locale')->json('system_locale'); @@ -57,6 +66,9 @@ public function version(): string return $this->client->get('app/version')->json('version'); } + /** + * @deprecated Use Dock::badge(?string $label) instead, v3 removes this method. + */ public function badgeCount($count = null): int { if ($count === null) { @@ -111,6 +123,9 @@ public function isEmojiPanelSupported(): bool return (bool) $this->client->get('app/is-emoji-panel-supported')->json('supported'); } + /** + * @deprecated v3 removes this method and replaces it with a Blade element. There is no v2 replacement. + */ public function showEmojiPanel(): void { $this->client->post('app/show-emoji-panel'); diff --git a/src/Facades/App.php b/src/Facades/App.php index 42d8c8e..9ee12ca 100644 --- a/src/Facades/App.php +++ b/src/Facades/App.php @@ -5,23 +5,25 @@ use Illuminate\Support\Facades\Facade; /** + * @deprecated v3 renames this facade to NativeApp, because it collides with Laravel's own App facade. Nothing changes in v2. + * * @method static void quit() * @method static void relaunch() * @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 getLocale() Deprecated: v3 moves this to System::language(), which v2 does not have yet. + * @method static string getLocaleCountryCode() Deprecated: v3 moves this to System::region(), which v2 does not have yet. + * @method static string getSystemLocale() Deprecated: v3 moves this to System::locale(), which v2 does not have yet. * @method static string version() - * @method static int badgeCount($count = null) + * @method static int badgeCount($count = null) Deprecated: use Dock::badge(?string $label) instead, v3 removes this method. * @method static void addRecentDocument(string $path) * @method static array recentDocuments() * @method static void clearRecentDocuments() * @method static bool isRunningBundled() * @method static bool openAtLogin(?bool $open = null) * @method static bool isEmojiPanelSupported() - * @method static void showEmojiPanel() + * @method static void showEmojiPanel() Deprecated: v3 removes this method and replaces it with a Blade element. There is no v2 replacement. * @method static static when($value = null, ?callable $callback = null, ?callable $default = null) * @method static static unless($value = null, ?callable $callback = null, ?callable $default = null) */