diff --git a/browser/brave_ads/creatives/search_result_ad/creative_search_result_ad_clicked_infobar_delegate.cc b/browser/brave_ads/creatives/search_result_ad/creative_search_result_ad_clicked_infobar_delegate.cc index 75097c49f8a9..499b24aefaa2 100644 --- a/browser/brave_ads/creatives/search_result_ad/creative_search_result_ad_clicked_infobar_delegate.cc +++ b/browser/brave_ads/creatives/search_result_ad/creative_search_result_ad_clicked_infobar_delegate.cc @@ -9,6 +9,7 @@ #include "brave/components/brave_ads/core/public/prefs/pref_names.h" #include "brave/grit/brave_generated_resources.h" +#include "build/build_config.h" #include "chrome/browser/infobars/confirm_infobar_creator.h" #include "components/infobars/content/content_infobar_manager.h" #include "components/infobars/core/infobar.h" @@ -24,8 +25,6 @@ namespace brave_ads { namespace { -constexpr int kIconSize = 20; - constexpr char kLearnMoreUrl[] = "https://search.brave.com/help/conversion-reporting"; @@ -48,9 +47,8 @@ void CreativeSearchResultAdClickedInfoBarDelegate::Create( if (!infobar_manager) { return; } - infobar_manager->AddInfoBar( - CreateConfirmInfoBar(std::unique_ptr( - new CreativeSearchResultAdClickedInfoBarDelegate()))); + infobar_manager->AddInfoBar(CreateConfirmInfoBar( + std::make_unique())); } CreativeSearchResultAdClickedInfoBarDelegate:: @@ -65,8 +63,12 @@ CreativeSearchResultAdClickedInfoBarDelegate::GetIdentifier() const { } ui::ImageModel CreativeSearchResultAdClickedInfoBarDelegate::GetIcon() const { +#if BUILDFLAG(IS_ANDROID) + return ui::ImageModel(); +#else return ui::ImageModel::FromVectorIcon(vector_icons::kProductIcon, - ui::kColorIcon, kIconSize); + ui::kColorIcon, /*icon_size=*/20); +#endif // BUILDFLAG(IS_ANDROID) } std::u16string CreativeSearchResultAdClickedInfoBarDelegate::GetMessageText() diff --git a/ios/brave-ios/Sources/Brave/Frontend/Browser/ButtonToast.swift b/ios/brave-ios/Sources/Brave/Frontend/Browser/ButtonToast.swift index 81a4b648d6a9..f66e2f90ce28 100644 --- a/ios/brave-ios/Sources/Brave/Frontend/Browser/ButtonToast.swift +++ b/ios/brave-ios/Sources/Brave/Frontend/Browser/ButtonToast.swift @@ -55,7 +55,7 @@ class ButtonToast: Toast { self.toastView.snp.makeConstraints { make in make.left.right.height.equalTo(self) - self.animationConstraint = make.top.equalTo(self).offset(ButtonToastUX.toastHeight).constraint + self.animationConstraint = make.top.equalTo(self.snp.bottom).constraint } self.snp.makeConstraints { make in diff --git a/ios/brave-ios/Sources/Brave/Frontend/Browser/DownloadToast.swift b/ios/brave-ios/Sources/Brave/Frontend/Browser/DownloadToast.swift index 28600d7a152d..9050e503e992 100644 --- a/ios/brave-ios/Sources/Brave/Frontend/Browser/DownloadToast.swift +++ b/ios/brave-ios/Sources/Brave/Frontend/Browser/DownloadToast.swift @@ -90,7 +90,7 @@ class DownloadToast: Toast { self.toastView.snp.makeConstraints { make in make.left.right.height.equalTo(self) - self.animationConstraint = make.top.equalTo(self).offset(ButtonToastUX.toastHeight).constraint + self.animationConstraint = make.top.equalTo(self.snp.bottom).constraint } self.snp.makeConstraints { make in diff --git a/ios/brave-ios/Sources/Brave/Frontend/Browser/Playlist/Onboarding & Toast/PlaylistToast.swift b/ios/brave-ios/Sources/Brave/Frontend/Browser/Playlist/Onboarding & Toast/PlaylistToast.swift index 7cb3dfada145..a665acc11d11 100644 --- a/ios/brave-ios/Sources/Brave/Frontend/Browser/Playlist/Onboarding & Toast/PlaylistToast.swift +++ b/ios/brave-ios/Sources/Brave/Frontend/Browser/Playlist/Onboarding & Toast/PlaylistToast.swift @@ -121,7 +121,7 @@ class PlaylistToast: Toast { toastView.snp.makeConstraints { $0.leading.trailing.height.equalTo(self) - self.animationConstraint = $0.top.equalTo(self).offset(ButtonToastUX.toastHeight).constraint + self.animationConstraint = $0.top.equalTo(self.snp.bottom).constraint } self.snp.makeConstraints { diff --git a/ios/brave-ios/Sources/Brave/Frontend/Browser/SearchResultAdClickedInfoBar.swift b/ios/brave-ios/Sources/Brave/Frontend/Browser/SearchResultAdClickedInfoBar.swift index 893e271afc5c..8851284a0263 100644 --- a/ios/brave-ios/Sources/Brave/Frontend/Browser/SearchResultAdClickedInfoBar.swift +++ b/ios/brave-ios/Sources/Brave/Frontend/Browser/SearchResultAdClickedInfoBar.swift @@ -10,7 +10,6 @@ import SwiftUI import UIKit private struct SearchResultAdClickedInfoBarUX { - static let toastHeight: CGFloat = 100.0 static let toastPadding: CGFloat = 10.0 static let toastCloseButtonWidth: CGFloat = 20.0 static let toastLabelFont = UIFont.preferredFont(forTextStyle: .subheadline) @@ -45,7 +44,7 @@ class SearchResultAdClickedInfoBar: Toast, UITextViewDelegate { addSubview(toastView) toastView.snp.makeConstraints { make in make.left.right.height.equalTo(self) - self.animationConstraint = make.top.equalTo(self).offset(SimpleToastUX.toastHeight).constraint + self.animationConstraint = make.top.equalTo(self.snp.bottom).constraint } } diff --git a/ios/brave-ios/Sources/Brave/Frontend/Browser/Toast.swift b/ios/brave-ios/Sources/Brave/Frontend/Browser/Toast.swift index c4fd1266cc79..b275c71fd83a 100644 --- a/ios/brave-ios/Sources/Brave/Frontend/Browser/Toast.swift +++ b/ios/brave-ios/Sources/Brave/Frontend/Browser/Toast.swift @@ -54,7 +54,7 @@ class Toast: UIView { UIView.animate( withDuration: SimpleToastUX.toastAnimationDuration, animations: { - self.animationConstraint?.update(offset: 0) + self.animationConstraint?.update(offset: -self.bounds.height) self.layoutIfNeeded() }, completion: { finished in @@ -83,7 +83,7 @@ class Toast: UIView { UIView.animate( withDuration: duration, animations: { - self.animationConstraint?.update(offset: SimpleToastUX.toastHeight) + self.animationConstraint?.update(offset: 0) self.layoutIfNeeded() }, completion: { finished in