From a9bd40338873bf8e5202b95a96c8b7a7812caef4 Mon Sep 17 00:00:00 2001 From: Lewis Crichton Date: Tue, 29 Aug 2023 19:44:38 +0100 Subject: [PATCH] fix: attempt to use reactivity to resize window --- .../components/installer/FailureModal.svelte | 19 ++++++++++++++++--- frontend/src/components/windows/index.ts | 8 ++++++++ 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/installer/FailureModal.svelte b/frontend/src/components/installer/FailureModal.svelte index 36c02a0..c7298ad 100644 --- a/frontend/src/components/installer/FailureModal.svelte +++ b/frontend/src/components/installer/FailureModal.svelte @@ -8,7 +8,7 @@ import * as Installer from "../../../wailsjs/go/installer/Installer.js"; import Heading from "../text/Heading.svelte"; import Button from "../Button.svelte"; - import { closeWindow } from "../windows/index.js"; + import { closeWindow, resizeWindow } from "../windows/index.js"; import { BrowserOpenURL } from "../../../wailsjs/runtime/runtime.js"; import * as IPC from "./ipc"; @@ -26,6 +26,19 @@ setTimeout(() => IPC.doAction(op, path, onAction)); } + + let isOwned = true; + + // svelte hacks... + async function CheckOwnership() { + isOwned = await Installer.CheckForOwnershipDarwin(path); + } + + $: if (!isOwned) { + resizeWindow(_windowId, 450, 510); + } else { + resizeWindow(_windowId, 450, 200); + }
@@ -33,9 +46,9 @@

Something went wrong!

{#if message} {#if message.includes("file exists") || message.includes("permission denied")} - {#await Installer.CheckForOwnershipDarwin(path)} + {#await CheckOwnership()}

{message}

- {:then isOwned} + {:then} {#if !isOwned}

Hmm... seems like you've encountered a Mac-specific problem! Usually, this is one of two things:

diff --git a/frontend/src/components/windows/index.ts b/frontend/src/components/windows/index.ts index 1e4f582..fde2df2 100644 --- a/frontend/src/components/windows/index.ts +++ b/frontend/src/components/windows/index.ts @@ -48,6 +48,14 @@ export const closeWindow = (id: string) => { }); }; +export const resizeWindow = (id: string, w: number, h: number) => { + windowStore.update(windows => { + windows[id].props.width = w; + windows[id].props.height = h; + return windows; + }); +} + let zIndex = 0; export const getFocusZIndex = () => { zIndex++;