## What the fix accomplishes:
1. **Captures the current state** before updating the config
2. **Detects when analytics is newly enabled** - when it changes from `None` (first-time) or `false` (previously disabled) to `true`
3. **Immediately sends `session_start`** for that current session when analytics is enabled
## Now the flow works correctly:
**First-time user:**
- App starts (no session_start - analytics not enabled yet)
- User sees privacy dialog, clicks "Yes"
- Config updated with `analytics_enabled: true`
- **session_start event fires immediately** ✓
- All subsequent events in that session have proper session context
**Returning user (already opted in):**
- App starts → session_start fires from main.rs ✓
- Normal session tracking continues
**User re-enabling analytics:**
- User toggles analytics back on in Settings
- **session_start event fires immediately** ✓
- Session tracking resumes
This ensures every analytics session has a `session_start` event without sending any events before user consent!