From 0ae7d123435856cc686014f5753bcc45a62a4c2f Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 3 Feb 2025 20:15:19 -0800 Subject: [PATCH] refac --- src/lib/components/chat/MessageInput/InputMenu.svelte | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/lib/components/chat/MessageInput/InputMenu.svelte b/src/lib/components/chat/MessageInput/InputMenu.svelte index 4a7624cfe..90a08a890 100644 --- a/src/lib/components/chat/MessageInput/InputMenu.svelte +++ b/src/lib/components/chat/MessageInput/InputMenu.svelte @@ -54,6 +54,11 @@ }, {}); }; + const detectMobile = () => { + const userAgent = navigator.userAgent || navigator.vendor || window.opera; + return /android|iphone|ipad|ipod|windows phone/i.test(userAgent); + }; + function handleFileChange(event) { const inputFiles = Array.from(event.target?.files); if (inputFiles && inputFiles.length > 0) { @@ -148,7 +153,7 @@ : ''}" on:click={() => { if (fileUploadEnabled) { - if (!$mobile) { + if (!detectMobile()) { screenCaptureHandler(); } else { const cameraInputElement = document.getElementById('camera-input');