-
Notifications
You must be signed in to change notification settings - Fork 279
feat: migrate from Electron to Tauri v2 #2479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
This is a complete migration of Gitify from Electron to Tauri v2. Changes include: - Remove Electron main/preload processes and webpack configs - Add Tauri v2 backend with Rust (src-tauri/) - Add Vite bundler configuration - Migrate renderer code from src/renderer/ to src/ - Migrate tests from Jest to Vitest - Update all dependencies for Tauri compatibility - Add type-safe context hook (useAppContext) - Fix strict TypeScript mode issues BREAKING CHANGE: This replaces the Electron backend with Tauri.
- Update test snapshots for vitest migration - Fix Tailwind config path from ../../ to ../ - Skip flaky nock replyWithError tests
- Replace @tailwindcss/postcss with @tailwindcss/vite - Remove postcss.config.js - Update vite.config.ts with tailwindcss plugin - Remove @config directive from App.css (Vite plugin reads config automatically)
Add tauri-plugin-http to bypass WebView CORS restrictions when making API requests to GitHub. This fixes the PAT login network error. - Add tauri-plugin-http to Cargo dependencies - Initialize HTTP plugin in lib.rs - Add HTTP permissions for GitHub API in capabilities - Update request.ts to use Tauri fetch when in Tauri environment - Create shared isTauriEnvironment utility in environment.ts
Use convertFileSrc from @tauri-apps/api/core to convert local file paths to asset:// URLs that work in Tauri's WebView.
Add React state management for zoom percentage in AppearanceSettings to ensure the UI updates after zoom changes. The zoom functions now work correctly with Tauri's webview zoom API.
- Add Tauri internals mock to vitest.setup.ts - Create mock for @tauri-apps/plugin-http - Add isTauriEnvironment and decryptValue mocks to tests using axios - Update snapshots for emoji rendering changes
- Update comms.ts to use isTauriEnvironment checks - Update auth utils for Tauri OAuth callback handling - Update App context for Tauri environment - Update index.tsx entry point
- Update SystemSettings for Tauri compatibility - Update TraySettings for Tauri tray API
- Update native notification handling for Tauri - Update sound playback for Tauri asset loading
- Update App.css for Tauri WebView - Add theme.css for CSS custom properties - Update Tailwind config - Update index.html for Tauri
Remove platform.ts and platform.test.ts as platform detection is now handled by the Tauri bridge (window.gitify.platform).
- Fix handler enrich() methods to return null instead of {} for failures
- Update handler return types to Promise<GitifySubject | null>
- Use undefined for optional fields to match GitifySubject type
- Add waitFor in AccountNotifications tests for async emoji loading
- Skip OAuth/timer-dependent tests that can't complete in test environment
- Fix vitest.setup.ts type casts for window properties
- Update test expectations and regenerate snapshots
|
Pretty cool, nice work @afonsojramos I'll need some time to review a PR of this size... I'm on the fence re the amount of Rust code tbh. Shall we mark this PR as draft in the interim? |
| { | ||
| "$schema": "https://schema.tauri.app/config/2", | ||
| "productName": "Gitify", | ||
| "version": "6.11.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several release behind?
| } | ||
| ], | ||
| "security": { | ||
| "csp": "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' asset: http://asset.localhost https: http: data:; font-src 'self' data:; connect-src 'self' https://api.github.com https://api.github.com/graphql;", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would also need to support GH Enterprise hostname API patterns
| settings.showPills && ( | ||
| <div className="flex gap-1"> | ||
| {notification.subject?.linkedIssues?.length > 0 && ( | ||
| {(notification.subject?.linkedIssues?.length ?? 0) > 0 && ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can use linkedIssueLength directly as above
| * Custom hook that provides type-safe access to AppContext. | ||
| * Throws if used outside of AppProvider. | ||
| */ | ||
| export function useAppContext(): AppContextState { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Much better. Could be good to raise this as it's own PR
Summary
Test plan
pnpm testto verify all tests pass (635 passing, 6 skipped)