Skip to content

Avoid syncing attributes for users with blank user ids#755

Merged
tonidero merged 6 commits into
mainfrom
avoid-syncing-attributes-users-empty-user-ids
Jan 25, 2023
Merged

Avoid syncing attributes for users with blank user ids#755
tonidero merged 6 commits into
mainfrom
avoid-syncing-attributes-users-empty-user-ids

Conversation

@tonidero

@tonidero tonidero commented Jan 25, 2023

Copy link
Copy Markdown
Contributor

Description

Attempt at dealing with CSDK-531

Back in #384, we added checks to make sure we don't allow blank user ids. However, before that was added, user ids could be empty and could have subscriber attributes. Those could remain in SharedPreferences unless users uninstall which could cause some issues when syncing user attributes.

This is an attempt of solving that issue by just ignoring those old user ids when syncing subscriber attributes.

@tonidero tonidero added the pr:fix A bug fix label Jan 25, 2023
@tonidero tonidero marked this pull request as ready for review January 25, 2023 11:22
@tonidero tonidero requested a review from a team January 25, 2023 11:22
@codecov

codecov Bot commented Jan 25, 2023

Copy link
Copy Markdown

Codecov Report

Merging #755 (80fec00) into main (193b5ae) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #755   +/-   ##
=======================================
  Coverage   81.50%   81.50%           
=======================================
  Files         120      120           
  Lines        3984     3984           
  Branches      509      510    +1     
=======================================
  Hits         3247     3247           
  Misses        534      534           
  Partials      203      203           
Impacted Files Coverage Δ
...ubscriberattributes/SubscriberAttributesManager.kt 89.13% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

obtainingDeviceIdentifiersObservable.waitUntilIdle {
val unsyncedStoredAttributesForAllUsers =
deviceCache.getUnsyncedSubscriberAttributes()
deviceCache.getUnsyncedSubscriberAttributes().filterKeys { it.isNotBlank() }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add a comment explaining the need for this filter and pointing to this PR

@tonidero tonidero merged commit 30cc1a1 into main Jan 25, 2023
@tonidero tonidero deleted the avoid-syncing-attributes-users-empty-user-ids branch January 25, 2023 15:57
This was referenced Jan 25, 2023
NachoSoto added a commit that referenced this pull request Jan 25, 2023
**This is an automatic release.**

### New Features
* Add `Purchases.logLevel` and deprecate `Purchases.debugLogsEnabled`
(#753) via NachoSoto (@NachoSoto)
### Bugfixes
* Avoid syncing attributes for users with blank user ids (#755) via Toni
Rico (@tonidero)
### Other Changes
* Fixed Readme.MD (#727) via AristiDevs (@ArisGuimera)
* Add codecov (#750) via Cesar de la Vega (@vegaro)
* Update AGP to 7.4.0 (#747) via Cesar de la Vega (@vegaro)
* Add test coverage using Kover (#748) via Cesar de la Vega (@vegaro)

Co-authored-by: revenuecat-ops <ops@revenuecat.com>
Co-authored-by: Cesar de la Vega <cesarvegaro@gmail.com>
Co-authored-by: NachoSoto <ignaciosoto90@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants