# Dream Recall

Dream Recall is a private dream journal for iOS, watchOS, and widgets. It supports text and voice capture, pattern review, lucid dreaming tools, export, widgets, and StoreKit 2 access control.

![Dream Recall Banner](Website/images/banner.png)

## Features

### Core Features (Free)
- **Dream Journal** - Log unlimited dreams with rich text
- **Voice Recording** - Record and transcribe dreams using speech recognition
- **Emotions & Themes** - Tag dreams with 11 emotions and 20 themes
- **Lucidity Tracking** - Track lucid dream frequency and levels
- **Dream Dictionary** - 100+ symbols with meanings and interpretations
- **Reality Checks** - Scheduled reminders with various check types
- **Moon Phase** - Track lunar cycles and their correlation with dreams
- **Analytics** - Basic charts and patterns
- **Apple Watch** - Quick capture from your wrist
- **Widgets** - Home screen and Lock Screen widgets
- **Siri Shortcuts** - Voice-activated dream logging

### Premium Features
- **Advanced Analytics** - SwiftCharts visualizations, trends, insights
- **Sleep Sounds** - 17 sounds including binaural beats
- **WBTB Alarm** - Wake Back To Bed lucid dream induction
- **Premium Themes** - 6 beautiful color themes
- **Export** - PDF, JSON, CSV export formats
- **Share Cards** - Beautiful shareable dream images
- **iCloud Sync** - Sync across all your devices
- **Priority Support** - Faster response times

## Screenshots

| Journal | Quick Capture | Analytics | Dictionary |
|---------|---------------|-----------|------------|
| ![Journal](Website/images/screenshot-1.png) | ![Capture](Website/images/screenshot-2.png) | ![Analytics](Website/images/screenshot-3.png) | ![Dictionary](Website/images/screenshot-4.png) |

## Requirements

- iOS 17.0+
- watchOS 10.0+
- Xcode 15.0+
- Swift 5.9+

## Installation

### 1. Clone the Repository
```bash
git clone https://github.com/yourusername/DreamKeeper.git
cd DreamKeeper
```

### 2. Open in Xcode
```bash
open DreamKeeper.xcodeproj
```

### 3. Configure Signing
1. Select the project in Xcode
2. Go to "Signing & Capabilities"
3. Select your Team
4. Update Bundle Identifier to your own

### 4. Run
Select your target device/simulator and press Run (Cmd+R)

## Project Structure

```
DreamKeeper/
├── DreamKeeperApp.swift          # App entry point
├── ContentView.swift              # Main tab navigation
│
├── Models/
│   ├── DreamEntry.swift          # Core dream model
│   ├── DreamCharacter.swift      # Character tracking
│   ├── DreamSymbol.swift         # Symbol model
│   └── Enums/                    # All enumerations
│
├── Views/
│   ├── Journal/                  # Journal & detail views
│   ├── Capture/                  # Dream entry creation
│   ├── Insights/                 # Analytics & charts
│   ├── Dictionary/               # Dream symbol lookup
│   ├── LucidDreaming/           # Reality checks, WBTB
│   ├── SleepSounds/             # Audio player
│   ├── Achievements/            # Gamification
│   ├── Tips/                    # Tutorial system
│   ├── Settings/                # App preferences
│   ├── Onboarding/              # First-run experience
│   └── Components/              # Reusable UI
│
├── ViewModels/
│   ├── JournalViewModel.swift
│   ├── EntryViewModel.swift
│   └── InsightsViewModel.swift
│
├── Services/
│   ├── SpeechService.swift      # Voice recording
│   ├── HapticsService.swift     # Haptic feedback
│   ├── MoonPhaseService.swift   # Lunar calculations
│   ├── ExportService.swift      # PDF/JSON/CSV export
│   └── DreamDictionaryService.swift
│
├── Store/
│   └── SubscriptionManager.swift # StoreKit 2
│
├── Intents/
│   └── DreamIntents.swift       # Siri Shortcuts
│
├── Design/
│   ├── AppColors.swift          # Color system
│   ├── AppDesignSystem.swift    # Typography, spacing
│   └── AppTheme.swift           # Theme management
│
├── DreamKeeperWatch/            # watchOS app
│   ├── Views/
│   └── Complications/
│
└── DreamKeeperWidgets/          # Widget extension
    ├── QuickLogWidget.swift
    ├── RecentDreamsWidget.swift
    └── DreamCalendarWidget.swift
```

## Key Technologies

| Technology | Purpose |
|------------|---------|
| SwiftUI | User interface |
| SwiftData | Persistence |
| SwiftCharts | Data visualization |
| StoreKit 2 | In-app purchases |
| AppIntents | Siri Shortcuts |
| WidgetKit | Home/Lock Screen widgets |
| AVFoundation | Audio playback |
| Speech | Voice transcription |
| UserNotifications | Alarms & reminders |

## Configuration

### Info.plist Keys Required
```xml
<key>NSMicrophoneUsageDescription</key>
<string>Record voice memos of your dreams</string>

<key>NSSpeechRecognitionUsageDescription</key>
<string>Transcribe your dream recordings</string>
```

### StoreKit Configuration
1. Use `DreamKeeper/Store/Products.storekit` for local StoreKit testing.
2. Mirror these product identifiers in App Store Connect:
   - `com.shankardutt.dreamkeeper.premium.monthly`
   - `com.shankardutt.dreamkeeper.premium.yearly`
   - `com.shankardutt.dreamkeeper.premium.lifetime`

### CloudKit (Optional)
1. Enable CloudKit in Signing & Capabilities
2. Create container: `iCloud.com.yourname.dreamkeeper`

## Architecture

Dream Recall uses **MVVM** architecture with modern SwiftUI patterns:

```
View
  ↓ @State, @Binding
ViewModel (@Observable)
  ↓
Model (SwiftData @Model)
  ↓
Services (Singletons)
```

### Key Patterns
- **@Observable** macro for ViewModels (iOS 17+)
- **@Model** macro for SwiftData entities
- **Dependency injection** via Environment
- **Singleton services** for shared functionality

## Customization

### Adding New Themes
1. Edit `Design/AppTheme.swift`
2. Add new case to `AppTheme` enum
3. Define colors in computed properties

### Adding Dream Symbols
1. Edit `Services/DreamDictionary.swift`
2. Add to appropriate category in `DreamDictionaryService.symbols`

### Adding Achievements
1. Edit `Models/Achievement.swift`
2. Add new `AchievementDefinition` to `allAchievements`

### Adding Sleep Sounds
1. Add audio file to bundle
2. Edit `Views/SleepSounds/SleepSoundsView.swift`
3. Add `SleepSound` to `allSounds`

## Testing

### Unit Tests
```bash
xcodebuild test -scheme DreamKeeper -destination 'platform=iOS Simulator,name=iPhone 15'
```

### UI Tests
```bash
xcodebuild test -scheme DreamKeeperUITests -destination 'platform=iOS Simulator,name=iPhone 15'
```

## Deployment

### App Store Submission Checklist
- [ ] Update version and build numbers
- [ ] Archive build (Product > Archive)
- [ ] Upload to App Store Connect
- [ ] Add screenshots for all device sizes
- [ ] Fill in App Store metadata
- [ ] Submit for review

### TestFlight
1. Archive in Xcode
2. Upload to App Store Connect
3. Add testers in TestFlight section

## Contributing

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit changes (`git commit -m 'Add amazing feature'`)
4. Push to branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## License

This project is proprietary software. All rights reserved.

## Support

- Website: https://dreamkeeper.duttlabs.app
- Support: https://dreamkeeper.duttlabs.app/support.html

## Acknowledgments

- Moon phase calculations based on astronomical algorithms
- Dream symbol meanings compiled from various cultural sources
- UI inspired by modern iOS design principles

---

Designed for private dream recording and reflective practice.
