Skip to content

Commit 72c5f2b

Browse files
authored
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState - CustomTabActivity (#4660)
Task/Issue URL: https://app.asana.com/0/1202552961248957/1207553561239861/f ### Description Updated `minActiveState` in `onCreate` from `CustomTabActivity`. ### Steps to test this PR Could not reproduce this. ### NO UI changes
1 parent 9bfad0d commit 72c5f2b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/src/main/java/com/duckduckgo/app/browser/customtabs/CustomTabActivity.kt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import com.duckduckgo.common.ui.DuckDuckGoActivity
3535
import com.duckduckgo.common.ui.viewbinding.viewBinding
3636
import com.duckduckgo.di.scopes.ActivityScope
3737
import java.util.UUID
38+
import kotlinx.coroutines.flow.distinctUntilChanged
3839
import kotlinx.coroutines.flow.launchIn
3940
import kotlinx.coroutines.flow.onEach
4041
import timber.log.Timber
@@ -55,9 +56,11 @@ class CustomTabActivity : DuckDuckGoActivity() {
5556

5657
Timber.d("onCreate called with url=$url and toolbar color=$toolbarColor")
5758

58-
viewModel.viewState.flowWithLifecycle(lifecycle, Lifecycle.State.CREATED).onEach {
59-
renderView(it)
60-
}.launchIn(lifecycleScope)
59+
viewModel.viewState.flowWithLifecycle(lifecycle, Lifecycle.State.STARTED)
60+
.distinctUntilChanged()
61+
.onEach {
62+
renderView(it)
63+
}.launchIn(lifecycleScope)
6164

6265
viewModel.onCustomTabCreated(url, toolbarColor)
6366

0 commit comments

Comments
 (0)