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,133 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:ns1="urn:oasis:names:tc:xliff:document:1.2">
<string msgid="8719607706653693137" name="androidx_compose_foundation_autofill">"自动填充"</string>
<string msgid="1150566100598813236" name="androidx_compose_ui_autofill">"自动填充"</string>
<string msgid="881409763997275156" name="call_notification_answer_action">"接听"</string>
<string msgid="8793775615905189152" name="call_notification_answer_video_action">"视频通话"</string>
<string msgid="3229508546291798546" name="call_notification_decline_action">"拒接"</string>
<string msgid="2659457946726154263" name="call_notification_hang_up_action">"挂断"</string>
<string msgid="6107532579223922871" name="call_notification_incoming_text">"来电"</string>
<string msgid="8623827134497363134" name="call_notification_ongoing_text">"正在通话"</string>
<string msgid="59049573811482460" name="call_notification_screening_text">"正在过滤来电"</string>
<string msgid="406453423630273620" name="close_drawer">"关闭导航菜单"</string>
<string msgid="7573152094250666567" name="close_sheet">"关闭工作表"</string>
<string msgid="8038256446254964252" name="default_error_message">"输入无效"</string>
<string name="default_notification_channel_name">正在播放</string>
<string msgid="6312721426453364202" name="default_popup_window_title">"弹出式窗口"</string>
<string msgid="1890207353314751437" name="dropdown_menu">"下拉菜单"</string>
<string name="error_message_authentication_expired">登录后才能使用此应用</string>
<string name="error_message_bad_value">输入数据有误</string>
<string name="error_message_concurrent_stream_limit">同时使用太多设备聆听</string>
<string name="error_message_content_already_playing">已经在播放这项内容</string>
<string name="error_message_disconnected">已与媒体应用断开连接</string>
<string name="error_message_end_of_playlist">队列中没有任何其他内容</string>
<string name="error_message_fallback">出了点问题。请稍后重试。</string>
<string name="error_message_info_cancelled">无法完成操作。请重试。</string>
<string name="error_message_invalid_state">目前无法完成该操作</string>
<string name="error_message_io">输入/输出有误</string>
<string name="error_message_not_available_in_region">在此地区无法获取这项内容</string>
<string name="error_message_not_supported">此应用无法执行该操作</string>
<string name="error_message_parental_control_restricted">该内容已被屏蔽</string>
<string name="error_message_permission_denied">访问被拒绝</string>
<string name="error_message_premium_account_required">需要使用付费账号访问</string>
<string name="error_message_setup_required">需要设置</string>
<string name="error_message_skip_limit_reached">无法再跳过更多曲目</string>
<string name="exo_download_completed">下载完毕</string>
<string name="exo_download_description">下载</string>
<string name="exo_download_downloading">正在下载</string>
<string name="exo_download_failed">下载失败</string>
<string name="exo_download_notification_channel_name">下载内容</string>
<string name="exo_download_paused">下载已暂停</string>
<string name="exo_download_paused_for_network">正在等待连接到网络以进行下载</string>
<string name="exo_download_paused_for_wifi">正在等待连接到 WLAN 网络以进行下载</string>
<string name="exo_download_removing">正在移除下载内容</string>
<string msgid="6827826412747255547" name="in_progress">"进行中"</string>
<string msgid="7933458017204019916" name="indeterminate">"部分选中"</string>
<string msgid="2988463736136100848" name="m3c_bottom_sheet_collapse_description">"收起底部动作条"</string>
<string msgid="1555567894577437024" name="m3c_bottom_sheet_dismiss_description">"关闭底部动作条"</string>
<string msgid="8403354765404029791" name="m3c_bottom_sheet_drag_handle_description">"拖动手柄"</string>
<string msgid="6670819569745899763" name="m3c_bottom_sheet_expand_description">"展开底部动作条"</string>
<string msgid="3010635850035863127" name="m3c_bottom_sheet_pane_title">"底部动作条"</string>
<string msgid="8166741421776570875" name="m3c_date_input_headline">"输入的日期"</string>
<string msgid="229313757840775812" name="m3c_date_input_headline_description">"输入的日期:%1$s"</string>
<string msgid="6116910750161463197" name="m3c_date_input_invalid_for_pattern">"日期不符合格式要求:%1$s"</string>
<string msgid="2521768508935305279" name="m3c_date_input_invalid_not_allowed">"日期无效:%1$s"</string>
<string msgid="7052898923934555305" name="m3c_date_input_invalid_year_range">"日期超出预期年份范围 %1$s - %2$s"</string>
<string msgid="2895559812010326913" name="m3c_date_input_label">"日期"</string>
<string msgid="1237013946323089826" name="m3c_date_input_no_input_description">"无"</string>
<string msgid="7306227249789210568" name="m3c_date_input_title">"选择日期"</string>
<string msgid="7605002211875882969" name="m3c_date_picker_headline">"选定的日期"</string>
<string msgid="3664277305226978227" name="m3c_date_picker_headline_description">"当前的选择:%1$s"</string>
<string msgid="8436650776581492840" name="m3c_date_picker_navigate_to_year_description">"切换到年份:%1$s"</string>
<string msgid="5811000998184572395" name="m3c_date_picker_no_selection_description">"无"</string>
<string msgid="7813882352367152251" name="m3c_date_picker_scroll_to_earlier_years">"滚动即可显示之前的年份"</string>
<string msgid="5727367015496556177" name="m3c_date_picker_scroll_to_later_years">"滚动即可显示之后的年份"</string>
<string msgid="1804346892470238807" name="m3c_date_picker_switch_to_calendar_mode">"切换到日历输入模式"</string>
<string msgid="395627960681594326" name="m3c_date_picker_switch_to_day_selection">"滑动可选择年份,点按可切换回选择日期"</string>
<string msgid="2219746470065162704" name="m3c_date_picker_switch_to_input_mode">"切换到文本字段输入模式"</string>
<string msgid="7142101321095356500" name="m3c_date_picker_switch_to_next_month">"转到下个月"</string>
<string msgid="228438865139394590" name="m3c_date_picker_switch_to_previous_month">"转到上个月"</string>
<string msgid="791651718641787594" name="m3c_date_picker_switch_to_year_selection">"切换为选择年份"</string>
<string msgid="7430790972741451689" name="m3c_date_picker_title">"选择日期"</string>
<string msgid="3199387177749801575" name="m3c_date_picker_today_description">"今天"</string>
<string msgid="2068382232816991922" name="m3c_date_picker_year_picker_pane_title">"年份选择器可见"</string>
<string msgid="3190049423327661366" name="m3c_date_range_input_invalid_range_input">"输入的日期范围无效"</string>
<string msgid="3148384720560189467" name="m3c_date_range_input_title">"输入日期"</string>
<string msgid="2138321128465719402" name="m3c_date_range_picker_day_in_range">"在范围内"</string>
<string msgid="4947636797751277713" name="m3c_date_range_picker_end_headline">"结束日期"</string>
<string msgid="602077859540990149" name="m3c_date_range_picker_scroll_to_next_month">"滚动即可显示下个月"</string>
<string msgid="4592174524846109496" name="m3c_date_range_picker_scroll_to_previous_month">"滚动即可显示上个月"</string>
<string msgid="4665981448952749820" name="m3c_date_range_picker_start_headline">"开始日期"</string>
<string msgid="3134165431120340385" name="m3c_date_range_picker_title">"选择日期"</string>
<string msgid="7617233117134790350" name="m3c_dialog">"对话框"</string>
<string msgid="3177828188723359358" name="m3c_dropdown_menu_collapsed">"已收起"</string>
<string msgid="2360841780724299882" name="m3c_dropdown_menu_expanded">"已展开"</string>
<string msgid="8687821690726149911" name="m3c_dropdown_menu_toggle">"展开/收起下拉菜单"</string>
<string msgid="6072492480528318635" name="m3c_floating_toolbar_collapse">"收起工具栏"</string>
<string msgid="6880757017246780255" name="m3c_floating_toolbar_expand">"展开工具栏"</string>
<string msgid="6152806324422087846" name="m3c_search_bar_search">"搜索"</string>
<string msgid="6152755701819882931" name="m3c_snackbar_dismiss">"关闭"</string>
<string msgid="3868801555855510515" name="m3c_snackbar_pane_title">"提醒"</string>
<string msgid="7655536806087401899" name="m3c_suggestions_available">"以下是搜索建议"</string>
<string msgid="409352516511718051" name="m3c_time_input_dialog_title">"输入时间"</string>
<string msgid="2786685010796619560" name="m3c_time_picker_am">"上午"</string>
<string msgid="7412665527536641863" name="m3c_time_picker_dialog_title">"选择时间"</string>
<string msgid="2349193472625211372" name="m3c_time_picker_hour">"小时"</string>
<string msgid="9179527532316922345" name="m3c_time_picker_hour_24h_suffix">"%1$d 小时"</string>
<string msgid="8876759303332837035" name="m3c_time_picker_hour_selection">"选择小时"</string>
<string msgid="3458167507790628988" name="m3c_time_picker_hour_suffix">"%1$d 点"</string>
<string msgid="6973808109666874069" name="m3c_time_picker_hour_text_field">"输入小时"</string>
<string msgid="4313071914266462005" name="m3c_time_picker_minute">"分钟"</string>
<string msgid="4699133535056739733" name="m3c_time_picker_minute_selection">"选择分钟"</string>
<string msgid="5064177921781937179" name="m3c_time_picker_minute_suffix">"%1$d 分钟"</string>
<string msgid="7661234488295443182" name="m3c_time_picker_minute_text_field">"输入分钟"</string>
<string msgid="5865171949528594571" name="m3c_time_picker_period_toggle_description">"选择上午或下午"</string>
<string msgid="6616362054113087709" name="m3c_time_picker_pm">"下午"</string>
<string msgid="4145073906612931838" name="m3c_time_picker_toggle_keyboard">"切换到文字输入法来输入时间"</string>
<string msgid="8841786098195101324" name="m3c_time_picker_toggle_touch">"切换到时钟模式来输入时间"</string>
<string msgid="1805687647081129904" name="m3c_tooltip_long_press_label">"显示提示"</string>
<string msgid="5460405025248574620" name="m3c_tooltip_pane_description">"提示"</string>
<string msgid="6564222473543418073" name="m3c_wide_navigation_rail_close_rail">"关闭此栏"</string>
<string msgid="8350283435461615411" name="m3c_wide_navigation_rail_pane_title">"侧边导航栏"</string>
<string name="media3_controls_pause_description">暂停</string>
<string name="media3_controls_play_description">播放</string>
<string name="media3_controls_seek_back_description">快退</string>
<string name="media3_controls_seek_forward_description">快进</string>
<string name="media3_controls_seek_to_next_description">跳转到下一项</string>
<string name="media3_controls_seek_to_previous_description">跳转到上一项</string>
<string msgid="542007171693138492" name="navigation_menu">"导航菜单"</string>
<string msgid="6610465462668679431" name="not_selected">"未选择"</string>
<string msgid="5941395253238309765" name="range_end">"范围终点"</string>
<string msgid="7097486360902471446" name="range_start">"范围起点"</string>
<string msgid="6043586758067023" name="selected">"已选择"</string>
<string msgid="2792228137354697160" name="snackbar_pane_title">"提醒"</string>
<string msgid="4139871816613051306" name="state_empty">"空白"</string>
<string msgid="5834637030682409883" name="state_off">"已关闭"</string>
<string msgid="1490883874751719580" name="state_on">"已开启"</string>
<string msgid="6277540029070332960" name="status_bar_notification_info_overflow">"999+"</string>
<string msgid="2561197295334830845" name="switch_role">"开关"</string>
<string msgid="1672349317127674378" name="tab">"标签页"</string>
<string msgid="5946805113151406391" name="template_percent">"百分之 <ns1:g id="PERCENTAGE">%1$d</ns1:g>。"</string>
<string msgid="3765533235322692011" name="tooltip_description">"提示"</string>
<string msgid="3124740595719787496" name="tooltip_label">"显示提示"</string>
</resources>