|
| 1 | +# Device Detection Debug Page |
| 2 | + |
| 3 | +This debug page helps developers troubleshoot device detection issues in the Reclaim SDK. |
| 4 | + |
| 5 | +## Usage |
| 6 | + |
| 7 | +### Access the Debug Page |
| 8 | +Navigate to `/debug` in your example app: |
| 9 | +``` |
| 10 | +http://localhost:3000/debug |
| 11 | +``` |
| 12 | + |
| 13 | +### Features |
| 14 | + |
| 15 | +1. **Real-time Detection Results** |
| 16 | + - Shows current device type (mobile/desktop) |
| 17 | + - Mobile OS detection (iOS/Android) |
| 18 | + - Live updates on window resize |
| 19 | + |
| 20 | +2. **Detection Factors** |
| 21 | + - All scoring factors used in detection |
| 22 | + - Visual indicators for each factor |
| 23 | + - Screen dimensions and capabilities |
| 24 | + |
| 25 | +3. **Environment Information** |
| 26 | + - User agent string |
| 27 | + - Platform and vendor details |
| 28 | + - Screen resolution and window size |
| 29 | + - Touch points and orientation |
| 30 | + |
| 31 | +4. **Browser Capabilities** |
| 32 | + - Touch support |
| 33 | + - Geolocation, notifications, service workers |
| 34 | + - WebGL, WebRTC support |
| 35 | + - Device motion/orientation APIs |
| 36 | + |
| 37 | +5. **Export Options** |
| 38 | + - Copy debug info as JSON |
| 39 | + - Download complete debug report |
| 40 | + - Share with issue reports |
| 41 | + |
| 42 | +## Adding to Your App |
| 43 | + |
| 44 | +To add this debug page to your own app: |
| 45 | + |
| 46 | +1. Copy the debug page component to your app |
| 47 | +2. Import the device detection functions from the SDK: |
| 48 | +```typescript |
| 49 | +import { |
| 50 | + getDeviceType, |
| 51 | + getMobileDeviceType, |
| 52 | + isMobileDevice, |
| 53 | + isDesktopDevice |
| 54 | +} from '@reclaimprotocol/js-sdk' |
| 55 | +``` |
| 56 | + |
| 57 | +3. Add a route to access the debug page (keep it hidden in production) |
| 58 | + |
| 59 | +## Reporting Issues |
| 60 | + |
| 61 | +If you find a device that's incorrectly detected: |
| 62 | + |
| 63 | +1. Visit the debug page on that device |
| 64 | +2. Click "Download Report" |
| 65 | +3. Include the JSON file in your GitHub issue |
| 66 | +4. Describe the expected vs actual behavior |
| 67 | + |
| 68 | +## Common Detection Patterns |
| 69 | + |
| 70 | +### Desktop with Touchscreen |
| 71 | +- Touch Device: Yes |
| 72 | +- Has Mouse: Yes |
| 73 | +- Large Screen: Yes |
| 74 | +- Can Hover: Yes |
| 75 | +- **Result**: Desktop ✓ |
| 76 | + |
| 77 | +### iPad Pro in Desktop Mode |
| 78 | +- User Agent: Contains "Macintosh" |
| 79 | +- Touch Device: Yes |
| 80 | +- Mobile APIs: Yes |
| 81 | +- **Result**: Mobile (iOS) ✓ |
| 82 | + |
| 83 | +### Android Tablet |
| 84 | +- User Agent: Contains "Android" |
| 85 | +- Touch Device: Yes |
| 86 | +- Screen Size: Variable |
| 87 | +- **Result**: Mobile (Android) ✓ |
| 88 | + |
| 89 | +### iPhone/Android Phone |
| 90 | +- Small Screen: Yes |
| 91 | +- Touch Device: Yes |
| 92 | +- Mobile User Agent: Yes |
| 93 | +- **Result**: Mobile ✓ |
| 94 | + |
| 95 | +## Privacy Note |
| 96 | + |
| 97 | +The debug page only collects browser information locally. No data is sent to external servers unless you explicitly export and share it. |
0 commit comments