Skip to content

Commit 70333be

Browse files
committed
address pr comments
1 parent 79da2e6 commit 70333be

File tree

5 files changed

+16
-24
lines changed

5 files changed

+16
-24
lines changed

app/build.gradle

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ ext {
1818

1919
android {
2020
defaultConfig {
21-
// applicationId "com.duckduckgo.mobile.android"
22-
applicationId "com.duckduckgo.mobile.android.duckai.poc"
21+
applicationId "com.duckduckgo.mobile.android"
2322

2423
minSdk min_sdk
2524
targetSdk target_sdk
@@ -141,8 +140,8 @@ android {
141140
minifyEnabled false
142141
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
143142
manifestPlaceholders = [
144-
appIcon : "@mipmap/ic_launcher_purple",
145-
appIconRound: "@mipmap/ic_launcher_purple_round"
143+
appIcon : "@mipmap/ic_launcher_red",
144+
appIconRound: "@mipmap/ic_launcher_red_round"
146145
]
147146

148147
if (project.hasProperty('useUploadSigning')) {

duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/DuckChatWebViewFragment.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,8 +350,8 @@ open class DuckChatWebViewFragment : DuckDuckGoFragment(R.layout.activity_duck_c
350350
}
351351

352352
private fun configureLegacyOmnibar() {
353-
root.findViewById<View>(R.id.includeToolbar).show()
354353
toolbar?.let {
354+
it.show()
355355
it.setNavigationIcon(com.duckduckgo.mobile.android.R.drawable.ic_arrow_left_24)
356356
it.setNavigationOnClickListener {
357357
requireActivity().onBackPressed()
@@ -362,7 +362,7 @@ open class DuckChatWebViewFragment : DuckDuckGoFragment(R.layout.activity_duck_c
362362
}
363363

364364
private fun configureFullscreenOmnibar() {
365-
root.findViewById<View>(R.id.includeToolbar).gone()
365+
toolbar?.gone()
366366
duckChatOmnibar?.show()
367367

368368
duckChatOmnibar?.setOmnibarItemPressedListener(

duckchat/duckchat-impl/src/main/java/com/duckduckgo/duckchat/impl/ui/DuckChatWebViewViewModel.kt

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ import com.duckduckgo.subscriptions.api.Subscriptions
2626
import kotlinx.coroutines.channels.BufferOverflow.DROP_OLDEST
2727
import kotlinx.coroutines.channels.Channel
2828
import kotlinx.coroutines.flow.SharingStarted
29-
import kotlinx.coroutines.flow.combine
3029
import kotlinx.coroutines.flow.distinctUntilChanged
3130
import kotlinx.coroutines.flow.launchIn
31+
import kotlinx.coroutines.flow.map
3232
import kotlinx.coroutines.flow.onEach
3333
import kotlinx.coroutines.flow.receiveAsFlow
3434
import kotlinx.coroutines.flow.stateIn
@@ -44,20 +44,18 @@ class DuckChatWebViewViewModel @Inject constructor(
4444
val commands = commandChannel.receiveAsFlow()
4545

4646
data class ViewState(
47-
val isDuckChatUserEnabled: Boolean = false,
4847
val isFullScreenModeEnabled: Boolean = false,
4948
)
5049

51-
val viewState =
52-
combine(
53-
duckChat.observeEnableDuckChatUserSetting(),
54-
duckChat.observeFullscreenModeUserSetting(),
55-
) { isDuckChatUserEnabled, isFullScreenModeEnabled ->
56-
ViewState(
57-
isDuckChatUserEnabled = isDuckChatUserEnabled,
58-
isFullScreenModeEnabled = isFullScreenModeEnabled,
59-
)
60-
}.stateIn(viewModelScope, SharingStarted.WhileSubscribed(), ViewState())
50+
val viewState = duckChat.observeFullscreenModeUserSetting()
51+
.map { isFullScreenModeEnabled ->
52+
ViewState(isFullScreenModeEnabled = isFullScreenModeEnabled)
53+
}
54+
.stateIn(
55+
scope = viewModelScope,
56+
started = SharingStarted.WhileSubscribed(), // Using a 5-second timeout is best practice
57+
initialValue = ViewState(),
58+
)
6159

6260
sealed class Command {
6361
data object SendSubscriptionAuthUpdateEvent : Command()

duckchat/duckchat-impl/src/main/res/values/attrs-omnibar-view.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?><!--
2-
~ Copyright (c) 2022 DuckDuckGo
2+
~ Copyright (c) 2025 DuckDuckGo
33
~
44
~ Licensed under the Apache License, Version 2.0 (the "License");
55
~ you may not use this file except in compliance with the License.

duckchat/duckchat-impl/src/test/java/com/duckduckgo/duckchat/impl/ui/DuckChatWebViewViewModelTest.kt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ class DuckChatWebViewViewModelTest {
5454
@Before
5555
fun setup() {
5656
whenever(subscriptions.getSubscriptionStatusFlow()).thenReturn(subscriptionStatusFlow)
57-
whenever(duckChat.observeEnableDuckChatUserSetting()).thenReturn(flowOf(true))
5857
whenever(duckChat.observeFullscreenModeUserSetting()).thenReturn(flowOf(true))
5958
viewModel = DuckChatWebViewViewModel(subscriptions, duckChat)
6059
}
@@ -145,7 +144,6 @@ class DuckChatWebViewViewModelTest {
145144
@Test
146145
fun `fullscreen mode - when flags enabled, then viewstate enabled`() =
147146
runTest {
148-
whenever(duckChat.observeEnableDuckChatUserSetting()).thenReturn(flowOf(true))
149147
whenever(duckChat.observeFullscreenModeUserSetting()).thenReturn(flowOf(true))
150148
viewModel = DuckChatWebViewViewModel(
151149
subscriptions,
@@ -154,15 +152,13 @@ class DuckChatWebViewViewModelTest {
154152

155153
viewModel.viewState.test {
156154
val state = awaitItem()
157-
assertTrue(state.isDuckChatUserEnabled)
158155
assertTrue(state.isFullScreenModeEnabled)
159156
}
160157
}
161158

162159
@Test
163160
fun `fullscreen mode - when flags disabled, then viewstate disabled`() =
164161
runTest {
165-
whenever(duckChat.observeEnableDuckChatUserSetting()).thenReturn(flowOf(false))
166162
whenever(duckChat.observeFullscreenModeUserSetting()).thenReturn(flowOf(false))
167163
viewModel = DuckChatWebViewViewModel(
168164
subscriptions,
@@ -171,7 +167,6 @@ class DuckChatWebViewViewModelTest {
171167

172168
viewModel.viewState.test {
173169
val state = awaitItem()
174-
assertFalse(state.isDuckChatUserEnabled)
175170
assertFalse(state.isFullScreenModeEnabled)
176171
}
177172
}

0 commit comments

Comments
 (0)