08-09-2025
📢 Ad System Overhaul & Robust Initialization
This release introduces a major architectural overhaul of the application's advertising system, focusing on flexibility, multi-format support, and improved lifecycle management. It also includes a significant refactoring of the app's startup sequence to ensure service dependencies are initialized in a more robust and predictable order.
📢 Advertising System Overhaul
The entire ad infrastructure has been refactored to support a more flexible, multi-provider, and multi-format system, aligning with a new remote configuration structure from the backend.
- Unified Ad Service: The
AdService
now supports multiple ad platforms (e.g., AdMob, Local) and ad formats (inline, banner, interstitial) through a unified interface and abstract ad models. [#109] - Granular Ad Caching: A new
InlineAdCacheService
was introduced to specifically cache native and banner ads, improving scrolling performance. Interstitial ads are now managed on-demand via a newAdNavigatorObserver
and are excluded from caching. [#109] - In-Article Ad Integration: The article details page now supports dynamic injection of in-article banner ads at configurable positions based on remote settings. [#109, #112]
- Robust Interstitial Logic: The logic for displaying interstitial ads has been refined to increment the page transition counter more selectively and to use
unawaited
to prevent blocking UI navigation during the ad display process. [#112, #114] - Enhanced Ad Logging: Added consistent log prefixes and more detailed error reporting across all ad-related services to improve debuggability. [#114]
🛠️ Demo Environment & Platform Compatibility
To streamline development and testing, the ad system has been improved to gracefully handle different environments and platforms.
- New Demo Ad Provider: A dedicated
DemoAdProvider
was introduced to simulate ad loading and display visual placeholders for all ad types when the app runs in demo mode, bypassing real ad network calls. [#111, #112] - Conditional Initialization: The app's bootstrap process now dynamically initializes ad providers based on the environment, using the
DemoAdProvider
in demo mode and real providers (AdMob, Local) otherwise. [#112] - Web Platform Safety: Implemented conditional imports for ad providers to ensure AdMob integration defaults to a demo provider on the web, preventing
MissingPluginException
crashes. [#113]
🚀 Robust Service Initialization
The application's startup sequence has been refactored to establish a more stable and predictable dependency chain, preventing potential race conditions and runtime issues.
- Logical Initialization Order: Core services like key-value storage and the HTTP client are now guaranteed to be initialized before services that depend on them. [#110]
- Circular Dependency Fix: Resolved a circular dependency between the
HttpClient
andAuthRepository
by having the client read auth tokens directly from storage. [#110] - Code Cleanup: Removed numerous redundant comments and unnecessary non-null assertions across the codebase to improve readability and rely on compiler null safety. [#110]