fix: 修复真机验证发现的三处问题
真机(Redmi K30 5G / Android 12 / MIUI)验证后修: - 登录失效不再卡死:任意请求返回 401 时自动退出登录、停掉前台服务,并在登录页说明「登录已失效,请重新登录」;网络/HTTP 层错误统一转成可读文案,不再直接抛「HTTP 401」 - 会话错误条不再盖住任务页标题:从叠在最上层改成正常布局占位(叠层只留给会话冲突弹窗) - 会话不再回不去:冲突出口处理后显式跳回会话页(hasSession 一直是 true,靠状态变化不会触发导航,原本会导致新会话的预期门禁被绕过);任务页在有进行中会话时新增「有一次学习正在进行 / 回到会话」入口 - 结束弹窗复用已缓存的报告草稿,重开不再白跑一次 AI
This commit is contained in:
@@ -89,6 +89,7 @@ private fun AppRoot(openEndRequest: androidx.compose.runtime.MutableState<Boolea
|
||||
val username by container.username.collectAsState()
|
||||
val baseUrl by container.baseUrl.collectAsState()
|
||||
val sessionState by container.session.state.collectAsState()
|
||||
val authNotice by container.authNotice.collectAsState()
|
||||
val openEnd by openEndRequest
|
||||
|
||||
var screen by remember { mutableStateOf(Screen.Tasks) }
|
||||
@@ -139,10 +140,22 @@ private fun AppRoot(openEndRequest: androidx.compose.runtime.MutableState<Boolea
|
||||
}
|
||||
|
||||
Box(modifier = Modifier.fillMaxSize()) {
|
||||
when {
|
||||
Column(modifier = Modifier.fillMaxSize()) {
|
||||
// 不在会话页时,会话层的失败也要让用户看到(用正常布局占位,不遮住下面的标题)
|
||||
if (screen != Screen.Session) {
|
||||
sessionState.error?.let { message ->
|
||||
ErrorBar(message = message, onDismiss = { container.session.consumeError() })
|
||||
}
|
||||
}
|
||||
|
||||
Box(modifier = Modifier.weight(1f)) {
|
||||
when {
|
||||
!ready -> LoadingScreen()
|
||||
|
||||
!loggedIn -> LoginScreen(initialBaseUrl = baseUrl) { user, password, url, onResult ->
|
||||
!loggedIn -> LoginScreen(
|
||||
initialBaseUrl = baseUrl,
|
||||
notice = authNotice,
|
||||
) { user, password, url, onResult ->
|
||||
container.login(user, password, url, onResult)
|
||||
}
|
||||
|
||||
@@ -162,6 +175,8 @@ private fun AppRoot(openEndRequest: androidx.compose.runtime.MutableState<Boolea
|
||||
reportTask = task
|
||||
screen = Screen.Reports
|
||||
},
|
||||
hasActiveSession = sessionState.hasSession,
|
||||
onOpenSession = { screen = Screen.Session },
|
||||
onOpenSettings = { screen = Screen.Settings },
|
||||
onOpenPermissions = { screen = Screen.Permissions },
|
||||
onLogout = {
|
||||
@@ -226,6 +241,8 @@ private fun AppRoot(openEndRequest: androidx.compose.runtime.MutableState<Boolea
|
||||
onBack = { screen = Screen.Tasks },
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 会话-05:别的任务上还有未结束会话时,先让用户选出口
|
||||
@@ -233,18 +250,15 @@ private fun AppRoot(openEndRequest: androidx.compose.runtime.MutableState<Boolea
|
||||
SessionConflictDialog(
|
||||
state = sessionState,
|
||||
onAction = { action ->
|
||||
container.session.resolveConflict(action) { StudySessionService.start(context) }
|
||||
// 处理完必须显式回到会话页:hasSession 一直是 true,靠状态变化不会触发导航
|
||||
container.session.resolveConflict(action) {
|
||||
StudySessionService.start(context)
|
||||
screen = Screen.Session
|
||||
}
|
||||
},
|
||||
onDismiss = { container.session.dismissConflict() },
|
||||
)
|
||||
}
|
||||
|
||||
// 不在会话页时,会话层的失败也要让用户看到
|
||||
if (screen != Screen.Session) {
|
||||
sessionState.error?.let { message ->
|
||||
ErrorBar(message = message, onDismiss = { container.session.consumeError() })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user