Skip to content
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

Custom Notification master #6451

Closed
wants to merge 2 commits into from

Conversation

yachtcaptain23
Copy link
Contributor

@yachtcaptain23 yachtcaptain23 commented Aug 18, 2020

browser/BUILD.gn Outdated Show resolved Hide resolved
@tmancey
Copy link
Collaborator

tmancey commented Aug 26, 2020

With regards to Chromium message center code which we have based custom ad notifications from, are these any files which have not changed?

@yachtcaptain23
Copy link
Contributor Author

yachtcaptain23 commented Aug 26, 2020

With regards to Chromium message center code which we have based custom ad notifications from, are these any files which have not changed?

padded_button.cc
padded_button.h
notification_background_painter.cc
notification_background_painter.h
proportional_image_view.cc
proportional_image_view.h

@yachtcaptain23 yachtcaptain23 force-pushed the albert-custom-notification-master branch from 43af083 to 412d5c1 Compare September 2, 2020 07:04
@tmancey
Copy link
Collaborator

tmancey commented Sep 21, 2020

@yachtcaptain23 can you please update the attached Android screenshot to include the BAT icon, thanks

@tmancey
Copy link
Collaborator

tmancey commented Sep 21, 2020

@yachtcaptain23 It does not appear the changes we made for timing out ad notifications on Android was merged?

const uint64_t timeout_in_seconds = 120;

as the above code is wrapped in !(OS_ANDROID), Android should timeout after 30 seconds (same as iOS), where macOS, Windows and Linux should timeout after 2 minutes


namespace brave_custom_notification {

ThunkNotificationDelegate::ThunkNotificationDelegate(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are we copying this code?

browser/BUILD.gn Outdated
]

sources += [
"brave_ads/android/brave_ads_native_helper.cc",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should go in brave/browser/brave_ads/android/BUILD.gn

"//skia",
]
sources = [
"brave_notification_platform_bridge_helper_android.cc",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implicit source filters are deprecated. Please use is_android guard

]
}
deps = [
"//base",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these deps are not correct. You should have a dep for header in these files (excluding chrome/*) and only the headers in the files (no indirect deps)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed it, do these look fine now?

#include "base/memory/scoped_refptr.h"
#include "base/run_loop.h"
#include "base/task/post_task.h"
#include "brave/components/brave_ads/browser/ads_notification_handler.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is definitely a problem. If this is a generic custom notification it should not have dependencies on brave_ads. If it is specific to ads then it should be in browser/brave_ads/notifications

#include "brave/components/brave_ads/browser/ads_service_impl.h"
#include "brave/ui/brave_custom_notification/message_popup_view.h"
#include "brave/ui/brave_custom_notification/public/cpp/notification.h"
#include "chrome/browser/browser_process.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this header list does not appear to be correct. I don't see any references from browser_process.h and you're missing browser_context.h just as a few examples. Please ensure that you include what you use and only what you use https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/WhyIWYU.md


#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "bat/ads/ad_notification_info.h"
#include "brave/ui/brave_custom_notification/public/cpp/notification.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have brave/ui and ui/message_center includes here?

@@ -55,6 +56,7 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile.h"
#if !defined(OS_ANDROID)
#include "brave/ui/brave_custom_notification/message_popup_view.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: brave_custom_notification seems excessively long and brave_ is redundant. I guess what we name this depends on whether it is actually a generic custom notification or specific to ads

@@ -0,0 +1,18 @@
include_rules = [
"+chrome/browser/profiles",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not allowed. If components depends on //brave/ui/* then //brave/ui/* cannot depend on //chrome/*

}

sources = [
"ad_notification_view_md.cc",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nothing ads specific should go in //brave/ui

* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "brave/browser/notifications/notification_platform_bridge_brave_custom_notification.h"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have a bridge when these aren't using platform notifications?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AdsServiceImpl was built around using NotificationPlatformBridge, and originally Android was going to be in a separate PR. Since Android is part of this PR, we can rename it to something like AdsNotificationViewController or something similar. Let me know your thoughts.

@@ -0,0 +1,3 @@
[email protected]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we please remove as we try to keep code owners for rewards to a minimum

@bsclifton
Copy link
Member

@simonhong can you check this out? 😄

Support Android ads notifications including support for Poppins for header and body.
Support OOBE on Android
@yachtcaptain23 yachtcaptain23 force-pushed the albert-custom-notification-master branch from fd386d7 to 23ff849 Compare September 29, 2020 04:54
@tmancey tmancey closed this Sep 29, 2020
@tmancey tmancey deleted the albert-custom-notification-master branch September 29, 2020 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement custom Brave Ad notifications
5 participants