-
Notifications
You must be signed in to change notification settings - Fork 69
feat: move onSetUserAttributeList to BaseAttributeListener #690
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
ad96dfd
8684dfd
799a4f2
a9067e5
193eed5
a5075ed
fdd973b
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 |
|---|---|---|
|
|
@@ -316,7 +316,7 @@ | |
| } | ||
|
|
||
| override fun onError() { | ||
| Logger.warning("unable to set key: " + keyIn + " with value: " + attributeValue) | ||
|
Check failure on line 319 in kits/braze/braze-38/src/main/kotlin/com/mparticle/kits/AppboyKit.kt
|
||
| } | ||
| }, | ||
| ) | ||
|
|
@@ -440,27 +440,6 @@ | |
| } | ||
| } | ||
|
|
||
| override fun setUserAttributeList( | ||
| key: String, | ||
| list: List<String>, | ||
| ) { | ||
| Braze | ||
| .getInstance(context) | ||
| .getCurrentUser( | ||
| object : IValueCallback<BrazeUser> { | ||
| override fun onSuccess(value: BrazeUser) { | ||
| val array = list.toTypedArray<String?>() | ||
| value.setCustomAttributeArray(key, array) | ||
| queueDataFlush() | ||
| } | ||
|
|
||
| override fun onError() { | ||
| Logger.warning("unable to set key: " + key + " with User Attribute List: " + list) | ||
| } | ||
| }, | ||
| ) | ||
| } | ||
|
|
||
| override fun onIncrementUserAttribute( | ||
| key: String?, | ||
| incrementedBy: Number?, | ||
|
|
@@ -526,10 +505,29 @@ | |
|
|
||
| override fun onSetUserAttributeList( | ||
| attributeKey: String?, | ||
| attributeValueList: MutableList<String>?, | ||
| attributeValueList: List<String>?, | ||
| user: FilteredMParticleUser?, | ||
| ) { | ||
| // No-op: this kit does not implement this feature. | ||
| if (attributeKey == null || attributeValueList == null) { | ||
| return | ||
| } | ||
| Braze | ||
| .getInstance(context) | ||
| .getCurrentUser( | ||
| object : IValueCallback<BrazeUser> { | ||
| override fun onSuccess(value: BrazeUser) { | ||
| val array = attributeValueList.toTypedArray<String?>() | ||
| value.setCustomAttributeArray(attributeKey, array) | ||
| queueDataFlush() | ||
| } | ||
|
|
||
| override fun onError() { | ||
| Logger.warning( | ||
| "unable to set key: " + attributeKey + " with User Attribute List: " + attributeValueList, | ||
| ) | ||
| } | ||
| }, | ||
| ) | ||
| } | ||
|
|
||
| override fun onSetAllUserAttributes( | ||
|
|
@@ -686,7 +684,21 @@ | |
| applyScalarUserAttribute(key, value) | ||
| } | ||
| for ((key, value) in attributeLists) { | ||
| setUserAttributeList(key, value) | ||
| Braze | ||
| .getInstance(context) | ||
| .getCurrentUser( | ||
| object : IValueCallback<BrazeUser> { | ||
| override fun onSuccess(brazeUser: BrazeUser) { | ||
| val array = value.toTypedArray<String?>() | ||
| brazeUser.setCustomAttributeArray(key, array) | ||
| queueDataFlush() | ||
| } | ||
|
|
||
| override fun onError() { | ||
| Logger.warning("unable to set key: " + key + " with User Attribute List: " + value) | ||
| } | ||
| }, | ||
| ) | ||
|
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. Duplicated Braze API logic instead of delegating to methodMedium Severity
Additional Locations (2) |
||
| } | ||
| kitPreferences.edit().putBoolean(PREF_KEY_HAS_SYNCED_ATTRIBUTES, true).apply() | ||
| } | ||
|
|
||


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