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. Go to Privacy & Security
  3. Tap Lockdown Mode
  4. Turn off Lockdown Mode
); }