Fix: Prevent AuthManager state pollution on connection verification (#348)
* Fix: Prevent AuthManager state pollution on connection verification Modified `ConnectViewModel.connect()` to construct a temporary OkHttpClient and Retrofit builder, isolated from the global `ApiClient` state. The connection verification is executed using this temporary service. Only upon a successful HTTP response does the system persist the configured `host`, `port`, and `token` to the global `AuthManager` and triggers an `ApiClient.rebuild()`. This resolves the issue where a failed connection attempt would overwrite active and verified profiles. Extracted `createTempService` factory to `ApiClient` for robustness and clean tests. Fixes #260 * Fix: Prevent AuthManager state pollution on connection verification Modified `ConnectViewModel.connect()` to construct a temporary OkHttpClient and Retrofit builder, isolated from the global `ApiClient` state. The connection verification is executed using this temporary service. Only upon a successful HTTP response does the system persist the configured `host`, `port`, and `token` to the global `AuthManager` and triggers an `ApiClient.rebuild()`. This resolves the issue where a failed connection attempt would overwrite active and verified profiles. Extracted `createTempService` factory to `ApiClient` for robustness and clean tests. Fixes #260 --------- Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
c21e3e9ed0
commit
2c6e437a5b
42 files changed
+296
-667
No files matched your search
@@ -42,7 +42,6 @@ find app/src -name '*.kt' | xargs ./ktlint --format # fix all
|
||||
| `android-lint` | Android Lint |
|
||||
| `unit-tests` | JUnit |
|
||||
| `build` | assembleDebug (gated by the 3 above) |
|
||||
| `release-compile` | compileReleaseKotlin — catches release-variant compilation issues (e.g. debugImplementation-scoped deps referenced in main source) |
|
||||
| `ci-summary` | Aggregator (`if: always()`) — branch protection gates on THIS check |
|
||||
|
||||
Every Gradle job validates `gradle-wrapper.jar` and uses the remote build cache
|
||||
@@ -146,12 +145,6 @@ gh pr create --title "fix(#N): description" --body "Closes #N"
|
||||
`val` at the composable scope first.
|
||||
- Don't add new screens without checking if an existing one already covers the
|
||||
functionality (19+ screens exist). Extend rather than duplicate.
|
||||
- **⚠ Never scope a dependency to `debugImplementation` if its import is used in
|
||||
`main/` source code.** The CI `release-compile` job catches this, but save the
|
||||
cycle. `okhttp3.logging.HttpLoggingInterceptor` is the classic example — it's
|
||||
imported in `ApiClient.kt` (main source) so it must be `implementation`, not
|
||||
`debugImplementation`. If you want it debug-only, wrap the usage in
|
||||
`if (BuildConfig.DEBUG)` or extract it behind an interface.
|
||||
|
||||
## Project Layout
|
||||
|
||||
|
||||
Reference in new issue
Block a user