Draft
Conversation
Added logic to detect user ID changes and force resubscription to chat list updates when the account changes. This ensures chat list updates are correctly handled after switching users.
Introduced a static property `didChangedUserID` to indicate when the user ID has changed. Updated the `set(userID:)` method to set this flag when the user ID changes, and added `setCacheHasBeenUpdated()` to reset the flag after cache updates.
Replaced the concurrent access queue with a serial queue to protect settingsCache. Updated the settings property to ensure user ID consistency and cache validity by accessing TGUserController within a lock and reading from disk inside the lock.
Updated indentation and whitespace throughout CloudVeilSecurityController.swift to improve code readability and maintain consistent formatting. No functional changes were made. feat: upgrade cache key to include user and organization ID Enhanced the caching system to use a composite key of user ID and organization ID for improved cache isolation and correctness when users switch organizations. Added orgId support to TGUserModel, updated TGUserController to manage orgId and its change flag, and modified CloudVeilSecurityController to use the new composite cache key. All changes maintain thread safety and do not break existing code. feat: add orgID support to user and settings controllers Introduces orgID tracking in TGUserController, including change detection and setter. Updates CloudVeilSecurityController to use orgID in cache key and cache validation, ensuring settings are correctly scoped per user and organization. refactor: saveSettings to support per-user/org cache Updated saveSettings to accept a user ID and use a cache key based on both user and organization IDs. The method now loads and merges settings from the correct disk cache, and only updates the in-memory cache if the user and org IDs match the current user. This improves multi-user and multi-organization support for settings caching.
Added orgId property to TGSettingsRequest and updated CloudVeilSecurityController to use orgId when saving settings to ensure correct cache key per user and organization. This change helps maintain accurate settings cache for users across different organizations.
Added detailed log statements to track settings access and cache updates, including user and org IDs and cache validity. Logging now clarifies when the settings cache is updated or not due to user/org mismatches, aiding debugging and monitoring.
Introduced a private withSettings accessor to ensure thread-safe access to settingsCache. Replaced repetitive accessQueue.sync blocks in computed properties with this new helper for improved code clarity and maintainability.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.