Merge branch 'next' into feat/dialog

pull/306/head
Lucas Nogueira 2 years ago
commit e712007094
No known key found for this signature in database
GPG Key ID: 7C32FCA95C8C95D7

16
Cargo.lock generated

@ -4344,7 +4344,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri" name = "tauri"
version = "2.0.0-alpha.7" version = "2.0.0-alpha.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f25eefe4ca0a396a73fd0309f778eeb22a19953a3169bf316b893abadc2118fb"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes 1.4.0", "bytes 1.4.0",
@ -4395,6 +4397,8 @@ dependencies = [
[[package]] [[package]]
name = "tauri-build" name = "tauri-build"
version = "2.0.0-alpha.4" version = "2.0.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c492211c72b95f8866e5c1fbc0a915080a5ebb9f03f9b250a1c936534b680a76"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cargo_toml", "cargo_toml",
@ -4413,6 +4417,8 @@ dependencies = [
[[package]] [[package]]
name = "tauri-codegen" name = "tauri-codegen"
version = "2.0.0-alpha.4" version = "2.0.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "818c570932ebc2ff6d498be89d93494b89ff142131937a7e56d7cfb9c8ef0ad0"
dependencies = [ dependencies = [
"base64 0.21.0", "base64 0.21.0",
"brotli", "brotli",
@ -4437,6 +4443,8 @@ dependencies = [
[[package]] [[package]]
name = "tauri-macros" name = "tauri-macros"
version = "2.0.0-alpha.4" version = "2.0.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3b596485d89003d2d7869469b2830e9a846de9ac2eecd69bc7c24890234aefc"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
@ -4674,6 +4682,8 @@ dependencies = [
[[package]] [[package]]
name = "tauri-runtime" name = "tauri-runtime"
version = "0.13.0-alpha.4" version = "0.13.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "404367cd32a5a8d33368448aab7da54bb2187b6a632526f1019de3fd13591cc2"
dependencies = [ dependencies = [
"gtk", "gtk",
"http", "http",
@ -4694,6 +4704,8 @@ dependencies = [
[[package]] [[package]]
name = "tauri-runtime-wry" name = "tauri-runtime-wry"
version = "0.13.0-alpha.4" version = "0.13.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "203764d673b440877dea87b972772be4091ee0ab25141748008646ca774a20dc"
dependencies = [ dependencies = [
"cocoa", "cocoa",
"gtk", "gtk",
@ -4713,6 +4725,8 @@ dependencies = [
[[package]] [[package]]
name = "tauri-utils" name = "tauri-utils"
version = "2.0.0-alpha.4" version = "2.0.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49fa79bc56f04ece491268a64273de945f65627bcda30d9e8ecc8708b89bca26"
dependencies = [ dependencies = [
"brotli", "brotli",
"ctor", "ctor",

@ -5,8 +5,8 @@ resolver = "2"
[workspace.dependencies] [workspace.dependencies]
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
log = "0.4" log = "0.4"
tauri = "2.0.0-alpha.6" tauri = "2.0.0-alpha.8"
tauri-build = "2.0.0-alpha.3" tauri-build = "2.0.0-alpha.4"
serde_json = "1" serde_json = "1"
thiserror = "1" thiserror = "1"
@ -15,7 +15,3 @@ edition = "2021"
authors = [ "Tauri Programme within The Commons Conservancy" ] authors = [ "Tauri Programme within The Commons Conservancy" ]
license = "Apache-2.0 OR MIT" license = "Apache-2.0 OR MIT"
rust-version = "1.64" rust-version = "1.64"
[patch.crates-io]
tauri = { path = "../tauri/core/tauri" }
tauri-build = { path = "../tauri/core/tauri-build" }

@ -3061,7 +3061,9 @@ dependencies = [
[[package]] [[package]]
name = "tauri" name = "tauri"
version = "2.0.0-alpha.7" version = "2.0.0-alpha.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f25eefe4ca0a396a73fd0309f778eeb22a19953a3169bf316b893abadc2118fb"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
@ -3119,6 +3121,8 @@ dependencies = [
[[package]] [[package]]
name = "tauri-build" name = "tauri-build"
version = "2.0.0-alpha.4" version = "2.0.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c492211c72b95f8866e5c1fbc0a915080a5ebb9f03f9b250a1c936534b680a76"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"cargo_toml", "cargo_toml",
@ -3137,6 +3141,8 @@ dependencies = [
[[package]] [[package]]
name = "tauri-codegen" name = "tauri-codegen"
version = "2.0.0-alpha.4" version = "2.0.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "818c570932ebc2ff6d498be89d93494b89ff142131937a7e56d7cfb9c8ef0ad0"
dependencies = [ dependencies = [
"base64 0.21.0", "base64 0.21.0",
"brotli", "brotli",
@ -3162,6 +3168,8 @@ dependencies = [
[[package]] [[package]]
name = "tauri-macros" name = "tauri-macros"
version = "2.0.0-alpha.4" version = "2.0.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3b596485d89003d2d7869469b2830e9a846de9ac2eecd69bc7c24890234aefc"
dependencies = [ dependencies = [
"heck 0.4.1", "heck 0.4.1",
"proc-macro2", "proc-macro2",
@ -3192,8 +3200,10 @@ version = "0.1.0"
dependencies = [ dependencies = [
"android_logger", "android_logger",
"byte-unit", "byte-unit",
"cocoa",
"fern", "fern",
"log", "log",
"objc",
"serde", "serde",
"serde_json", "serde_json",
"serde_repr", "serde_repr",
@ -3206,6 +3216,8 @@ dependencies = [
[[package]] [[package]]
name = "tauri-runtime" name = "tauri-runtime"
version = "0.13.0-alpha.4" version = "0.13.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "404367cd32a5a8d33368448aab7da54bb2187b6a632526f1019de3fd13591cc2"
dependencies = [ dependencies = [
"gtk", "gtk",
"http", "http",
@ -3226,6 +3238,8 @@ dependencies = [
[[package]] [[package]]
name = "tauri-runtime-wry" name = "tauri-runtime-wry"
version = "0.13.0-alpha.4" version = "0.13.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "203764d673b440877dea87b972772be4091ee0ab25141748008646ca774a20dc"
dependencies = [ dependencies = [
"cocoa", "cocoa",
"gtk", "gtk",
@ -3245,6 +3259,8 @@ dependencies = [
[[package]] [[package]]
name = "tauri-utils" name = "tauri-utils"
version = "2.0.0-alpha.4" version = "2.0.0-alpha.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49fa79bc56f04ece491268a64273de945f65627bcda30d9e8ecc8708b89bca26"
dependencies = [ dependencies = [
"brotli", "brotli",
"ctor", "ctor",

@ -14,12 +14,12 @@ rust-version = "1.64"
crate-type = ["staticlib", "cdylib", "rlib"] crate-type = ["staticlib", "cdylib", "rlib"]
[build-dependencies] [build-dependencies]
tauri-build = { version = "2.0.0-alpha.3", features = [] } tauri-build = { version = "2.0.0-alpha.4", features = [] }
[dependencies] [dependencies]
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
tauri = { version = "2.0.0-alpha.6", features = ["api-all"] } tauri = { version = "2.0.0-alpha.8", features = ["api-all"] }
tauri-plugin-dialog = { path = "../../../" } tauri-plugin-dialog = { path = "../../../" }
tauri-plugin-log = { path = "../../../../log" } tauri-plugin-log = { path = "../../../../log" }
log = "0.4" log = "0.4"
@ -27,7 +27,3 @@ log = "0.4"
[features] [features]
# DO NOT remove this # DO NOT remove this
custom-protocol = [ "tauri/custom-protocol" ] custom-protocol = [ "tauri/custom-protocol" ]
[patch.crates-io]
tauri = { path = "../../../../../../tauri/core/tauri" }
tauri-build = { path = "../../../../../../tauri/core/tauri-build" }

@ -327,7 +327,7 @@ impl Builder {
LogTarget::LogDir => continue, LogTarget::LogDir => continue,
#[cfg(desktop)] #[cfg(desktop)]
LogTarget::LogDir => { LogTarget::LogDir => {
let path = app_handle.path_resolver().app_log_dir().unwrap(); let path = app_handle.path().app_log_dir().unwrap();
if !path.exists() { if !path.exists() {
fs::create_dir_all(&path).unwrap(); fs::create_dir_all(&path).unwrap();
} }

@ -40,9 +40,9 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
#[cfg(feature = "protocol-asset")] #[cfg(feature = "protocol-asset")]
let asset_protocol_scope = app.asset_protocol_scope(); let asset_protocol_scope = app.asset_protocol_scope();
let app = app.clone(); let app = app.clone();
let app_dir = app.path_resolver().app_data_dir(); let app_dir = app.path().app_data_dir();
if let Some(app_dir) = app_dir { if let Ok(app_dir) = app_dir {
let scope_state_path = app_dir.join(SCOPE_STATE_FILENAME); let scope_state_path = app_dir.join(SCOPE_STATE_FILENAME);
let _ = fs_scope.forbid_file(&scope_state_path); let _ = fs_scope.forbid_file(&scope_state_path);

@ -12,11 +12,11 @@ rust-version = "1.57"
[dependencies] [dependencies]
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = [ "derive" ] } serde = { version = "1.0", features = [ "derive" ] }
tauri = { version = "1", features = ["api-all"] } tauri = { version = "2.0.0-alpha.8", features = ["api-all"] }
tauri-plugin-single-instance = { path = "../../../" } tauri-plugin-single-instance = { path = "../../../" }
[build-dependencies] [build-dependencies]
tauri-build = { version = "1", features = [] } tauri-build = { version = "2.0.0-alpha.4", features = [] }
[features] [features]
default = [ "custom-protocol" ] default = [ "custom-protocol" ]

@ -63,10 +63,7 @@ type Result<T> = std::result::Result<T, Error>;
/// Resolves the App's **file path** from the `AppHandle` context /// Resolves the App's **file path** from the `AppHandle` context
/// object /// object
fn app_path<R: Runtime>(app: &AppHandle<R>) -> PathBuf { fn app_path<R: Runtime>(app: &AppHandle<R>) -> PathBuf {
#[allow(deprecated)] // FIXME: Change to non-deprecated function in Tauri v2 app.path().app_config_dir().expect("No App path was found!")
app.path_resolver()
.app_dir()
.expect("No App path was found!")
} }
#[cfg(feature = "sqlite")] #[cfg(feature = "sqlite")]

@ -10,7 +10,7 @@ use std::{
io::Write, io::Write,
path::PathBuf, path::PathBuf,
}; };
use tauri::{AppHandle, Runtime}; use tauri::{AppHandle, Manager, Runtime};
type SerializeFn = fn(&HashMap<String, JsonValue>) -> Result<Vec<u8>, Box<dyn std::error::Error>>; type SerializeFn = fn(&HashMap<String, JsonValue>) -> Result<Vec<u8>, Box<dyn std::error::Error>>;
type DeserializeFn = fn(&[u8]) -> Result<HashMap<String, JsonValue>, Box<dyn std::error::Error>>; type DeserializeFn = fn(&[u8]) -> Result<HashMap<String, JsonValue>, Box<dyn std::error::Error>>;
@ -171,7 +171,7 @@ impl Store {
/// Update the store from the on-disk state /// Update the store from the on-disk state
pub fn load<R: Runtime>(&mut self, app: &AppHandle<R>) -> Result<(), Error> { pub fn load<R: Runtime>(&mut self, app: &AppHandle<R>) -> Result<(), Error> {
let app_dir = app let app_dir = app
.path_resolver() .path()
.app_data_dir() .app_data_dir()
.expect("failed to resolve app dir"); .expect("failed to resolve app dir");
let store_path = app_dir.join(&self.path); let store_path = app_dir.join(&self.path);
@ -186,7 +186,7 @@ impl Store {
/// Saves the store to disk /// Saves the store to disk
pub fn save<R: Runtime>(&self, app: &AppHandle<R>) -> Result<(), Error> { pub fn save<R: Runtime>(&self, app: &AppHandle<R>) -> Result<(), Error> {
let app_dir = app let app_dir = app
.path_resolver() .path()
.app_data_dir() .app_data_dir()
.expect("failed to resolve app dir"); .expect("failed to resolve app dir");
let store_path = app_dir.join(&self.path); let store_path = app_dir.join(&self.path);

@ -9,14 +9,14 @@ edition = "2021"
[dependencies] [dependencies]
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = "1" serde_json = "1"
tauri = { version = "1", features = [] } tauri = { version = "2.0.0-alpha.8", features = [] }
tokio = { version = "1.11", features = ["net"] } tokio = { version = "1.11", features = ["net"] }
futures-util = "0.3" futures-util = "0.3"
tauri-plugin-websocket = { path = "../../../" } tauri-plugin-websocket = { path = "../../../" }
tokio-tungstenite = "0.15" tokio-tungstenite = "0.15"
[build-dependencies] [build-dependencies]
tauri-build = { version = "1", features = [] } tauri-build = { version = "2.0.0-alpha.4", features = [] }
[features] [features]
default = [ "custom-protocol" ] default = [ "custom-protocol" ]

@ -69,7 +69,7 @@ pub trait AppHandleExt {
impl<R: Runtime> AppHandleExt for tauri::AppHandle<R> { impl<R: Runtime> AppHandleExt for tauri::AppHandle<R> {
fn save_window_state(&self, flags: StateFlags) -> Result<()> { fn save_window_state(&self, flags: StateFlags) -> Result<()> {
if let Some(app_dir) = self.path_resolver().app_config_dir() { if let Ok(app_dir) = self.path().app_config_dir() {
let state_path = app_dir.join(STATE_FILENAME); let state_path = app_dir.join(STATE_FILENAME);
let cache = self.state::<WindowStateCache>(); let cache = self.state::<WindowStateCache>();
let mut state = cache.0.lock().unwrap(); let mut state = cache.0.lock().unwrap();
@ -270,8 +270,8 @@ impl Builder {
let flags = self.state_flags; let flags = self.state_flags;
PluginBuilder::new("window-state") PluginBuilder::new("window-state")
.setup(|app, _api| { .setup(|app, _api| {
let cache: Arc<Mutex<HashMap<String, WindowState>>> = if let Some(app_dir) = let cache: Arc<Mutex<HashMap<String, WindowState>>> = if let Ok(app_dir) =
app.path_resolver().app_config_dir() app.path().app_config_dir()
{ {
let state_path = app_dir.join(STATE_FILENAME); let state_path = app_dir.join(STATE_FILENAME);
if state_path.exists() { if state_path.exists() {

Loading…
Cancel
Save