mnemo_cards/mnemo_cards_web_v2/tasks.md

380 lines
12 KiB
Markdown
Raw Normal View History

2025-11-10 23:55:41 +00:00
# Tasks for mnemo_cards_web_v2
## Status: API v2 Implementation Phase
**Last Updated:** January 2025
**Current Phase:** Phase 1.6 Complete - API v2 Backend Implementation
---
## 🎯 Phase 1: Backend API v2 Implementation
### Task 1.7: Implement Subscriptions API v2 ⬜ PENDING
**Priority:** HIGH
**Estimated Time:** 4-6 hours
**Status:** 0% complete
### Description
Complete subscription management endpoints with purchase, status checking, and cancellation functionality.
### Implementation Steps
1. ⬜ Create SubscriptionsApiV2 with endpoints:
- GET `/api/v2/subscriptions/plans` - Get available subscription plans
- POST `/api/v2/subscriptions/purchase` - Purchase subscription
- GET `/api/v2/subscriptions/status` - Check subscription status
- POST `/api/v2/subscriptions/cancel` - Cancel subscription
2. ⬜ Implement subscription plan models and DTOs
3. ⬜ Add subscription validation and business logic
4. ⬜ Write comprehensive unit tests (15+ tests)
5. ⬜ Write integration tests for subscription flow
### Acceptance Criteria
- [ ] All subscription endpoints implemented and tested
- [ ] Subscription plans can be fetched
- [ ] Subscription purchase flow works
- [ ] Subscription status checking works
- [ ] Subscription cancellation works
- [ ] Comprehensive test coverage (15+ tests)
---
### Task 1.8: Implement Promocodes API v2 ⬜ PENDING
**Priority:** MEDIUM
**Estimated Time:** 3-4 hours
**Status:** 0% complete
### Description
Complete promocode validation, application, and listing endpoints.
### Implementation Steps
1. ⬜ Create PromocodesApiV2 with endpoints:
- GET `/api/v2/promocodes` - List available promocodes
- POST `/api/v2/promocodes/apply` - Apply promocode
- GET `/api/v2/promocodes/{code}/validate` - Validate promocode
2. ⬜ Implement promocode models and validation logic
3. ⬜ Add promocode application and discount calculation
4. ⬜ Write comprehensive unit tests (10+ tests)
5. ⬜ Write integration tests for promocode flow
### Acceptance Criteria
- [ ] All promocode endpoints implemented and tested
- [ ] Promocode validation works correctly
- [ ] Promocode application works correctly
- [ ] Discount calculation is accurate
- [ ] Comprehensive test coverage (10+ tests)
---
## 🎯 Phase 2: Web App Migration to API v2
### Task 2.1: Complete Web App Migration ⬜ PENDING
**Priority:** HIGH
**Estimated Time:** 8-10 hours
**Status:** 60% complete
### Description
Migrate all remaining services from v1 to v2 API (GamesManager, TestManager, PurchaseService, etc.).
### Implementation Steps
1. [x] Migrate GamesManager to use HttpRepositoryV2
2. [x] Migrate TestManager to use HttpRepositoryV2
3. ⬜ Migrate PurchaseService to use HttpRepositoryV2
4. [x] Migrate SubscriptionService to use HttpRepositoryV2
5. [x] Migrate PromocodeService to use HttpRepositoryV2
6. ⬜ Update all API calls to use v2 endpoints
7. [x] Remove deprecated v1 dependencies
8. [x] Update all tests to use v2 API
9. ⬜ Verify all functionality works with v2
### Acceptance Criteria
- [ ] All services migrated to API v2
- [ ] All API calls use v2 endpoints
- [ ] No v1 dependencies remain
- [ ] All tests pass with v2 API
- [ ] All functionality verified working
---
## 🎯 Phase 3: Feature Implementation
### Task 3.1: Implement Pack Purchase Flow ⬜ PENDING
**Priority:** HIGH
**Estimated Time:** 6-8 hours
**Status:** 0% complete
### Description
Create purchase UI, payment integration with YooMoney, and purchase confirmation flow.
### Implementation Steps
1. ⬜ Create PurchaseService with v2 API integration
2. ⬜ Create PurchaseModule in UserScope
3. ⬜ Create PurchasePage UI with:
- Pack details and pricing
- Payment method selection
- Payment form (YooMoney integration)
- Purchase confirmation
4. ⬜ Add "Buy Pack" button to PackDetailsPage
5. ⬜ Implement payment status checking
6. ⬜ Add purchase success/failure handling
7. ⬜ Write comprehensive unit tests (15+ tests)
8. ⬜ Write integration tests for purchase flow
### Acceptance Criteria
- [ ] Purchase UI is complete and functional
- [ ] YooMoney payment integration works
- [ ] Purchase confirmation flow works
- [ ] Payment status checking works
- [ ] Purchase success/failure handling works
- [ ] Comprehensive test coverage (15+ tests)
---
### Task 3.2: Complete Subscription Management UI ⬜ PENDING
**Priority:** MEDIUM
**Estimated Time:** 4-6 hours
**Status:** 0% complete
### Description
Create subscription page with plans, purchase flow, and status management.
### Implementation Steps
1. ⬜ Create SubscriptionPage UI with:
- Available subscription plans display
- Plan comparison and features
- Purchase flow for subscriptions
- Current subscription status
- Subscription management (cancel/renew)
2. ⬜ Add subscription status to ProfilePage
3. ⬜ Implement subscription purchase flow
4. ⬜ Add subscription cancellation flow
5. ⬜ Write comprehensive unit tests (10+ tests)
6. ⬜ Write integration tests for subscription flow
### Acceptance Criteria
- [ ] Subscription page UI is complete
- [ ] Subscription plans display correctly
- [ ] Subscription purchase flow works
- [ ] Subscription status management works
- [ ] Comprehensive test coverage (10+ tests)
---
### Task 3.3: Implement Promocode UI ⬜ PENDING
**Priority:** MEDIUM
**Estimated Time:** 3-4 hours
**Status:** 0% complete
### Description
Add promocode input field, validation, and application functionality.
### Implementation Steps
1. ⬜ Create PromocodeInput widget
2. ⬜ Add promocode input to PurchasePage and SubscriptionPage
3. ⬜ Implement promocode validation UI
4. ⬜ Add promocode application and discount display
5. ⬜ Create promocode success/failure feedback
6. ⬜ Write comprehensive unit tests (8+ tests)
7. ⬜ Write integration tests for promocode flow
### Acceptance Criteria
- [ ] Promocode input widget is complete
- [ ] Promocode validation works
- [ ] Promocode application works
- [ ] Discount display works correctly
- [ ] Comprehensive test coverage (8+ tests)
---
### Task 3.4: Create Vocabulary/Review Page ⬜ PENDING
**Priority:** LOW
**Estimated Time:** 6-8 hours
**Status:** 0% complete
### Description
Display all learned words across packs with filtering and search functionality.
### Implementation Steps
1. ⬜ Create VocabularyService for fetching learned words
2. ⬜ Create VocabularyStateManager for state management
3. ⬜ Create VocabularyModule in UserScope
4. ⬜ Create VocabularyPage UI with:
- List of all learned words
- Filter by pack, language
- Search functionality
- Word review interface
- Export vocabulary option
5. ⬜ Add VocabularyPage to bottom navigation
6. ⬜ Write comprehensive unit tests (12+ tests)
7. ⬜ Write integration tests for vocabulary flow
### Acceptance Criteria
- [ ] Vocabulary page UI is complete
- [ ] Word filtering works correctly
- [ ] Search functionality works
- [ ] Word review interface works
- [ ] Export functionality works
- [ ] Comprehensive test coverage (12+ tests)
---
### Task 3.5: Implement Ads Reward Flow 🟡 IN PROGRESS
**Priority:** HIGH
**Estimated Time:** 6-8 hours
**Status:** 40% complete (service layer, scope integration, and unit tests ready)
### Description
Bring the mobile "watch ad to unlock pack/product" flow to the web client using Adsgram rewarded ads and the existing `/ads` backend endpoints.
### Implementation Steps
1. [x] Expose ads reward endpoints in `HttpRepositoryV2` (acquire product, optional reward ping)
2. [x] Create `AdsRewardService` coordinating ad session, backend calls, and user state updates
3. [x] Add `AdsRewardModule` to `UserScope` with yx_state manager for ad CTA/status
4. ⬜ Integrate web Adsgram SDK and wrap in Flutter widget/service with proper lifecycle
5. ⬜ Update pack purchase UI to show "Unlock by watching ad" CTA when `adsKey` present
6. ⬜ Refresh packs/user purchases after reward success and handle errors gracefully
7. [x] Write unit tests for service/state manager and widget logic (reward success, failure, retries)
### Acceptance Criteria
- [ ] Ads CTA appears for eligible packs/products with valid `adsKey`
- [ ] Rewarded ad plays to completion using web SDK with proper loading state
- [ ] Successful reward calls `/ads/product/acquire/<key>` and unlocks the product
- [ ] Error states show helpful messages and allow retry
- [ ] Comprehensive unit tests (10+ tests) cover service, state, and widget logic
- [ ] Analytics events emitted for ad impressions, completions, failures
---
### Task 3.6: Create Dedicated Settings Page ⬜ PENDING
**Priority:** LOW
**Estimated Time:** 2-3 hours
**Status:** 0% complete
### Description
Separate settings from profile with theme, language, and notification options.
### Implementation Steps
1. ⬜ Create SettingsPage UI with:
- Theme toggle (light/dark)
- Language selection
- Sound effects toggle
- Notifications settings
- Account settings
2. ⬜ Create SettingsStateManager for settings state
3. ⬜ Add SettingsPage to navigation
4. ⬜ Move settings from ProfilePage to SettingsPage
5. ⬜ Write comprehensive unit tests (6+ tests)
### Acceptance Criteria
- [ ] Settings page UI is complete
- [ ] All settings options work correctly
- [ ] Settings are persisted properly
- [ ] Comprehensive test coverage (6+ tests)
---
## 🎯 Phase 4: Quality & Testing
### Task 4.1: Fix Test Failures ⬜ PENDING
**Priority:** MEDIUM
**Estimated Time:** 2-3 hours
**Status:** 0% complete
### Description
Resolve 24 failing tests (mostly empty test files) to ensure all tests pass.
### Implementation Steps
1. ⬜ Fix test_page_test.dart empty file
2. ⬜ Investigate and fix other test failures
3. ⬜ Ensure all tests compile and run
4. ⬜ Verify all tests pass
### Acceptance Criteria
- [ ] All 24 failing tests are fixed
- [ ] All tests pass successfully
- [ ] No compilation errors in tests
---
### Task 4.2: Increase Test Coverage ⬜ PENDING
**Priority:** MEDIUM
**Estimated Time:** 4-6 hours
**Status:** 0% complete
### Description
Add comprehensive tests for all new services and UI components.
### Implementation Steps
1. ⬜ Add tests for all new API v2 services
2. ⬜ Add tests for all new UI components
3. ⬜ Add tests for all new state managers
4. ⬜ Add tests for all new modules
5. ⬜ Ensure test coverage is above 90%
### Acceptance Criteria
- [ ] Test coverage above 90%
- [ ] All new services have comprehensive tests
- [ ] All new UI components have tests
- [ ] All new state managers have tests
---
### Task 4.3: Fix Linter Issues ⬜ PENDING
**Priority:** LOW
**Estimated Time:** 1-2 hours
**Status:** 0% complete
### Description
Run flutter analyze and resolve all warnings and code quality issues.
### Implementation Steps
1. ⬜ Run `flutter analyze` to identify issues
2. ⬜ Fix all linter warnings
3. ⬜ Fix all code quality issues
4. ⬜ Ensure clean analysis report
### Acceptance Criteria
- [ ] No linter warnings
- [ ] No code quality issues
- [ ] Clean analysis report
---
### Task 4.4: Write Integration Tests ⬜ PENDING
**Priority:** LOW
**Estimated Time:** 6-8 hours
**Status:** 0% complete
### Description
Create end-to-end tests for auth flow, pack browsing, test taking, and card learning.
### Implementation Steps
1. ⬜ Create integration test for auth flow
2. ⬜ Create integration test for pack browsing
3. ⬜ Create integration test for test taking
4. ⬜ Create integration test for card learning
5. ⬜ Create integration test for purchase flow
6. ⬜ Create integration test for subscription flow
### Acceptance Criteria
- [ ] All major user flows have integration tests
- [ ] Integration tests cover critical paths
- [ ] Integration tests are reliable and maintainable
---
## 📊 Summary
**Total Tasks:** 13
**Completed:** 0
**In Progress:** 0
**Pending:** 13
**Priority Breakdown:**
- 🔴 HIGH: 5 tasks (API v2 completion, web migration, pack purchase, ads reward)
- 🟡 MEDIUM: 5 tasks (subscription UI, promocode UI, test fixes, coverage)
- 🟢 LOW: 3 tasks (vocabulary page, settings page, linter fixes)
**Current Focus:** Phase 1.7 - Implement Subscriptions API v2
**Next Task:** Phase 1.8 - Implement Promocodes API v2
**Note:** Tasks are marked as complete only when fully implemented, tested, and production-ready (no stubs or TODOs).