Migrate from window.electron to tauri IPC functions across components
- Replaced `window.electron.invoke` calls with equivalent `tauri` function calls for all IPC interactions. - Removed `electron.d.ts` TypeScript definitions as they are no longer needed. - Updated related logic for offline/online state synchronization. - Added `types.rs` and `shared/mod.rs` modules to support Tauri IPC integration with Rust enums and shared logic. - Refactored IPC request queues to use updated handler names for consistency with Tauri.
This commit is contained in:
@@ -5,6 +5,7 @@ import { SessionContext } from '@/context/SessionContext';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faLock, faShieldAlt, faEye, faEyeSlash } from '@fortawesome/free-solid-svg-icons';
|
||||
import * as tauri from '@/lib/tauri';
|
||||
|
||||
interface OfflinePinSetupProps {
|
||||
onClose?: () => void;
|
||||
@@ -53,15 +54,13 @@ export default function OfflinePinSetup({ onClose, onSuccess, showOnFirstLogin }
|
||||
setError('');
|
||||
|
||||
try {
|
||||
if (window.electron) {
|
||||
const result = await window.electron.offlinePinSet(pin);
|
||||
const result = await tauri.offlinePinSet(pin);
|
||||
|
||||
if (result.success) {
|
||||
await window.electron.offlineModeSet(true, 30); // 30 days sync interval
|
||||
onSuccess?.();
|
||||
} else {
|
||||
setError(result.error || t('offline.pin.errors.setupFailed'));
|
||||
}
|
||||
if (result.success) {
|
||||
await tauri.offlineModeSet(true, 30);
|
||||
onSuccess?.();
|
||||
} else {
|
||||
setError(result.error || t('offline.pin.errors.setupFailed'));
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('[OfflinePin] Error setting PIN:', error);
|
||||
|
||||
Reference in New Issue
Block a user