Skip to content

Commit

Permalink
Merge pull request #705 from prebid/686-native-event-seatbidbidextpre…
Browse files Browse the repository at this point in the history
…bideventsimp-is-not-notified

Native event seatbid.bid.ext.prebid.events.imp is not notified
  • Loading branch information
jsligh authored Nov 3, 2023
2 parents 28aa022 + e0be978 commit b73eecd
Showing 1 changed file with 27 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,21 +295,14 @@ public boolean registerView(View view, final PrebidNativeAdEventListener listene
return false;
}

ArrayList<String> combinedImpTrackers = new ArrayList<>();
if (imp_trackers != null) {
impressionTrackers = new ArrayList<>(imp_trackers.size());
for (String url : imp_trackers) {
ImpressionTracker impressionTracker = ImpressionTracker.create(url, visibilityDetector, view.getContext(), new ImpressionTrackerListener() {
@Override
public void onImpressionTrackerFired() {
if (listener != null) {
listener.onAdImpression();
}
notifyImpressionEvent();
}
});
impressionTrackers.add(impressionTracker);
}
combinedImpTrackers.addAll(imp_trackers);
}
if (impEvent != null) {
combinedImpTrackers.add(impEvent);
}
createImpressionTrackers(view, combinedImpTrackers);

registeredView = new WeakReference<>(view);

Expand Down Expand Up @@ -347,22 +340,14 @@ public boolean registerView(View container, List<View> clickableViews, final Pre
if (visibilityDetector == null) {
return false;
}

ArrayList<String> combinedImpTrackers = new ArrayList<>();
if (imp_trackers != null) {
impressionTrackers = new ArrayList<>(imp_trackers.size());
for (String url : imp_trackers) {
ImpressionTracker impressionTracker = ImpressionTracker.create(url, visibilityDetector, container.getContext(), new ImpressionTrackerListener() {
@Override
public void onImpressionTrackerFired() {
if (listener != null) {
listener.onAdImpression();
}
notifyImpressionEvent();
}
});
impressionTrackers.add(impressionTracker);
}
combinedImpTrackers.addAll(imp_trackers);
}
if (impEvent != null) {
combinedImpTrackers.add(impEvent);
}
createImpressionTrackers(container, combinedImpTrackers);

registeredView = new WeakReference<>(container);

Expand All @@ -380,6 +365,21 @@ public void onImpressionTrackerFired() {
return false;
}

private void createImpressionTrackers(View view, ArrayList<String> trackers) {
impressionTrackers = new ArrayList<>(imp_trackers.size());
for (String url : trackers) {
ImpressionTracker impressionTracker = ImpressionTracker.create(url, visibilityDetector, view.getContext(), new ImpressionTrackerListener() {
@Override
public void onImpressionTrackerFired() {
if (listener != null) {
listener.onAdImpression();
}
}
});
impressionTrackers.add(impressionTracker);
}
}

protected boolean registerPrebidNativeAdEventListener(PrebidNativeAdEventListener listener) {
this.listener = listener;
return true;
Expand Down

0 comments on commit b73eecd

Please sign in to comment.