-
Notifications
You must be signed in to change notification settings - Fork 7
[MOB-3582] AI Shortcut Access Point on NTP #932
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
[MOB-3582] AI Shortcut Access Point on NTP #932
Conversation
- Add EcosiaAISearchButton to Ecosia framework with twinkle icon - Create NTPAIActionsCell with SwiftUI integration - Add NTPAIActionsCellViewModel with proper delegate pattern - Extend URLProvider with ai.search URLs for staging/production - Integrate with HomepageSectionType enum (.aiActions case) - Wire navigation through SharedHomepageCellDelegate pattern - Position AI search button right-aligned in new NTP section - Follow Ecosia comment conventions for modified Firefox code BREAKING CHANGE: Adds new .aiActions case to HomepageSectionType enum Note: Files need to be added to Xcode project build target
- Rename NTPAIActionsCell → NTPMultiPurposeEcosiaHeader - Rename NTPAIActionsCellViewModel → NTPMultiPurposeEcosiaHeaderViewModel - Update HomepageSectionType case: .aiActions → .multiPurposeEcosiaHeader - Rename delegate protocol: NTPAIActionsCellDelegate → NTPMultiPurposeEcosiaHeaderDelegate - Update delegate method: aiActionsCellDidRequestAISearch → multiPurposeEcosiaHeaderDidRequestAISearch - Move files from AIActions/ to MultiPurposeHeader/ directory - Update all references and variable names throughout codebase This better reflects the component's purpose as a multi-purpose header that can contain various Ecosia-specific actions beyond just AI search.
- Fix 'self used before super.init' error in LegacyHomepageViewController - Pass nil delegate during HomepageViewModel initialization - Set multiPurposeEcosiaHeaderViewModel.delegate after super.init() - Make delegate property internal and settable in view model - Remove trailing whitespace for SwiftLint compliance Build now compiles successfully with no errors or warnings.
…kView pattern - Add @published theme properties to NTPMultiPurposeEcosiaHeaderViewModel - Implement applyTheme() method using theme.colors.ecosia colors - Add .onReceive listener for .ThemeDidChange notification - Use viewModel theme colors instead of themeManager in SwiftUI view - Update setTheme() to delegate to applyTheme() for consistency - Follow exact pattern used in Ecosia's FeedbackView for theme handling The AI search button now properly responds to system theme changes and manual theme switching in the app.
- Add aiSearchMVP case to Toggle.Name enum in Unleash.Model.swift - Create AISearchMVPExperiment.swift with public access for cross-target usage - Update NTPMultiPurposeEcosiaHeaderViewModel to use feature flag for isEnabled - Feature flag controls visibility of entire NTPMultiPurposeEcosiaHeader cell - Raw string flag: ai2-67-ai-search-mvp
…d code cleanup - Add UnleashAISearchMVPSetting debug class for testing feature flag - Add AI Search MVP setting to debug settings list - Code cleanup: remove trailing whitespace and fix formatting - Add missing newlines at end of files for Swift style consistency
- Add new ai_search category in Analytics.Category - Add ntpShortcut label in Analytics.Label.AISearch - Implement aiSearchNTPButtonTapped() method for tracking - Replace TODO comment with actual analytics call in NTPMultiPurposeEcosiaHeaderViewModel - Track AI Search button taps from New Tab Page for user engagement metrics
PR Reviewer Guide 🔍(Review updated until commit 6585715)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Latest suggestions up to 6585715
Previous suggestionsSuggestions up to commit 6585715
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great! Just some questions as I will be taking it over as mentioned on this ticket comment.
return [ | ||
var types: [ReusableCell.Type] = [] | ||
|
||
if #available(iOS 16.0, *) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you check with Product if no problem not supporting iOS 15? I see no issue and to be honest will likely soon be the case for the FF base, just checking.
|
||
/// NTP header cell containing multiple Ecosia-specific actions like AI search | ||
@available(iOS 16.0, *) | ||
final class NTPMultiPurposeEcosiaHeader: UICollectionViewCell, ThemeApplicable, ReusableCell { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the descriptiveness, but to be honest I think NTPHeader
might be a good enough name and the rest just making it longer 😅 Any specific reason for the longer name? I see as a pattern we also don't include Ecosia
in others, not sure if you experience any conflicts.
func applyTheme(theme: Theme) { | ||
self.theme = theme | ||
buttonBackgroundColor = Color(theme.colors.ecosia.backgroundElevation1) | ||
buttonIconColor = Color(theme.colors.ecosia.textPrimary) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels a bit bad to me that this is on the view model, but I remember this was already the case for the latest feedback view implementation. Can you remind me why that is? Couldn't we leave handling colors as a responsibility of the view similar to how SeedCounterView
is?
Persistent review updated to latest commit 6585715 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed bases to the feature branch mob-3505-ai-access-points and approving to merge into there to continue other work separately.
@d4r1091 feel free to still jump into the discussions and sort out confusions when you are back 🙂
MOB-3582
Context
We want an entry point on NTP in order to let users access the AI Search with ease.
Approach
All SwiftUI iOS16+
Before merging
Checklist
// Ecosia:
helper comments where needed