Skip to content

Commit

Permalink
add us_privacy string for any partner outside of US (#645)
Browse files Browse the repository at this point in the history
  • Loading branch information
maggie98choy authored Oct 7, 2024
1 parent 9b6ab2e commit 358f316
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
13 changes: 12 additions & 1 deletion core/main/src/firebolt/handlers/privacy_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,24 @@ impl AllowAppContentAdTargetingSettings {
};

[
(country_code == "US").then(|| (US_PRIVACY_KEY.to_owned(), self.us_privacy.to_owned())),
(country_code == "US"
|| Self::allow_using_us_privacy(platform_state.clone(), &country_code.to_string()))
.then(|| (US_PRIVACY_KEY.to_owned(), self.us_privacy.to_owned())),
Some((LMT_KEY.to_owned(), self.lmt.to_owned())),
]
.into_iter()
.flatten()
.collect()
}

fn allow_using_us_privacy(state: PlatformState, country_code: &String) -> bool {
let countries_using_us_privacy = state
.get_device_manifest()
.configuration
.default_values
.countries_using_us_privacy;
countries_using_us_privacy.contains(country_code)
}
}

impl Default for AllowAppContentAdTargetingSettings {
Expand Down
8 changes: 8 additions & 0 deletions core/sdk/src/api/manifest/device_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ pub struct DefaultValues {
pub role_based_support: bool,
#[serde(default = "country_postal_code_default")]
pub country_postal_code: HashMap<String, String>,
#[serde(default = "countries_using_us_privacy_default")]
pub countries_using_us_privacy: Vec<String>,
}

pub fn name_default() -> String {
Expand All @@ -358,6 +360,10 @@ pub fn default_video_dimensions() -> Vec<i32> {
vec![1920, 1080]
}

pub fn countries_using_us_privacy_default() -> Vec<String> {
Vec::new()
}

fn country_postal_code_default() -> HashMap<String, String> {
let mut default_map = HashMap::default();
default_map.insert("USA".to_string(), "66952".to_string());
Expand Down Expand Up @@ -454,6 +460,7 @@ impl Default for DefaultValues {
accessibility_audio_description_settings: false,
role_based_support: false,
country_postal_code: country_postal_code_default(),
countries_using_us_privacy: countries_using_us_privacy_default(),
}
}
}
Expand Down Expand Up @@ -924,6 +931,7 @@ pub(crate) mod tests {
accessibility_audio_description_settings: false,
role_based_support: false,
country_postal_code: HashMap::new(),
countries_using_us_privacy: Vec::new(),
},
settings_defaults_per_app: HashMap::new(),
model_friendly_names: {
Expand Down

0 comments on commit 358f316

Please sign in to comment.