commit 46886fd6617d79a46d2f8273753e170a898b5f88
parent eae555791f606b6987b8654b0ce287ef2eebc2d7
Author: Harrison Oglesby <oglesby.harrison@gmail.com>
Date: Tue, 30 Sep 2025 22:38:02 +0000
Bug 1990025 - Add SettingsSearchItem r=android-reviewers,skhan
Differential Revision: https://phabricator.services.mozilla.com/D265890
Diffstat:
1 file changed, 46 insertions(+), 0 deletions(-)
diff --git a/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/settingssearch/SettingsSearchItem.kt b/mobile/android/fenix/app/src/main/java/org/mozilla/fenix/settings/settingssearch/SettingsSearchItem.kt
@@ -0,0 +1,46 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+package org.mozilla.fenix.settings.settingssearch
+
+/**
+ * Class representing a settings item in the Settings Search.
+ *
+ * @property title Title [String] of the settings item.
+ * @property summary Summary [String] of the settings item.
+ * @property preferenceKey Preference key [String] of the settings item.
+ * @property breadcrumbs Breadcrumbs [List] of [String]s that leads to the settings item.
+ * [0] is the section on the main Settings page
+ * [1] is the subPage title, if any
+ * [2] is the subPage section, if any
+ */
+data class SettingsSearchItem(
+ val title: String,
+ val summary: String,
+ val preferenceKey: String,
+ val breadcrumbs: List<String>,
+) {
+
+ /**
+ * Copy this [SettingsSearchItem] with the given parameters replaced.
+ *
+ * @param title New title [String].
+ * @param summary New summary [String].
+ * @param preferenceKey New preference key [String].
+ * @param breadcrumbs New breadcrumbs [List] of [String]s.
+ */
+ fun copyWith(
+ title: String? = null,
+ summary: String? = null,
+ preferenceKey: String? = null,
+ breadcrumbs: List<String>? = null,
+ ): SettingsSearchItem {
+ return SettingsSearchItem(
+ title = title ?: this.title,
+ summary = summary ?: this.summary,
+ preferenceKey = preferenceKey ?: this.preferenceKey,
+ breadcrumbs = breadcrumbs ?: this.breadcrumbs,
+ )
+ }
+}