Skip to content

Commit

Permalink
Bug 1860897 - Change shopping attribution source event and use new st…
Browse files Browse the repository at this point in the history
…atic sendAttributionEvent r=geckoview-reviewers,owlish

Differential Revision: https://phabricator.services.mozilla.com/D193459
  • Loading branch information
calumozilla committed Nov 13, 2023
1 parent 79e5a64 commit 77454b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2425,7 +2425,7 @@ public void requestCreateAnalysis(
GeckoResult<String> result = session.requestCreateAnalysis(url);
result.map(
status -> {
Log.d(LOGTAG, "Started analysis, status: " + status);
Log.d(LOGTAG, "Started shopping analysis, status: " + status);
return status;
});
}
Expand Down Expand Up @@ -2461,14 +2461,15 @@ public void requestRecommendations(
aids.add(recs.get(i).aid);
}
if (aids.size() >= 1) {
Log.d(LOGTAG, "Sending attribution events to first AID: " + aids.get(0));
Log.d(LOGTAG, "Sending shopping attribution events to first AID: " + aids.get(0));
session
.sendClickAttributionEvent(aids.get(0))
.then(
new GeckoResult.OnValueListener<Boolean, Void>() {
@Override
public GeckoResult<Void> onValue(final Boolean isSuccessful) {
Log.d(LOGTAG, "Success of click attribution event: " + isSuccessful);
Log.d(
LOGTAG, "Success of shopping click attribution event: " + isSuccessful);
return null;
}
});
Expand All @@ -2479,7 +2480,9 @@ public GeckoResult<Void> onValue(final Boolean isSuccessful) {
new GeckoResult.OnValueListener<Boolean, Void>() {
@Override
public GeckoResult<Void> onValue(final Boolean isSuccessful) {
Log.d(LOGTAG, "Success of impression attribution event: " + isSuccessful);
Log.d(
LOGTAG,
"Success of shopping impression attribution event: " + isSuccessful);
return null;
}
});
Expand Down
9 changes: 2 additions & 7 deletions mobile/android/modules/geckoview/GeckoViewContent.sys.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -408,19 +408,14 @@ export class GeckoViewContent extends GeckoViewModule {
}

async _sendAttributionEvent(aEvent, aData, aCallback) {
// TODO (bug1859055): remove product object once sendAttributionEvent() is static
const product = new lazy.ShoppingProduct(
"http://example.com/dp/ABCDEFG123"
);
let result;
if (Services.prefs.getBoolPref("geckoview.shopping.test_response", true)) {
result = { TEST_AID: "TEST_AID_RESPONSE" };
} else {
// TODO (bug 1860897): source will be changed to geckoview_android
result = await product.sendAttributionEvent(
result = await lazy.ShoppingProduct.sendAttributionEvent(
aEvent,
aData.aid,
"firefox_android"
"geckoview_android"
);
}
if (!result || !(aData.aid in result) || !result[aData.aid]) {
Expand Down

0 comments on commit 77454b6

Please sign in to comment.