mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-14 05:06:19 +03:00
chore(examples): remove mobile code from API example
This commit is contained in:
parent
20a7036ba5
commit
d2572050be
4
examples/api/src-tauri/.gitignore
vendored
4
examples/api/src-tauri/.gitignore
vendored
@ -1,7 +1,3 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
|
||||
# cargo-mobile
|
||||
.cargo/
|
||||
/gen
|
||||
|
@ -6,9 +6,6 @@ edition = "2021"
|
||||
rust-version = "1.57"
|
||||
license = "Apache-2.0 OR MIT"
|
||||
|
||||
[lib]
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { path = "../../../core/tauri-build", features = ["isolation", "codegen"] }
|
||||
|
||||
|
@ -8,10 +8,6 @@
|
||||
)]
|
||||
|
||||
mod cmd;
|
||||
#[cfg(mobile)]
|
||||
mod mobile;
|
||||
#[cfg(mobile)]
|
||||
pub use mobile::*;
|
||||
|
||||
use serde::Serialize;
|
||||
use tauri::{window::WindowBuilder, App, AppHandle, RunEvent, WindowUrl};
|
||||
|
@ -1,47 +0,0 @@
|
||||
#[cfg(target_os = "android")]
|
||||
use tauri_runtime_wry::wry::application::{android_fn, platform::android::ndk_glue::*};
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
fn init_logging(app_name: &str) {
|
||||
android_logger::init_once(
|
||||
android_logger::Config::default()
|
||||
.with_min_level(log::Level::Trace)
|
||||
.with_tag(app_name),
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
fn init_logging(_app_name: &str) {
|
||||
env_logger::init();
|
||||
}
|
||||
|
||||
fn stop_unwind<F: FnOnce() -> T, T>(f: F) -> T {
|
||||
match std::panic::catch_unwind(std::panic::AssertUnwindSafe(f)) {
|
||||
Ok(t) => t,
|
||||
Err(err) => {
|
||||
eprintln!("attempt to unwind out of `rust` with err: {:?}", err);
|
||||
std::process::abort()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn _start_app() {
|
||||
stop_unwind(main);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
#[inline(never)]
|
||||
pub extern "C" fn start_app() {
|
||||
#[cfg(target_os = "android")]
|
||||
android_fn!(com.tauri, api);
|
||||
_start_app()
|
||||
}
|
||||
|
||||
fn main() {
|
||||
super::AppBuilder::new()
|
||||
.setup(|app| {
|
||||
init_logging(&app.package_info().name);
|
||||
Ok(())
|
||||
})
|
||||
.run();
|
||||
}
|
Loading…
Reference in New Issue
Block a user