feat: implement dynamic API URL configuration with Firebase Remote Config#2
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
Implements dynamic API URL configuration using Firebase Remote Config and an OkHttp interceptor, updates dependency versions, and augments the DI setup and tests.
- Integrate Firebase Remote Config to fetch and apply API URL at runtime
- Introduce
DynamicApiUrlInterceptorand corresponding comprehensive unit tests - Update DI modules and application class to wire in new services; bump Java/Kotlin target to 17 and add Firebase Config & Mockito-Kotlin
Reviewed Changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| gradle/libs.versions.toml | Added mockito, mockito-kotlin, and firebase-config entries |
| DynamicApiUrlInterceptorTest.kt | New tests covering URL replacement, query/fragment preservation |
| FakeSevibusApi.kt | Added getCardInfo and getCardTransactions methods to fake API |
| RemoteConfigService.kt | New service for Firebase Remote Config setup, listener, fetch |
| DynamicApiUrlInterceptor.kt | OkHttp interceptor to swap placeholder base URL at runtime |
| ApiConfigurationManager.kt | Manages current API URL with defaults and trailing‐slash logic |
| DI.kt | Registered config manager, interceptor, remote config service; replaced hardcoded URLs |
| SevApplication.kt | Initialized RemoteConfigService in onCreate |
| app/build.gradle.kts | Updated Java/Kotlin compatibility to 17; added dependencies |
Comments suppressed due to low confidence (2)
app/src/main/java/com/sloy/sevibus/infrastructure/config/RemoteConfigService.kt:22
- Core logic in
initialize()(setupConfigUpdateListener, fetchAndActivate) isn't covered by unit tests. Consider adding tests to simulate success and failure paths for fetch and update flows.
fun initialize() {
app/src/test/java/com/sloy/sevibus/data/api/FakeSevibusApi.kt:110
- Missing imports for
kotlinx.coroutines.Dispatchersandkotlinx.coroutines.withContext, causing a compilation error.
override suspend fun getCardInfo(card: CardId): CardInfoDto = withContext(Dispatchers.IO) {
| fun setup() { | ||
| apiConfigurationManager = ApiConfigurationManager() | ||
| interceptor = DynamicApiUrlInterceptor(apiConfigurationManager) | ||
| mockChain = mock() |
There was a problem hiding this comment.
[nitpick] You're mixing Mockito.mock() with Mockito-Kotlin extensions—consider using mock<Interceptor.Chain>() from org.mockito.kotlin.mock for consistency and clearer Kotlin integration.
Suggested change
| mockChain = mock() | |
| mockChain = mock<Interceptor.Chain>() |
- Replace string replacement with HttpUrl.Builder for robust URL construction - Extract BASE_URL_PLACEHOLDER constant to interceptor companion object - Update DI.kt and tests to use the shared constant - Properly handle paths in currentApiUrl (e.g., /dev/, /prod/) - Preserve query parameters and URL fragments correctly - All tests passing with improved URL handling Addresses PR review feedback about brittle string replacement and code duplication. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
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.
Summary
Technical Changes
Test Coverage
🤖 Generated with Claude Code