-
Notifications
You must be signed in to change notification settings - Fork 23
Description
The LaunchDarkly library caches fetched feature flags locally so they are known if the servers cannot be reached. We are encountering an issue where the cached flags are "cleared" when we load up the app offline after a Google Play store update.
We were able to track down the issue in the SDK code, and it appears that the DefaultUserManager uses a hashed value of the LDUser json string, which includes all fields. We created a LDUser using the builder code below, where the "version_code" gets updated after the release and causes the DefaultUserManager to create a new cache file instead of using the original one.
Is there a work-around where we can specify the LDUser cache name specifically, so it will not be impacted by any properties that have a dynamic value? Ideally, having the userId as the cache name would work for our use case.
val builder = LDUser.Builder(userId)
.email(userEmailAddress)
.firstName(userFirstName)
.lastName(userLastName)
.custom("company_id", companyId)
.custom("project_id", projectId)
.custom("version_code", appVersionCode)
We believe this method in the DefaultUserManager class is causing our issue:
public static String sharedPrefs(final LDUser user) {
return HASHER.hash(toJson(user));
}
To reproduce
- Create a LDUser that a property that can change
- Get the current flags
- Change the property to another value
- Flags will not longer be cached
SDK version
3.1.2
Language version, developer tools
Kotlin 1.5.31
OS/platform
Android - All OS versions