feat: integrate platform provider with enhanced crypto handling and new AppLayout component

- Added a new `AppLayout` component to manage navigation and routing within the application.
- Refactored `AppRoot` to utilize `PlatformLoadGuard` for ensuring platform readiness before rendering.
- Introduced `useAppStore` hook for accessing the Redux store directly.
- Updated `SDKVersion` and `PanelQingTing` components to leverage the new platform provider for crypto operations.
- Enhanced error handling with `PlatformNotInitializedError` for better user feedback on uninitialized platform states.
- Added tests for new functionalities and ensured compatibility with the updated platform architecture.
This commit is contained in:
鲁树人 committed 2026-11-01 11:18:24 +09:00
1 parent cb5531e9e4
commit b5fdc8ebbe
18 files changed
+466 -102

No files matched your search

+16
View File
@@ -14,6 +14,22 @@ export class NotImplementedError extends Error {
}
}
/**
* Thrown when `crypto.*` (or other init-gated APIs) is used before `provider.init()` completes.
* Distinct from {@link NotImplementedError} (not wired) and {@link NotSupportedMethod} (unsupported).
*/
export class PlatformNotInitializedError extends Error {
readonly code = 'NOT_INITIALIZED' as const;
constructor(
readonly capability: string,
message?: string,
) {
super(message ?? `Platform not initialized; call init() before using ${capability}`);
this.name = 'PlatformNotInitializedError';
}
}
/**
* Thrown when the current platform explicitly does not support a method / mode
* (e.g. Browser `keys.importNative`, or `saveMany(DirectWrite)` when not in `downloadTypes`).