Skip to content

18-09-2025

Compare
Choose a tag to compare
@fulleni fulleni released this 18 Sep 16:25
· 181 commits to main since this release
7cf9fe1

Centralized App State, Robust Ad Lifecycle & Startup Refinements

This release introduces a significant architectural refactoring of the application's core state management, a complete overhaul of the ad lifecycle to prevent common crashes and memory leaks, and a more robust and predictable startup sequence.

🚦 Centralized App State & Initialization

The application's state management and initialization logic have been fundamentally re-architected to improve data flow, simplify the codebase, and handle startup errors more gracefully.

  • Single Source of Truth: The AppBloc is now the single source of truth for all application-wide state, including user authentication, app settings, and content preferences. This centralizes data and eliminates the need for the separate AccountBloc. [#121]
  • Robust Startup Sequence: Remote configuration is now fetched earlier in the bootstrap process, and a new AppLifeCycleStatus enum provides more granular states. This prevents race conditions related to evaluating maintenance mode or required updates. [#120]
  • Critical Error Handling: A dedicated CriticalErrorPage has been added to provide a clear UI and retry mechanism for unrecoverable startup failures, such as failing to fetch initial remote config. [#121]
  • Persistent User Settings: All user display settings (theme, font, etc.) are now immediately persisted, ensuring preferences are saved and reloaded consistently across sessions. [#120]
  • Centralized Filter Logic: A new HeadlinesFilterBloc has been introduced to manage all headline filtering logic (topics, sources, countries), simplifying filter management. [#121]
  • Demo Mode Stability: Improved error handling in the AppBloc to gracefully handle NotFoundException for user data in demo mode, preventing the app from entering a critical error state. [#122]

💰 Ad Lifecycle & Management Overhaul

The entire ad system has been refactored to address critical lifecycle issues, prevent memory leaks, and provide more granular control over ad display.

  • Centralized Ad Disposal: A disposeAd method has been introduced in the AdProvider and AdService. The InlineAdCacheService is now the central authority for managing the ad lifecycle, preventing memory leaks by ensuring ad resources are properly released. [#118]
  • Fixed 'AdWidget' Errors: Resolved the common 'AdWidget' is already in the Widget tree error by adding a ValueKey to the admob.AdWidget and improving the didUpdateWidget logic in AdmobInlineAdWidget to handle new ad instances correctly. [#119]
  • Stable Ad Loader Widgets: All setState calls within FeedAdLoaderWidget are now guarded by if (mounted) checks to prevent errors when a widget is disposed of during an async operation. [#119]
  • Refactored Interstitial Ads: Replaced the AdNavigatorObserver with a new InterstitialAdManager to centralize logic. UI components now explicitly call onPotentialAdTrigger, providing more precise control and allowing for ad pre-loading. [#115]
  • Synchronized Ad Navigation: Navigation now explicitly awaits the completion of an interstitial ad before proceeding to the next screen, ensuring a more predictable user flow. [#116]

🛠️ Other Notable Changes

  • Realistic Demo Ads: Demo and local interstitial ads now feature a 5-second countdown timer before the close button is enabled, more accurately simulating a real ad experience. [#116]
  • Improved Ad Placement Logic: The FeedDecoratorService now correctly includes CallToActionItem and ContentCollectionItem when calculating content density, leading to more intelligent inline ad placement. [#119]
  • Code Reusability: Extracted common headline tap logic and metadata display into new reusable utility classes and widgets (HeadlineTapHandler, HeadlineMetadataRow), reducing code duplication. [#116]