Open lucamegh opened 1 month ago
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!
Hi @lucamegh! Thank you for your suggestion - we will look into it and prioritize it accordingly.
Our app uses a custom
UserDefaultsClient
interface to manageUserDefaults
, defined as follows:The SDK currently lacks support for abstractions like these, causing a compile error when trying to use
UserDefaultsClient
instead ofUserDefaults
:To work around this limitation, I am forced to add a new dependency endpoint that provides direct access to the wrapped
UserDefaults
instance.However, this workaround defeats the purpose of the abstraction, as it forces us back to using a concrete
UserDefaults
instance.Solution
UserDefaultsProtocol
: Add a protocol to the SDK that mirrors theUserDefaults
methods used within the SDK:Extend
Configuration.Builder
: Add support forUserDefaultsProtocol
in theConfiguration.Builder
:Conform
UserDefaults
(andUserDefaultsClient
) toUserDefaultsProtocol
.The solution enables custom
UserDefaults
implementations, such asUserDefaultsClient
, to integrate seamlessly with the SDK, enhancing flexibility without introducing breaking changes to the public API.