From 236eb0c16a2e04caf38fec57fafd4af6beb72415 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 4 Feb 2026 18:29:21 -0600 Subject: [PATCH] Display a warning to users of iOS lockdown mode --- src/App.tsx | 2 + src/components/LockdownModeDetector.tsx | 73 +++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 src/components/LockdownModeDetector.tsx diff --git a/src/App.tsx b/src/App.tsx index a5af3b43..691ba2e7 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -28,6 +28,7 @@ import { DynamicFavicon } from '@/components/DynamicFavicon'; import { OfflineIndicator } from '@/components/OfflineIndicator'; import { PWAUpdatePrompt } from '@/components/PWAUpdatePrompt'; import { ErrorBoundary } from '@/components/ErrorBoundary'; +import { LockdownModeDetector } from '@/components/LockdownModeDetector'; import AppRouter from './AppRouter'; @@ -152,6 +153,7 @@ export function App() { + diff --git a/src/components/LockdownModeDetector.tsx b/src/components/LockdownModeDetector.tsx new file mode 100644 index 00000000..8ba9aaf4 --- /dev/null +++ b/src/components/LockdownModeDetector.tsx @@ -0,0 +1,73 @@ +import { useEffect, useState } from 'react'; +import { + AlertDialog, + AlertDialogContent, + AlertDialogDescription, + AlertDialogHeader, + AlertDialogTitle, +} from '@/components/ui/alert-dialog'; + +/** + * Detects if IndexedDB is unavailable (which happens in iOS lockdown mode) + * and displays a blocking alert dialog informing the user. + */ +export function LockdownModeDetector() { + const [isLockdownMode, setIsLockdownMode] = useState(false); + + useEffect(() => { + // Check if IndexedDB is available + const checkIndexedDB = async () => { + try { + // Check if IndexedDB exists + if (!window.indexedDB) { + setIsLockdownMode(true); + return; + } + + // Try to open a test database to verify IndexedDB actually works + // In iOS lockdown mode, indexedDB exists but throws errors when used + const testDBName = '_shakespeare_lockdown_test'; + const request = window.indexedDB.open(testDBName, 1); + + request.onerror = () => { + setIsLockdownMode(true); + }; + + request.onsuccess = () => { + // IndexedDB is working, clean up test database + request.result.close(); + window.indexedDB.deleteDatabase(testDBName); + }; + } catch { + // Any error means IndexedDB is not available + setIsLockdownMode(true); + } + }; + + checkIndexedDB(); + }, []); + + return ( + + + + 🔒 Lockdown Mode Detected + +

+ Shakespeare requires IndexedDB to function, which is unavailable in iOS Lockdown Mode. +

+

+ To use Shakespeare, please disable Lockdown Mode in your device settings: +

+
    +
  1. Open Settings
  2. +
  3. Go to Privacy & Security
  4. +
  5. Tap Lockdown Mode
  6. +
  7. Turn off Lockdown Mode
  8. +
+
+
+
+
+ ); +}