refactor(kits): inline user attribute removal in onRemoveUserAttribute#686
Conversation
Introduce KitIntegration.BaseAttributeListener as the common superinterface for AttributeListener and UserAttributeListener. Document it as a temporary contract to enable incremental migration and smaller PRs. Made-with: Cursor
Resolve via BaseAttributeListener before AttributeListener/UserAttributeListener branches in onUserAttributesReceived and setUserAttribute(list). Made-with: Cursor
UserAttributeListener.onRemoveUserAttribute now forwards to the existing AttributeListener.removeUserAttribute implementation for braze-38 through braze-41. Made-with: Cursor
Declare onRemoveUserAttribute on KitIntegration.BaseAttributeListener so AttributeListener and UserAttributeListener implementors must implement it. KitManagerImpl now dispatches removal once via BaseAttributeListener. AttributeListener-only kits delegate onRemoveUserAttribute to removeUserAttribute; AttributeListenerTestKit updated accordingly. Made-with: Cursor
Drop void removeUserAttribute(String) from KitIntegration.AttributeListener. Kits keep the same logic as private-style helpers (fun removeUserAttribute without override) and still satisfy BaseAttributeListener via onRemoveUserAttribute. AdobeKitBase implements onRemoveUserAttribute by delegating to removeUserAttribute. Made-with: Cursor
Move kit-specific handling from removed helper methods into BaseAttributeListener.onRemoveUserAttribute implementations. Rename AttributeListenerTestKit callback to removeUserAttributeListener. Fix Braze custom-key branch for Kotlin smart-cast in Braze callback. Made-with: Cursor
PR SummaryMedium Risk Overview
Written by Cursor Bugbot for commit 8b60dc3. This will update automatically on new commits. Configure here. |
Document intentional empty overrides in Adobe, AppsFlyer, Branch, Braze, and Kochava kits to satisfy SonarQube analysis. Made-with: Cursor
|
| if (key == null) { | ||
| return | ||
| } | ||
| var keyMut = key |
There was a problem hiding this comment.
Unnecessary mutable variable keyMut is never reassigned
Low Severity
var keyMut = key is declared as mutable but never reassigned — the $-prefix stripping now uses a separate var customKey local. In the old removeUserAttribute, the equivalent variable was mutated in-place, but that mutation was moved to customKey, making keyMut effectively a val. Using var here is misleading and suggests future mutation that never happens. Same issue in braze-39, braze-40, and braze-41.




Background
Attribute removal for kits is consolidated on
BaseAttributeListener.onRemoveUserAttributeso the SDK does not rely on a separateAttributeListener.removeUserAttributecontract. Kits now implement removal in one place, which aligns with the broader move towardUserAttributeListener-style APIs.What Has Changed
removeUserAttributefromAttributeListener; kits keep removal logic only inonRemoveUserAttribute.AttributeListenerTestKittest hook toremoveUserAttributeListenerand adjusted dataplan blocking tests.Screenshots/Video
N/A (SDK behavior change, no UI).
Checklist
Additional Notes
Target branch:
workstation/6.0-Release. Kits were validated withpublishMavenPublicationToMavenLocalandtestReleaseusing-Pmparticle.kit.mparticleFromMavenLocalOnly=true.