Commit Graph

9 Commits

Author SHA1 Message Date
31f7c4286d chore: Update bundle ID to net.ivuorinen.HihaArvio
Change ApplicationId from com.companyname.hihaarvio to net.ivuorinen.HihaArvio
to properly identify the application with the developer's domain.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 13:43:35 +02:00
a9249ec5d5 chore: Add .gitignore and remove build artifacts from repository
- Add comprehensive .gitignore for .NET MAUI projects
- Remove 2,651 tracked build artifacts (bin/, obj/ directories)
- Build artifacts should be generated in CI/CD, not committed

Patterns added to .gitignore:
- Build outputs (bin/, obj/, Debug/, Release/)
- IDE files (.vs/, .vscode/, *.user, .idea/)
- Test results and coverage files
- NuGet packages (*.nupkg, *.snupkg)
- SQLite database files (*.db, *.db-shm, *.db-wal)
- Platform-specific build artifacts
- Temporary and cache files

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 13:41:36 +02:00
5ccd1075cb docs: Complete Milestone 6 - Mark project as complete
All 6 milestones successfully implemented and verified:

**Project Status:  COMPLETE**

**End-to-End Integration Verified:**
- Accelerometer → ShakeDetection → EstimateGeneration → Storage → UI
- MainViewModel auto-starts shake monitoring on initialization
- All ViewModels connected via dependency injection
- Dispose pattern implemented for proper cleanup
- 189 tests passing across all layers
- 0 warnings, 0 errors on all platforms

**Test Coverage:**
- Models: 48 tests
- Services: 71 tests (EstimateService, StorageService, ShakeDetectionService, Integration)
- ViewModels: 46 tests (MainViewModel, HistoryViewModel, SettingsViewModel)
- Accelerometer: 24 tests (SensorReading, iOS, Desktop, Contract)
- **Total: 189 tests, 100% passing**

**Platform Support:**
- iOS: Real accelerometer via MAUI API
- macOS Catalyst: Real accelerometer via MAUI API
- Desktop: Simulated accelerometer with timer-based readings
- All platforms: 0 warnings, 0 errors

**Architecture:**
- MVVM with strict separation (Models, ViewModels, Views, Services)
- Dependency injection throughout
- Platform-specific implementations via conditional compilation
- Event-driven shake detection
- Async/await for all I/O operations
- SQLite persistence with auto-pruning
- CommunityToolkit.Mvvm source generators

**Ready for Deployment:**
1. iOS deployment (real accelerometer)
2. macOS Catalyst deployment (real accelerometer)
3. Desktop testing (simulated accelerometer)

Future enhancements documented in CLAUDE.md for Web/Blazor support, haptic feedback, PWA manifest, and performance optimizations.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 13:19:05 +02:00
7c3916dab1 feat: Complete Milestone 5 - Platform-Specific Implementations
Implemented platform-agnostic accelerometer abstraction with iOS and desktop implementations:

**IAccelerometerService Interface:**
- Platform-agnostic abstraction for sensor input
- SensorReading model (renamed from AccelerometerData to avoid MAUI conflict)
- X, Y, Z acceleration values in g-force units
- ReadingChanged event for continuous data stream
- Start/Stop methods for sensor control
- IsSupported property for platform capability detection

**IosAccelerometerService (10 tests):**
- Uses MAUI's Microsoft.Maui.Devices.Sensors.Accelerometer
- Works on iOS devices and simulator (provides simulated data)
- Conditional compilation (#if IOS || MACCATALYST)
- Converts MAUI AccelerometerData to our SensorReading
- Graceful failure when sensor unavailable
- Pragma directives for conditional warnings

**DesktopAccelerometerService (11 tests):**
- Timer-based simulated sensor readings (~60Hz)
- Generates realistic noise around 1g gravity baseline
- Device-at-rest simulation: X≈0, Y≈0, Z≈1
- Includes SimulateShake() method for manual testing
- Always reports IsSupported=true (simulation available)

**ShakeDetectionService Integration:**
- Updated constructor to require IAccelerometerService (breaking change)
- StartMonitoring: subscribes to ReadingChanged, calls accelerometer.Start()
- StopMonitoring: unsubscribes and calls accelerometer.Stop()
- OnAccelerometerReadingChanged: pipes readings to ProcessAccelerometerReading
- All existing shake detection logic unchanged

**Platform-Specific DI:**
- MauiProgram.cs uses conditional compilation
- iOS/macOS Catalyst: IosAccelerometerService
- Desktop/other platforms: DesktopAccelerometerService
- All services registered as Singleton

**Test Updates:**
- ShakeDetectionServiceTests: now uses NSubstitute mock accelerometer
- ServiceIntegrationTests: uses DesktopAccelerometerService
- AccelerometerServiceContractTests: base class for implementation tests
- IosAccelerometerServiceTests: 10 tests with platform-aware assertions
- DesktopAccelerometerServiceTests: 11 tests with async timing

**Technical Details:**
- SensorReading record type with required init properties
- Value equality for SensorReading (record type benefit)
- Timer disposal in DesktopAccelerometerService
- Event subscription safety (check for null, unsubscribe on stop)
- 189 tests passing (165 previous + 24 accelerometer)
- 0 warnings, 0 errors across all platforms

Build verified: net8.0, iOS (net8.0-ios), macOS Catalyst (net8.0-maccatalyst)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 13:11:14 +02:00
53cb6df8af feat: Complete Milestone 4 - Views/UI Layer
Implemented complete MVVM UI layer with data binding:

**Dependency Injection (MauiProgram.cs):**
- Registered all services as Singleton (shared state)
- Registered all ViewModels and Pages as Transient
- Configured SQLite database path

**Pages:**
- MainPage: Mode selector, estimate display, shake status
- HistoryPage: CollectionView with auto-load on appearing
- SettingsPage: Mode picker, MaxHistorySize stepper

**Value Converters:**
- IsNullConverter / IsNotNullConverter (visibility)
- BoolToShakingConverter (status text)
- BoolToColorConverter (status colors)
- InvertedBoolConverter (boolean inversion)

**Navigation:**
- AppShell with TabBar (Estimate, History, Settings)
- ContentTemplate for lazy loading

**Technical details:**
- All XAML uses x:DataType for compile-time checking
- All code-behind uses constructor injection
- Zero warnings, zero errors
- 165 tests passing (no UI tests yet)

Build verified across all platforms (net8.0, iOS, macOS Catalyst)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:52:20 +02:00
48a844b0c1 feat: implement ViewModels layer with TDD (Milestone 3)
Implemented all ViewModels using strict TDD (RED-GREEN-REFACTOR) with CommunityToolkit.Mvvm.

**ViewModels Implemented:**
- MainViewModel: Coordinates shake detection, estimate generation, and display
- HistoryViewModel: Manages estimate history display and clearing
- SettingsViewModel: Handles app settings (mode selection, history size)

**MainViewModel Features:**
- Subscribes to ShakeDetectionService events
- Generates estimates when shake stops (transition from shaking→not shaking)
- Automatically saves estimates to storage
- Resets shake detection after estimate generation
- Loads and saves settings (SelectedMode)
- Proper disposal pattern (unsubscribe, stop monitoring)

**HistoryViewModel Features:**
- ObservableCollection<EstimateResult> for UI binding
- LoadHistoryCommand to fetch from storage
- ClearHistoryCommand to remove all history
- IsEmpty property for conditional UI display
- Replaces collection contents on reload

**SettingsViewModel Features:**
- SelectedMode property (Work/Generic)
- MaxHistorySize property
- SaveSettingsCommand to persist changes
- Loads settings on initialization

**Tests:**
- MainViewModel: 18 tests (RED-GREEN-REFACTOR)
- HistoryViewModel: 15 tests (RED-GREEN-REFACTOR)
- SettingsViewModel: 13 tests (RED-GREEN-REFACTOR)
- Total: 165 tests, all passing (48 models + 71 services + 46 ViewModels)

**Quality:**
- Build: 0 warnings, 0 errors across all platforms
- All tests use NSubstitute for mocking
- Property change notifications verified
- Async operations properly tested

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:44:07 +02:00
dd3a4f3d97 feat: implement services layer with TDD (Milestone 2)
Implemented all core services following strict TDD (RED-GREEN-REFACTOR):

**Services Implemented:**
- EstimateService: Generate estimates with intensity-based range selection
- StorageService: SQLite persistence with auto-pruning
- ShakeDetectionService: Accelerometer-based shake detection

**Features:**
- Cryptographically secure RNG for estimate selection
- Easter egg logic (>15s shake → Humorous mode)
- Intensity-based range calculation (0-0.3: 20%, 0.3-0.7: 50%, 0.7+: 100%)
- SQLite with auto-pruning based on MaxHistorySize
- Shake detection with 1.5g threshold
- Duration tracking and intensity normalization (0.0-1.0)
- Event-based notifications (ShakeDataChanged)

**Tests:**
- EstimateService: 25 tests (RED-GREEN-REFACTOR)
- StorageService: 14 tests (RED-GREEN-REFACTOR)
- ShakeDetectionService: 22 tests (RED-GREEN-REFACTOR)
- Integration tests: 10 tests
- Total: 119 tests, all passing

**Quality:**
- Build: 0 warnings, 0 errors across all platforms
- Coverage: 51.28% line (low due to MAUI template), 87.5% branch
- All service/model code has high coverage

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:37:20 +02:00
83ec08f14b feat: project setup and core models with TDD
MILESTONE 1 COMPLETE:

Project Setup:
- Create .NET 8 MAUI solution targeting iOS, macOS, and web
- Configure nullable reference types and warnings as errors
- Add required dependencies (MAUI 8.0.3, SQLite, CommunityToolkit.Mvvm)
- Add testing dependencies (xUnit, NSubstitute, FluentAssertions, Coverlet)
- Create comprehensive .editorconfig with C# coding standards
- Update CLAUDE.md with development commands

Core Models (TDD - 48 tests, all passing):
- EstimateMode enum (Work, Generic, Humorous modes)
- EstimateResult model with validation (intensity 0.0-1.0, non-null text)
- ShakeData model with intensity validation
- AppSettings model with defaults (Work mode, max history 10)

Build Status:
- All platforms build successfully (net8.0, iOS, macOS)
- 0 warnings, 0 errors
- Test coverage: 51.28% line, 87.5% branch (models have ~100% coverage)

Per spec: Strict TDD followed (RED-GREEN-REFACTOR), models fully validated

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 12:12:36 +02:00
17df545fba Add initial project design and specification documents
- Add comprehensive design document with validated architecture
- Add formal specification with RFC 2119 requirements language
- Include MVVM architecture, testing strategy, and platform requirements
- Define shake detection algorithm and estimate generation logic

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 01:21:38 +02:00