Skip to content

Commit

Permalink
Uplift of #16617 (squashed) to release
Browse files Browse the repository at this point in the history
  • Loading branch information
brave-builds committed Jan 11, 2023
1 parent 1659e3e commit 48706e7
Showing 1 changed file with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,20 +295,21 @@ protected void onAttachedToWindow() {
}
if (ChromeFeatureList.isEnabled(BraveFeatureList.BRAVE_NEWS)) {
initBraveNewsController();
if (BraveActivity.getBraveActivity() != null
&& BravePrefServiceBridge.getInstance().getNewsOptIn()) {
if (BravePrefServiceBridge.getInstance().getNewsOptIn()) {
new Handler(Looper.getMainLooper()).post(() -> {
Tab tab = BraveActivity.getBraveActivity().getActivityTab();
if (tab != null && tab.getUrl().getSpec() != null
&& UrlUtilities.isNTPUrl(tab.getUrl().getSpec())) {
// purges display ads on tab change
if (BraveActivity.getBraveActivity().getLastTabId() != tab.getId()) {
if (mBraveNewsController != null) {
mBraveNewsController.onDisplayAdPurgeOrphanedEvents();
if (BraveActivity.getBraveActivity() != null) {
Tab tab = BraveActivity.getBraveActivity().getActivityTab();
if (tab != null && tab.getUrl().getSpec() != null
&& UrlUtilities.isNTPUrl(tab.getUrl().getSpec())) {
// purges display ads on tab change
if (BraveActivity.getBraveActivity().getLastTabId() != tab.getId()) {
if (mBraveNewsController != null) {
mBraveNewsController.onDisplayAdPurgeOrphanedEvents();
}
}
}

BraveActivity.getBraveActivity().setLastTabId(tab.getId());
BraveActivity.getBraveActivity().setLastTabId(tab.getId());
}
}
});
}
Expand Down

0 comments on commit 48706e7

Please sign in to comment.