Skip to content

lipeng1667/HomeAssistantPro

Repository files navigation

HomeAssistantPro

Created: March 3, 2025
Last Updated: July 21, 2025
Version: 2.2.0
iOS Target: 16.0+
Xcode: 17+
Swift: 5.10

HomeAssistantPro is a modern SwiftUI-based iOS application designed for smart home enthusiasts. Built with MVVM + Clean-DI architecture and 2025 iOS design principles, it features glassmorphism effects, responsive design, comprehensive design system, and real-time communication capabilities.

🌟 Features

Core Functionality

  • 🏠 Home Dashboard: Curated smart home case studies with demo video player
  • πŸ’¬ Community Forum: Discussion platform with hot topics, categories, and post creation/editing
  • πŸ”§ Tech Support Chat: Real-time WebSocket chat with typing indicators and message management
  • βš™οΈ Settings Hub: Profile management, theme switching, and app preferences
  • ✨ Splash Screen: Modern glassmorphism launch screen with floating animations
  • 🎯 Intro Experience: Beautiful onboarding flow for new users
  • πŸ” Authentication: Anonymous/registered login with persistent session management

Design & UX

  • πŸŒ™ Dark Mode: Automatic light/dark theme switching with adaptive colors
  • πŸ“± Responsive Design: Device-adaptive layouts for compact/regular/large screen sizes
  • ✨ Glassmorphism: Modern iOS design aesthetics with blur effects
  • 🎨 Design System: Centralized DesignTokens.swift for colors, spacing, typography
  • ⚑ Smooth Animations: Fluid spring transitions with haptic feedback integration
  • πŸŽͺ Floating Elements: Dynamic orbs and animated gradient backgrounds
  • β™Ώ Accessibility: VoiceOver support and Dynamic Type scaling

Technical Excellence

  • πŸ—οΈ MVVM + Clean-DI: Architecture with dependency injection using @Environment
  • πŸ”§ Modular Components: Reusable UI components with standardized styling
  • πŸ“ Responsive Layouts: Three-tier device size system (compact/regular/large)
  • 🎯 Type Safety: Comprehensive Swift 5.10 type system with async/await
  • 🌐 Network Layer: URLSession-based API client with HMAC-SHA256 authentication
  • πŸ”’ Security: Keychain-based device identification and UserDefaults caching
  • ⚑ Performance: BackgroundDataPreloader with CacheManager for optimized loading
  • πŸ”Œ Real-time: WebSocket integration with SocketIO for live chat features

πŸš€ Quick Start

Prerequisites

- Xcode 17+
- iOS 16.0+ deployment target
- Swift 5.10+
- macOS Sonoma 14.0+
- Swift Package Manager (SPM)

Installation

# Clone the repository
git clone https://github.com/lipeng1667/HomeAssistantPro.git
cd HomeAssistantPro

# Open in Xcode
open HomeAssistantPro.xcodeproj

# Build and run (⌘+R)

πŸ“ Architecture Overview

Project Structure

HomeAssistantPro/
β”œβ”€β”€ HomeAssistantProApp.swift            # App entry point with splash screen logic
β”œβ”€β”€ 🧠 ViewModels/
β”‚   β”œβ”€β”€ AppViewModel.swift               # Global app state & authentication
β”‚   β”œβ”€β”€ AnonymousRestrictionViewModel.swift # Anonymous user access management
β”‚   └── ImageViewerModal.swift           # Image viewing modal state
β”œβ”€β”€ πŸ› οΈ Utils/
β”‚   β”œβ”€β”€ DesignTokens.swift               # Complete design system (colors, spacing, typography)
β”‚   β”œβ”€β”€ AnimationPresets.swift           # Consistent spring animations
β”‚   β”œβ”€β”€ HapticManager.swift              # Haptic feedback patterns
β”‚   β”œβ”€β”€ SharedButtonStyles.swift         # Unified button behaviors
β”‚   β”œβ”€β”€ KeyboardDismissModifier.swift    # Keyboard handling utilities
β”‚   β”œβ”€β”€ LocalizationManager.swift       # Multi-language support
β”‚   β”œβ”€β”€ DateUtils.swift                  # Date formatting utilities
β”‚   └── PhoneNumberUtils.swift           # Phone number validation
β”œβ”€β”€ πŸ–₯️ Views/
β”‚   β”œβ”€β”€ SplashView.swift                 # Glassmorphism splash with floating orbs
β”‚   β”œβ”€β”€ Components/
β”‚   β”‚   β”œβ”€β”€ MainTabView.swift            # Tab navigation controller
β”‚   β”‚   β”œβ”€β”€ StandardTabHeader.swift      # Unified headers with glassmorphism
β”‚   β”‚   β”œβ”€β”€ StandardTabBackground.swift  # Animated gradient backgrounds
β”‚   β”‚   β”œβ”€β”€ GlassmorphismCard.swift      # Glass effect cards
β”‚   β”‚   β”œβ”€β”€ CustomConfirmationModal.swift # Configurable confirmation modals
β”‚   β”‚   └── ReviewStatusBadge.swift      # Post status indicators
β”‚   β”œβ”€β”€ HomeView.swift                   # Home dashboard with video player
β”‚   β”œβ”€β”€ Forum/
β”‚   β”‚   β”œβ”€β”€ ForumView.swift              # Community forum with categories
β”‚   β”‚   β”œβ”€β”€ TopicDetailView.swift        # Forum topic details with replies
β”‚   β”‚   β”œβ”€β”€ CreatePostView.swift         # Post creation interface
β”‚   β”‚   └── EditReplyView.swift          # Reply editing interface
β”‚   β”œβ”€β”€ ChatView.swift                   # Real-time WebSocket chat
β”‚   β”œβ”€β”€ SettingsView.swift               # Settings & profile management
β”‚   β”œβ”€β”€ Login/
β”‚   β”‚   β”œβ”€β”€ AuthenticationView.swift     # Main auth flow controller
β”‚   β”‚   β”œβ”€β”€ LoginView.swift              # Login interface
β”‚   β”‚   └── RegisterView.swift           # Registration interface
β”‚   └── IntroView.swift                  # Onboarding flow
β”œβ”€β”€ 🌐 Services/
β”‚   β”œβ”€β”€ APIClient.swift                  # HMAC authenticated HTTP client
β”‚   β”œβ”€β”€ ForumService.swift               # Forum API integration
β”‚   β”œβ”€β”€ IMService.swift                  # Chat messaging service
β”‚   β”œβ”€β”€ SocketManager.swift              # WebSocket connection manager
β”‚   β”œβ”€β”€ SettingsStore.swift              # UserDefaults + Keychain wrapper
β”‚   β”œβ”€β”€ BackgroundDataPreloader.swift    # Performance optimization service
β”‚   └── CacheManager.swift               # Memory caching system
β”œβ”€β”€ πŸ“¦ Models/
β”‚   β”œβ”€β”€ AuthModels.swift                 # Authentication request/response models
β”‚   β”œβ”€β”€ ForumModels.swift                # Forum post and topic models
β”‚   β”œβ”€β”€ IMModels.swift                   # Chat message models
β”‚   └── LocalVideoAssets.swift           # Video player models
β”œβ”€β”€ 🎬 Components/
β”‚   └── VideoPlayer/
β”‚       β”œβ”€β”€ VideoPlayerView.swift        # Main video player component
β”‚       β”œβ”€β”€ LocalVideoPlayer.swift       # Local video playback
β”‚       └── FullscreenVideoModal.swift   # Fullscreen video modal
β”œβ”€β”€ πŸ›οΈ Legacy/
β”‚   └── AppDelegate.swift                # Legacy app delegate
└── πŸ§ͺ Tests/
    β”œβ”€β”€ HomeAssistantProTests/           # Unit tests
    β”œβ”€β”€ SettingsStoreTests.swift         # Settings store test suite
    └── HomeAssistantProUITests/         # UI tests

Design System Architecture

🎨 DesignTokens.swift

The foundation of our design system providing:

  • Adaptive Colors: Automatic light/dark mode switching with brand colors
  • Responsive Spacing: Three-tier device system (compact/regular/large)
  • Typography Scale: Device-aware font sizing with responsive scaling
  • Shadow Presets: Elevation system with adaptive opacity
  • Device Detection: Screen size categorization and responsive utilities

🧩 Component System

  • StandardTabHeader: Unified header with glassmorphism background
  • StandardTabBackground: Animated gradient backgrounds with floating orbs
  • GlassmorphismCard: Material design cards with blur effects
  • CustomConfirmationModal: Themed confirmation dialogs (.destructive/.primary/.success)
  • ReviewStatusBadge: Post status indicators with color coding
  • VideoPlayerView: Full-featured video player with fullscreen support

🎨 Design System

Color Palette

// Brand Colors
primaryPurple   #8B5CF6  // Home tab, primary actions
primaryCyan     #06B6D4  // Forum tab, secondary actions  
primaryGreen    #10B981  // Chat tab, success states
primaryAmber    #F59E0B  // Settings tab, warning states

// Adaptive Backgrounds (Light β†’ Dark)
backgroundPrimary    #FAFAFA β†’ #0F0F0F
backgroundSecondary  #F8FAFC β†’ #1A1A1A
backgroundTertiary   #F4F4F5 β†’ #262626

Responsive Spacing System

Device Categories:
- Compact (<385pt width): iPhone SE, mini series - base spacing
- Regular (385-415pt width): iPhone standard models - enhanced spacing  
- Large (>415pt width): iPhone Plus/Pro Max - maximum spacing

Responsive Spacing Examples:
- contentMargins(): 16pt β†’ 20pt β†’ 24pt
- responsivePadding(): 12pt β†’ 16pt β†’ 20pt
- Section spacing: 24pt β†’ 28pt β†’ 32pt

Typography Scale

// DesignTokens.ResponsiveTypography
headingLarge:   28pt β†’ 32pt β†’ 36pt
headingMedium:  24pt β†’ 26pt β†’ 28pt
bodyLarge:      18pt β†’ 19pt β†’ 20pt
bodyMedium:     16pt β†’ 17pt β†’ 18pt
bodySmall:      14pt β†’ 15pt β†’ 16pt
caption:        12pt β†’ 13pt β†’ 14pt

πŸ”§ Development

Dependencies

// Package.swift - Swift Package Manager
dependencies: [
    .package(url: "https://github.com/socketio/socket.io-client-swift", from: "16.0.0")
]

Building

# Debug build
xcodebuild -project HomeAssistantPro.xcodeproj -scheme HomeAssistantPro -destination 'platform=iOS Simulator,name=iPhone 15 Pro' build

# Release build  
xcodebuild -project HomeAssistantPro.xcodeproj -scheme HomeAssistantPro -configuration Release -destination 'platform=iOS Simulator,name=iPhone 15 Pro' build

Testing

# Run unit tests
xcodebuild test -project HomeAssistantPro.xcodeproj -scheme HomeAssistantPro -destination 'platform=iOS Simulator,name=iPhone 15 Pro'

# Run UI tests
xcodebuild test -project HomeAssistantPro.xcodeproj -scheme HomeAssistantProUITests -destination 'platform=iOS Simulator,name=iPhone 15 Pro'

Code Quality Standards

  • SwiftLint: Enforced strict code style and best practices
  • swift-format: Auto-formatting with Google style guidelines
  • Type Safety: Comprehensive Swift 5.10 type system usage
  • MVVM + Clean-DI: Clear separation with dependency injection
  • Async/Await: Structured concurrency, no Combine usage
  • os.Logger: Unified logging with subsystem tagging

πŸ” Authentication & Network Architecture

Security Implementation

  • Device Identification: UUID-based device ID stored securely in iOS Keychain
  • HMAC Authentication: SHA-256 signature validation for all API requests
  • Session Management: UserDefaults for state, Keychain for sensitive data
  • Anonymous + Registered: Dual authentication modes with permission restrictions

API Integration & Services

// Service Architecture
APIClient (HMAC Auth) β†’ ForumService/IMService β†’ ViewModels β†’ SwiftUI Views
                     ↳ SocketManager (WebSocket) β†’ Real-time Chat

Network Layer Services

  • APIClient: URLSession-based HTTP client with HMAC-SHA256 authentication
  • ForumService: Forum posts, topics, replies API integration
  • IMService: Chat messaging service with real-time capabilities
  • SocketManager: WebSocket connection management using SocketIO
  • BackgroundDataPreloader: Performance optimization with CacheManager

Session & Cache Management

  • SettingsStore: UserDefaults + Keychain wrapper for user data
  • CacheManager: Memory-based caching with 30-minute expiration
  • Automatic Restoration: Persistent login state across app launches
  • Permission System: Anonymous users have view-only access restrictions

πŸ“± Device Support & Compatibility

Supported Device Categories

// DesignTokens.DeviceSize detection
.compact: <385pt width  (iPhone SE, mini series)
.regular: 385-415pt     (iPhone 12-15 standard)  
.large:   >415pt width  (iPhone Plus/Pro Max series)

iOS Compatibility

  • iOS 16.0+: Minimum deployment target (updated from 15.6+)
  • iOS 18.0+: Recommended for optimal performance
  • Swift 5.10: Latest language features and concurrency
  • SwiftUI: Native UI framework with backward compatibility

Accessibility & Responsive Design

  • Dark Mode: Automatic system theme detection with adaptive colors
  • Dynamic Type: Font scaling support for accessibility
  • VoiceOver: Screen reader compatibility
  • Responsive Layouts: Auto-adapting to screen sizes and orientations

🎯 Technical Achievements

Architecture & Performance

  • MVVM + Clean-DI: Structured architecture with dependency injection
  • Centralized Design System: DesignTokens.swift eliminates styling inconsistencies
  • Background Preloading: 3-second splash screen preloads forum data
  • Memory Caching: CacheManager reduces redundant API calls
  • Responsive Design: Automatic adaptation across device sizes

User Experience Excellence

  • Seamless Authentication: Anonymous and registered modes with session persistence
  • Real-time Communication: WebSocket-powered chat with typing indicators
  • Glassmorphism UI: Modern iOS design with blur effects and floating animations
  • Accessibility First: VoiceOver, Dynamic Type, and responsive layouts
  • Haptic Integration: Consistent tactile feedback throughout the app

πŸš€ Version History

v2.2.0 (Current - July 21, 2025)

  • πŸ”Œ WebSocket Integration: Real-time chat with SocketIO and typing indicators
  • πŸ“Ή Video Player: Full-featured video player with fullscreen modal support
  • 🎨 Enhanced Components: ReviewStatusBadge and improved forum interfaces
  • πŸ“± Chat System: Complete instant messaging with message management
  • ⚑ Performance: BackgroundDataPreloader with CacheManager optimization

v2.1.0 (July 4, 2025)

  • 🌐 Network Integration: Complete API authentication with backend server
  • πŸ” Dual Authentication: Anonymous and registered login modes
  • πŸ”’ Security: HMAC-SHA256 authenticated requests with device identification
  • πŸ’Ύ Session Persistence: Automatic login state restoration via SettingsStore
  • 🎨 Confirmation System: CustomConfirmationModal with themed variants

v2.0.0 (June 26, 2025)

  • ✨ Design System: Complete DesignTokens.swift implementation
  • πŸŒ™ Dark Mode: Adaptive color system with light/dark switching
  • πŸ“± Responsive Design: Three-tier device size system (compact/regular/large)
  • πŸŽͺ Glassmorphism: Modern UI with blur effects and floating animations
  • πŸ—οΈ Architecture: MVVM + Clean-DI with dependency injection

v1.0.0 (March 3, 2025)

  • πŸ—οΈ Foundation: Initial MVVM architecture setup
  • 🎬 Onboarding: Complete intro flow and authentication system
  • πŸ“± Navigation: Four-tab app structure with SwiftUI
  • πŸ” Authentication: Basic login and anonymous mode implementation

πŸ“„ License

This project is licensed under the MIT License. See LICENSE.md for details.

πŸ‘¨β€πŸ’» Author

Michael Lee

  • Created: March 3, 2025
  • Architecture: MVVM + SwiftUI
  • Design: Modern iOS 2025 aesthetics

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published