chore(examples): remove mobile code from API example

This commit is contained in:
Lucas Nogueira 2022-08-14 17:53:15 -03:00
parent 20a7036ba5
commit d2572050be
No known key found for this signature in database
GPG Key ID: FFEA6C72E73482F1
4 changed files with 0 additions and 58 deletions

View File

@ -1,7 +1,3 @@
# Generated by Cargo
# will have compiled files and executables
/target/
# cargo-mobile
.cargo/
/gen

View File

@ -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"] }

View File

@ -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};

View File

@ -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();
}