# Plan

## FRE-517: Build settings and preferences screen

### Overview
Create a settings screen with the following sections:
- Sync intervals
- Notifications
- Theme (light/dark/system)
- Reading preferences
- Account management

### Implementation Plan

#### 1. Types and Interfaces
- [ ] Add `SyncInterval` type to `src/types/feed.ts`
- [ ] Add `NotificationPreference` type to `src/types/feed.ts`
- [ ] Add `ReadingPreference` type to `src/types/feed.ts`
- [ ] Add `AccountSettings` type to `src/types/global.d.ts`

#### 2. Settings State Management
- [ ] Create `settings-store` in `src/stores/settings-store.ts`
- [ ] Initialize default settings
- [ ] Add actions for updating all preference types

#### 3. Settings Screen Component
- [ ] Create `src/components/settings.tsx` with:
  - Sync interval selector
  - Notification toggle switches
  - Theme selector
  - Reading preference toggles
  - Account section placeholder

#### 4. Settings Navigation
- [ ] Add route `src/app/settings.tsx`
- [ ] Update `app-tabs.tsx` to include settings tab
- [ ] Add navigation to `AppLayout.tsx`

#### 5. Integration
- [ ] Connect settings to feed subscription intervals
- [ ] Connect theme settings to `useTheme` hook
- [ ] Connect notifications to expo-notifications

---

## FRE-520: Add push notifications

### Overview
Implement push notifications for new articles, episode releases, and custom alerts using expo-notifications.

### Implementation Plan

#### 1. Notifications Types
- [ ] Add `NotificationType` enum to `src/types/global.d.ts`
- [ ] Add `NotificationConfig` interface to `src/types/global.d.ts`
- [ ] Add `PushNotificationConfig` interface to `src/types/global.d.ts`

#### 2. Notifications Service
- [ ] Create `src/services/notification-service.ts`
- [ ] Implement `requestPermission()`
- [ ] Implement `scheduleNotification(type: NotificationType)`
- [ ] Implement `onNotificationReceived()`
- [ ] Implement `onNotificationOpened()`
- [ ] Implement `clearAllNotifications()`

#### 3. Notification Handlers
- [ ] Create `src/hooks/use-notifications.ts`
- [ ] Add notification state and actions
- [ ] Add notification display component

#### 4. Notification Settings
- [ ] Add notification type preferences in settings
- [ ] Add push notification toggle in settings
- [ ] Add custom alert configuration

#### 5. Integration
- [ ] Connect notifications to feed updates
- [ ] Schedule notifications on feed fetch
- [ ] Handle notification deep linking

---

## Dependencies and Tools
- expo-notifications (already installed)
- expo-task-manager (already installed)
- expo-sqlite (already installed)
- zustand (already installed)

## Notes
- Settings will persist via zustand persist middleware
- Notifications will use Expo's token-based system
- Feed subscriptions will respect sync interval settings
