Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
df7e8b8
Add new resources
0nko Dec 15, 2025
e497182
Refactor the original dialog into a dialog fragment
0nko Dec 15, 2025
9a5ace4
Simplify fire dialog creation
0nko Dec 15, 2025
2221a8f
Add the zero data resource string
0nko Dec 15, 2025
beaf7f9
Update the fire dialog call sites
0nko Dec 15, 2025
fb1b6c3
Add new fire dialog
0nko Dec 15, 2025
5c0c5c3
Clean up
0nko Dec 15, 2025
9d39f21
Add back the changes lost during the rebasing
0nko Dec 15, 2025
d9825df
Clean up string instructions
0nko Dec 15, 2025
1b62d74
Make the dialog scrollable
0nko Dec 15, 2025
66b1968
Add the missing listeners
0nko Dec 15, 2025
e501e5a
Fix a bug with the restart flag
0nko Dec 15, 2025
600de4e
Fix the history update logic
0nko Dec 16, 2025
401676c
Fix the animation speed-up
0nko Dec 16, 2025
a21ebba
Use DateProvider in the legacy dialog
0nko Dec 16, 2025
83f950f
Fix the callbacks getting lost on config change
0nko Dec 16, 2025
afcea45
Address a possible race condition
0nko Dec 16, 2025
0aee160
Fix a potential animation bug
0nko Dec 16, 2025
99b6911
Fix ktlint issues
0nko Dec 17, 2025
9c8b66a
Fix the lint issue
0nko Dec 17, 2025
b4d49a2
Only restart process if data or chats cleared
0nko Dec 17, 2025
92d30a8
Fix the data clearing issue when tabs-only selected
0nko Dec 17, 2025
07f1b5b
Fix lint issue
0nko Dec 17, 2025
79b42b8
Add string placeholder positions
0nko Dec 17, 2025
4ad8d08
Dismiss the dialog when the cancel command is issued
0nko Dec 17, 2025
d169c4f
Reduce the code duplication in WebLocalStorageManager
0nko Dec 18, 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
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?><!--
~ Copyright (c) 2022 DuckDuckGo
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="?attr/daxColorSurface" />
<corners android:radius="@dimen/mediumShapeCornerRadius" />
</shape>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="96dp"
android:height="96dp"
android:viewportWidth="96"
android:viewportHeight="96">
<path
android:pathData="M42.647,18C47.94,21.52 48.28,27.4 49.784,33C50.039,33.949 51.412,38 56,38C60.078,38 61.765,35.271 62.274,34C62.784,32.729 63.039,30.002 63.294,30.229C63.549,30.457 72.2,39.865 72.2,56.136C72.2,68.339 62.02,76 48,76C33.98,76 22,68.339 22,56.136C22,39.865 35.765,35.797 42.647,18Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="47.366"
android:startY="29.6"
android:endX="53.23"
android:endY="70.978"
android:type="linear">
<item android:offset="0" android:color="#FFFA8B38"/>
<item android:offset="0.52" android:color="#FFE72A57"/>
<item android:offset="1" android:color="#FFCC165B"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M72,56.136C72,45.491 67.263,37.951 64.296,34.271C64.243,34.436 64.19,34.596 64.131,34.744C63.455,36.429 61.212,40 56,40C53.021,40 50.999,38.648 49.734,37.141C48.523,35.695 48.017,34.132 47.853,33.519C47.465,32.077 47.146,30.588 46.831,29.244C46.509,27.866 46.181,26.587 45.754,25.395C45.197,23.839 44.483,22.467 43.431,21.295C39.899,29.083 35.106,34.227 31.293,38.903C27.077,44.074 24,48.705 24,56.136L24.005,56.527C24.201,64.733 30.552,71.871 39.601,74.72C42.231,75.548 45.066,76 48,76C50.934,76 53.769,75.548 56.399,74.72C65.591,71.825 72,64.505 72,56.136ZM75.994,56.63C75.749,66.974 67.815,75.318 57.601,78.534C54.584,79.484 51.345,80 48,80C44.655,80 41.416,79.484 38.399,78.534C28.184,75.318 20.251,66.974 20.006,56.63L20,56.136C20,47.295 23.806,41.756 28.192,36.376C32.577,30.998 37.482,25.811 40.782,17.278L40.875,17.073C41.118,16.608 41.536,16.254 42.042,16.094C42.62,15.91 43.25,15.999 43.755,16.335C46.867,18.404 48.49,21.172 49.52,24.046C50.027,25.463 50.397,26.924 50.727,28.333C51.064,29.776 51.351,31.123 51.716,32.481C51.806,32.817 52.115,33.754 52.8,34.571C53.433,35.326 54.391,36 56,36C58.944,36 60.074,34.113 60.418,33.256C60.585,32.839 60.741,32.067 60.917,31.168C60.991,30.789 61.079,30.343 61.172,30.008C61.208,29.879 61.297,29.563 61.472,29.264C61.534,29.156 61.8,28.701 62.367,28.423C62.708,28.256 63.148,28.16 63.629,28.248C63.973,28.311 64.245,28.451 64.446,28.594L64.624,28.734L64.63,28.74C65.012,29.083 76,38.994 76,56.136L75.994,56.63Z">
<aapt:attr name="android:fillColor">
<gradient
android:startX="48"
android:startY="18"
android:endX="48"
android:endY="78"
android:type="linear">
<item android:offset="0" android:color="#FFFF862D"/>
<item android:offset="1" android:color="#FFB40B4A"/>
</gradient>
</aapt:attr>
</path>
<path
android:pathData="M48,51C53.333,56.459 60,62.373 60,68.173C60,74.428 56,80 48,80C40,80 36,74.428 36,68.173C36,61.918 42.667,56.459 48,51Z"
android:fillColor="#FFCC33"/>
</vector>
33 changes: 23 additions & 10 deletions app/src/main/java/com/duckduckgo/app/browser/BrowserActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ import com.duckduckgo.app.global.intentText
import com.duckduckgo.app.global.rating.PromptCount
import com.duckduckgo.app.global.sanitize
import com.duckduckgo.app.global.view.ClearDataAction
import com.duckduckgo.app.global.view.FireDialog
import com.duckduckgo.app.global.view.FireDialogProvider
import com.duckduckgo.app.global.view.renderIfChanged
import com.duckduckgo.app.onboarding.ui.page.DefaultBrowserPage
Expand Down Expand Up @@ -346,6 +347,7 @@ open class BrowserActivity : DuckDuckGoActivity() {
// LiveData observers are restarted on each showWebContent() call; we want to subscribe to
// flows only once, so a separate initialization is necessary
configureFlowCollectors()
setupFireDialogListener()

viewModel.viewState
.flowWithLifecycle(lifecycle, Lifecycle.State.RESUMED)
Expand Down Expand Up @@ -399,6 +401,24 @@ open class BrowserActivity : DuckDuckGoActivity() {
}
}

private fun setupFireDialogListener() {
supportFragmentManager.setFragmentResultListener(FireDialog.REQUEST_KEY, this) { _, bundle ->
when (bundle.getString(FireDialog.RESULT_KEY_EVENT)) {
FireDialog.EVENT_ON_SHOW -> {
currentTab?.onFireDialogVisibilityChanged(isVisible = true)
}
FireDialog.EVENT_ON_CANCEL -> {
pixel.fire(FIRE_DIALOG_CANCEL)
currentTab?.onFireDialogVisibilityChanged(isVisible = false)
}
FireDialog.EVENT_ON_CLEAR_STARTED -> {
isDataClearingInProgress = true
removeObservers()
}
}
}
}

override fun onStart() {
super.onStart()
duckAiAnimDelayJob =
Expand Down Expand Up @@ -801,17 +821,10 @@ open class BrowserActivity : DuckDuckGoActivity() {
val params = mapOf(PixelParameter.FROM_FOCUSED_NTP to launchedFromFocusedNtp.toString())
pixel.fire(AppPixelName.FORGET_ALL_PRESSED_BROWSING, params)

val dialog = fireDialogProvider.createFireDialog(context = this)
dialog.setOnShowListener { currentTab?.onFireDialogVisibilityChanged(isVisible = true) }
dialog.setOnCancelListener {
pixel.fire(FIRE_DIALOG_CANCEL)
currentTab?.onFireDialogVisibilityChanged(isVisible = false)
}
dialog.clearStarted = {
isDataClearingInProgress = true
removeObservers()
lifecycleScope.launch {
val dialog = fireDialogProvider.createFireDialog()
dialog.show(supportFragmentManager)
}
dialog.show()
}

fun launchSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,39 +71,9 @@ class DuckDuckGoWebLocalStorageManager @Inject constructor(
private var matchingRegex = emptyList<String>()

override suspend fun clearWebLocalStorage() = withContext(dispatcherProvider.io()) {
val settings = androidBrowserConfigFeature.webLocalStorage().getSettings()
val webLocalStorageSettings = webLocalStorageSettingsJsonParser.parseJson(settings)

val fireproofedDomains = fireproofWebsiteRepository.fireproofWebsitesSync().map { it.domain }

domains = webLocalStorageSettings.domains.list + fireproofedDomains
keysToDelete = webLocalStorageSettings.keysToDelete.list
matchingRegex = webLocalStorageSettings.matchingRegex.list

logcat { "WebLocalStorageManager: Allowed domains: $domains" }
logcat { "WebLocalStorageManager: Keys to delete: $keysToDelete" }
logcat { "WebLocalStorageManager: Matching regex: $matchingRegex" }

val db = databaseProvider.get()
db.iterator().use { iterator ->
iterator.seekToFirst()

while (iterator.hasNext()) {
val entry = iterator.next()
val key = String(entry.key, StandardCharsets.UTF_8)

val domainForMatchingAllowedKey = getDomainForMatchingAllowedKey(key)
if (domainForMatchingAllowedKey == null) {
db.delete(entry.key)
logcat { "WebLocalStorageManager: Deleted key: $key" }
} else if (settingsDataStore.clearDuckAiData && DUCKDUCKGO_DOMAINS.contains(domainForMatchingAllowedKey)) {
if (keysToDelete.any { key.endsWith(it) }) {
db.delete(entry.key)
logcat { "WebLocalStorageManager: Deleted key: $key" }
}
}
}
}
val shouldClearBrowserData = true // As per legacy behavior, we always clear browser data
val shouldClearDuckAiData = settingsDataStore.clearDuckAiData
clearWebLocalStorage(shouldClearBrowserData, shouldClearDuckAiData)
}

override suspend fun clearWebLocalStorage(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ import com.duckduckgo.common.ui.viewbinding.viewBinding
import com.duckduckgo.di.scopes.ActivityScope
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
import logcat.logcat
import javax.inject.Inject

Expand Down Expand Up @@ -288,8 +289,10 @@ class FireButtonActivity : DuckDuckGoActivity() {
}

private fun launchFireDialog() {
val dialog = fireDialogProvider.createFireDialog(context = this)
dialog.show()
lifecycleScope.launch {
val dialog = fireDialogProvider.createFireDialog()
dialog.show(supportFragmentManager)
}
}

companion object {
Expand Down
Loading
Loading