From 0858e8a5696911d1d787a13ed54003dbce739507 Mon Sep 17 00:00:00 2001 From: L00Cyph3r <10772371+L00Cyph3r@users.noreply.github.com> Date: Mon, 2 Sep 2024 14:34:11 +0200 Subject: [PATCH 1/4] Fix build: update dbip.mmdb URL --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dd71b7a..e2a275b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Download dbip database - run: wget -nv -O- "https://download.db-ip.com/free/dbip-country-lite-2024-04.mmdb.gz" | zcat > dbip.mmdb + run: wget -nv -O- "https://download.db-ip.com/free/dbip-country-lite-2024-09.mmdb.gz" | zcat > dbip.mmdb - uses: actions/upload-artifact@v3 with: name: dbip From 0cb23a583c31a117394c4c8481f6457de5330534 Mon Sep 17 00:00:00 2001 From: L00Cyph3r <10772371+L00Cyph3r@users.noreply.github.com> Date: Mon, 2 Sep 2024 14:48:39 +0200 Subject: [PATCH 2/4] Use upstream tauri-build action since changes have been merged --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e2a275b..170f7b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,7 +76,7 @@ jobs: - name: install npm packages run: npm ci - - uses: qu1ck/action-tauri-build@5c69c9fdbb4231a738b4a668a2caddf6af45eab8 + - uses: JonasKruckenberg/tauri-build@v1 id: tauri_build with: target: ${{ matrix.platform.rust_target }} From 67ea33b683e17de9838fe72000e7f2b426607fbc Mon Sep 17 00:00:00 2001 From: L00Cyph3r <10772371+L00Cyph3r@users.noreply.github.com> Date: Mon, 2 Sep 2024 15:45:06 +0200 Subject: [PATCH 3/4] Fix missing target in CI for x86_64 macOS --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 170f7b7..8274119 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,6 +62,10 @@ jobs: if: matrix.platform.rust_target == 'aarch64-apple-darwin' run: rustup target add aarch64-apple-darwin + - name: "Setup Rust" + if: matrix.platform.rust_target == 'x86_64-apple-darwin' + run: rustup target add x86_64-apple-darwin + - uses: Swatinem/rust-cache@v2 with: shared-key: ${{ matrix.platform.rust_target }} From bf359ca0577a6f1e9100a44b64c63ae1ef854a49 Mon Sep 17 00:00:00 2001 From: L00Cyph3r <10772371+L00Cyph3r@users.noreply.github.com> Date: Mon, 2 Sep 2024 15:49:49 +0200 Subject: [PATCH 4/4] Fix macOS build and some deprecations from objc2 --- src-tauri/src/macos.rs | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/src-tauri/src/macos.rs b/src-tauri/src/macos.rs index d40d432..a22bdfb 100644 --- a/src-tauri/src/macos.rs +++ b/src-tauri/src/macos.rs @@ -24,14 +24,13 @@ use std::{ use objc2::{ class, declare_class, ffi::NSInteger, - msg_send, msg_send_id, - mutability::Immutable, + msg_send, msg_send_id, mutability, rc::Id, - runtime::{NSObject, Object}, - sel, ClassType, + runtime::{AnyObject, NSObject}, + sel, ClassType, DeclaredClass, }; use once_cell::sync::OnceCell; -use tauri::{Menu, MenuItem, Submenu, CustomMenuItem}; +use tauri::{CustomMenuItem, Menu, MenuItem, Submenu}; type THandler = OnceCell) + Send + 'static>>>; @@ -54,7 +53,7 @@ const EVENT_OPEN_DOCUMENTS: u32 = 0x6F646F63; const EVENT_REOPEN_APP: u32 = 0x72617070; // Adapted from https://github.com/mrmekon/fruitbasket/blob/aad14e400d710d1d46317c0d8c55ff742bfeaadd/src/osx.rs#L848 -fn parse_event(event: *mut Object) -> Vec { +fn parse_event(event: *mut AnyObject) -> Vec { if event as u64 == 0u64 { return vec![]; } @@ -64,9 +63,9 @@ fn parse_event(event: *mut Object) -> Vec { match (class, id) { (GURL_EVENT_CLASS, EVENT_GET_URL) => { - let url: *mut Object = + let url: *mut AnyObject = msg_send![event, paramDescriptorForKeyword: KEY_DIRECT_OBJECT]; - let nsstring: *mut Object = msg_send![url, stringValue]; + let nsstring: *mut AnyObject = msg_send![url, stringValue]; let cstr: *const i8 = msg_send![nsstring, UTF8String]; if !cstr.is_null() { @@ -76,15 +75,15 @@ fn parse_event(event: *mut Object) -> Vec { } } (CORE_EVENT_CLASS, EVENT_OPEN_DOCUMENTS) => { - let documents: *mut Object = + let documents: *mut AnyObject = msg_send![event, paramDescriptorForKeyword: KEY_DIRECT_OBJECT]; let count: NSInteger = msg_send![documents, numberOfItems]; let mut paths = Vec::::new(); for i in 1..count + 1 { - let path: *mut Object = msg_send![documents, descriptorAtIndex: i]; - let nsstring: *mut Object = msg_send![path, stringValue]; + let path: *mut AnyObject = msg_send![documents, descriptorAtIndex: i]; + let nsstring: *mut AnyObject = msg_send![path, stringValue]; let cstr: *const i8 = msg_send![nsstring, UTF8String]; if !cstr.is_null() { @@ -108,13 +107,15 @@ declare_class!( unsafe impl ClassType for Handler { type Super = NSObject; - type Mutability = Immutable; + type Mutability = mutability::Immutable; const NAME: &'static str = "TauriPluginDeepLinkHandler"; } + impl DeclaredClass for Handler {} + unsafe impl Handler { #[method(handleEvent:withReplyEvent:)] - fn handle_event(&self, event: *mut Object, _replace: *const Object) { + fn handle_event(&self, event: *mut AnyObject, _replace: *const AnyObject) { let s = parse_event(event); let mut cb = HANDLER.get().unwrap().lock().unwrap(); cb(s); @@ -143,7 +144,7 @@ pub fn set_handler) + Send + 'static>(handler: F) -> Result fn listen_apple_event(event_class: u32, event_id: u32) { unsafe { - let event_manager: Id = + let event_manager: Id = msg_send_id![class!(NSAppleEventManager), sharedAppleEventManager]; let handler = Handler::new();