Skip to content

Commit

Permalink
Bug 1930984 - Implement default search engine selection on the search…
Browse files Browse the repository at this point in the history
… engine selector.
  • Loading branch information
Standard8 committed Nov 26, 2024
1 parent 564a561 commit 283bc6a
Show file tree
Hide file tree
Showing 6 changed files with 533 additions and 21 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions components/search/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ uniffi = { workspace = true }

[build-dependencies]
uniffi = { workspace = true, features = ["build"] }

[dev-dependencies]
lazy_static = "1.4"
33 changes: 32 additions & 1 deletion components/search/src/configuration_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,43 @@ pub(crate) struct JSONEngineRecord {
pub variants: Vec<JSONEngineVariant>,
}

#[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub(crate) struct JSONSpecificDefaultRecord {
/// The identifier of the engine that will be used as the application default
/// for the associated environment. If the entry is suffixed with a star,
/// matching is applied on a "starts with" basis.
#[serde(default)]
pub default: String,

/// The identifier of the engine that will be used as the application default
/// in private mode for the associated environment. If the entry is suffixed
/// with a star, matching is applied on a "starts with" basis.
#[serde(default)]
pub default_private: String,

/// The specific environment to match for this record.
pub environment: JSONVariantEnvironment,
}

/// Represents the default engines record.
#[derive(Debug, Deserialize, Clone)]
#[serde(rename_all = "camelCase")]
pub(crate) struct JSONDefaultEnginesRecord {
/// The identifier of the engine that will be used as the application default
/// if no other engines are specified as default.
pub global_default: String,
pub global_default_private: Option<String>,

/// The identifier of the engine that will be used as the application default
/// in private mode if no other engines are specified as default.
#[serde(default)]
pub global_default_private: String,

/// The specific environment filters to set a different default engine. The
/// array is ordered, when multiple entries match on environments, the later
/// entry will override earlier entries.
#[serde(default)]
pub specific_defaults: Vec<JSONSpecificDefaultRecord>,
}

/// Represents the engine orders record.
Expand Down
Loading

0 comments on commit 283bc6a

Please sign in to comment.