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

Tab swiping #5408

Open
wants to merge 39 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
990c806
Add a new swiping tabs feature flag
0nko Oct 30, 2024
31521ba
Add a class for checking if tab swiping is enabled
0nko Oct 30, 2024
214b4df
Add an interface for checking if tab swiping is enabled
0nko Oct 30, 2024
ce74105
Update app/src/main/java/com/duckduckgo/app/browser/RealTabSwipingAva…
0nko Nov 9, 2024
25fce10
Optimize imports
0nko Nov 9, 2024
273bbb2
Remove the extra class since onboarding check needs to happen reactively
0nko Nov 11, 2024
e23f84b
Swiping tabs: Feature flag (#5263)
0nko Nov 15, 2024
6a20a60
Merge branch 'develop' into feature/ondrej/swiping-tabs
0nko Nov 22, 2024
91c2896
Swiping tabs: Refactoring (#5264)
0nko Nov 25, 2024
1eb1a6e
Merge branch 'develop' into feature/ondrej/swiping-tabs
0nko Nov 26, 2024
4ef99cf
Merge branch 'develop' into feature/ondrej/swiping-tabs
0nko Dec 4, 2024
4c9cf61
Code clean up
0nko Dec 4, 2024
6c5820a
Merge branch 'feature/ondrej/swiping-tabs' into feature/ondrej/swipin…
0nko Dec 4, 2024
4ef2b6d
Add a missing call to the callback
0nko Dec 4, 2024
f577be2
Merge branch 'develop' into feature/ondrej/swiping-tabs
0nko Dec 11, 2024
fd40460
Merge branch 'develop' into feature/ondrej/swiping-tabs
0nko Dec 16, 2024
2663e84
Merge branch 'develop' into feature/ondrej/swiping-tabs
0nko Dec 18, 2024
c2c0743
Tab swiping: Feature flag cache (#5323)
0nko Dec 20, 2024
0f06a07
Merge branch 'develop' into feature/ondrej/swiping-tabs
0nko Dec 20, 2024
2ee109f
Tab swiping: Integration of the new tab management (#5322)
0nko Dec 20, 2024
abf45e8
Tab swiping: Pixels (#5400)
0nko Dec 20, 2024
d487aae
Move the activity-related tab functionality back to activity
0nko Dec 20, 2024
3ed8c20
Decrease the gap between tabs
0nko Dec 20, 2024
d7c7ca1
Disable the swiping feature by default
0nko Dec 20, 2024
3753240
Merge branch 'develop' into feature/ondrej/swiping-tabs
0nko Dec 20, 2024
518a5ca
Merge branch 'develop' into feature/ondrej/swiping-tabs
0nko Jan 7, 2025
86ab1aa
Make ViewModel Private Again
0nko Jan 7, 2025
e4d0ab8
Remove unnecessary !!
0nko Jan 7, 2025
585fa88
Remove unused code
0nko Jan 7, 2025
0441e83
Change the default swiping feature flag value to false and only enabl…
0nko Jan 7, 2025
803d973
Fix a crash when omnibar moved in custom tab
0nko Jan 7, 2025
0081249
Merge branch 'develop' into feature/ondrej/swiping-tabs
0nko Jan 7, 2025
bb2e31b
Add an artificial touch to enable webview scrolling
0nko Jan 8, 2025
389b6ff
Merge branch 'develop' into feature/ondrej/swiping-tabs
0nko Jan 8, 2025
030dd42
Only collect commands if the fragment's resumed
0nko Jan 8, 2025
b1fb6d1
Swiping tabs: Tests (#5446)
0nko Jan 8, 2025
26dc31b
Remove unused code
0nko Jan 10, 2025
dd619c7
Disable swiping when in focus mode
0nko Jan 13, 2025
3e84e0d
Remove redundant single-tab operation
0nko Jan 13, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,15 @@ class BrowserTabViewModelTest {
private val extendedOnboardingFeatureToggles = FeatureToggles.Builder(FakeToggleStore(), featureName = "extendedOnboarding").build()
.create(ExtendedOnboardingFeatureToggles::class.java)
private val extendedOnboardingPixelsPlugin = ExtendedOnboardingPixelsPlugin(extendedOnboardingFeatureToggles)
private val swipingTabsFeature = FakeFeatureToggleFactory.create(SwipingTabsFeature::class.java)
private val swipingTabsFeatureProvider = SwipingTabsFeatureProvider(swipingTabsFeature)

@Before
fun before() = runTest {
MockitoAnnotations.openMocks(this)

swipingTabsFeature.self().setRawStoredState(State(enable = true))

db = Room.inMemoryDatabaseBuilder(context, AppDatabase::class.java)
.allowMainThreadQueries()
.build()
Expand Down Expand Up @@ -675,6 +680,7 @@ class BrowserTabViewModelTest {
toggleReports = mockToggleReports,
brokenSitePrompt = mockBrokenSitePrompt,
tabStatsBucketing = mockTabStatsBucketing,
swipingTabsFeature = swipingTabsFeatureProvider,
)

testee.loadData("abc", null, false, false)
Expand Down Expand Up @@ -2445,14 +2451,29 @@ class BrowserTabViewModelTest {
}

@Test
fun whenUserRequestedToOpenNewTabThenNewTabCommandIssued() {
fun whenUserRequestedToOpenNewTabAndNoEmptyTabExistsThenNewTabCommandIssued() {
tabsLiveData.value = listOf(TabEntity("1", "https://example.com", position = 0))
testee.userRequestedOpeningNewTab()
verify(mockCommandObserver, atLeastOnce()).onChanged(commandCaptor.capture())
val command = commandCaptor.lastValue
assertTrue(command is Command.LaunchNewTab)
verify(mockPixel, never()).fire(AppPixelName.TAB_MANAGER_NEW_TAB_LONG_PRESSED)
}

@Test
fun whenUserRequestedToOpenNewTabAndEmptyTabExistsThenSelectTheEmptyTab() = runTest {
val emptyTabId = "EMPTY_TAB"
tabsLiveData.value = listOf(TabEntity(emptyTabId))
testee.userRequestedOpeningNewTab()

verify(mockCommandObserver, atLeastOnce()).onChanged(commandCaptor.capture())
val command = commandCaptor.lastValue
assertFalse(command is Command.LaunchNewTab)

verify(mockTabRepository).select(emptyTabId)
verify(mockPixel, never()).fire(AppPixelName.TAB_MANAGER_NEW_TAB_LONG_PRESSED)
}

@Test
fun whenUserRequestedToOpenNewTabByLongPressThenPixelFired() {
testee.userRequestedOpeningNewTab(longPress = true)
Expand Down
Loading
Loading