From 539c38a692ebf3b80331d21f9f38cc570892c02e Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Thu, 16 Mar 2023 09:36:31 -0300 Subject: [PATCH] feat: update swift-rs (#285) * feat: update swift-rs * swift-rs v1 * pin deps --- Cargo.lock | 21 +++++++++++---------- plugins/log/Cargo.toml | 2 +- plugins/log/ios/Sources/LogPlugin.swift | 8 ++++---- plugins/log/src/lib.rs | 6 +++--- 4 files changed, 19 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ba17acfe..5810e68b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4140,10 +4140,11 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "swift-rs" -version = "0.3.0" -source = "git+https://github.com/Brendonovich/swift-rs?rev=eb6de914ad57501da5019154d476d45660559999#eb6de914ad57501da5019154d476d45660559999" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "806ff0904302a8a91644422fcfeee4828c3a9dbcfd1757ba495f1a755c2ac873" dependencies = [ - "base64 0.13.1", + "base64 0.21.0", "serde", "serde_json", ] @@ -4258,7 +4259,7 @@ dependencies = [ [[package]] name = "tauri" version = "2.0.0-alpha.3" -source = "git+https://github.com/tauri-apps/tauri?branch=next#105fe3fa242df87ad7655b519b0c01c3da9d8ee4" +source = "git+https://github.com/tauri-apps/tauri?branch=next#5d94eaa3bc9f1e5cf3e0fa64fba5801d494c2541" dependencies = [ "anyhow", "attohttpc", @@ -4308,7 +4309,7 @@ dependencies = [ [[package]] name = "tauri-build" version = "2.0.0-alpha.1" -source = "git+https://github.com/tauri-apps/tauri?branch=next#105fe3fa242df87ad7655b519b0c01c3da9d8ee4" +source = "git+https://github.com/tauri-apps/tauri?branch=next#5d94eaa3bc9f1e5cf3e0fa64fba5801d494c2541" dependencies = [ "anyhow", "cargo_toml", @@ -4327,7 +4328,7 @@ dependencies = [ [[package]] name = "tauri-codegen" version = "2.0.0-alpha.1" -source = "git+https://github.com/tauri-apps/tauri?branch=next#105fe3fa242df87ad7655b519b0c01c3da9d8ee4" +source = "git+https://github.com/tauri-apps/tauri?branch=next#5d94eaa3bc9f1e5cf3e0fa64fba5801d494c2541" dependencies = [ "base64 0.21.0", "brotli", @@ -4352,7 +4353,7 @@ dependencies = [ [[package]] name = "tauri-macros" version = "2.0.0-alpha.1" -source = "git+https://github.com/tauri-apps/tauri?branch=next#105fe3fa242df87ad7655b519b0c01c3da9d8ee4" +source = "git+https://github.com/tauri-apps/tauri?branch=next#5d94eaa3bc9f1e5cf3e0fa64fba5801d494c2541" dependencies = [ "heck", "proc-macro2", @@ -4573,7 +4574,7 @@ dependencies = [ [[package]] name = "tauri-runtime" version = "0.13.0-alpha.1" -source = "git+https://github.com/tauri-apps/tauri?branch=next#105fe3fa242df87ad7655b519b0c01c3da9d8ee4" +source = "git+https://github.com/tauri-apps/tauri?branch=next#5d94eaa3bc9f1e5cf3e0fa64fba5801d494c2541" dependencies = [ "gtk", "http", @@ -4594,7 +4595,7 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" version = "0.13.0-alpha.1" -source = "git+https://github.com/tauri-apps/tauri?branch=next#105fe3fa242df87ad7655b519b0c01c3da9d8ee4" +source = "git+https://github.com/tauri-apps/tauri?branch=next#5d94eaa3bc9f1e5cf3e0fa64fba5801d494c2541" dependencies = [ "cocoa", "gtk", @@ -4614,7 +4615,7 @@ dependencies = [ [[package]] name = "tauri-utils" version = "2.0.0-alpha.1" -source = "git+https://github.com/tauri-apps/tauri?branch=next#105fe3fa242df87ad7655b519b0c01c3da9d8ee4" +source = "git+https://github.com/tauri-apps/tauri?branch=next#5d94eaa3bc9f1e5cf3e0fa64fba5801d494c2541" dependencies = [ "brotli", "ctor", diff --git a/plugins/log/Cargo.toml b/plugins/log/Cargo.toml index 2bd073e3..864618ea 100644 --- a/plugins/log/Cargo.toml +++ b/plugins/log/Cargo.toml @@ -26,7 +26,7 @@ fern = "0.6" android_logger = "0.11" [target."cfg(target_os = \"ios\")".dependencies] -swift-rs = { git = "https://github.com/Brendonovich/swift-rs", rev = "eb6de914ad57501da5019154d476d45660559999" } +swift-rs = "1.0.1" [features] colored = ["fern/colored"] \ No newline at end of file diff --git a/plugins/log/ios/Sources/LogPlugin.swift b/plugins/log/ios/Sources/LogPlugin.swift index 04c98aa1..4ae3621d 100644 --- a/plugins/log/ios/Sources/LogPlugin.swift +++ b/plugins/log/ios/Sources/LogPlugin.swift @@ -3,11 +3,11 @@ import Tauri import SwiftRs @_cdecl("tauri_log") -func log(level: Int, message: UnsafePointer) { +func log(level: Int, message: SRString) { switch level { - case 1: Logger.debug(message.pointee.to_string()) - case 2: Logger.info(message.pointee.to_string()) - case 3: Logger.error(message.pointee.to_string()) + case 1: Logger.debug(message.toString()) + case 2: Logger.info(message.toString()) + case 3: Logger.error(message.toString()) default: break } } diff --git a/plugins/log/src/lib.rs b/plugins/log/src/lib.rs index 86c2b618..66d534b4 100644 --- a/plugins/log/src/lib.rs +++ b/plugins/log/src/lib.rs @@ -23,9 +23,9 @@ use tauri::{ pub use fern; #[cfg(target_os = "ios")] -extern "C" { - fn tauri_log(level: u8, message: &swift_rs::SRString); -} +swift_rs::swift!(fn tauri_log( + level: u8, message: &swift_rs::SRString +)); const DEFAULT_MAX_FILE_SIZE: u128 = 40000; const DEFAULT_ROTATION_STRATEGY: RotationStrategy = RotationStrategy::KeepOne;