From 77454b62a00f56dd3b960d4d94e7cb6b849a7349 Mon Sep 17 00:00:00 2001 From: Cathy Lu Date: Mon, 13 Nov 2023 20:39:49 +0000 Subject: [PATCH] Bug 1860897 - Change shopping attribution source event and use new static sendAttributionEvent r=geckoview-reviewers,owlish Differential Revision: https://phabricator.services.mozilla.com/D193459 --- .../mozilla/geckoview_example/GeckoViewActivity.java | 11 +++++++---- .../modules/geckoview/GeckoViewContent.sys.mjs | 9 ++------- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java b/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java index 165015ca0d63..743f4ecc8e9c 100644 --- a/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java +++ b/mobile/android/geckoview_example/src/main/java/org/mozilla/geckoview_example/GeckoViewActivity.java @@ -2425,7 +2425,7 @@ public class GeckoViewActivity extends AppCompatActivity GeckoResult result = session.requestCreateAnalysis(url); result.map( status -> { - Log.d(LOGTAG, "Started analysis, status: " + status); + Log.d(LOGTAG, "Started shopping analysis, status: " + status); return status; }); } @@ -2461,14 +2461,15 @@ public class GeckoViewActivity extends AppCompatActivity 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() { @Override public GeckoResult 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; } }); @@ -2479,7 +2480,9 @@ public class GeckoViewActivity extends AppCompatActivity new GeckoResult.OnValueListener() { @Override public GeckoResult 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; } }); diff --git a/mobile/android/modules/geckoview/GeckoViewContent.sys.mjs b/mobile/android/modules/geckoview/GeckoViewContent.sys.mjs index 92abc43fef35..be5c43a509f7 100644 --- a/mobile/android/modules/geckoview/GeckoViewContent.sys.mjs +++ b/mobile/android/modules/geckoview/GeckoViewContent.sys.mjs @@ -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]) {