-
Notifications
You must be signed in to change notification settings - Fork 70
feat: inline user attribute removal in onRemoveUserAttribute #687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
9d13235
0716166
5b1e319
4f063e8
74d4e4f
7710780
8b60dc3
24d6e81
7ad01d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -605,8 +605,9 @@ public void onUserAttributesReceived(Map<String, String> userAttributes, Map<Str | |
| userAttributes); | ||
| Map<String, List<String>> filteredAttributeLists = (Map<String, List<String>>) KitConfiguration.filterAttributes(provider.getConfiguration().getUserAttributeFilters(), | ||
| userAttributeLists); | ||
| boolean supportsAttributeLists = ((KitIntegration.BaseAttributeListener) provider).supportsAttributeLists(); | ||
| if (provider instanceof KitIntegration.AttributeListener) { | ||
| if (((KitIntegration.AttributeListener) provider).supportsAttributeLists()) { | ||
| if (supportsAttributeLists) { | ||
| ((KitIntegration.AttributeListener) provider).setAllUserAttributes(filteredAttributeSingles, filteredAttributeLists); | ||
| } else { | ||
| Map<String, String> singlesCopy = new HashMap<>(filteredAttributeSingles); | ||
|
|
@@ -617,7 +618,7 @@ public void onUserAttributesReceived(Map<String, String> userAttributes, Map<Str | |
| } | ||
| } | ||
| if (provider instanceof KitIntegration.UserAttributeListener) { | ||
| if (((KitIntegration.UserAttributeListener) provider).supportsAttributeLists()) { | ||
| if (supportsAttributeLists) { | ||
| ((KitIntegration.UserAttributeListener) provider).onSetAllUserAttributes(filteredAttributeSingles, filteredAttributeLists, FilteredMParticleUser.getInstance(mpid, provider)); | ||
| } else { | ||
| Map<String, String> singlesCopy = new HashMap<>(filteredAttributeSingles); | ||
|
|
@@ -683,15 +684,16 @@ private void setUserAttribute(KitIntegration provider, String attributeKey, List | |
| if ((provider instanceof KitIntegration.AttributeListener || provider instanceof KitIntegration.UserAttributeListener) | ||
| && !provider.isDisabled() | ||
| && KitConfiguration.shouldForwardAttribute(provider.getConfiguration().getUserAttributeFilters(), attributeKey)) { | ||
| boolean supportsAttributeLists = ((KitIntegration.BaseAttributeListener) provider).supportsAttributeLists(); | ||
| if (provider instanceof KitIntegration.AttributeListener) { | ||
| if (((KitIntegration.AttributeListener) provider).supportsAttributeLists()) { | ||
| if (supportsAttributeLists) { | ||
| ((KitIntegration.AttributeListener) provider).setUserAttributeList(attributeKey, valueList); | ||
| } else { | ||
| ((KitIntegration.AttributeListener) provider).setUserAttribute(attributeKey, KitUtils.join(valueList)); | ||
| } | ||
| } | ||
| if (provider instanceof KitIntegration.UserAttributeListener) { | ||
| if (((KitIntegration.UserAttributeListener) provider).supportsAttributeLists()) { | ||
| if (supportsAttributeLists) { | ||
| ((KitIntegration.UserAttributeListener) provider).onSetUserAttributeList(attributeKey, valueList, FilteredMParticleUser.getInstance(mpid, provider)); | ||
| } else { | ||
| ((KitIntegration.UserAttributeListener) provider).onSetUserAttribute(attributeKey, KitUtils.join(valueList), FilteredMParticleUser.getInstance(mpid, provider)); | ||
|
|
@@ -721,15 +723,10 @@ public void removeUserAttribute(String key, long mpid) { | |
| } | ||
| for (KitIntegration provider : providers.values()) { | ||
| try { | ||
| if ((provider instanceof KitIntegration.AttributeListener || provider instanceof KitIntegration.UserAttributeListener) | ||
| if ((provider instanceof KitIntegration.BaseAttributeListener listener) | ||
| && !provider.isDisabled() | ||
| && KitConfiguration.shouldForwardAttribute(provider.getConfiguration().getUserAttributeFilters(), key)) { | ||
| if (provider instanceof KitIntegration.AttributeListener) { | ||
| ((KitIntegration.AttributeListener) provider).removeUserAttribute(key); | ||
| } | ||
| if (provider instanceof KitIntegration.UserAttributeListener) { | ||
| ((KitIntegration.UserAttributeListener) provider).onRemoveUserAttribute(key, FilteredMParticleUser.getInstance(mpid, provider)); | ||
| } | ||
| listener.onRemoveUserAttribute(key, FilteredMParticleUser.getInstance(mpid, provider)); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nullable user passed to non-null Kotlin parameterMedium Severity
Additional Locations (2) |
||
| } | ||
| } catch (Exception e) { | ||
| Logger.warning("Failed to call removeUserAttribute/onRemoveUserAttribute for kit: " + provider.getName() + ": " + e.getMessage()); | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.