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

Enable Omnibar changes for AI Chat #3954

Merged
merged 4 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .maestro/release_tests/application-lock.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ tags:
- runFlow:
file: ../shared/setup.yaml

- tapOn: "Browsing Menu"
- tapOn: "Settings"
- scrollUntilVisible:
element: "General"
Expand Down
1 change: 1 addition & 0 deletions .maestro/release_tests/autoclear.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ tags:

# Enable autoclear

- tapOn: "Browsing Menu"
- tapOn: "Settings"
- assertVisible: "Default Browser"
- scrollUntilVisible:
Expand Down
3 changes: 2 additions & 1 deletion .maestro/release_tests/emailprotection.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ tags:
- runFlow:
file: ../shared/setup.yaml

- tapOn: Settings
- tapOn: "Browsing Menu"
- tapOn: "Settings"
# Handling two different flows because of the current experiment
# TODO: Remove the unused flow when the experiment is completed.
- runFlow:
Expand Down
3 changes: 3 additions & 0 deletions .maestro/release_tests/password-authentication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ tags:
file: ../shared/setup.yaml

# Validate passcode requested when accessing passwords for the first time
- tapOn: "Browsing Menu"
- tapOn: "Settings"
- scrollUntilVisible:
element: "Passwords"
Expand All @@ -30,6 +31,7 @@ tags:
- tapOn: "Done"

# Validate initial authentication
- tapOn: "Browsing Menu"
- tapOn: "Settings"
- scrollUntilVisible:
element: "Passwords"
Expand All @@ -54,6 +56,7 @@ tags:

- tapOn: "DuckDuckGO"

- tapOn: "Browsing Menu"
- tapOn: "Settings"
- scrollUntilVisible:
element: "Passwords"
Expand Down
2 changes: 2 additions & 0 deletions .maestro/release_tests/password-management.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ tags:
file: ../shared/setup.yaml

# Validate passcode requested when accessing passwords for the first time
- tapOn: "Browsing Menu"
- tapOn: "Settings"
- scrollUntilVisible:
element: "Passwords"
Expand Down Expand Up @@ -53,6 +54,7 @@ tags:
- tapOn: "Done"

# Validate everything was saved
- tapOn: "Browsing Menu"
- tapOn: "Settings"
- scrollUntilVisible:
element: "Passwords"
Expand Down
2 changes: 1 addition & 1 deletion Core/FeatureFlag.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ extension FeatureFlag: FeatureFlagDescribing {
case .syncSeamlessAccountSwitching:
return .remoteReleasable(.subfeature(SyncSubfeature.seamlessAccountSwitching))
case .aiChatNewTabPage:
return .internalOnly()
return .enabled
case .testExperiment:
return .remoteReleasable(.subfeature(ExperimentTestSubfeatures.experimentTestAA))
case .maliciousSiteProtection:
Expand Down
12 changes: 8 additions & 4 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ extension Pixel {
case settingsAutoconsentOff

case browsingMenuOpened
case browsingMenuOpenedNewTabPage
case browsingMenuNewTab
case browsingMenuAddToBookmarks
case browsingMenuEditBookmark
Expand All @@ -95,6 +96,7 @@ extension Pixel {
case browsingMenuFireproof
case browsingMenuAutofill
case browsingMenuAIChat
case browsingMenuListAIChat

case addressBarShare
case addressBarSettings
Expand Down Expand Up @@ -669,7 +671,8 @@ extension Pixel {
case bookmarksMigrationCouldNotPrepareDatabaseOnFailedMigration
case bookmarksMigrationCouldNotRemoveOldStore
case bookmarksMigrationCouldNotPrepareMultipleFavoriteFolders


case bookmarksOpenFromToolbar
case syncSignupDirect
case syncSignupConnect
case syncLogin
Expand Down Expand Up @@ -1061,6 +1064,7 @@ extension Pixel.Event {
case .settingsMoreSearchSettings: return "m_settings_more_search_settings"

case .browsingMenuOpened: return "mb"
case .browsingMenuOpenedNewTabPage: return "m_nav_menu_ntp"
case .browsingMenuNewTab: return "mb_tb"
case .browsingMenuAddToBookmarks: return "mb_abk"
case .browsingMenuEditBookmark: return "mb_ebk"
Expand All @@ -1080,9 +1084,7 @@ extension Pixel.Event {
case .browsingMenuAutofill: return "m_nav_autofill_menu_item_pressed"

case .browsingMenuShare: return "m_browsingmenu_share"
case .browsingMenuAIChat: return "m_aichat_menu_tab_icon"
case .browsingMenuListPrint: return "m_browsing_menu_list_print"

case .addressBarShare: return "m_addressbar_share"
case .addressBarSettings: return "m_addressbar_settings"
case .addressBarCancelPressedOnNTP: return "m_addressbar_cancel_ntp"
Expand Down Expand Up @@ -1629,7 +1631,7 @@ extension Pixel.Event {
return "m_d_bookmarks_migration_could_not_prepare_database_on_failed_migration"
case .bookmarksMigrationCouldNotRemoveOldStore: return "m_d_bookmarks_migration_could_not_remove_old_store"
case .bookmarksMigrationCouldNotPrepareMultipleFavoriteFolders: return "m_d_bookmarks_migration_could_not_prepare_multiple_favorite_folders"
case .bookmarksOpenFromToolbar: return "m_nav_bookmarks"
case .syncSignupDirect: return "m_sync_signup_direct"
case .syncSignupConnect: return "m_sync_signup_connect"
case .syncLogin: return "m_sync_login"
Expand Down Expand Up @@ -1961,6 +1963,8 @@ extension Pixel.Event {
case .openAIChatFromWidgetQuickAction: return "m_aichat-widget-quickaction"
case .openAIChatFromWidgetControlCenter: return "m_aichat-widget-control-center"
case .openAIChatFromWidgetLockScreenComplication: return "m_aichat-widget-lock-screen-complication"
case .browsingMenuAIChat: return "m_aichat_menu_tab_icon"
case .browsingMenuListAIChat: return "m_browsing_menu_list_aichat"

// MARK: Lifecycle
case .appDidTransitionToUnexpectedState: return "m_debug_app-did-transition-to-unexpected-state-3"
Expand Down
2 changes: 1 addition & 1 deletion DuckDuckGo/Base.lproj/OmniBar.xib
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</imageView>
<button contentMode="scaleToFill" horizontalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" reversesTitleShadowWhenHighlighted="YES" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="5FH-Ge-Z9a" userLabel="Dismiss Button">
<rect key="frame" x="-5" y="0.0" width="40" height="40"/>
<accessibility key="accessibilityConfiguration" label="Voice Search"/>
<accessibility key="accessibilityConfiguration" label="Cancel"/>
<constraints>
<constraint firstAttribute="width" priority="900" constant="40" id="QWL-gP-sMT"/>
<constraint firstAttribute="height" constant="40" id="hqB-cj-vKd"/>
Expand Down
16 changes: 14 additions & 2 deletions DuckDuckGo/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ class MainViewController: UIViewController {
viewCoordinator.toolbarForwardButton.action = #selector(onForwardPressed)
viewCoordinator.toolbarFireButton.action = #selector(onFirePressed)
viewCoordinator.toolbarPasswordsButton.action = #selector(onPasswordsPressed)
viewCoordinator.toolbarBookmarksButton.action = #selector(onBookmarksPressed)
viewCoordinator.toolbarBookmarksButton.action = #selector(onToolbarBookmarksPressed)

installSwipeTabs()

Expand Down Expand Up @@ -1987,6 +1987,12 @@ extension MainViewController: OmniBarDelegate {

self.presentedMenuButton.setState(.closeImage, animated: true)
tab.didLaunchBrowsingMenu()

if isNewTabPageEnabled && newTabPageViewController != nil {
Pixel.fire(pixel: .browsingMenuOpenedNewTabPage)
} else {
Pixel.fire(pixel: .browsingMenuOpened)
}
}

@objc func onBookmarksPressed() {
Expand All @@ -1996,7 +2002,12 @@ extension MainViewController: OmniBarDelegate {
performCancel()
segueToBookmarks()
}


@objc func onToolbarBookmarksPressed() {
Pixel.fire(pixel: .bookmarksOpenFromToolbar)
onBookmarksPressed()
}

func onBookmarkEdit() {
ViewHighlighter.hideAll()
hideSuggestionTray()
Expand Down Expand Up @@ -2466,6 +2477,7 @@ extension MainViewController: TabDelegate {
}

func tabDidRequestAIChat(tab: TabViewController) {
Pixel.fire(pixel: .browsingMenuListAIChat)
openAIChat()
}

Expand Down
4 changes: 4 additions & 0 deletions DuckDuckGo/OmniBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,10 @@ class OmniBar: UIView {
searchStackContainer.setCustomSpacing(13, after: voiceSearchButton)
}

if oldState.showAccessoryButton != state.showAccessoryButton {
refreshOmnibarPaddingConstraintsForAccessoryButton()
}

UIView.animate(withDuration: 0.0) { [weak self] in
self?.layoutIfNeeded()
}
Expand Down
1 change: 0 additions & 1 deletion DuckDuckGo/TabViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,6 @@ class TabViewController: UIViewController {
}

func didLaunchBrowsingMenu() {
Pixel.fire(pixel: .browsingMenuOpened)
DaxDialogs.shared.resumeRegularFlow()
}

Expand Down
Loading
Loading