Skip to content

Commit

Permalink
feat: cleanup unused default manifest (#662)
Browse files Browse the repository at this point in the history
* feat: cleanup unused default manifest
  • Loading branch information
maggie98choy authored Oct 28, 2024
1 parent ce96f61 commit b897614
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 34 deletions.
17 changes: 4 additions & 13 deletions core/main/src/processor/storage/default_storage_properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ use ripple_sdk::{
KEY_ALLOW_WATCH_HISTORY, KEY_AUDIO_DESCRIPTION_ENABLED, KEY_BACKGROUND_COLOR,
KEY_BACKGROUND_OPACITY, KEY_COUNTRY_CODE, KEY_ENABLED, KEY_FONT_COLOR, KEY_FONT_EDGE,
KEY_FONT_EDGE_COLOR, KEY_FONT_FAMILY, KEY_FONT_OPACITY, KEY_FONT_SIZE, KEY_LANGUAGE,
KEY_LOCALE, KEY_NAME, KEY_POSTAL_CODE, KEY_SKIP_RESTRICTION, KEY_TEXT_ALIGN,
KEY_TEXT_ALIGN_VERTICAL, KEY_WINDOW_COLOR, KEY_WINDOW_OPACITY, NAMESPACE_ADVERTISING,
NAMESPACE_AUDIO_DESCRIPTION, NAMESPACE_CLOSED_CAPTIONS, NAMESPACE_DEVICE_NAME,
NAMESPACE_LOCALIZATION, NAMESPACE_PRIVACY,
KEY_LOCALE, KEY_NAME, KEY_SKIP_RESTRICTION, KEY_TEXT_ALIGN, KEY_TEXT_ALIGN_VERTICAL,
KEY_WINDOW_COLOR, KEY_WINDOW_OPACITY, NAMESPACE_ADVERTISING, NAMESPACE_AUDIO_DESCRIPTION,
NAMESPACE_CLOSED_CAPTIONS, NAMESPACE_DEVICE_NAME, NAMESPACE_LOCALIZATION,
NAMESPACE_PRIVACY,
},
log::trace,
};
Expand Down Expand Up @@ -251,15 +251,6 @@ impl DefaultStorageProperties {
key.to_owned(),
)),
}
} else if let Some(defaults) = state
.get_device_manifest()
.get_settings_defaults_per_app()
.get(namespace)
{
match key {
KEY_POSTAL_CODE => Ok(defaults.postal_code.clone()),
_ => Err(DefaultStoragePropertiesError::NotFound(key.to_owned())),
}
} else {
Err(DefaultStoragePropertiesError::UnreconizedNamespace(
namespace.to_owned(),
Expand Down
23 changes: 2 additions & 21 deletions core/sdk/src/api/manifest/device_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ pub struct RippleConfiguration {
#[serde(default)]
pub default_values: DefaultValues,
#[serde(default)]
pub settings_defaults_per_app: HashMap<String, SettingsDefaults>,
#[serde(default)]
pub model_friendly_names: HashMap<String, String>,
pub distributor_experience_id: String,
pub distributor_services: Option<Value>,
Expand Down Expand Up @@ -361,14 +359,11 @@ pub fn default_video_dimensions() -> Vec<i32> {
}

pub fn countries_using_us_privacy_default() -> Vec<String> {
Vec::new()
vec!["CA".to_string()]
}

fn country_postal_code_default() -> HashMap<String, String> {
let mut default_map = HashMap::default();
default_map.insert("USA".to_string(), "66952".to_string());
default_map.insert("CAN".to_string(), "L6T 0C1".to_string());
default_map
HashMap::default()
}

#[derive(Deserialize, Debug, Clone, Default)]
Expand Down Expand Up @@ -726,7 +721,6 @@ impl Default for RippleConfiguration {
distribution_id_salt: None,
form_factor: Default::default(),
default_values: DefaultValues::default(),
settings_defaults_per_app: Default::default(),
model_friendly_names: Default::default(),
distributor_experience_id: Default::default(),
distributor_services: None,
Expand Down Expand Up @@ -836,10 +830,6 @@ impl DeviceManifest {
self.configuration.features.clone()
}

pub fn get_settings_defaults_per_app(&self) -> HashMap<String, SettingsDefaults> {
self.configuration.clone().settings_defaults_per_app
}

pub fn get_model_friendly_names(&self) -> HashMap<String, String> {
self.configuration.model_friendly_names.clone()
}
Expand Down Expand Up @@ -933,7 +923,6 @@ pub(crate) mod tests {
country_postal_code: HashMap::new(),
countries_using_us_privacy: Vec::new(),
},
settings_defaults_per_app: HashMap::new(),
model_friendly_names: {
let mut names = HashMap::new();
names.insert("RSPPI".to_string(), "Raspberry PI".to_string());
Expand Down Expand Up @@ -1114,14 +1103,6 @@ pub(crate) mod tests {
);
}

#[test]
fn test_get_settings_defaults_per_app() {
let manifest = DeviceManifest::mock();
let settings_defaults_per_app = manifest.get_settings_defaults_per_app();

assert_eq!(settings_defaults_per_app, HashMap::new());
}

#[test]
fn test_get_model_friendly_names() {
let manifest = DeviceManifest::mock();
Expand Down

0 comments on commit b897614

Please sign in to comment.