Modern Apps git

← Modern-Apps.git

web: tab viewer clear-all, bottom inset, MA Search, Settings cleanup

Commit
53cc47a16582028d6a17d1f74342aad20cec773f
Author
Vayun Mathur <[email protected]>
When
2026-12-02 03:03 UTC (4 days ago)
Parents
4696cbf
Five owner-requested changes in the web module:

- Tab viewer no longer rests under the bottom navigation area: the
  grid now takes a 96.dp bottom content inset (TAB_SWITCHER_BOTTOM_INSET)
  so its last row and action buttons scroll fully clear of the bottom
  browser toolbar and the system navigation bar.
- A "Clear all tabs" button joins the switcher footer. It calls the new
  WebViewModel.clearAllTabs(), which drops per-tab state and thumbnails
  for every tab and leaves exactly one fresh new tab.
- The last tab can now be closed like any other: the flick gesture is
  no longer suppressed at one tab, and closeTab already replaced an
  emptied list with a blank tab, so the browser never sits at zero
  tabs. The fresh tab after a close or a clear-all keeps the privacy
  of the previously active tab / incognito window.
- Settings loses its bottom About section (header, app-name row) and
  the WebView-engine info card. The search-engine picker is untouched;
  the removed strings (about, engine) go with it in the base resources
  and every translated locale.
- "MA Search" is now selectable in every build: SELF_HOSTED keeps its
  enum name (stored preferences keep resolving) but displays as MA
  Search, joins PICKABLE unconditionally, and effective() no longer
  falls back to the default outside dev builds. Its query URL is the
  first-party GET https://api.maproj.org/api/search?q=%s endpoint,
  confirmed against WebSearchRepository/WebSearch, and results keep
  rendering natively via the existing search:// flow.

Tests pin the new behaviour: last-tab close replaced by a fresh tab,
clear-all leaves exactly one fresh tab, the switcher bottom inset is
present, the Clear all tabs button fires its callback, and MA Search
is pickable with the correct query-URL building.

Verified: :web:compileReleaseKotlin and :web:compileDevKotlin green;
:web:testDevUnitTest green. :web:lint and :web:lintVitalRelease fail
only on pre-existing errors (DialogAsRoute, RouteScreenshotCoverage,
FixtureDeterminism) that are identical at pristine HEAD; no changed
file adds a lint error.

Diff

web/AGENTS.md
diff --git a/web/AGENTS.md b/web/AGENTS.mdindex 0914ed14ba..255cc5930d 100644--- a/web/AGENTS.md+++ b/web/AGENTS.md@@ -15,6 +15,8 @@ _Install: ./install web (dev by default)._ **Key features:** - Shields engine (`platform/shields/`: request filter, WebView clients, JS injection, service-worker client) over the Rust core (`shields/ShieldsNative`) with `domain/shields/` URL cleaning; per-site panel + fingerprint controls - Tabs with thumbnails, bookmarks/history/downloads, installed-site PWAs in a standalone `PwaActivity`, desktop-mode toggle+- The tab switcher never leaves the browser at zero tabs: closing the last tab (tile X, flick, or "Clear all tabs") replaces it with one fresh new tab; the grid insets its last row clear of the bottom navigation area+- Search engines are `SearchEngine` entries in `platform/BrowserState.kt`; "MA Search" (`SELF_HOSTED`) is selectable in every build and renders `GET https://api.maproj.org/api/search` results natively - LAN safety policy (`domain/LanPolicy`, `LocalNetwork`) + per-site permissions/storage (`WebPermissions`, permission sheets) **Architecture / data-flow:** `ui/` chrome (omnibox, menu, tab switcher, panels) → `platform/WebViewModel` (+ split `Permissions`/`SiteData` helpers, `BrowserState`) → `data/WebRepository` over Room (bookmarks/history/tabs/favicons) + `platform/shields/ShieldsEngine` on the network path; `platform/ContentFilters` + `ThumbnailCapture` + `WindowLauncher` support. **Entry points + reading order:** `Route` → `MainActivity.kt` → `Navigation.kt` → `ui/BrowserPage.kt` → `platform/WebViewModel.kt` → `platform/shields/ShieldsEngine.kt` → `domain/shields/UrlCleaner.kt`.
web/src/main/java/com/vayunmathur/web/platform/BrowserState.kt
diff --git a/web/src/main/java/com/vayunmathur/web/platform/BrowserState.kt b/web/src/main/java/com/vayunmathur/web/platform/BrowserState.ktindex a3be5c77eb..11db1a57f9 100644--- a/web/src/main/java/com/vayunmathur/web/platform/BrowserState.kt+++ b/web/src/main/java/com/vayunmathur/web/platform/BrowserState.kt@@ -44,13 +44,15 @@ enum class SearchEngine(     ECOSIA("Ecosia", "https://www.ecosia.org/search?q=%s", "https://www.ecosia.org", "safesearch=1"),     QWANT("Qwant", "https://www.qwant.com/?q=%s", "https://www.qwant.com", "safesearch=2"),     /**-     * First-party search: queries go to our own API and render in a native+     * First-party search ("MA Search"): queries go to our own API+     * (GET https://api.maproj.org/api/search) and render in a native      * Compose results page instead of loading engine HTML in a WebView.      * [searchUrl] is only a template for [buildQueryUrl]; navigation is-     * intercepted in [navigateActiveTab] before any WebView load.+     * intercepted in [navigateActiveTab] before any WebView load. The+     * enum name stays SELF_HOSTED so a stored preference keeps resolving.      */     SELF_HOSTED(-        "Maproj Search",+        "MA Search",         "https://api.maproj.org/api/search?q=%s",         "https://api.maproj.org/api/search",         "safe_search=on",@@ -79,26 +81,14 @@ enum class SearchEngine(         /** Used when the selected engine has no strict-filter parameter of its own. */         val SAFE_FALLBACK = DUCKDUCKGO -        /**-         * Engines offered in the Settings picker. [SELF_HOSTED] is dev-only-         * (its backend text scraping is datacenter-blocked and the UI is-         * unfinished): release builds never offer it. R8 folds-         * [com.vayunmathur.web.BuildConfig.DEV_BUILD], so the reference is-         * stripped from release.-         */-        val PICKABLE: List<SearchEngine> =-            if (com.vayunmathur.web.BuildConfig.DEV_BUILD) entries else entries - SELF_HOSTED+        /** Engines offered in the Settings picker: every engine, MA Search included. */+        val PICKABLE: List<SearchEngine> = entries          fun fromName(name: String): SearchEngine =             entries.find { it.name == name } ?: DEFAULT -        /**-         * The engine to actually use: [SELF_HOSTED] outside a dev build falls-         * back to [DEFAULT] (e.g. a dev-build pref restored on release).-         */-        fun effective(engine: SearchEngine): SearchEngine =-            if (engine == SELF_HOSTED && !com.vayunmathur.web.BuildConfig.DEV_BUILD) DEFAULT-            else engine+        /** The engine to actually use: every engine is selectable in every build. */+        fun effective(engine: SearchEngine): SearchEngine = engine     } } 
web/src/main/java/com/vayunmathur/web/platform/WebViewModel.kt
diff --git a/web/src/main/java/com/vayunmathur/web/platform/WebViewModel.kt b/web/src/main/java/com/vayunmathur/web/platform/WebViewModel.ktindex 8833be7810..97dbea7015 100644--- a/web/src/main/java/com/vayunmathur/web/platform/WebViewModel.kt+++ b/web/src/main/java/com/vayunmathur/web/platform/WebViewModel.kt@@ -436,7 +436,6 @@ class WebViewModel(         }         searchEngineName?.let {             runCatching { SearchEngine.valueOf(it) }.getOrNull()?.let { se ->-                // Dev-gated engine never survives into a release build.                 searchEngine = SearchEngine.effective(se)             }         }
web/src/main/java/com/vayunmathur/web/platform/WebViewModelSettings.kt
diff --git a/web/src/main/java/com/vayunmathur/web/platform/WebViewModelSettings.kt b/web/src/main/java/com/vayunmathur/web/platform/WebViewModelSettings.ktindex 51a55852de..84160fb40d 100644--- a/web/src/main/java/com/vayunmathur/web/platform/WebViewModelSettings.kt+++ b/web/src/main/java/com/vayunmathur/web/platform/WebViewModelSettings.kt@@ -8,8 +8,6 @@ fun WebViewModel.updateCacheMode(mode: CacheMode) { }  fun WebViewModel.updateSearchEngine(engine: SearchEngine) {-    // Dev-gated engine can never be selected on release (belt-and-braces:-    // the picker already hides it there).     searchEngine = SearchEngine.effective(engine)     persistPrefs() }
web/src/main/java/com/vayunmathur/web/platform/WebViewModelTabs.kt
diff --git a/web/src/main/java/com/vayunmathur/web/platform/WebViewModelTabs.kt b/web/src/main/java/com/vayunmathur/web/platform/WebViewModelTabs.ktindex d5ee81143c..f9f0c0302e 100644--- a/web/src/main/java/com/vayunmathur/web/platform/WebViewModelTabs.kt+++ b/web/src/main/java/com/vayunmathur/web/platform/WebViewModelTabs.kt@@ -122,6 +122,35 @@ fun WebViewModel.closeTab(tabId: String) {     persistTabs() } +/**+ * Closes every tab and leaves exactly one fresh new tab in their place, so the browser+ * never sits at zero tabs. The fresh tab keeps the privacy of the tab that was active+ * (and of an incognito window), matching [newTab]. Per-tab state and thumbnails for the+ * closed tabs are dropped, exactly as [closeTab] drops them one tab at a time.+ */+fun WebViewModel.clearAllTabs() {+    val keepPrivate = incognito || activeTab?.isPrivate == true+    tabs.map { it.id }.forEach { tabId ->+        tabTitles.remove(tabId)+        tabProgress.remove(tabId)+        tabCanGoBack.remove(tabId)+        tabCanGoForward.remove(tabId)+        tabCurrentUrl.remove(tabId)+        blockedCounts.remove(tabId)+        blockedTotals.remove(tabId)+        pwaInfos.remove(tabId)+        TabThumbnailStore.remove(tabId)+    }+    tabs.clear()+    val fresh = blankTab().copy(isPrivate = keepPrivate)+    tabs.add(fresh)+    activeTabId = fresh.id+    omniboxText = ""+    searchDraft = ""+    omniboxFocused = false+    persistTabs()+}+ /**  * Tab order is the persisted order — [persistTabsSync] writes the list as it stands — so a  * reorder needs nothing beyond moving the entry and saving.@@ -149,8 +178,7 @@ fun WebViewModel.navigateActiveTab(input: String) {     // loading engine HTML in a WebView. The query is stored as a search://     // pseudo-URL in the tab so tab switching, persistence, and the omnibox keep     // working unchanged; BrowserContent branches on the scheme. URLs and blank-    // input still go through the normal path below. Dev-gated: release builds-    // resolve SELF_HOSTED to the default engine via SearchEngine.effective.+    // input still go through the normal path below.     val engine = SearchEngine.effective(searchEngine)     if (engine == SearchEngine.SELF_HOSTED) {         val trimmed = input.trim()
web/src/main/java/com/vayunmathur/web/ui/BrowserOverlays.kt
diff --git a/web/src/main/java/com/vayunmathur/web/ui/BrowserOverlays.kt b/web/src/main/java/com/vayunmathur/web/ui/BrowserOverlays.ktindex 453ba6d3b0..fd32fca865 100644--- a/web/src/main/java/com/vayunmathur/web/ui/BrowserOverlays.kt+++ b/web/src/main/java/com/vayunmathur/web/ui/BrowserOverlays.kt@@ -23,6 +23,7 @@ import com.vayunmathur.web.platform.blockedCount import com.vayunmathur.web.platform.clearFileChooser import com.vayunmathur.web.platform.clearLocalNetworkPrompt import com.vayunmathur.web.platform.clearPermissionPrompt+import com.vayunmathur.web.platform.clearAllTabs import com.vayunmathur.web.platform.closeTab import com.vayunmathur.web.platform.denyGeolocation import com.vayunmathur.web.platform.farblingConfig@@ -70,6 +71,7 @@ internal fun BrowserOverlays(             activeTabId = viewModel.activeTabId,             onSwitch = { viewModel.switchToTab(it) },             onClose = { viewModel.closeTab(it) },+            onClearAll = { viewModel.clearAllTabs() },             onReorder = { from, to -> viewModel.moveTab(from, to) },             onNewTab = { viewModel.newTab(isPrivate = viewModel.incognito || viewModel.activeTab?.isPrivate == true) },             onNewIncognitoTab = { viewModel.newTab(isPrivate = true) },
web/src/main/java/com/vayunmathur/web/ui/SettingsPage.kt
diff --git a/web/src/main/java/com/vayunmathur/web/ui/SettingsPage.kt b/web/src/main/java/com/vayunmathur/web/ui/SettingsPage.ktindex e6337497fe..63516fcacf 100644--- a/web/src/main/java/com/vayunmathur/web/ui/SettingsPage.kt+++ b/web/src/main/java/com/vayunmathur/web/ui/SettingsPage.kt@@ -7,12 +7,10 @@ import android.webkit.CookieManager import android.webkit.WebStorage import android.webkit.WebView import androidx.compose.foundation.layout.Arrangement-import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.LazyColumn-import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf@@ -34,7 +32,6 @@ import com.vayunmathur.library.ui.SettingsRow import com.vayunmathur.library.ui.SingleChoiceDialog import com.vayunmathur.library.ui.SettingsSwitchRow import com.vayunmathur.library.ui.Scaffold-import com.vayunmathur.library.ui.Surface import com.vayunmathur.library.ui.Text import com.vayunmathur.library.ui.TopAppBar import com.vayunmathur.web.Route@@ -194,25 +191,6 @@ fun SettingsPage(                 )             } -            item { HorizontalDivider(Modifier.padding(vertical = 8.dp)) }--            item {-                Text(stringResource(R.string.about), style = MaterialTheme.typography.titleSmall, color = MaterialTheme.colorScheme.primary, modifier = Modifier.padding(horizontal = 16.dp, vertical = 12.dp))-            }--            item {-                SettingsRow(-                    title = stringResource(R.string.app_name),-                )-            }--            item {-                Surface(shape = RoundedCornerShape(16.dp), color = MaterialTheme.colorScheme.surfaceVariant, modifier = Modifier.padding(16.dp)) {-                    Column(Modifier.padding(14.dp), verticalArrangement = Arrangement.spacedBy(6.dp)) {-                        Text(stringResource(R.string.engine, WebView.getCurrentWebViewPackage()?.let { "${it.packageName} ${it.versionName}" } ?: "System WebView"), style = MaterialTheme.typography.bodySmall)-                    }-                }-            }         }         }     }
web/src/main/java/com/vayunmathur/web/ui/TabSwitcher.kt
diff --git a/web/src/main/java/com/vayunmathur/web/ui/TabSwitcher.kt b/web/src/main/java/com/vayunmathur/web/ui/TabSwitcher.ktindex 0e04e3cdda..3900fba057 100644--- a/web/src/main/java/com/vayunmathur/web/ui/TabSwitcher.kt+++ b/web/src/main/java/com/vayunmathur/web/ui/TabSwitcher.kt@@ -51,6 +51,14 @@ import kotlin.math.abs /** Minimum tile width: keeps a tile big enough to recognise a page in while letting wider windows fit more columns. */ private const val MIN_TILE_WIDTH_DP = 180 +/**+ * Space left below the last grid row so it scrolls fully clear of the bottom+ * navigation area (the browser toolbar when it sits at the bottom, plus the+ * system navigation bar below it). The switcher is a full-screen overlay, so+ * without this inset its last row would rest underneath that area.+ */+internal val TAB_SWITCHER_BOTTOM_INSET = 96.dp+ /** How far across itself a tile has to travel before letting go of it closes the tab. */ private const val FLICK_FRACTION = 0.4f @@ -76,9 +84,9 @@ private const val FLICK_OUT_MILLIS = 150  * is normal when reordering, so a scheme that read the release would close tabs that were being  * moved — and closing a tab cannot be undone.  *- * Flicking is suppressed when there is only one tab, because closing the last tab immediately- * creates a blank one, which would appear under the finger and read as the flick having failed.- * The close button stays on every tile regardless: it is the affordance that works with TalkBack.+ * Closing the last tab is allowed: [onClose] replaces it with a fresh new tab, so the+ * browser never sits at zero tabs. The close button stays on every tile regardless:+ * it is the affordance that works with TalkBack.  */ @Composable fun TabSwitcher(@@ -89,6 +97,7 @@ fun TabSwitcher(     onNewTab: () -> Unit,     onDismiss: () -> Unit,     modifier: Modifier = Modifier,+    onClearAll: () -> Unit = {},     onReorder: (from: Int, to: Int) -> Unit = { _, _ -> },     onNewIncognitoTab: () -> Unit = {},     onNewWindow: () -> Unit = onNewTab,@@ -113,7 +122,7 @@ fun TabSwitcher(                 columns = adaptiveGridCells(MIN_TILE_WIDTH_DP.dp),                 state = gridState,                 modifier = Modifier.fillMaxSize(),-                contentPadding = PaddingValues(8.dp),+                contentPadding = PaddingValues(start = 8.dp, top = 8.dp, end = 8.dp, bottom = TAB_SWITCHER_BOTTOM_INSET),                 horizontalArrangement = Arrangement.spacedBy(8.dp),                 verticalArrangement = Arrangement.spacedBy(8.dp),             ) {@@ -153,7 +162,6 @@ fun TabSwitcher(                             onSwap = { haptics.tick() },                             onDragStopped = { haptics.confirm() },                             horizontalFlick = HorizontalFlick(-                                enabled = { tabs.size > 1 },                                 onDrag = { flickX = it },                                 onRelease = { dx, velocity ->                                     val thrown = abs(velocity) > FLICK_VELOCITY && velocity * dx > 0f@@ -197,6 +205,12 @@ fun TabSwitcher(                                 Text(stringResource(R.string.new_incognito_window))                             }                         }+                        OutlinedButton(+                            onClick = onClearAll,+                            modifier = Modifier.fillMaxWidth()+                        ) {+                            Text(stringResource(R.string.clear_all_tabs))+                        }                     }                 }             }
web/src/main/res/values-ar/strings.xml
diff --git a/web/src/main/res/values-ar/strings.xml b/web/src/main/res/values-ar/strings.xmlindex 053100ec65..2054619c99 100644--- a/web/src/main/res/values-ar/strings.xml+++ b/web/src/main/res/values-ar/strings.xml@@ -25,7 +25,6 @@     <string name="privacy_data">الخصوصية والبيانات</string>     <string name="clear_browsing_data">مسح بيانات التصفح</string>     <string name="cookies_cache_history_storage_permission">ملفات تعريف الارتباط، ذاكرة التخزين المؤقت، السجل، التخزين، الأذونات</string>-    <string name="about">حول</string>     <string name="clear_browsing_data_2">مسح بيانات التصفح؟</string>     <string name="clears_cookies_cache_storage_history_dow">يمسح ملفات تعريف الارتباط، الذاكرة المؤقتة، التخزين، السجل، التنزيلات، الأذونات. علامات التبويب تظل مفتوحة.</string>     <string name="your_choice_is_saved_per_site_change_it">يتم حفظ اختيارك لكل موقع. قم بتغييره في الإعدادات ← بيانات الموقع.</string>@@ -69,13 +68,13 @@         <item quantity="many">%1$s ملف</item>         <item quantity="other">%1$s ملف</item>     </plurals>-    <string name="engine">المحرك: %1$s</string>     <string name="allow_to_access">السماح لـ %1$s بالوصول؟</string>     <string name="wants_to_know_your_location">%1$s يريد معرفة موقعك الجغرافي.</string>     <string name="accepted">تم القبول: %1$s</string>     <string name="open_a_site_and_tap_menu_install_app_add">افتح موقعًا واضغط على القائمة ← تثبيت التطبيق / إضافة إلى الشاشة الرئيسية. ينشئ اختصارًا مثبتًا يُشغّل PwaActivity بشكل مستقل (بدون متصفح chrome). يستخدم الرمز أفضل رمز 192x192 أو apple-touch-icon؛ ويعود إلى مربع الحرف.</string>     <string name="bookmarks_inside_will_also_be_deleted">الإشارات المرجعية داخل \"%1$s\" سيتم أيضًا حذفها.</string>     <string name="share_link">مشاركة الرابط</string>+    <string name="clear_all_tabs">مسح كل علامات التبويب</string>     <string name="new_window">نافذة جديدة</string>     <string name="new_incognito_window">نافذة التصفح الخفي جديدة</string>     <string name="new_incognito_tab">علامة تبويب التصفح الخفي جديدة</string>
web/src/main/res/values-et/strings.xml
diff --git a/web/src/main/res/values-et/strings.xml b/web/src/main/res/values-et/strings.xmlindex 859efe1e0f..fa2336321f 100644--- a/web/src/main/res/values-et/strings.xml+++ b/web/src/main/res/values-et/strings.xml@@ -61,11 +61,11 @@         <item quantity="one">%1$s fail</item>         <item quantity="other">%1$s faili</item>     </plurals>-    <string name="engine">Renderdusmootor: %1$s</string>     <string name="wants_to_know_your_location">%1$s soovib teada sinu asukohta.</string>     <string name="share_link">Jaga linki</string>     <string name="clear_browsing_data_2">Kas kustutad veebisirvimise andmed?</string>     <string name="clears_cookies_cache_storage_history_dow">Sellega eemaldad küpsised, puhverdatud andmed, brauseri andmeruumi sisu, ajaloo, allalaadimiste teave ja antud õigused. Vahekaardid jäävad avatuks.</string>+    <string name="clear_all_tabs">Sulge kõik vahekaardid</string>     <string name="new_window">Uus aken</string>     <string name="new_incognito_window">Uus privaatne aken</string>     <string name="new_incognito_tab">Uus privaatne vahekaart</string>@@ -93,7 +93,6 @@     <string name="shields_down">Kaitse pole selle saidi puhul töös</string>     <string name="shields_for_host">Kaitse „%1$s“ saidi puhul</string>     <string name="shields_no_site_exceptions">Veebisaidi-kohaseid muudatusi veel pole. Veebisaidi seadistuste kohendamiseks klõpsa tööriistaribal olevat kilpi.</string>-    <string name="about">Saidi teave</string>     <plurals name="pwas">         <item quantity="one">%1$s PWA</item>         <item quantity="other">%1$s PWA-d</item>
web/src/main/res/values-fr/strings.xml
diff --git a/web/src/main/res/values-fr/strings.xml b/web/src/main/res/values-fr/strings.xmlindex 873bdfb2c8..8164ca42fd 100644--- a/web/src/main/res/values-fr/strings.xml+++ b/web/src/main/res/values-fr/strings.xml@@ -15,7 +15,6 @@     <string name="your_choice_is_saved_per_site_change_it">Votre choix est enregistré pour chaque site. Modifiez-le dans Paramètres → Données des sites.</string>     <string name="javascript">JavaScript</string>     <string name="installed_apps">Applications installées</string>-    <string name="engine">Moteur : %1$s</string>     <string name="cookies_cache_history_storage_permission">Cookies, cache, historique, stockage et autorisations</string>     <string name="permissions">Autorisations</string>     <string name="choose_files">Choisir des fichiers</string>@@ -46,7 +45,6 @@         <item quantity="many">%1$s PWA</item>         <item quantity="other">%1$s PWA</item>     </plurals>-    <string name="about">À propos</string>     <string name="private_prefix">Privé •</string>     <string name="site_data">Données des sites</string>     <string name="privacy_data">Confidentialité et données</string>@@ -83,6 +81,7 @@     <string name="search_engine">Moteur de recherche</string>     <string name="bookmarks">Favoris</string>     <string name="allow_to_access">Autoriser %1$s à y accéder ?</string>+    <string name="clear_all_tabs">Fermer tous les onglets</string>     <string name="new_window">Nouvelle fenêtre</string>     <string name="new_incognito_window">Nouvelle fenêtre de navigation privée</string>     <string name="new_incognito_tab">Nouvel onglet de navigation privée</string>
web/src/main/res/values-it/strings.xml
diff --git a/web/src/main/res/values-it/strings.xml b/web/src/main/res/values-it/strings.xmlindex 2bc3551f2c..8a4326b998 100644--- a/web/src/main/res/values-it/strings.xml+++ b/web/src/main/res/values-it/strings.xml@@ -61,7 +61,6 @@         <item quantity="many">%1$s PWA</item>         <item quantity="other">%1$s PWA</item>     </plurals>-    <string name="engine">Motore: %1$s</string>     <string name="allow_to_access">Concedere a %1$s di accedere?</string>     <string name="wants_to_know_your_location">%1$s desidera conoscere la tua posizione.</string>     <string name="accepted">Accettato: %1$s</string>@@ -76,7 +75,7 @@     <string name="privacy_data">Privacy e dati</string>     <string name="clear_browsing_data">Cancella dati di navigazione</string>     <string name="cookies_cache_history_storage_permission">Cookie, cache, cronologia, archiviazione, autorizzazioni</string>-    <string name="about">Informazioni</string>     <string name="no_site_data_yet_cookies_localstorage_in">Nessun dato del sito ancora presente. Cookie, localStorage, IndexedDB e autorizzazioni persistono tra i caricamenti nella directory del profilo WebView. Le schede private sono escluse.</string>     <string name="open_a_site_and_tap_menu_install_app_add">Apri un sito e tocca Menu → Installa app / Aggiungi a schermata home. Crea una scorciatoia bloccata che avvia PwaActivity in modo autonomo (senza l\'interfaccia del browser). L\'icona utilizza l\'icona migliore 192x192 o apple-touch-icon; in alternativa usa un riaquadro con lettera.</string>+    <string name="clear_all_tabs">Chiudi tutte le schede</string> </resources>
web/src/main/res/values-ja/strings.xml
diff --git a/web/src/main/res/values-ja/strings.xml b/web/src/main/res/values-ja/strings.xmlindex 37b261b746..b9aec6a529 100644--- a/web/src/main/res/values-ja/strings.xml+++ b/web/src/main/res/values-ja/strings.xml@@ -25,7 +25,6 @@     <string name="privacy_data">プライバシーとデータ</string>     <string name="clear_browsing_data">ブラウジングデータを消去</string>     <string name="cookies_cache_history_storage_permission">Cookie、キャッシュ、履歴、ストレージ、権限</string>-    <string name="about">このアプリについて</string>     <string name="clear_browsing_data_2">ブラウジングデータを消去しますか?</string>     <string name="clears_cookies_cache_storage_history_dow">Cookie、キャッシュ、ストレージ、履歴、ダウンロード、権限が消去されます。タブは開き続けます。</string>     <string name="your_choice_is_saved_per_site_change_it">この選択はウェブサイトごとに保存されます。「設定 → ウェブサイトのデータ」から変更できます。</string>@@ -66,7 +65,6 @@     <plurals name="pwas">         <item quantity="other">%1$s 個のPWA</item>     </plurals>-    <string name="engine">エンジン: %1$s</string>     <string name="allow_to_access">%1$s のアクセスを許可しますか?</string>     <string name="wants_to_know_your_location">%1$s は位置情報を必要としています。</string>     <string name="accepted">許可: %1$s</string>@@ -75,6 +73,7 @@     <string name="shortcuts_launch_pwaactivity_standalone">ショートカットはPwaActivityスタンドアローンのWebView (操作、ダウンロード、サードパーティー cookie が有効化)で起動します。「ここを削除」はデータベースのエントリを削除します。その場合、ピン留めされたランチャーアイコンは長押しで削除する必要があります。</string>     <string name="bookmarks_inside_will_also_be_deleted">ブックマーク「%1$s」も削除されました。</string>     <string name="share_link">リンクを共有</string>+    <string name="clear_all_tabs">すべてのタブを閉じる</string>     <string name="new_window">新しいウィンドウ</string>     <string name="new_incognito_window">新しいシークレットウィンドウ</string>     <string name="new_incognito_tab">新しいシークレットタブ</string>
web/src/main/res/values-ru/strings.xml
diff --git a/web/src/main/res/values-ru/strings.xml b/web/src/main/res/values-ru/strings.xmlindex e9f0457e55..af7849e171 100644--- a/web/src/main/res/values-ru/strings.xml+++ b/web/src/main/res/values-ru/strings.xml@@ -28,7 +28,6 @@     <string name="privacy_data">Конфиденциальность и данные</string>     <string name="clear_browsing_data">Очистить данные просмотра</string>     <string name="cookies_cache_history_storage_permission">Cookies, кэш, история, хранилище, разрешения</string>-    <string name="about">О приложении</string>     <string name="clear_browsing_data_2">Очистить данные просмотра?</string>     <string name="clears_cookies_cache_storage_history_dow">Очищает cookies, кэш, хранилище, историю, загрузки, разрешения. Вкладки остаются открытыми.</string>     <string name="your_choice_is_saved_per_site_change_it">Ваш выбор сохраняется по сайтам. Изменить его в Настройках → Данных сайта.</string>@@ -81,7 +80,6 @@         <item quantity="many">%1$s PWA</item>         <item quantity="other">%1$s PWA</item>     </plurals>-    <string name="engine">Движок: %1$s</string>     <string name="allow_to_access">Предоставить %1$s доступ?</string>     <string name="wants_to_know_your_location">%1$s хочет знать ваше местоположение.</string>     <string name="accepted">Принято: %1$s</string>@@ -89,6 +87,7 @@     <string name="open_a_site_and_tap_menu_install_app_add">Откройте сайт и нажмите Меню → Установить приложение / Добавить на домашний экран. Создает встроенный ярлык запуска PwaActivity (без браузера chrome). По возможности использует лучшую икону 192x192.</string>     <string name="shortcuts_launch_pwaactivity_standalone">Ярлыки запускают PwaActivity в автономном WebView (обработка разрешений, загрузки, сторонние файлы cookie включены). \"Удалить здесь\" удаляет записи DB; ярлык должен быть удален с помощью долгого нажатия.</string>     <string name="bookmarks_inside_will_also_be_deleted">Закладки внутри «%1$s» также будут удалены.</string>+    <string name="clear_all_tabs">Закрыть все вкладки</string>     <string name="new_window">Новое окно</string>     <string name="new_incognito_window">Новое окно Инкогнито</string>     <string name="new_incognito_tab">Новая вкладка Incognito</string>
web/src/main/res/values-sv/strings.xml
diff --git a/web/src/main/res/values-sv/strings.xml b/web/src/main/res/values-sv/strings.xmlindex 57a44704dd..8dc210988e 100644--- a/web/src/main/res/values-sv/strings.xml+++ b/web/src/main/res/values-sv/strings.xml@@ -28,7 +28,6 @@     <string name="privacy_data">Integritet och data</string>     <string name="clear_browsing_data">Rensa webbinformation</string>     <string name="cookies_cache_history_storage_permission">Cookies, cache, historik, lagring, behörigheter</string>-    <string name="about">Om</string>     <string name="clear_browsing_data_2">Rensa webbinformation?</string>     <string name="clears_cookies_cache_storage_history_dow">Rensar cookies, cache, lagring, historik, hämtningar och behörigheter. Flikarna förblir öppna.</string>     <string name="your_choice_is_saved_per_site_change_it">Ditt val sparas för varje webbplats. Ändra det i Inställningar → Webbplatsdata.</string>@@ -72,7 +71,6 @@         <item quantity="one">%1$s PWA</item>         <item quantity="other">%1$s PWA:er</item>     </plurals>-    <string name="engine">Motor: %1$s</string>     <string name="allow_to_access">Tillåt att %1$s får åtkomst?</string>     <string name="wants_to_know_your_location">%1$s vill veta var du är.</string>     <string name="accepted">Godkänd: %1$s</string>@@ -81,6 +79,7 @@     <string name="shortcuts_launch_pwaactivity_standalone">Genvägar startar PwaActivity som en fristående WebView med behörighetshantering, hämtningar och tredjepartscookies aktiverade. Om du tar bort den här raderas databasposten; en redan fäst startskärmsikon måste tas bort genom att hålla ned den.</string>     <string name="bookmarks_inside_will_also_be_deleted">Bokmärken i \"%1$s\" tas också bort.</string>     <string name="share_link">Dela länk</string>+    <string name="clear_all_tabs">Stäng alla flikar</string>     <string name="new_window">Nytt fönster</string>     <string name="new_incognito_window">Nytt inkognitofönster</string>     <string name="new_incognito_tab">Ny inkognitoflik</string>
web/src/main/res/values-zh-rCN/strings.xml
diff --git a/web/src/main/res/values-zh-rCN/strings.xml b/web/src/main/res/values-zh-rCN/strings.xmlindex d362151fd2..ef9d6c7c3b 100644--- a/web/src/main/res/values-zh-rCN/strings.xml+++ b/web/src/main/res/values-zh-rCN/strings.xml@@ -15,7 +15,6 @@     <string name="your_choice_is_saved_per_site_change_it">您的选择按网站保存。可在设置 → 网站数据中进行更改。</string>     <string name="javascript">JavaScript</string>     <string name="installed_apps">已安装应用</string>-    <string name="engine">引擎:%1$s</string>     <string name="cookies_cache_history_storage_permission">Cookie、缓存、历史记录、存储、权限</string>     <string name="permissions">权限</string>     <string name="choose_files">选择文件</string>@@ -42,7 +41,6 @@     <plurals name="pwas">         <item quantity="other">%1$s 个 PWA</item>     </plurals>-    <string name="about">关于</string>     <string name="private_prefix">私密 •</string>     <string name="site_data">网站数据</string>     <string name="privacy_data">隐私和数据</string>@@ -75,6 +73,7 @@     <string name="search_engine">搜索引擎</string>     <string name="bookmarks">书签</string>     <string name="allow_to_access">允许 %1$s 访问吗?</string>+    <string name="clear_all_tabs">关闭所有标签页</string>     <string name="new_window">新窗口</string>     <string name="new_incognito_window">新无痕窗口</string>     <string name="new_incognito_tab">新无痕标签页</string>
web/src/main/res/values/strings.xml
diff --git a/web/src/main/res/values/strings.xml b/web/src/main/res/values/strings.xmlindex 3399589a99..e13030630c 100644--- a/web/src/main/res/values/strings.xml+++ b/web/src/main/res/values/strings.xml@@ -27,7 +27,6 @@     <string name="privacy_data">Privacy &amp; data</string>     <string name="clear_browsing_data">Clear browsing data</string>     <string name="cookies_cache_history_storage_permission">Cookies, cache, history, storage, permissions</string>-    <string name="about">About</string>     <string name="clear_browsing_data_2">Clear browsing data?</string>     <string name="clears_cookies_cache_storage_history_dow">Clears cookies, cache, storage, history, downloads, permissions. Tabs stay open.</string>     <string name="your_choice_is_saved_per_site_change_it">Your choice is saved per site. Change it in Settings → Site data.</string>@@ -72,7 +71,6 @@         <item quantity="one">%1$s PWA</item>         <item quantity="other">%1$s PWAs</item>     </plurals>-    <string name="engine">Engine: %1$s</string>     <string name="allow_to_access">Allow %1$s to access?</string>     <string name="wants_to_know_your_location">%1$s wants to know your location.</string>     <string name="accepted">Accepted: %1$s</string>@@ -81,6 +79,7 @@     <string name="shortcuts_launch_pwaactivity_standalone">Shortcuts open sites on their own without browser controls. Removing one here deletes it; remove a pinned icon by long-pressing it.</string>     <string name="bookmarks_inside_will_also_be_deleted">Bookmarks inside \"%1$s\" will also be deleted.</string>     <string name="share_link">Share link</string>+    <string name="clear_all_tabs">Clear all tabs</string>     <string name="new_window">New Window</string>     <string name="new_incognito_window">New Incognito Window</string>     <string name="new_incognito_tab">New Incognito Tab</string>
web/src/test/java/com/vayunmathur/web/platform/BrowserStateTest.kt
diff --git a/web/src/test/java/com/vayunmathur/web/platform/BrowserStateTest.kt b/web/src/test/java/com/vayunmathur/web/platform/BrowserStateTest.ktindex 5666fc88de..ea09f129f7 100644--- a/web/src/test/java/com/vayunmathur/web/platform/BrowserStateTest.kt+++ b/web/src/test/java/com/vayunmathur/web/platform/BrowserStateTest.kt@@ -53,12 +53,25 @@ class BrowserStateTest {     }      @Test-    fun `self-hosted is only effective in dev builds`() {-        val eff = SearchEngine.effective(SearchEngine.SELF_HOSTED)-        assertTrue(eff == SearchEngine.SELF_HOSTED || eff == SearchEngine.DEFAULT)+    fun `MA Search is pickable and effective in every build`() {+        assertEquals("MA Search", SearchEngine.SELF_HOSTED.displayName)+        assertTrue(SearchEngine.SELF_HOSTED in SearchEngine.PICKABLE)+        assertEquals(SearchEngine.SELF_HOSTED, SearchEngine.effective(SearchEngine.SELF_HOSTED))         assertEquals(SearchEngine.GOOGLE, SearchEngine.effective(SearchEngine.GOOGLE))     } +    @Test+    fun `MA Search builds query urls against the first-party search API`() {+        assertEquals(+            "https://api.maproj.org/api/search?q=hello%20world",+            SearchEngine.SELF_HOSTED.buildQueryUrl("hello world"),+        )+        assertEquals(+            "https://api.maproj.org/api/search",+            SearchEngine.SELF_HOSTED.homepage,+        )+    }+     // ---------------------------------------------------------- BrowserUtils      @Test
web/src/test/java/com/vayunmathur/web/platform/WebViewModelTest.kt
diff --git a/web/src/test/java/com/vayunmathur/web/platform/WebViewModelTest.kt b/web/src/test/java/com/vayunmathur/web/platform/WebViewModelTest.ktindex bd76a7cfe1..21d0cea296 100644--- a/web/src/test/java/com/vayunmathur/web/platform/WebViewModelTest.kt+++ b/web/src/test/java/com/vayunmathur/web/platform/WebViewModelTest.kt@@ -98,6 +98,28 @@ class WebViewModelTest {         assertTrue(v.activeTab!!.isNewTab)     } +    @Test fun closingLastTabReplacesItWithFreshNewTab() {+        val v = vm()+        v.newTab(url = "https://only.example")+        val oldId = v.activeTabId+        v.closeTab(oldId!!)+        assertEquals(1, v.tabs.size)+        assertTrue(v.activeTab!!.isNewTab)+        assertTrue(v.activeTabId != oldId)+    }++    @Test fun clearAllTabsLeavesExactlyOneFreshTab() {+        val v = vm()+        v.newTab(url = "https://a.example"); v.newTab(url = "https://b.example"); v.newTab(url = "https://c.example")+        val oldIds = v.tabs.map { it.id }.toSet()+        v.clearAllTabs()+        assertEquals(1, v.tabs.size)+        assertTrue(v.activeTab!!.isNewTab)+        assertEquals(v.tabs.single().id, v.activeTabId)+        assertTrue(v.activeTabId !in oldIds)+        assertEquals("", v.omniboxText)+    }+     @Test fun closeUnknownAndMoveValidation() {         val v = vm()         v.newTab(url = "https://a.example"); v.newTab(url = "https://b.example"); v.newTab(url = "https://c.example")
web/src/test/java/com/vayunmathur/web/ui/TabSwitcherTest.kt
diff --git a/web/src/test/java/com/vayunmathur/web/ui/TabSwitcherTest.kt b/web/src/test/java/com/vayunmathur/web/ui/TabSwitcherTest.ktindex c9900f6778..83f5b3df93 100644--- a/web/src/test/java/com/vayunmathur/web/ui/TabSwitcherTest.kt+++ b/web/src/test/java/com/vayunmathur/web/ui/TabSwitcherTest.kt@@ -1,10 +1,13 @@ package com.vayunmathur.web.ui  import androidx.compose.ui.test.assertIsDisplayed+import androidx.compose.ui.test.hasScrollAction import androidx.compose.ui.test.junit4.createComposeRule import androidx.compose.ui.test.onNodeWithContentDescription import androidx.compose.ui.test.onNodeWithText import androidx.compose.ui.test.performClick+import androidx.compose.ui.test.performScrollToIndex+import androidx.compose.ui.unit.dp import com.vayunmathur.web.platform.BrowserTab import kotlin.test.Test import kotlin.test.assertEquals@@ -67,6 +70,39 @@ class TabSwitcherTest {         assertTrue(opened)     } +    @Test+    fun `clear all tabs button closes every tab`() {+        var cleared = false+        rule.setContent {+            TabSwitcher(+                tabs = listOf(+                    BrowserTab(id = "1", url = "https://example.com", title = "Example"),+                    BrowserTab(id = "2", url = "https://other.org", title = "Other"),+                ),+                activeTabId = "1",+                onSwitch = {},+                onClose = {},+                onNewTab = {},+                onDismiss = {},+                onClearAll = { cleared = true },+            )+        }+        rule.waitForIdle()+        // The actions live below the tiles; scroll the grid so the footer composes.+        rule.onNode(hasScrollAction()).performScrollToIndex(2)+        rule.waitForIdle()+        rule.onNodeWithText("Clear all tabs").performClick()+        rule.waitForIdle()+        assertTrue(cleared)+    }++    @Test+    fun `tab grid keeps a bottom inset clear of the navigation area`() {+        // The switcher is a full-screen overlay: the inset below its last row+        // must clear the bottom browser toolbar plus the system nav bar.+        assertTrue(TAB_SWITCHER_BOTTOM_INSET >= 64.dp)+    }+     @Test     fun `an empty switcher offers a new tab button`() {         var opened = false