Skip to content

Commit 71c4c53

Browse files
authored
chore: Remove deprecated KitIntegration.getAllUserAttributes() (#682)
* chore: Remove deprecated KitIntegration.getAllUserAttributes() - Remove tests that only covered the removed API - Add CHANGELOG entry for custom kit migration path Made-with: Cursor * docs: Link CHANGELOG to PR 682 for getAllUserAttributes removal Made-with: Cursor * test: Fix DataplanBlockingUserTests after KitIntegration.getAllUserAttributes removal Use getCurrentUser().userAttributes instead of removed allUserAttributes property. Made-with: Cursor
1 parent 8209098 commit 71c4c53

4 files changed

Lines changed: 6 additions & 280 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### Removed
44

5+
- Remove deprecated `KitIntegration.getAllUserAttributes()`. Custom kits must use `getCurrentUser().getUserAttributes()` (or other `FilteredMParticleUser` APIs) and `AttributeListener` callbacks instead ([#682](https://github.com/mParticle/mparticle-android-sdk/pull/682))
56
- Remove deprecated `KitIntegration.getUserIdentities()`. Custom kits must use identity data from kit callbacks and request objects instead ([#681](https://github.com/mParticle/mparticle-android-sdk/pull/681)) ([8d3a23c8](https://github.com/mParticle/mparticle-android-sdk/commit/8d3a23c84c96d11f0ee1f80763adacc4f964b544))
67

78
## [5.78.2](https://github.com/mParticle/mparticle-android-sdk/compare/v5.78.1...v5.78.2) (2026-02-27)

android-kit-base/src/androidTest/kotlin/com/mparticle/kits/DataplanBlockingUserTests.kt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class DataplanBlockingUserTests : BaseKitOptionsTest() {
9090
AccessUtils.awaitMessageHandler()
9191

9292
kitIntegrationTestKits.forEach { kit ->
93-
assertEquals(kit.name, allowedAttributes, kit.allUserAttributes)
93+
assertEquals(kit.name, allowedAttributes, kit.getCurrentUser()?.userAttributes)
9494
}
9595
// sanity check to make sure the non-filtered User has the blocked identities
9696
assertEquals(
@@ -174,7 +174,7 @@ class DataplanBlockingUserTests : BaseKitOptionsTest() {
174174
assertEquals(count, allowedAttributes.size * 4)
175175

176176
kitIntegrationTestKits.forEach {
177-
assertEquals(0, it.allUserAttributes.size)
177+
assertEquals(0, it.getCurrentUser()?.userAttributes?.size ?: 0)
178178
}
179179
// sanity check to make sure the non-filtered User has the blocked identities
180180
assertEquals(
@@ -241,8 +241,9 @@ class DataplanBlockingUserTests : BaseKitOptionsTest() {
241241

242242
assertEquals(count, allowedAttributes.size * 4)
243243
kitIntegrationTestKits.forEach { kit ->
244-
assertEquals(allowedAttributes.size, kit.allUserAttributes.size)
245-
assertEquals(allowedAttributes.keys, kit.allUserAttributes.keys)
244+
val filtered = kit.getCurrentUser()?.userAttributes
245+
assertEquals(allowedAttributes.size, filtered?.size ?: 0)
246+
assertEquals(allowedAttributes.keys, filtered?.keys)
246247
}
247248
// sanity check to make sure the non-filtered User has the blocked attributes
248249
assertEquals(

android-kit-base/src/main/java/com/mparticle/kits/KitIntegration.java

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import java.lang.ref.WeakReference;
3131
import java.math.BigDecimal;
3232
import java.util.Collections;
33-
import java.util.HashMap;
3433
import java.util.List;
3534
import java.util.Map;
3635

@@ -119,46 +118,6 @@ public boolean isDisabled(boolean isOptOutEvent) {
119118
(getConfiguration().shouldHonorOptOut() && kitManager.isOptedOut() && !isOptOutEvent);
120119
}
121120

122-
/**
123-
* Retrieve filtered user attributes. Use this method to retrieve user attributes at any time.
124-
* To ensure that filtering is respected, kits must use this method rather than the public API.
125-
* <p>
126-
* If the KitIntegration implements the {@link AttributeListener} interface and returns true
127-
* for {@link AttributeListener#supportsAttributeLists()}, this method will pass back all attributes
128-
* as they are (as String values or as List&lt;String&gt; values). Otherwise, this method will comma-separate
129-
* the List values and return back all String values.
130-
*
131-
* @return a Map of attributes according to the logic above.
132-
*/
133-
@Deprecated
134-
public final Map<String, Object> getAllUserAttributes() {
135-
MParticle instance = MParticle.getInstance();
136-
if (instance != null) {
137-
MParticleUser user = instance.Identity().getCurrentUser();
138-
if (user != null) {
139-
Map<String, Object> userAttributes = user.getUserAttributes();
140-
if (kitManager != null) {
141-
userAttributes = kitManager.getDataplanFilter().transformUserAttributes(userAttributes);
142-
}
143-
Map<String, Object> attributes = (Map<String, Object>) KitConfiguration.filterAttributes(
144-
getConfiguration().getUserAttributeFilters(),
145-
userAttributes
146-
);
147-
if ((this instanceof AttributeListener) && ((AttributeListener) this).supportsAttributeLists()) {
148-
return attributes;
149-
} else {
150-
for (Map.Entry<String, Object> entry : attributes.entrySet()) {
151-
if (entry.getValue() instanceof List) {
152-
attributes.put(entry.getKey(), KitUtils.join((List) entry.getValue()));
153-
}
154-
}
155-
return attributes;
156-
}
157-
}
158-
}
159-
return new HashMap<String, Object>();
160-
}
161-
162121
public final MParticleUser getCurrentUser() {
163122
MParticle instance = MParticle.getInstance();
164123
if (instance != null) {

android-kit-base/src/test/kotlin/com/mparticle/kits/KitIntegrationTest.kt

Lines changed: 0 additions & 235 deletions
This file was deleted.

0 commit comments

Comments
 (0)