# SelfieCam

A modern, professional-grade selfie camera app for iOS featuring a customizable ring light overlay, premium camera controls, and beautiful branding. Built entirely with SwiftUI, Swift 6, and the MijickCamera framework.

Perfect for low-light selfies, content creation, video calls, makeup application, or professional portrait lighting on the go.

## Features

### Core Camera & Lighting
- Full-screen camera preview with front/back camera switching
- Configurable **screen-based ring light** with adjustable border thickness (10-120pt)
- Multiple color temperature presets (Pure White, Warm Cream, Ice Blue, Soft Pink, Warm Amber, Cool Lavender)
- **Ring light brightness control** with adjustable opacity
- **Flash modes**: Off, On, Auto
- **Front Flash**: Uses screen brightness for front camera flash effect
- Real-time camera preview with smooth performance

### Capture Modes
- **Photo capture** with high-quality output
- **Video recording** (Premium)
- **Boomerang mode** for looping short videos (Premium)
- Self-timer with 3-second (free), 5-second, and 10-second (Premium) options
- Pinch-to-zoom gesture support
- Rule-of-thirds grid overlay (toggleable)
- Post-capture preview with share functionality

### Premium Features (Freemium Model)
- **Custom ring light colors** with full color picker
- **Premium color presets**: Ice Blue, Soft Pink, Warm Amber, Cool Lavender
- **Flash Sync**: Match flash color with ring light color
- **HDR Mode**: High Dynamic Range photo capture
- **High Quality Photos**: Maximum resolution output
- **True Mirror Mode**: Horizontally flipped preview like a real mirror
- **Skin Smoothing**: Real-time subtle skin smoothing filter
- **Center Stage**: Automatic subject tracking/centering
- **Extended Timers**: 5-second and 10-second self-timer options
- **Video & Boomerang**: Video recording and looping video capture
- Ad-free experience

### iCloud Sync
- Automatic settings synchronization across all devices
- Real-time sync status with last sync timestamp
- Manual "Sync Now" option
- Available to all users (free and premium)

### Branding & Launch
- **Animated launch screen** with customizable design
- **App icon generator** for creating consistent branding
- Seamless transition from launch to main app
- Configurable colors, patterns, and layout styles

### Accessibility & Polish
- Full VoiceOver support with meaningful labels, hints, and announcements
- Dynamic Type and ScaledMetric for readable text at all sizes
- String Catalog localization ready (`.xcstrings`)
- Consistent design system using Bedrock framework
- Prevents screen dimming during camera use

## Screenshots
*(Add App Store-ready screenshots here once built)*

## Requirements
- iOS 18.0 or later
- Xcode 16+
- Swift 6 language mode

## Dependencies
- **[MijickCamera](https://github.com/Mijick/Camera)** - Modern SwiftUI camera framework
- **[RevenueCat](https://www.revenuecat.com)** - Subscription management
- **Bedrock** - Internal design system and UI components (local package)

## Setup

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

### 2. Configure API Keys

This project uses `.xcconfig` files to securely manage API keys. **Never commit your actual API keys to version control.**

1. Copy the template file:
   ```bash
   cp SelfieCam/Configuration/Secrets.xcconfig.template SelfieCam/Configuration/Secrets.xcconfig
   ```

2. Edit `Secrets.xcconfig` with your actual API key:
   ```
   REVENUECAT_API_KEY = appl_your_actual_api_key_here
   ```

3. The `Secrets.xcconfig` file is gitignored and will never be committed.

### 3. RevenueCat Setup

1. Create an account at [RevenueCat](https://www.revenuecat.com)
2. Create a new project and connect it to App Store Connect
3. Create products in App Store Connect (e.g., `com.yourapp.pro.monthly`, `com.yourapp.pro.yearly`)
4. Configure the products in RevenueCat dashboard
5. Create an entitlement named `pro`
6. Create an offering with your subscription packages
7. Copy your **Public App-Specific API Key** to `Secrets.xcconfig`

### 4. Debug Premium Mode

To test premium features without a real subscription during development:

1. Edit Scheme (⌘⇧<) → Run → Arguments
2. Add Environment Variable:
   - **Name:** `ENABLE_DEBUG_PREMIUM`
   - **Value:** `1`

This unlocks all premium features in DEBUG builds only.

### 5. Branding Configuration

The app uses the Bedrock branding system for launch screen and app icon:

1. **BrandingConfig.swift** defines colors, icons, and launch screen settings
2. **Launch Screen Background Color** is set in Assets.xcassets and project build settings
3. **Icon Generator** available in Settings → Debug (DEBUG builds only)

See `Bedrock/Sources/Bedrock/Branding/BRANDING_GUIDE.md` for complete documentation.

### 6. CI/CD Configuration

For automated builds, set the `REVENUECAT_API_KEY` environment variable in your CI/CD system:

**GitHub Actions:**
```yaml
env:
  REVENUECAT_API_KEY: ${{ secrets.REVENUECAT_API_KEY }}
```

**Xcode Cloud:**
Add `REVENUECAT_API_KEY` as a secret in your Xcode Cloud workflow.

## Privacy
- Camera access required for preview and capture
- Photo Library access required to save photos/videos
- Microphone access required for video recording
- iCloud access for settings synchronization (optional)
- No data collection, no analytics, no tracking

## Monetization
Freemium model with optional "Pro" subscription:
- **Free**: Basic ring light, standard colors (Pure White, Warm Cream), photo capture, 3s timer, grid, zoom
- **Pro**: Full color palette, custom colors, HDR, high quality, flash sync, true mirror, skin smoothing, center stage, extended timers, video, boomerang

Implemented with RevenueCat for reliable subscription management.

## Project Structure

```
SelfieCam/
├── App/                              # App entry point with launch screen
├── Configuration/                    # xcconfig files (API keys)
├── Features/
│   ├── Camera/                       # Main camera UI
│   │   ├── ContentView.swift         # Main screen coordinator
│   │   ├── Views/                    # Camera UI components
│   │   │   ├── CustomCameraScreen.swift
│   │   │   ├── RingLightOverlay.swift
│   │   │   ├── CaptureButton.swift
│   │   │   ├── ExpandableControlsPanel.swift
│   │   │   └── ...
│   │   ├── GridOverlay.swift         # Rule of thirds overlay
│   │   └── PostCapturePreviewView.swift
│   ├── Paywall/                      # Pro subscription flow
│   │   └── ProPaywallView.swift
│   └── Settings/                     # Configuration screens
│       ├── SettingsView.swift
│       ├── SettingsViewModel.swift
│       └── ...
├── Shared/
│   ├── BrandingConfig.swift          # App icon & launch screen config
│   ├── DesignConstants.swift         # Design tokens (uses Bedrock)
│   ├── Color+Extensions.swift        # Ring light color presets
│   ├── Models/                       # Data models
│   │   ├── CameraFlashMode.swift
│   │   ├── CameraHDRMode.swift
│   │   ├── PhotoQuality.swift
│   │   └── ...
│   ├── Protocols/                    # Shared protocols
│   │   ├── RingLightConfigurable.swift
│   │   ├── CaptureControlling.swift
│   │   └── PremiumManaging.swift
│   ├── Premium/                      # Subscription management
│   │   └── PremiumManager.swift
│   ├── Services/                     # App services
│   │   └── PhotoLibraryService.swift
│   └── Storage/                      # Persistence
│       └── SyncedSettings.swift      # iCloud-synced settings model
└── Resources/                        # Assets, localization
    ├── Assets.xcassets/
    │   ├── AppIcon.appiconset/
    │   ├── LaunchBackground.colorset/
    │   └── ...
    └── Localizable.xcstrings
```

## Key Technologies

| Technology | Purpose |
|------------|---------|
| SwiftUI | User interface framework |
| Swift 6 | Modern concurrency with strict checking |
| MijickCamera | Camera capture and preview |
| RevenueCat | Subscription management |
| Bedrock | Design system and branding |
| CloudKit | iCloud settings synchronization |
| AVFoundation | Low-level camera access |

## License
*(Add your license here)*
