Add offline mode support with PIN configuration and management
- Introduce `OfflinePinSetup` component for users to configure secure offline access. - Add new `AIUsageContext` and extend `OfflineProvider` for offline-related state management. - Implement offline login functionality in `electron/main.ts` with PIN verification and fallback support. - Enhance IPC handlers to manage offline mode data, PIN setup, and synchronization. - Update localization files (`en.json`, `fr.json`) with offline mode and PIN-related strings. - Add `bcrypt` and `@types/bcrypt` dependencies for secure PIN hashing and validation. - Refactor login and session management to handle offline mode scenarios with improved error handling and flow.
This commit is contained in:
17
context/AIUsageContext.ts
Normal file
17
context/AIUsageContext.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import {Context, createContext, Dispatch, SetStateAction} from "react";
|
||||
|
||||
export interface AIUsageContextProps {
|
||||
totalCredits: number;
|
||||
totalPrice: number;
|
||||
setTotalCredits: Dispatch<SetStateAction<number>>;
|
||||
setTotalPrice: Dispatch<SetStateAction<number>>;
|
||||
}
|
||||
|
||||
export const AIUsageContext: Context<AIUsageContextProps> = createContext<AIUsageContextProps>({
|
||||
totalCredits: 0,
|
||||
totalPrice: 0,
|
||||
setTotalCredits: (): void => {
|
||||
},
|
||||
setTotalPrice: (): void => {
|
||||
}
|
||||
})
|
||||
4
context/AlertContext.ts
Normal file
4
context/AlertContext.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
// This file is kept for backwards compatibility
|
||||
// It now re-exports from the new AlertProvider system
|
||||
export {AlertContext, AlertProvider} from './AlertProvider';
|
||||
export type {AlertContextProps} from './AlertProvider';
|
||||
Reference in New Issue
Block a user