mirror of
https://github.com/gopher64/gopher64.git
synced 2026-07-11 01:25:20 +02:00
dont use open on android (#914)
This commit is contained in:
+1
-1
@@ -18,7 +18,6 @@ chrono = "0.4"
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
serde_json = "1.0"
|
||||
serde-big-array = "0.5"
|
||||
open = "5.3"
|
||||
sha2 = "0.11"
|
||||
sdl3-sys = { version = "0.6", features = ["build-from-source-static"] }
|
||||
sdl3-ttf-sys = { version = "0.6", features = ["build-static-vendored", "no-sdlttf-harfbuzz", "no-sdlttf-plutosvg"] }
|
||||
@@ -43,6 +42,7 @@ discord-rich-presence = "1.1"
|
||||
slint = { version = "1.16", default-features = false, features = ["compat-1-2", "std", "unstable-winit-030", "backend-winit", "renderer-femtovg-wgpu", "accessibility"], optional = true }
|
||||
rfd = {version = "0.17", optional = true }
|
||||
dirs = "6.0"
|
||||
open = "5.3"
|
||||
|
||||
[target.'cfg(target_os = "android")'.dependencies]
|
||||
slint = { version = "1.16", default-features = false, features = ["compat-1-2", "std", "backend-android-activity-06", "accessibility"], optional = true }
|
||||
|
||||
+17
-22
@@ -46,6 +46,16 @@ fn check_latest_version(weak: slint::Weak<AppWindow>) {
|
||||
});
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
pub fn open_uri(path: impl AsRef<std::ffi::OsStr>) {
|
||||
if let Err(e) = open::that_detached(path) {
|
||||
eprintln!("Error opening path: {}", e);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
pub fn open_uri(_path: impl AsRef<std::ffi::OsStr>) {}
|
||||
|
||||
fn run_with_path(weak: slint::Weak<AppWindow>, path: std::path::PathBuf) {
|
||||
let weak2 = weak.clone();
|
||||
weak.upgrade_in_event_loop(move |handle| {
|
||||
@@ -127,9 +137,7 @@ fn local_game_window(app: &AppWindow, config: &ui::config::Config) {
|
||||
|
||||
let saves_path = dirs.data_dir.join("saves");
|
||||
app.on_saves_folder_button_clicked(move || {
|
||||
if let Err(e) = open::that_detached(saves_path.clone()) {
|
||||
eprintln!("Error opening saves folder: {}", e);
|
||||
}
|
||||
open_uri(&saves_path);
|
||||
});
|
||||
#[cfg(not(target_os = "android"))]
|
||||
file_dropped(app);
|
||||
@@ -474,35 +482,22 @@ pub fn save_settings(app: &AppWindow) {
|
||||
|
||||
fn about_window(app: &AppWindow) {
|
||||
app.on_wiki_button_clicked(move || {
|
||||
if let Err(e) = open::that_detached("https://github.com/gopher64/gopher64/wiki") {
|
||||
eprintln!("Error opening wiki: {}", e);
|
||||
}
|
||||
open_uri("https://github.com/gopher64/gopher64/wiki");
|
||||
});
|
||||
app.on_discord_button_clicked(move || {
|
||||
if let Err(e) = open::that_detached("https://discord.gg/9RGXq8W8JQ") {
|
||||
eprintln!("Error opening Discord: {}", e);
|
||||
}
|
||||
open_uri("https://discord.gg/9RGXq8W8JQ");
|
||||
});
|
||||
app.on_patreon_button_clicked(move || {
|
||||
if let Err(e) = open::that_detached("https://patreon.com/loganmc10") {
|
||||
eprintln!("Error opening Patreon: {}", e);
|
||||
}
|
||||
open_uri("https://patreon.com/loganmc10");
|
||||
});
|
||||
app.on_github_sponsors_button_clicked(move || {
|
||||
if let Err(e) = open::that_detached("https://github.com/sponsors/loganmc10") {
|
||||
eprintln!("Error opening GitHub Sponsors: {}", e);
|
||||
}
|
||||
open_uri("https://github.com/sponsors/loganmc10");
|
||||
});
|
||||
app.on_source_code_button_clicked(move || {
|
||||
if let Err(e) = open::that_detached("https://github.com/gopher64/gopher64") {
|
||||
eprintln!("Error opening source code: {}", e);
|
||||
}
|
||||
open_uri("https://github.com/gopher64/gopher64");
|
||||
});
|
||||
app.on_newversion_button_clicked(move || {
|
||||
if let Err(e) = open::that_detached("https://github.com/gopher64/gopher64/releases/latest")
|
||||
{
|
||||
eprintln!("Error opening new version: {}", e);
|
||||
}
|
||||
open_uri("https://github.com/gopher64/gopher64/releases/latest");
|
||||
});
|
||||
app.set_version(format!("Version: {}", env!("GIT_DESCRIBE")).into());
|
||||
|
||||
|
||||
+3
-8
@@ -3,7 +3,7 @@ use crate::device;
|
||||
use crate::ui;
|
||||
use crate::ui::gui::{
|
||||
AppWindow, CustomNetplayServer, DispatcherDialog, ErrorDialog, NetplayCreate, NetplayDevice,
|
||||
NetplayJoin, NetplayWait, run_rom, save_settings,
|
||||
NetplayJoin, NetplayWait, open_uri, run_rom, save_settings,
|
||||
};
|
||||
use futures::{SinkExt, StreamExt};
|
||||
use sha2::{Digest, Sha256};
|
||||
@@ -1265,14 +1265,9 @@ pub fn netplay_window(app: &AppWindow) {
|
||||
});
|
||||
|
||||
app.on_netplay_discord_button_clicked(move || {
|
||||
if let Err(e) = open::that_detached("https://discord.gg/JyW6ZgBUyS") {
|
||||
eprintln!("Error opening Discord: {}", e);
|
||||
}
|
||||
open_uri("https://discord.gg/JyW6ZgBUyS");
|
||||
});
|
||||
app.on_netplay_feedback_button_clicked(move || {
|
||||
if let Err(e) = open::that_detached("https://github.com/gopher64/gopher64/discussions/453")
|
||||
{
|
||||
eprintln!("Error opening feedback: {}", e);
|
||||
}
|
||||
open_uri("https://github.com/gopher64/gopher64/discussions/453");
|
||||
});
|
||||
}
|
||||
|
||||
@@ -96,20 +96,14 @@ pub fn ra_window(app: &ui::gui::AppWindow) {
|
||||
);
|
||||
|
||||
app.on_ra_games_clicked(move || {
|
||||
if let Err(e) =
|
||||
open::that_detached("https://retroachievements.org/system/2-nintendo-64/games")
|
||||
{
|
||||
eprintln!("Error opening games: {}", e);
|
||||
}
|
||||
ui::gui::open_uri("https://retroachievements.org/system/2-nintendo-64/games");
|
||||
});
|
||||
|
||||
app.on_ra_show_profile_clicked(move || {
|
||||
if let Err(e) = open::that_detached(format!(
|
||||
ui::gui::open_uri(format!(
|
||||
"https://retroachievements.org/user/{}",
|
||||
retroachievements::get_username().unwrap_or_default()
|
||||
)) {
|
||||
eprintln!("Error opening profile: {}", e);
|
||||
}
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user