Skip to content

Commit cdf44c0

Browse files
committed
Add OmnibarTypeReslover
1 parent a863754 commit cdf44c0

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* Copyright (c) 2025 DuckDuckGo
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.duckduckgo.app.browser.omnibar
18+
19+
import com.duckduckgo.app.pixels.remoteconfig.AndroidBrowserConfigFeature
20+
import com.duckduckgo.app.settings.db.SettingsDataStore
21+
import com.duckduckgo.browser.ui.omnibar.OmnibarType
22+
import com.duckduckgo.di.scopes.AppScope
23+
import dagger.SingleInstanceIn
24+
import javax.inject.Inject
25+
26+
@SingleInstanceIn(AppScope::class)
27+
class OmnibarTypeResolver @Inject constructor(
28+
private val settingsDataStore: SettingsDataStore,
29+
private val browserFeatureFlags: AndroidBrowserConfigFeature,
30+
) {
31+
fun resolveOmnibarType(): OmnibarType {
32+
val type = settingsDataStore.omnibarType
33+
return if (type == OmnibarType.SPLIT &&
34+
(
35+
!browserFeatureFlags.useUnifiedOmnibarLayout().isEnabled() ||
36+
!browserFeatureFlags.useUnifiedOmnibarLayout().isEnabled()
37+
)
38+
) {
39+
OmnibarType.SINGLE_TOP
40+
} else {
41+
type
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)