Skip to content

eGxC/watertrack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

H2O - Water Reminder & Habit Tracker

A beautiful, minimal water tracking app for iOS and Apple Watch that helps you build a sustainable hydration habit.

Features

Core Features

  • Smart Water Reminders - Timely, non-intrusive notifications throughout the day
  • Daily & Weekly Progress Tracking - Simple statistics to visualize hydration consistency
  • Apple Health Sync - Automatically sync water intake with Apple Health
  • Apple Watch App - Log water intake instantly from your wrist
  • Widgets - Quick access to daily progress from your home screen

Experience Enhancers

  • Dark Mode - Comfortable viewing in all lighting conditions
  • Custom Notifications - Personalized reminder schedules
  • Streak Tracking - Motivation through daily consistency tracking
  • Beautiful UI - Soft pastel colors with smooth animations

PRO Features (In-App Purchase)

  • Unlimited usage
  • 100% Ad-free
  • Access to all features
  • All Air Apps included

Architecture

Project Structure

H2O/
├── Models/              # Data models (WaterEntry, DailyGoal, etc.)
├── Views/               # SwiftUI views
│   ├── HomeView.swift
│   ├── StatsView.swift
│   ├── SettingsView.swift
│   ├── OnboardingView.swift
│   └── AddWaterView.swift
├── Services/            # Business logic and managers
│   ├── WaterTrackingManager.swift
│   ├── NotificationManager.swift
│   ├── HealthKitManager.swift
│   └── SiriShortcutManager.swift
├── Resources/           # Assets and color sets
└── Info.plist

H2OWatch/               # Apple Watch app
├── H2OWatchApp.swift
└── WatchHomeView.swift

H2OWidget/              # Home screen widgets
└── H2OWidget.swift

Key Components

WaterTrackingManager

  • Singleton pattern for centralized water tracking
  • Manages daily entries, goals, and streaks
  • Persists data using UserDefaults with JSON encoding
  • Auto-cleanup of old entries (90 days)

NotificationManager

  • Local notification scheduling
  • Configurable reminder intervals
  • Motivational notifications on goal completion
  • Foreground notification support

HealthKitManager

  • Bidirectional Apple Health sync
  • Water intake logging in liters
  • Authorization handling
  • Background sync support

Design System

Colors

The app uses a soft, calming color palette inspired by water:

  • AccentColor: Teal/Cyan (#66B3CC) - Primary actions and highlights
  • AccentColorLight: Light Cyan (#80CCFF) - Gradients and secondary highlights
  • BackgroundTop: Very light blue (#FFEFD9) - Top gradient
  • BackgroundBottom: Light cyan (#F2E5B3) - Bottom gradient
  • TextPrimary: Dark gray-blue (#4D6666) - Main text
  • TextSecondary: Medium gray (#809999) - Secondary text

UI Patterns

  • Rounded Corners: 16-20px for cards, 10-12px for buttons
  • Shadows: Subtle shadows (opacity 0.03-0.05) for depth
  • Gradients: Linear gradients for backgrounds and important CTAs
  • Progress Rings: Circular progress indicators with smooth animations
  • Quick Add Buttons: Grid of preset water amounts for fast logging

Data Persistence

UserDefaults Keys

  • waterEntries - JSON array of all water entries
  • dailyGoal - JSON object of daily goal configuration
  • currentStreak - Integer for current streak count
  • longestStreak - Integer for best streak achieved
  • hasCompletedOnboarding - Boolean for onboarding status
  • isPro - Boolean for subscription status

Data Models

WaterEntry {
    id: UUID
    amount: Double (ml)
    timestamp: Date
}

DailyWaterGoal {
    targetAmount: Double (ml)
    reminderInterval: Int (minutes)
    startTime: Date
    endTime: Date
}

DailyStats {
    date: Date
    totalAmount: Double
    entries: [WaterEntry]
    goalCompleted: Bool
}

Notifications

Local Notifications

  • Scheduled based on user's active hours (default: 8 AM - 10 PM)
  • Configurable interval (default: 60 minutes)
  • Auto-reschedule on settings change
  • Motivational messages on goal completion

Notification Permissions

Requested during onboarding with clear explanation of benefits.

Apple Watch Integration

Features

  • Real-time sync with iPhone app
  • Quick add buttons (100ml, 250ml, 500ml, 750ml)
  • Progress ring showing daily percentage
  • Current streak display
  • Goal completion indicator

Complications

Widget support for watch faces showing:

  • Current progress percentage
  • Total intake vs goal
  • Streak count

Widget Implementation

Small Widget

  • Progress percentage (large)
  • Current intake amount
  • Goal amount (small text)
  • Water drop icon

Medium Widget

  • Progress ring (left side)
  • Detailed stats (right side)
  • App branding
  • Current intake and goal

Update Schedule

Widgets update every 15 minutes to show current progress.

Subscription System

In-App Purchase

  • Monthly subscription: $9.99/month
  • Auto-renewable subscription
  • Managed through StoreKit
  • Restore purchases support

PRO Features

  • Unlimited water tracking
  • Ad-free experience
  • All app features unlocked
  • Access to Air Apps suite

Privacy & Permissions

Required Permissions

  1. Notifications - For water reminders
  2. HealthKit - For Apple Health sync (optional)

Privacy Policy

  • No user data collection
  • All data stored locally on device
  • HealthKit data synced only with user consent
  • Full privacy policy at: https://airapps.co/privacy

Building & Running

Requirements

  • Xcode 14.0+
  • iOS 15.0+
  • watchOS 8.0+
  • Swift 5.7+

Setup Steps

  1. Open the project in Xcode
  2. Configure signing & capabilities
  3. Add HealthKit capability
  4. Add Push Notifications capability
  5. Configure App Groups for Watch sync
  6. Build and run on device or simulator

Capabilities Needed

  • HealthKit
  • Push Notifications
  • App Groups (for Watch sync)
  • WidgetKit
  • Siri & Shortcuts

Testing

Manual Testing Checklist

  • Water entry logging
  • Goal completion detection
  • Notification scheduling
  • HealthKit sync
  • Watch app sync
  • Widget updates
  • Streak calculation
  • Onboarding flow
  • Settings persistence
  • Subscription flow

Future Enhancements

Planned Features

  • iMessage stickers
  • Custom app icons
  • Social sharing
  • Export data to CSV
  • Water intake insights
  • Smart goal recommendations
  • Integration with Fitness+ workouts

Technical Debt

  • Implement proper StoreKit 2 for subscriptions
  • Add unit tests for managers
  • Add UI tests for critical flows
  • Implement CloudKit sync for multi-device support
  • Add analytics (privacy-focused)

Support

License

Copyright © 2024 Air Apps. All rights reserved.


H2O - Building healthy hydration habits, one drop at a time.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors