Fixed indents on feature flagged compiling of examples

This commit is contained in:
Sebastian Imlay 2022-08-14 16:06:53 -04:00
parent 7c917ee0ea
commit b0b93468d8
3 changed files with 8 additions and 8 deletions

View file

@ -73,7 +73,7 @@ impl Dispatcher for BasicApp {
fn on_ui_message(&self, message: Self::Message) { fn on_ui_message(&self, message: Self::Message) {
let window = self.window.delegate.as_ref().unwrap(); let window = self.window.delegate.as_ref().unwrap();
#[cfg(feature = "webview")] #[cfg(feature = "webview")]
{ {
let webview = &window.content; let webview = &window.content;
@ -100,7 +100,7 @@ impl WebViewDelegate for WebViewInstance {}
struct AppWindow { struct AppWindow {
toolbar: Toolbar<BrowserToolbar>, toolbar: Toolbar<BrowserToolbar>,
#[cfg(feature = "webview")] #[cfg(feature = "webview")]
content: WebView<WebViewInstance> content: WebView<WebViewInstance>
} }
@ -108,14 +108,14 @@ impl AppWindow {
pub fn new() -> Self { pub fn new() -> Self {
AppWindow { AppWindow {
toolbar: Toolbar::new("com.example.BrowserToolbar", BrowserToolbar::new()), toolbar: Toolbar::new("com.example.BrowserToolbar", BrowserToolbar::new()),
#[cfg(feature = "webview")] #[cfg(feature = "webview")]
content: WebView::with(WebViewConfig::default(), WebViewInstance::default()) content: WebView::with(WebViewConfig::default(), WebViewInstance::default())
} }
} }
pub fn load_url(&self, url: &str) { pub fn load_url(&self, url: &str) {
self.toolbar.delegate.as_ref().unwrap().set_url(url); self.toolbar.delegate.as_ref().unwrap().set_url(url);
#[cfg(feature = "webview")] #[cfg(feature = "webview")]
self.content.load_url(url); self.content.load_url(url);
} }
} }
@ -129,7 +129,7 @@ impl WindowDelegate for AppWindow {
window.set_minimum_content_size(400., 400.); window.set_minimum_content_size(400., 400.);
window.set_toolbar(&self.toolbar); window.set_toolbar(&self.toolbar);
#[cfg(feature = "webview")] #[cfg(feature = "webview")]
window.set_content_view(&self.content); window.set_content_view(&self.content);
self.load_url("https://www.duckduckgo.com/"); self.load_url("https://www.duckduckgo.com/");

View file

@ -57,7 +57,7 @@ impl ViewDelegate for RootView {
#[derive(Default)] #[derive(Default)]
pub struct WindowScene { pub struct WindowScene {
#[cfg(target_os= "ios")] #[cfg(target_os= "ios")]
pub window: RwLock<Option<Window>>, pub window: RwLock<Option<Window>>,
pub root_view_controller: RwLock<Option<ViewController<RootView>>> pub root_view_controller: RwLock<Option<ViewController<RootView>>>
} }
@ -84,6 +84,6 @@ impl WindowSceneDelegate for WindowScene {
} }
fn main() { fn main() {
#[cfg(target_os= "ios")] #[cfg(target_os= "ios")]
App::new(TestApp::default(), || Box::new(WindowScene::default())).run(); App::new(TestApp::default(), || Box::new(WindowScene::default())).run();
} }

View file

@ -64,7 +64,7 @@ impl WebViewDelegate for WebViewInstance {
} }
struct AppWindow { struct AppWindow {
#[cfg(feature = "webview")] #[cfg(feature = "webview")]
content: WebView<WebViewInstance> content: WebView<WebViewInstance>
} }