Skip to content

Commit 4e27372

Browse files
authored
RPPL-3821: Backporting fb marketplace app api changes. (#943)
* RPPL-3821: remove unused variable.
1 parent d507b60 commit 4e27372

File tree

1 file changed

+71
-122
lines changed

1 file changed

+71
-122
lines changed

core/main/src/firebolt/handlers/discovery_rpc.rs

Lines changed: 71 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ use ripple_sdk::{
4343
firebolt::{
4444
fb_capabilities::FireboltCap,
4545
fb_discovery::{
46-
AgePolicy, LaunchRequest, DISCOVERY_EVENT_ON_NAVIGATE_TO, ENTITY_INFO_CAPABILITY,
46+
LaunchRequest, DISCOVERY_EVENT_ON_NAVIGATE_TO, ENTITY_INFO_CAPABILITY,
4747
ENTITY_INFO_EVENT, EVENT_DISCOVERY_POLICY_CHANGED, PURCHASED_CONTENT_CAPABILITY,
4848
PURCHASED_CONTENT_EVENT,
4949
},
@@ -256,7 +256,7 @@ impl DiscoveryServer for DiscoveryImpl {
256256
DiscoveryImpl::get_content_policy(&ctx, &self.state, &ctx.app_id).await
257257
}
258258

259-
async fn launch(&self, ctx: CallContext, request: LaunchRequest) -> RpcResult<bool> {
259+
async fn launch(&self, _ctx: CallContext, request: LaunchRequest) -> RpcResult<bool> {
260260
let app_defaults_configuration = self.state.get_device_manifest().applications.defaults;
261261

262262
let intent_validation_config = self
@@ -265,18 +265,6 @@ impl DiscoveryServer for DiscoveryImpl {
265265
.get_features()
266266
.intent_validation;
267267
validate_navigation_intent(intent_validation_config, request.intent.clone()).await?;
268-
let policy_ids = self
269-
.state
270-
.policy_state
271-
.policy_identifiers_alias
272-
.read()
273-
.unwrap()
274-
.clone();
275-
let req_updated_source = update_intent(ctx.app_id.clone(), policy_ids, request.clone());
276-
info!(
277-
"Discovery.launch: req_updated_source: {:?}",
278-
&req_updated_source
279-
);
280268

281269
if let Some(reserved_app_id) =
282270
app_defaults_configuration.get_reserved_application_id(&request.app_id)
@@ -294,9 +282,9 @@ impl DiscoveryServer for DiscoveryImpl {
294282
match BrokerUtils::process_internal_main_request(
295283
&self.state.clone(),
296284
"discovery.launch.internal",
297-
Some(serde_json::to_value(req_updated_source).map_err(|e| {
285+
Some(serde_json::to_value(request).map_err(|e| {
298286
error!("Serialization error: {:?}", e);
299-
rpc_err("Failed to serialize SectionIntent")
287+
rpc_err("Failed to serialize LaunchIntent")
300288
})?),
301289
)
302290
.await
@@ -310,47 +298,7 @@ impl DiscoveryServer for DiscoveryImpl {
310298
return Err(rpc_err("Internal subscription launch failed"));
311299
}
312300
}
313-
314-
// Not validating the intent, pass-through to app as is.
315-
// if !AppEvents::is_app_registered_for_event(
316-
// &self.state,
317-
// reserved_app_id.to_string(),
318-
// DISCOVERY_EVENT_ON_NAVIGATE_TO,
319-
// ) {
320-
// return Err(rpc_navigate_reserved_app_err(
321-
// format!("Discovery.launch: reserved app id {} is not registered for discovery.onNavigateTo event",
322-
// reserved_app_id).as_str(),
323-
// ));
324-
// }
325-
// emit EVENT_ON_NAVIGATE_TO to the reserved app.
326-
// AppEvents::emit_to_app(
327-
// &self.state,
328-
// reserved_app_id.to_string(),
329-
// DISCOVERY_EVENT_ON_NAVIGATE_TO,
330-
// &serde_json::to_value(req_updated_source.intent).unwrap(),
331-
// )
332-
// .await;
333-
// info!(
334-
// "emit_to_app called for app {} event {}",
335-
// reserved_app_id.to_string(),
336-
// DISCOVERY_EVENT_ON_NAVIGATE_TO
337-
// );
338-
// return Ok(true);
339301
}
340-
// let (app_resp_tx, app_resp_rx) = oneshot::channel::<AppResponse>();
341-
342-
// let app_request =
343-
// AppRequest::new(AppMethod::Launch(req_updated_source.clone()), app_resp_tx);
344-
345-
// if self
346-
// .state
347-
// .get_client()
348-
// .send_app_request(app_request)
349-
// .is_ok()
350-
// && app_resp_rx.await.is_ok()
351-
// {
352-
// return Ok(true);
353-
// }
354302

355303
Err(jsonrpsee::core::Error::Custom(String::from(
356304
"Discovery.launch: some failure",
@@ -528,73 +476,74 @@ impl DiscoveryServer for DiscoveryImpl {
528476
Ok(true)
529477
}
530478
}
531-
fn update_intent(
532-
source: String,
533-
_policy_ids: Vec<AgePolicy>,
534-
request: LaunchRequest,
535-
) -> LaunchRequest {
536-
match request.intent.clone() {
537-
Some(NavigationIntent::NavigationIntentStrict(navigation_intent)) => {
538-
let updated_navigation_intent = match navigation_intent {
539-
NavigationIntentStrict::Home(mut home_intent) => {
540-
home_intent.context.source = source;
541-
NavigationIntentStrict::Home(home_intent)
542-
}
543-
NavigationIntentStrict::Launch(mut launch_intent) => {
544-
launch_intent.context.source = source;
545-
NavigationIntentStrict::Launch(launch_intent)
546-
}
547-
NavigationIntentStrict::Entity(mut entity_intent) => {
548-
entity_intent.context.source = source;
549-
NavigationIntentStrict::Entity(entity_intent)
550-
}
551-
NavigationIntentStrict::Playback(mut playback_intent) => {
552-
playback_intent.context.source = source;
553-
NavigationIntentStrict::Playback(playback_intent)
554-
}
555-
NavigationIntentStrict::Search(mut search_intent) => {
556-
search_intent.context.source = source;
557-
NavigationIntentStrict::Search(search_intent)
558-
}
559-
NavigationIntentStrict::Section(mut section_intent) => {
560-
section_intent.context.source = source;
561-
NavigationIntentStrict::Section(section_intent)
562-
}
563-
NavigationIntentStrict::Tune(mut tune_intent) => {
564-
tune_intent.context.source = source;
565-
NavigationIntentStrict::Tune(tune_intent)
566-
}
567-
NavigationIntentStrict::ProviderRequest(mut provider_request_intent) => {
568-
provider_request_intent.context.source = source;
569-
NavigationIntentStrict::ProviderRequest(provider_request_intent)
570-
}
571-
NavigationIntentStrict::PlayEntity(mut p) => {
572-
p.context.source = source;
573-
NavigationIntentStrict::PlayEntity(p)
574-
}
575-
NavigationIntentStrict::PlayQuery(mut p) => {
576-
p.context.source = source;
577-
NavigationIntentStrict::PlayQuery(p)
578-
}
579-
};
580479

581-
LaunchRequest {
582-
app_id: request.app_id,
583-
intent: Some(NavigationIntent::NavigationIntentStrict(
584-
updated_navigation_intent,
585-
)),
586-
}
587-
}
588-
Some(NavigationIntent::NavigationIntentLoose(mut loose_intent)) => {
589-
loose_intent.context.source = source;
590-
LaunchRequest {
591-
app_id: request.app_id,
592-
intent: Some(NavigationIntent::NavigationIntentLoose(loose_intent)),
593-
}
594-
}
595-
_ => request,
596-
}
597-
}
480+
// fn update_intent(
481+
// source: String,
482+
// _policy_ids: Vec<AgePolicy>,
483+
// request: LaunchRequest,
484+
// ) -> LaunchRequest {
485+
// match request.intent.clone() {
486+
// Some(NavigationIntent::NavigationIntentStrict(navigation_intent)) => {
487+
// let updated_navigation_intent = match navigation_intent {
488+
// NavigationIntentStrict::Home(mut home_intent) => {
489+
// home_intent.context.source = source;
490+
// NavigationIntentStrict::Home(home_intent)
491+
// }
492+
// NavigationIntentStrict::Launch(mut launch_intent) => {
493+
// launch_intent.context.source = source;
494+
// NavigationIntentStrict::Launch(launch_intent)
495+
// }
496+
// NavigationIntentStrict::Entity(mut entity_intent) => {
497+
// entity_intent.context.source = source;
498+
// NavigationIntentStrict::Entity(entity_intent)
499+
// }
500+
// NavigationIntentStrict::Playback(mut playback_intent) => {
501+
// playback_intent.context.source = source;
502+
// NavigationIntentStrict::Playback(playback_intent)
503+
// }
504+
// NavigationIntentStrict::Search(mut search_intent) => {
505+
// search_intent.context.source = source;
506+
// NavigationIntentStrict::Search(search_intent)
507+
// }
508+
// NavigationIntentStrict::Section(mut section_intent) => {
509+
// section_intent.context.source = source;
510+
// NavigationIntentStrict::Section(section_intent)
511+
// }
512+
// NavigationIntentStrict::Tune(mut tune_intent) => {
513+
// tune_intent.context.source = source;
514+
// NavigationIntentStrict::Tune(tune_intent)
515+
// }
516+
// NavigationIntentStrict::ProviderRequest(mut provider_request_intent) => {
517+
// provider_request_intent.context.source = source;
518+
// NavigationIntentStrict::ProviderRequest(provider_request_intent)
519+
// }
520+
// NavigationIntentStrict::PlayEntity(mut p) => {
521+
// p.context.source = source;
522+
// NavigationIntentStrict::PlayEntity(p)
523+
// }
524+
// NavigationIntentStrict::PlayQuery(mut p) => {
525+
// p.context.source = source;
526+
// NavigationIntentStrict::PlayQuery(p)
527+
// }
528+
// };
529+
530+
// LaunchRequest {
531+
// app_id: request.app_id,
532+
// intent: Some(NavigationIntent::NavigationIntentStrict(
533+
// updated_navigation_intent,
534+
// )),
535+
// }
536+
// }
537+
// Some(NavigationIntent::NavigationIntentLoose(mut loose_intent)) => {
538+
// loose_intent.context.source = source;
539+
// LaunchRequest {
540+
// app_id: request.app_id,
541+
// intent: Some(NavigationIntent::NavigationIntentLoose(loose_intent)),
542+
// }
543+
// }
544+
// _ => request,
545+
// }
546+
// }
598547

599548
pub async fn validate_navigation_intent(
600549
intent_validation_config: IntentValidation,

0 commit comments

Comments
 (0)