* fix: Improve GoogleMapsInitializer error handling and allow retries
Refactored the error handling within `GoogleMapsInitializer` to make it more robust against initialization failures.
Previously, any exception during the `initialize` call would permanently set the state to `FAILURE`, preventing any subsequent attempts.
This change introduces more granular error handling:
- Unrecoverable errors, such as `GooglePlayServicesMissingManifestValueException`, will correctly set the state to `FAILURE`.
- Other exceptions, which may be transient, will now reset the state to `UNINITIALIZED`, allowing the initialization to be attempted again.
Additionally, a `forceInitialization` parameter has been added to the `initialize` function to allow bypassing the initial state check for re-initialization scenarios.
* feat: More improvements to GoogleMapsInitializer
Introduced a new `preferredRenderer` parameter to the `initialize` function.
Key changes:
- The `initialize` function now accepts a `preferredRenderer` to specify which Maps renderer to use.
- The `try-catch` block within the `initialize` function has been refactored to be more idiomatic.
The `AdvancedMarkersActivity` example has been updated to use this improved initializer. It now calls `GoogleMapsInitializer.initialize` within a `LaunchedEffect`, making the initialization asynchronous and tied to the composable's lifecycle.
* refactor: Remove preferredRenderer from Maps initialization
The `preferredRenderer` parameter has been removed from the `GoogleMapsInitializer.initialize()` function. The Maps SDK for Android now automatically selects the latest available renderer, making this parameter redundant.
This change simplifies the initialization API. The explicit initialization call in the `AdvancedMarkersActivity` sample has also been removed to reflect this simplification.
* feat(maps-compose): Introduce interface-based GoogleMapsInitializer
This commit refactors the `GoogleMapsInitializer` from a static object to an interface-based dependency provided via a `CompositionLocal`.
This architectural change offers several key benefits:
- **Improved Testability:** The initialization logic can now be easily mocked and tested in isolation, as demonstrated by the new unit tests using `mockk`.
- **Dependency Injection:** It aligns with modern dependency injection principles, making the `GoogleMap` composable more configurable and less reliant on a global singleton.
- **Robustness:** The error handling has been made more granular, distinguishing between unrecoverable manifest errors and transient, recoverable issues.
The new `DefaultGoogleMapsInitializer` provides the concrete implementation, ensuring backward compatibility for existing usages while enabling advanced testing and customization scenarios.