This repository was archived by the owner on Aug 21, 2025. It is now read-only.
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR implements local storage functionality for private contact fields (phone and email) in the user component. The implementation includes debounced saving to prevent excessive storage operations during user input.
- Added use cases for getting and updating private contact information with debounced storage
- Extended the DataStore persistence layer to handle private contact info storage
- Updated the Share screen ViewModel to collect and save private contact information with 500ms debounce delay
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| UpdatePrivateContactInfoUseCase.kt | New use case for updating private contact info with storage interface |
| GetPrivateContactInfoUseCase.kt | New use case for retrieving private contact info with flow-based data access |
| UserComponentModule.kt | Dependency injection setup for new private contact info use cases |
| DatastoreModule.kt | DataStore module configuration for private contact info storage |
| UserPrefsStorage.kt | Extended storage interface and implementation for private contact persistence |
| ShareViewModelTest.kt | Comprehensive test coverage for private contact info functionality and debouncing |
| ShareViewModel.kt | ViewModel updates to handle private contact info with debounced saving logic |
...main/kotlin/com/gravatar/app/usercomponent/domain/usecase/UpdatePrivateContactInfoUseCase.kt
Show resolved
Hide resolved
...rc/main/kotlin/com/gravatar/app/usercomponent/domain/usecase/GetPrivateContactInfoUseCase.kt
Show resolved
Hide resolved
| internal val uiState: StateFlow<ShareUiState> = _uiState.asStateFlow() | ||
|
|
||
| private var saveContactInfoJob: Job? = null | ||
| private val debounceDelay = 500L // 500ms debounce delay |
There was a problem hiding this comment.
The debounce delay should be extracted as a constant at the class or companion object level, or made configurable, rather than being a magic number in the property declaration.
Suggested change
| private val debounceDelay = 500L // 500ms debounce delay | |
| companion object { | |
| const val DEBOUNCE_DELAY = 500L // 500ms debounce delay | |
| } |
a7033c0 to
9a2f82e
Compare
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Description
This PR implements the local storage for private contact fields: phone and email.
The storing is debounced by 500ms to prevent saving on each input field change when the user is typing.
Testing Steps