-
Notifications
You must be signed in to change notification settings - Fork 0
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
[MOB-22283] Exposing new API for generateDisplayXDM for batching multiple display propositions #3
base: MOB-21475
Are you sure you want to change the base?
Conversation
…f offers 2. Adding new extension for converting list of offers to list of propositions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of things before I start the PR review:
- Please provide a description of what is being done in this PR and why
- CI jobs did not run for this PR. Please have a look to figure out why
- Why is this PR being raised in your forked repo? Please create it again https://github.com/adobe/aepsdk-optimize-android
- Please add docs, unit tests and functional tests for the new APIs you have introduced
code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/Offer.kt
Outdated
Show resolved
Hide resolved
code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/Offer.kt
Outdated
Show resolved
Hide resolved
code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/Offer.kt
Outdated
Show resolved
Hide resolved
private set | ||
var characteristics: Map<String, String> = HashMap() | ||
private set | ||
var propositionReference: SoftReference<OptimizeProposition>? = null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a public API getProposition
. With the way its refactored here, that method no longer exists, making this a breaking change.
We're also making propositionReference
public when it was not before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will need to do something like this to achieve parity
@get:JvmName("getPropositionReference")
@set:JvmName("setPropositionReference")
internal var propositionReference: SoftReference<OptimizeProposition>? = null
var proposition = propositionReference?.get()
private set
code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/Offer.kt
Outdated
Show resolved
Hide resolved
code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/Offer.kt
Outdated
Show resolved
Hide resolved
code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/Offer.kt
Outdated
Show resolved
Hide resolved
code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/Offer.kt
Outdated
Show resolved
Hide resolved
code/testapp/src/main/java/com/adobe/marketing/optimizeapp/OffersScreen.kt
Outdated
Show resolved
Hide resolved
9adfb55
to
c1e3e53
Compare
… and generateInteractionXdm
code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/Offer.java
Outdated
Show resolved
Hide resolved
code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/OptimizeProposition.java
Outdated
Show resolved
Hide resolved
code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/OfferExtension.kt
Outdated
Show resolved
Hide resolved
code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/Offer.java
Outdated
Show resolved
Hide resolved
code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/Offer.java
Outdated
Show resolved
Hide resolved
code/optimize/src/main/java/com/adobe/marketing/mobile/optimize/Offer.java
Outdated
Show resolved
Hide resolved
|
||
/** | ||
* Generates a map containing XDM formatted data for {@code Experience Event - | ||
* OptimizeProposition Interactions} field group from this {@code OptimizeProposition} item. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment here
...XDM formatted data for {@code Experience Event OptimizeProposition Interactions} field group from {@code Offer} list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done @spoorthipujariadobe
public static Map<String, Object> generateDisplayInteractionXdm(List<Offer> offers) { | ||
return OptimizeUtils.generateInteractionXdm( | ||
OptimizeConstants.JsonValues.EE_EVENT_TYPE_PROPOSITION_DISPLAY, | ||
Objects.requireNonNull(toUniquePropositionsList(offers))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Objects.requireNonNull
would throw a null pointer exception if toUniquePropositionsList
returns null, which would cause a RuntimeException and app will crash. Can we handle this gracefully? Either we can throw the exception so the app can handle it or we can do a null check for result of toUniquePropositionsList
and fail fast without calling OptimizeUtils.generateInteractionXdm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated @spoorthipujariadobe
|
||
internal object OfferExtension { | ||
@JvmStatic | ||
fun List<Offer>?.toUniquePropositionsList(): List<OptimizeProposition>? { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic here in conjunction with OptimizeUtils.generateInteractionXdm
doesn't achieve our goal. You're creating a list of proposition reference for the list of offers passed in. Then in OptimizeUtils.generateInteractionXdm
you're adding all the offer ids in the proposition to the display events, rather only the ids of offer list that was passed to the API.
https://github.com/siddique-adobe/aepsdk-optimize-android/pull/3/files#diff-b90c589ff2ce5c066bb12f60a6b2ce62e77b4fede59cbe980f944bd99f45680dR288
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please review this again, I've fixed the missing logic here @spoorthipujariadobe
d8a8bd0
to
4039fc5
Compare
4039fc5
to
1f6ef04
Compare
* @return {@code Map<String, Object>} containing the XDM data for the proposition interaction. | ||
* @see OptimizeUtils#generateInteractionXdm(String, List) | ||
*/ | ||
public static Map<String, Object> generateDisplayInteractionXdm(List<Offer> offers) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Add @Nullable
annotation to the API signature
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure to add tests in the PR opened against the Optimize repo
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: