From cce3a8199d48ecbce536a0e49efd501d97a2b370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=96R=C3=96K=20Attila?= Date: Sat, 9 Jan 2021 20:36:56 +0100 Subject: [PATCH] web: Add a config option to disable the message about unsupported content --- core/src/player.rs | 14 +++++++++++++- web/packages/core/src/load-options.ts | 8 ++++++++ web/src/lib.rs | 7 +++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/core/src/player.rs b/core/src/player.rs index 42cb0060493b..e399a89edfe1 100644 --- a/core/src/player.rs +++ b/core/src/player.rs @@ -150,6 +150,8 @@ pub struct Player { swf: Arc, + warn_on_unsupported_content: bool, + is_playing: bool, needs_render: bool, @@ -241,6 +243,8 @@ impl Player { swf: fake_movie.clone(), + warn_on_unsupported_content: true, + is_playing: false, needs_render: true, @@ -535,6 +539,14 @@ impl Player { || (self.letterbox == Letterbox::Fullscreen && self.user_interface.is_fullscreen()) } + pub fn warn_on_unsupported_content(&self) -> bool { + self.warn_on_unsupported_content + } + + pub fn set_warn_on_unsupported_content(&mut self, warn_on_unsupported_content: bool) { + self.warn_on_unsupported_content = warn_on_unsupported_content + } + pub fn movie_width(&self) -> u32 { self.movie_width } @@ -868,7 +880,7 @@ impl Player { lib.register_character(id, crate::character::Character::MorphShape(morph_shape)); } }); - if is_action_script_3 { + if is_action_script_3 && self.warn_on_unsupported_content { self.user_interface.message("This SWF contains ActionScript 3 which is not yet supported by Ruffle. The movie may not work as intended."); } } diff --git a/web/packages/core/src/load-options.ts b/web/packages/core/src/load-options.ts index 43e569557e85..36f3bf8faca9 100644 --- a/web/packages/core/src/load-options.ts +++ b/web/packages/core/src/load-options.ts @@ -114,6 +114,14 @@ export interface BaseLoadOptions { * @default true */ upgradeToHttps?: boolean; + + /** + * Whether or not to display an overlay with a warning when + * loading a movie with unsupported content. + * + * @default true + */ + warnOnUnsupportedContent?: boolean; } /** diff --git a/web/src/lib.rs b/web/src/lib.rs index f477ad569191..dfb88521d757 100644 --- a/web/src/lib.rs +++ b/web/src/lib.rs @@ -118,6 +118,9 @@ pub struct Config { #[serde(rename = "upgradeToHttps")] upgrade_to_https: bool, + + #[serde(rename = "warnOnUnsupportedContent")] + warn_on_unsupported_content: bool, } impl Default for Config { @@ -125,6 +128,7 @@ impl Default for Config { Self { letterbox: Default::default(), upgrade_to_https: true, + warn_on_unsupported_content: true, } } } @@ -359,6 +363,9 @@ impl Ruffle { user_interface, )?; core.lock().unwrap().set_letterbox(config.letterbox); + core.lock() + .unwrap() + .set_warn_on_unsupported_content(config.warn_on_unsupported_content); // Create instance. let instance = RuffleInstance {