Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,3 +152,4 @@ Breakdown the big Ripple monolith into smaller runtime extensions using a standa
## Further Reading

[How-to](./docs/how-to.md)
# Test change for pre-push hook demo
8 changes: 4 additions & 4 deletions core/main/src/firebolt/handlers/discovery_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ impl DiscoveryServer for DiscoveryImpl {
) -> RpcResult<bool> {
let response = ProviderResponse {
correlation_id: entity_info.correlation_id,
result: ProviderResponsePayload::EntityInfoResponse(entity_info.result),
result: ProviderResponsePayload::EntityInfoResponse(Box::new(entity_info.result)),
};
ProviderBroker::provider_response(&self.state, response).await;
Ok(true)
Expand Down Expand Up @@ -545,7 +545,7 @@ fn update_intent(

match request.intent.clone() {
Some(NavigationIntent::NavigationIntentStrict(navigation_intent)) => {
let updated_navigation_intent = match navigation_intent {
let updated_navigation_intent = match *navigation_intent {
NavigationIntentStrict::Home(mut home_intent) => {
home_intent.context.source = source;
home_intent.context.age_policy = new_age_policy;
Expand Down Expand Up @@ -600,9 +600,9 @@ fn update_intent(

LaunchRequest {
app_id: request.app_id,
intent: Some(NavigationIntent::NavigationIntentStrict(
intent: Some(NavigationIntent::NavigationIntentStrict(Box::new(
updated_navigation_intent,
)),
))),
}
}
Some(NavigationIntent::NavigationIntentLoose(mut loose_intent)) => {
Expand Down
2 changes: 1 addition & 1 deletion core/main/src/state/openrpc_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub mod openrpc_validator {
}
}

#[derive(Debug, Clone)]
#[derive(Debug, Clone, Default)]
pub struct RpcMethodValidator;

impl RpcMethodValidator {
Expand Down
8 changes: 4 additions & 4 deletions core/sdk/src/api/apps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,15 @@ mod tests {
},
};

app.update_intent(NavigationIntent::NavigationIntentStrict(
app.update_intent(NavigationIntent::NavigationIntentStrict(Box::new(
NavigationIntentStrict::Home(home_intent.clone()),
));
)));

assert_eq!(
app.launch.intent,
Some(NavigationIntent::NavigationIntentStrict(
Some(NavigationIntent::NavigationIntentStrict(Box::new(
NavigationIntentStrict::Home(home_intent),
))
)))
);
}

Expand Down
16 changes: 9 additions & 7 deletions core/sdk/src/api/device/entertainment_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,23 +391,25 @@ pub struct ContentPolicy {
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
#[serde(untagged)]
pub enum NavigationIntent {
NavigationIntentStrict(NavigationIntentStrict),
NavigationIntentStrict(Box<NavigationIntentStrict>),
NavigationIntentLoose(NavigationIntentLoose),
}

// Original Navigation Intent is untagged meaning it cant be used to serialize again when passed between extensions which also uses serde
// To avoid the data loss during IEC InternalNavigationIntent is created so the Firebolt specification is not affected
#[derive(Debug, PartialEq, Serialize, Deserialize, Clone)]
pub enum InternalNavigationIntent {
NavigationIntentStrict(InternalNavigationIntentStrict),
NavigationIntentStrict(Box<InternalNavigationIntentStrict>),
NavigationIntentLoose(NavigationIntentLoose),
}

impl From<NavigationIntent> for InternalNavigationIntent {
fn from(value: NavigationIntent) -> Self {
match value {
NavigationIntent::NavigationIntentLoose(l) => Self::NavigationIntentLoose(l),
NavigationIntent::NavigationIntentStrict(s) => Self::NavigationIntentStrict(s.into()),
NavigationIntent::NavigationIntentStrict(s) => {
Self::NavigationIntentStrict(Box::new((*s).into()))
}
}
}
}
Expand All @@ -418,17 +420,17 @@ impl From<InternalNavigationIntent> for NavigationIntent {
match value {
InternalNavigationIntent::NavigationIntentLoose(l) => Self::NavigationIntentLoose(l),
InternalNavigationIntent::NavigationIntentStrict(s) => {
Self::NavigationIntentStrict(s.into())
Self::NavigationIntentStrict(Box::new((*s).into()))
}
}
}
}

impl Default for NavigationIntent {
fn default() -> Self {
NavigationIntent::NavigationIntentStrict(
NavigationIntentStrict::Home(HomeIntent::default()),
)
NavigationIntent::NavigationIntentStrict(Box::new(NavigationIntentStrict::Home(
HomeIntent::default(),
)))
}
}

Expand Down
16 changes: 9 additions & 7 deletions core/sdk/src/api/firebolt/fb_discovery.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,20 +484,22 @@ mod tests {

let launch_request = LaunchRequest {
app_id: "test_app".to_string(),
intent: Some(NavigationIntent::NavigationIntentStrict(
intent: Some(NavigationIntent::NavigationIntentStrict(Box::new(
NavigationIntentStrict::Home(home_intent),
)),
))),
};

let intent = launch_request.get_intent();
assert_eq!(
intent,
NavigationIntent::NavigationIntentStrict(NavigationIntentStrict::Home(HomeIntent {
context: DiscoveryContext {
source: "test_source".to_string(),
age_policy: None,
NavigationIntent::NavigationIntentStrict(Box::new(NavigationIntentStrict::Home(
HomeIntent {
context: DiscoveryContext {
source: "test_source".to_string(),
age_policy: None,
}
}
}))
)))
);
}

Expand Down
12 changes: 6 additions & 6 deletions core/sdk/src/api/firebolt/fb_lifecycle_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,23 +256,23 @@ mod tests {
fn test_get_launch_request() {
let launch_params = LifecycleManagementLaunchParameters {
app_id: "test_app".to_string(),
intent: Some(InternalNavigationIntent::NavigationIntentStrict(
intent: Some(InternalNavigationIntent::NavigationIntentStrict(Box::new(
InternalNavigationIntentStrict::Home(HomeIntent {
context: DiscoveryContext::new("voice", None),
}),
)),
))),
};

let launch_request = launch_params.get_launch_request();
assert_eq!(
launch_request,
LaunchRequest {
app_id: "test_app".to_string(),
intent: Some(NavigationIntent::NavigationIntentStrict(
intent: Some(NavigationIntent::NavigationIntentStrict(Box::new(
NavigationIntentStrict::Home(HomeIntent {
context: DiscoveryContext::new("voice", None),
}),
)),
))),
}
);
}
Expand Down Expand Up @@ -304,14 +304,14 @@ mod tests {
LifecycleManagementEventRequest::Launch(LifecycleManagementLaunchEvent {
parameters: LifecycleManagementLaunchParameters {
app_id: "example_app".to_string(),
intent: Some(InternalNavigationIntent::NavigationIntentStrict(
intent: Some(InternalNavigationIntent::NavigationIntentStrict(Box::new(
InternalNavigationIntentStrict::Home(HomeIntent {
context: DiscoveryContext {
source: "test_source".to_string(),
age_policy: None,
},
}),
)),
))),
},
});
let contract_type: RippleContract = RippleContract::Launcher;
Expand Down
19 changes: 11 additions & 8 deletions core/sdk/src/api/firebolt/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub enum ProviderResponsePayload {
GenericError(GenericProviderError),
PinChallengeResponse(PinChallengeResponse),
KeyboardResult(KeyboardSessionResponse),
EntityInfoResponse(Option<EntityInfoResult>),
EntityInfoResponse(Box<Option<EntityInfoResult>>),
PurchasedContentResponse(PurchasedContentResult),
GenericResponse(serde_json::Value),
}
Expand Down Expand Up @@ -109,7 +109,7 @@ impl ProviderResponsePayload {

pub fn as_entity_info_result(&self) -> Option<Option<EntityInfoResult>> {
match self {
ProviderResponsePayload::EntityInfoResponse(res) => Some(res.clone()),
ProviderResponsePayload::EntityInfoResponse(res) => Some((**res).clone()),
_ => None,
}
}
Expand All @@ -129,7 +129,9 @@ impl ProviderResponsePayload {
serde_json::to_value(res).unwrap()
}
ProviderResponsePayload::KeyboardResult(res) => serde_json::to_value(res).unwrap(),
ProviderResponsePayload::EntityInfoResponse(res) => serde_json::to_value(res).unwrap(),
ProviderResponsePayload::EntityInfoResponse(res) => {
serde_json::to_value(res.clone()).unwrap()
}
ProviderResponsePayload::PurchasedContentResponse(res) => {
serde_json::to_value(res).unwrap()
}
Expand Down Expand Up @@ -341,11 +343,12 @@ mod tests {
audio_descriptions: Some(vec!["en".to_string()]),
}]),
};
let response = ProviderResponsePayload::EntityInfoResponse(Some(EntityInfoResult {
expires: "expires".to_string(),
entity: entity_info.clone(),
related: None,
}));
let response =
ProviderResponsePayload::EntityInfoResponse(Box::new(Some(EntityInfoResult {
expires: "expires".to_string(),
entity: entity_info.clone(),
related: None,
})));
assert_eq!(
response.as_entity_info_result(),
Some(Some(EntityInfoResult {
Expand Down
8 changes: 4 additions & 4 deletions core/sdk/src/api/manifest/app_library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ impl AppLibrary {
error!("Local manifests not supported yet");
None
}
AppManifestLoad::Embedded(manifest) => Some(manifest.clone()),
AppManifestLoad::Embedded(manifest) => Some((**manifest).clone()),
}
}

Expand Down Expand Up @@ -123,12 +123,12 @@ mod tests {
AppLibraryEntry {
app_id: "app1".to_string(),
boot_state: BootState::Foreground,
manifest: AppManifestLoad::Embedded(AppManifest::default()),
manifest: AppManifestLoad::Embedded(Box::default()),
},
AppLibraryEntry {
app_id: "app2".to_string(),
boot_state: BootState::Unloaded,
manifest: AppManifestLoad::Embedded(AppManifest::default()),
manifest: AppManifestLoad::Embedded(Box::default()),
},
]
}
Expand Down Expand Up @@ -161,7 +161,7 @@ mod tests {
Some(AppLibraryEntry {
app_id: "app1".to_string(),
boot_state: BootState::Foreground,
manifest: AppManifestLoad::Embedded(AppManifest::default()),
manifest: AppManifestLoad::Embedded(Box::default()),
})
);
}
Expand Down
2 changes: 1 addition & 1 deletion core/sdk/src/api/manifest/device_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ pub struct AppLibraryEntry {
pub enum AppManifestLoad {
Remote(String),
Local(String),
Embedded(AppManifest),
Embedded(Box<AppManifest>),
}

#[derive(Serialize, Deserialize, Debug, Clone)]
Expand Down
2 changes: 1 addition & 1 deletion core/sdk/src/extn/extn_client_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ pub enum ExtnResponse {
StorageData(StorageData),
NetworkResponse(NetworkResponse),
TimezoneWithOffset(String, i64),
DefaultApp(AppLibraryEntry),
DefaultApp(Box<AppLibraryEntry>),
Settings(HashMap<String, SettingValue>),
BoolMap(HashMap<String, bool>),
}
Expand Down