Skip to content

Commit 1b0a8e8

Browse files
authored
Tab swiping: Clean up unused fixes behind feature flags (#6025)
Task/Issue URL: https://app.asana.com/1/137249556945/project/72649045549333/task/1210187246401089?focus=true ### Description This PR removes unused fixes and the associated feature flags. --- - To see the specific tasks where the Asana app for GitHub is being used, see below: - https://app.asana.com/0/0/1208271988740971
1 parent f04c7af commit 1b0a8e8

File tree

4 files changed

+3
-52
lines changed

4 files changed

+3
-52
lines changed

app/src/main/java/com/duckduckgo/app/browser/tabs/adapter/FragmentStateAdapter.java

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -210,11 +210,7 @@ public void onDetachedFromRecyclerView(@NonNull RecyclerView recyclerView) {
210210
@NonNull
211211
@Override
212212
public final FragmentViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
213-
if (mSwipingTabsFeature != null && mSwipingTabsFeature.isTabSwipingFix1Enabled()) {
214-
return FragmentContainerViewHolder.create(parent);
215-
} else {
216-
return FrameLayoutViewHolder.create(parent);
217-
}
213+
return FrameLayoutViewHolder.create(parent);
218214
}
219215

220216
@Override
@@ -470,13 +466,7 @@ void addViewToContainer(@NonNull View v, @NonNull FrameLayout container) {
470466
}
471467

472468
private void throwDesignAssumptionViolatedException() {
473-
throw new IllegalStateException(
474-
String.format(
475-
"Design assumption violated: Fix1 enabled: %s, Fix2 enabled: %s",
476-
mSwipingTabsFeature.isTabSwipingFix1Enabled(),
477-
mSwipingTabsFeature.isTabSwipingFix2Enabled()
478-
)
479-
);
469+
throw new IllegalStateException("Design assumption violated");
480470
}
481471

482472
@Override
@@ -562,11 +552,6 @@ private void removeFragment(long itemId) {
562552
}
563553

564554
private void hideFragment(long itemId) {
565-
// do not attempt to hide fragments if the ViewPager is in a transient state
566-
if (shouldDelayFragmentTransactions() && mSwipingTabsFeature.isTabSwipingFix2Enabled()) {
567-
return;
568-
}
569-
570555
Fragment fragment = mFragments.get(itemId);
571556

572557
if (fragment == null) {

app/src/main/java/com/duckduckgo/app/browser/tabs/adapter/FragmentViewHolder.kt

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ package com.duckduckgo.app.browser.tabs.adapter
1818
import android.view.View
1919
import android.view.ViewGroup
2020
import android.widget.FrameLayout
21-
import androidx.fragment.app.FragmentContainerView
2221
import androidx.recyclerview.widget.RecyclerView
2322

2423
/**
@@ -46,19 +45,3 @@ class FrameLayoutViewHolder private constructor(container: FrameLayout) : Fragme
4645
}
4746
}
4847
}
49-
50-
class FragmentContainerViewHolder private constructor(container: FragmentContainerView) : FragmentViewHolder(container) {
51-
companion object {
52-
@JvmStatic
53-
fun create(parent: ViewGroup): FragmentViewHolder {
54-
val container = FragmentContainerView(parent.context)
55-
container.layoutParams = ViewGroup.LayoutParams(
56-
ViewGroup.LayoutParams.MATCH_PARENT,
57-
ViewGroup.LayoutParams.MATCH_PARENT,
58-
)
59-
container.id = View.generateViewId()
60-
container.isSaveEnabled = false
61-
return FragmentContainerViewHolder(container)
62-
}
63-
}
64-
}

common/common-ui/src/main/java/com/duckduckgo/common/ui/tabs/SwipingTabsFeature.kt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,11 @@ import com.duckduckgo.feature.toggles.api.Toggle.InternalAlwaysEnabled
2828
)
2929
interface SwipingTabsFeature {
3030
// The main kill switch for the feature
31-
@Toggle.DefaultValue(DefaultFeatureValue.FALSE)
32-
@InternalAlwaysEnabled
31+
@Toggle.DefaultValue(DefaultFeatureValue.INTERNAL)
3332
fun self(): Toggle
3433

3534
// The toggle used for staged rollout to external users
3635
@Toggle.DefaultValue(DefaultFeatureValue.FALSE)
3736
@InternalAlwaysEnabled
3837
fun enabledForUsers(): Toggle
39-
40-
// The toggle used to enable a potential fix for https://app.asana.com/0/1207418217763355/1209914129786590/f
41-
@Toggle.DefaultValue(DefaultFeatureValue.FALSE)
42-
fun tabSwipingFix1(): Toggle
43-
44-
// The toggle used to enable a potential fix for https://app.asana.com/0/1207418217763355/1209914129786590/f
45-
@Toggle.DefaultValue(DefaultFeatureValue.FALSE)
46-
fun tabSwipingFix2(): Toggle
4738
}

common/common-ui/src/main/java/com/duckduckgo/common/ui/tabs/SwipingTabsFeatureProvider.kt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,4 @@ class SwipingTabsFeatureProvider @Inject constructor(
2727
val isEnabled: Boolean by lazy {
2828
swipingTabsFeature.self().isEnabled() && swipingTabsFeature.enabledForUsers().isEnabled()
2929
}
30-
31-
val isTabSwipingFix1Enabled by lazy {
32-
swipingTabsFeature.tabSwipingFix1().isEnabled()
33-
}
34-
35-
val isTabSwipingFix2Enabled by lazy {
36-
swipingTabsFeature.tabSwipingFix2().isEnabled()
37-
}
3830
}

0 commit comments

Comments
 (0)