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:
+211
@@ -0,0 +1,211 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.fabledsword.minstrel"
|
||||
android:versionCode="1"
|
||||
android:versionName="0.1.0-native" >
|
||||
|
||||
<uses-sdk
|
||||
android:minSdkVersion="26"
|
||||
android:targetSdkVersion="36" />
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
|
||||
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
|
||||
<permission
|
||||
android:name="com.fabledsword.minstrel.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
|
||||
android:protectionLevel="signature" />
|
||||
|
||||
<uses-permission android:name="com.fabledsword.minstrel.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" />
|
||||
|
||||
<application
|
||||
android:name="com.fabledsword.minstrel.MinstrelApplication"
|
||||
android:allowBackup="false"
|
||||
android:appComponentFactory="androidx.core.app.CoreComponentFactory"
|
||||
android:dataExtractionRules="@xml/data_extraction_rules"
|
||||
android:debuggable="true"
|
||||
android:extractNativeLibs="false"
|
||||
android:fullBackupContent="@xml/backup_rules"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:supportsRtl="true"
|
||||
android:testOnly="true"
|
||||
android:theme="@style/Theme.Minstrel"
|
||||
android:usesCleartextTraffic="true" >
|
||||
<activity
|
||||
android:name="com.fabledsword.minstrel.MainActivity"
|
||||
android:exported="true"
|
||||
android:theme="@style/Theme.Minstrel" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name="com.fabledsword.minstrel.player.MinstrelPlayerService"
|
||||
android:exported="true"
|
||||
android:foregroundServiceType="mediaPlayback" >
|
||||
<intent-filter>
|
||||
<action android:name="androidx.media3.session.MediaSessionService" />
|
||||
</intent-filter>
|
||||
</service>
|
||||
|
||||
<activity
|
||||
android:name="androidx.compose.ui.tooling.PreviewActivity"
|
||||
android:exported="true" />
|
||||
|
||||
<provider
|
||||
android:name="androidx.startup.InitializationProvider"
|
||||
android:authorities="com.fabledsword.minstrel.androidx-startup"
|
||||
android:exported="false" >
|
||||
<meta-data
|
||||
android:name="androidx.work.WorkManagerInitializer"
|
||||
android:value="androidx.startup" />
|
||||
<meta-data
|
||||
android:name="androidx.emoji2.text.EmojiCompatInitializer"
|
||||
android:value="androidx.startup" />
|
||||
<meta-data
|
||||
android:name="androidx.lifecycle.ProcessLifecycleInitializer"
|
||||
android:value="androidx.startup" />
|
||||
<meta-data
|
||||
android:name="androidx.profileinstaller.ProfileInstallerInitializer"
|
||||
android:value="androidx.startup" />
|
||||
</provider>
|
||||
|
||||
<service
|
||||
android:name="androidx.work.impl.background.systemalarm.SystemAlarmService"
|
||||
android:directBootAware="false"
|
||||
android:enabled="@bool/enable_system_alarm_service_default"
|
||||
android:exported="false" />
|
||||
<service
|
||||
android:name="androidx.work.impl.background.systemjob.SystemJobService"
|
||||
android:directBootAware="false"
|
||||
android:enabled="@bool/enable_system_job_service_default"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.BIND_JOB_SERVICE" />
|
||||
<service
|
||||
android:name="androidx.work.impl.foreground.SystemForegroundService"
|
||||
android:directBootAware="false"
|
||||
android:enabled="@bool/enable_system_foreground_service_default"
|
||||
android:exported="false" />
|
||||
|
||||
<receiver
|
||||
android:name="androidx.work.impl.utils.ForceStopRunnable$BroadcastReceiver"
|
||||
android:directBootAware="false"
|
||||
android:enabled="true"
|
||||
android:exported="false" />
|
||||
<receiver
|
||||
android:name="androidx.work.impl.background.systemalarm.ConstraintProxy$BatteryChargingProxy"
|
||||
android:directBootAware="false"
|
||||
android:enabled="false"
|
||||
android:exported="false" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
|
||||
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name="androidx.work.impl.background.systemalarm.ConstraintProxy$BatteryNotLowProxy"
|
||||
android:directBootAware="false"
|
||||
android:enabled="false"
|
||||
android:exported="false" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BATTERY_OKAY" />
|
||||
<action android:name="android.intent.action.BATTERY_LOW" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name="androidx.work.impl.background.systemalarm.ConstraintProxy$StorageNotLowProxy"
|
||||
android:directBootAware="false"
|
||||
android:enabled="false"
|
||||
android:exported="false" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.DEVICE_STORAGE_LOW" />
|
||||
<action android:name="android.intent.action.DEVICE_STORAGE_OK" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name="androidx.work.impl.background.systemalarm.ConstraintProxy$NetworkStateProxy"
|
||||
android:directBootAware="false"
|
||||
android:enabled="false"
|
||||
android:exported="false" >
|
||||
<intent-filter>
|
||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name="androidx.work.impl.background.systemalarm.RescheduleReceiver"
|
||||
android:directBootAware="false"
|
||||
android:enabled="false"
|
||||
android:exported="false" >
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
||||
<action android:name="android.intent.action.TIME_SET" />
|
||||
<action android:name="android.intent.action.TIMEZONE_CHANGED" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name="androidx.work.impl.background.systemalarm.ConstraintProxyUpdateReceiver"
|
||||
android:directBootAware="false"
|
||||
android:enabled="@bool/enable_system_alarm_service_default"
|
||||
android:exported="false" >
|
||||
<intent-filter>
|
||||
<action android:name="androidx.work.impl.background.systemalarm.UpdateProxies" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
<receiver
|
||||
android:name="androidx.work.impl.diagnostics.DiagnosticsReceiver"
|
||||
android:directBootAware="false"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.DUMP" >
|
||||
<intent-filter>
|
||||
<action android:name="androidx.work.diagnostics.REQUEST_DIAGNOSTICS" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
<uses-library
|
||||
android:name="androidx.window.extensions"
|
||||
android:required="false" />
|
||||
<uses-library
|
||||
android:name="androidx.window.sidecar"
|
||||
android:required="false" />
|
||||
|
||||
<activity
|
||||
android:name="androidx.activity.ComponentActivity"
|
||||
android:exported="true"
|
||||
android:theme="@android:style/Theme.Material.Light.NoActionBar" />
|
||||
|
||||
<service
|
||||
android:name="androidx.room.MultiInstanceInvalidationService"
|
||||
android:directBootAware="true"
|
||||
android:exported="false" />
|
||||
|
||||
<receiver
|
||||
android:name="androidx.profileinstaller.ProfileInstallReceiver"
|
||||
android:directBootAware="false"
|
||||
android:enabled="true"
|
||||
android:exported="true"
|
||||
android:permission="android.permission.DUMP" >
|
||||
<intent-filter>
|
||||
<action android:name="androidx.profileinstaller.action.INSTALL_PROFILE" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="androidx.profileinstaller.action.SKIP_FILE" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="androidx.profileinstaller.action.SAVE_PROFILE" />
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="androidx.profileinstaller.action.BENCHMARK_OPERATION" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"version": 3,
|
||||
"artifactType": {
|
||||
"type": "PACKAGED_MANIFESTS",
|
||||
"kind": "Directory"
|
||||
},
|
||||
"applicationId": "com.fabledsword.minstrel",
|
||||
"variantName": "debug",
|
||||
"elements": [
|
||||
{
|
||||
"type": "SINGLE",
|
||||
"filters": [],
|
||||
"attributes": [],
|
||||
"versionCode": 1,
|
||||
"versionName": "0.1.0-native",
|
||||
"outputFile": "AndroidManifest.xml"
|
||||
}
|
||||
],
|
||||
"elementType": "File"
|
||||
}
|
||||
Reference in New Issue
Block a user