🖼️ feat: Integrate backend image proxy for optimized Community Post images#17
Merged
inventory69 merged 7 commits intomainfrom Dec 17, 2025
Merged
Conversation
- Discord CDN URLs expire after some time (404 errors) - Added _freshImageUrl state to cache refreshed URLs - Added _fetchFreshImageUrl() to get fresh URL from backend - Error builder now automatically retries with fresh URL - Added detailed debug logging for image loading troubleshooting - Shows loading indicator while fetching fresh URL Fixes issue with Post ID 2 and other posts with expired CDN links
…d environment configuration
- Wrapped _fetchFreshImageUrl() call in WidgetsBinding.addPostFrameCallback() - Prevents 'setState() called during build' error - Ensures state updates happen after current build frame completes
- Added _hasFetchedFreshUrl flag to track fetch attempts - Only attempt fetch once per widget lifecycle - Check flag in errorBuilder condition - Reduced timeout from 15s to 5s - Added mounted checks before setState - Prevents repeated API calls on connection errors
- Changed from API_URL to API_BASE_URL to match .env file - Now correctly uses https://api.haze.pro/api instead of localhost - Fixes connection refused errors on mobile devices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📋 Changes
✨ Features
New Image URL Builder:
getCommunityPostImageUrl()function inapi_service.dartpostId,width,quality,format,original)Simplified Image Loading:
dart:async,dart:convert,http,flutter_dotenv)🎨 UI Improvements
🔧 Refactoring
Before (community_post_card.dart):
After:
📊 Performance Impact
Loading Times (4G connection):
Data Usage (Feed with 10 posts):
🎯 Usage Examples
🔗 Related
✅ Testing