fix(android): unblock first device test — auth contrast + dynamic base URL

Two regressions surfaced on the first real device run.

1. Contrast on ServerUrl + Login screens: both wrapped content in a
   bare Box(fillMaxSize), no Surface. The obsidian background never
   painted (rendered against the system root view's default),
   LocalContentColor cascade fell through to Material's default
   contentColor — the screens rendered as near-invisible dark text
   on dark grey. Wrap both in Surface(color = background, contentColor
   = onBackground) so the bg paints AND the M3 contentColor pipeline
   flows correctly through OutlinedTextField labels / cursor /
   placeholders + the Button content tint.

2. The bigger bug: NetworkModule.provideRetrofit read
   authStore.baseUrl.value ONCE at Retrofit creation. AuthStore loads
   from Room async, so at injection time the value was still the
   localhost:8080 placeholder. Result: even after the user typed
   their real server URL on the ServerUrl screen, every API call
   kept hitting localhost:8080 ("Failed to connect to
   localhost/127.0.0.1:8080" on the login attempt). The pre-fix
   NetworkModule comment even acknowledged it — *"Server-URL
   changes require an app relaunch"*.

   Fix: per-request rewrite. New BaseUrlInterceptor reads the live
   AuthStore.baseUrl.value on every request and rewrites
   scheme/host/port of the outgoing URL. Retrofit now keeps a
   placeholder baseUrl ("http://placeholder.invalid/") solely to
   satisfy its parser; the actual target host is dynamic. Order in
   OkHttp chain: BaseUrl first → Auth → logging, so the cookie
   interceptor sees the final URL.

New:
  - api/BaseUrlInterceptor.kt — per-request scheme/host/port rewrite
    from AuthStore.baseUrl. Falls through to the original request
    when the stored URL is unparseable.

Modified:
  - api/NetworkModule.kt — adds BaseUrlInterceptor to the OkHttp
    chain. Drops the AuthStore dependency from provideRetrofit;
    swaps baseUrl for the placeholder.
  - auth/ui/ServerUrlScreen.kt — Box → Surface wrap.
  - auth/ui/LoginScreen.kt — Box → Surface wrap.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-26 00:27:05 -04:00
parent 0415b5ccc3
commit 0b72827682
5553 changed files with 63548 additions and 10 deletions
@@ -0,0 +1,61 @@
#Tue May 26 00:18:01 EDT 2026
base.0=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeExtDexDebug/classes.dex
base.1=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeProjectDexDebug/0/classes.dex
base.10=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeProjectDexDebug/3/classes.dex
base.11=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeProjectDexDebug/4/classes.dex
base.12=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeProjectDexDebug/5/classes.dex
base.13=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeProjectDexDebug/6/classes.dex
base.14=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeProjectDexDebug/7/classes.dex
base.15=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeProjectDexDebug/8/classes.dex
base.16=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeProjectDexDebug/9/classes.dex
base.17=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/global_synthetics_dex/debug/mergeDebugGlobalSynthetics/classes.dex
base.18=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeExtDexDebug/classes2.dex
base.19=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeExtDexDebug/classes3.dex
base.2=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeProjectDexDebug/1/classes.dex
base.3=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeProjectDexDebug/10/classes.dex
base.4=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeProjectDexDebug/11/classes.dex
base.5=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeProjectDexDebug/12/classes.dex
base.6=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeProjectDexDebug/13/classes.dex
base.7=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeProjectDexDebug/14/classes.dex
base.8=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeProjectDexDebug/15/classes.dex
base.9=/home/bvandeusen/Nextcloud/Projects/Minstrel/android/app/build/intermediates/dex/debug/mergeProjectDexDebug/2/classes.dex
path.0=classes.dex
path.1=0/classes.dex
path.10=3/classes.dex
path.11=4/classes.dex
path.12=5/classes.dex
path.13=6/classes.dex
path.14=7/classes.dex
path.15=8/classes.dex
path.16=9/classes.dex
path.17=classes.dex
path.18=classes2.dex
path.19=classes3.dex
path.2=1/classes.dex
path.3=10/classes.dex
path.4=11/classes.dex
path.5=12/classes.dex
path.6=13/classes.dex
path.7=14/classes.dex
path.8=15/classes.dex
path.9=2/classes.dex
renamed.0=classes.dex
renamed.1=classes2.dex
renamed.10=classes11.dex
renamed.11=classes12.dex
renamed.12=classes13.dex
renamed.13=classes14.dex
renamed.14=classes15.dex
renamed.15=classes16.dex
renamed.16=classes17.dex
renamed.17=classes18.dex
renamed.18=classes19.dex
renamed.19=classes20.dex
renamed.2=classes3.dex
renamed.3=classes4.dex
renamed.4=classes5.dex
renamed.5=classes6.dex
renamed.6=classes7.dex
renamed.7=classes8.dex
renamed.8=classes9.dex
renamed.9=classes10.dex
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long