Skip to content

Commit

Permalink
fix url input for android
Browse files Browse the repository at this point in the history
  • Loading branch information
gterzian committed May 24, 2018
1 parent 2812b3c commit a5dc1b6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion ports/servo/browser.rs
Expand Up @@ -99,7 +99,7 @@ impl Browser {
String::from("")
};
let title = "URL or search query";
if let Some(input) = tinyfiledialogs::input_box(title, title, &url) {
if let Some(input) = get_url_input(title, &url) {
if let Some(url) = sanitize_url(&input) {
self.event_queue.push(WindowEvent::LoadUrl(id, url));
}
Expand Down Expand Up @@ -351,6 +351,17 @@ fn display_alert_dialog(_message: String) {
// tinyfiledialogs not supported on Android
}

#[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))]
fn get_url_input(_title: &str, _url: &str) -> Option<String> {
// tinyfiledialogs not supported on Android
None
}

#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
fn get_url_input(title: &str, url: &str) -> Option<String> {
tinyfiledialogs::input_box(title, title, url)
}

#[cfg(target_os = "linux")]
fn platform_get_selected_devices(devices: Vec<String>) -> Option<String> {
let picker_name = "Choose a device";
Expand Down
1 change: 1 addition & 0 deletions ports/servo/main.rs
Expand Up @@ -34,6 +34,7 @@ extern crate servo;
#[cfg(all(feature = "unstable", not(target_os = "android")))]
#[macro_use]
extern crate sig;
#[cfg(any(target_os = "macos", target_os = "linux", target_os = "windows"))]
extern crate tinyfiledialogs;
extern crate winit;
#[cfg(target_os = "windows")] extern crate winapi;
Expand Down

0 comments on commit a5dc1b6

Please sign in to comment.