Cap icon indicating copy to clipboard operation
Cap copied to clipboard

Migrate to Tauri v2

Open ItsEeleeya opened this issue 1 year ago • 8 comments

This is now READY With the recent release of Tauri 2.0.0-rc, I decided to give this another try after a couple of weeks since my last attempt. Most things should work as expected.

TODO:

  • [x] All dependencies updated for v2
  • [x] Tray stop icon when recording is in-progress.
  • [x] Camera overlay
  • [x] Fix any missing permissions

New changes:

  • Using tauri-plugin-decorum for webview transparency (No longer using macOS private APIs). This allows for possible publishing on the Mac AppStore in the future.
  • (macOS/Linux) Camera overlay is visible on all spaces/workspaces
  • Add more info to the About Cap window. (Should now show copyright text)
  • Fix missing background and border styles when running with NEXT_PUBLIC_LOCAL_MODE=true

Changes below will not longer be part of this and will be part of future PRs.

  • ~~Make camera overlay into NSPanel on macos. (more appropriate for its functionality)~~
  • ~~(Windows/Linux) Optimize the titlebar to better suit other platforms.~~
  • ~~Minor adjustments to the look of preview~~
  • ~~(macOS/Linux) _Show timer on the tray icon when recording is in-progress.~~
  • Deep-links and re-implementation of #48

Any feedbacks or requests are appreciated!

ItsEeleeya avatar Aug 03 '24 20:08 ItsEeleeya

@ItsEeleeya is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Aug 03 '24 20:08 vercel[bot]

7a55c41 preview:

The icon on the right is from Cap. (For me, it seems to update every two seconds or so which might be from Tauri, I'm not sure) The text looks a bit odd because it's using Unicode monospace characters instead. Otherwise the width of the menu item would change and cause the rest of the items to shift as well.

I'm not sure if this should be kept. To make it look more like the one on the left (From the Clock app) I might need to make a plugin to allow for the creation of NSStatusItem. We might be able to also make it look like a chip component, or the green camera indicator.

ItsEeleeya avatar Aug 06 '24 06:08 ItsEeleeya

If anyone testing this experiences this same issue, or has more info on them please let me know! I seem to get these frontend errors randomly. Only on first launch. Main window (unexpected EOF): sc1

Camera window (Hydration error): sc2

ItsEeleeya avatar Aug 06 '24 06:08 ItsEeleeya

There are a few more changes in progress, but this should be ready for a review.

ItsEeleeya avatar Aug 06 '24 06:08 ItsEeleeya

Most things seem to work properly, just a couple of things I've ran across: The version of tauri-plugin-oauth might need to be updated in Cargo.lock, the currently locked version didn't compile with tauri rc 0 on my machine. Styles are a bit off in dark mode, not sure if this is a tauri 2 thing but it doesn't happen on main image

Brendonovich avatar Aug 10 '24 04:08 Brendonovich

Regarding the styles, I was thinking wondering the same thing. It's happened for my previous PRs too even though I've made no changes to them and the branches are based on main .

Also, the background style on macOS was NSVisualEffectMaterialMediumLight which has been deprecated so I set it to NSVisualEffectMaterialUnderWindowBackground which seems to be appropriate. I'll make sure it looks as similar to main if it doesn't by the end of this without using the previous deprecated material.

ItsEeleeya avatar Aug 10 '24 10:08 ItsEeleeya

I just built directly from main and it looks like this which it always did for me (at first I thought it was intentional)

ItsEeleeya avatar Aug 10 '24 12:08 ItsEeleeya

Hey @Brendonovich, this is now ready for a review! The previous issue regarding the look was just due to the app missing styles in dev mode. Make sure to test the recording and check if you also get any random hydration errors

ItsEeleeya avatar Aug 12 '24 01:08 ItsEeleeya

Hey @Brendonovich, I'm so sorry I forgot one of the permissions!! It's for plugin-oauth. I only realized this when I ran the whole project with Docker and couldn't log in. Missing in main.rs:

~155

    tauri::Builder::default()
        .plugin(tauri_plugin_shell::init())
        .plugin(tauri_plugin_oauth::init()) // <-

~/apps/desktop/src-tauri/capabilities/migrated.json:

{
  "permissions": [
      "oauth:default",
      "oauth:allow-start",
      "oauth:allow-cancel"
    ]
}

ItsEeleeya avatar Aug 17 '24 10:08 ItsEeleeya

Ah thanks for mentioning that, I'll add it back in!

Brendonovich avatar Aug 18 '24 06:08 Brendonovich