feat(preferences): add getAll method and IPC handler for retrieving all preferences

This commit introduces a new IPC channel and handler for fetching all user preferences at once, enhancing the efficiency of preference management. The PreferenceService is updated with a getAll method to retrieve all preferences from the memory cache, and the renderer-side PreferenceService is adjusted to support this new functionality. Additionally, type safety improvements are made across the preference handling code, ensuring better consistency and reducing potential errors.
This commit is contained in:
fullex
2025-08-12 01:01:22 +08:00
parent a81f13848c
commit 72f32e4b8f
13 changed files with 1502 additions and 82 deletions
+13
View File
@@ -273,6 +273,19 @@ export class PreferenceService {
setInterval(cleanup, 30000)
}
/**
* Get all preferences from memory cache
* Returns complete preference object for bulk operations
*/
getAll(): PreferenceDefaultScopeType {
if (!this.initialized) {
logger.warn('Preference cache not initialized, returning defaults')
return DefaultPreferences.default
}
return { ...this.cache }
}
/**
* Get all current subscriptions (for debugging)
*/