18-09-2025
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 separateAccountBloc
. [#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 handleNotFoundException
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 theAdProvider
andAdService
. TheInlineAdCacheService
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 aValueKey
to theadmob.AdWidget
and improving thedidUpdateWidget
logic inAdmobInlineAdWidget
to handle new ad instances correctly. [#119] - Stable Ad Loader Widgets: All
setState
calls withinFeedAdLoaderWidget
are now guarded byif (mounted)
checks to prevent errors when a widget is disposed of during an async operation. [#119] - Refactored Interstitial Ads: Replaced the
AdNavigatorObserver
with a newInterstitialAdManager
to centralize logic. UI components now explicitly callonPotentialAdTrigger
, providing more precise control and allowing for ad pre-loading. [#115] - Synchronized Ad Navigation: Navigation now explicitly
await
s 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 includesCallToActionItem
andContentCollectionItem
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]