From ad1cae7f1859161cd15f96ea8f5cdc1e9273ad1c Mon Sep 17 00:00:00 2001 From: OpenClaw Date: Sat, 7 Mar 2026 21:53:52 +0800 Subject: [PATCH] Add manual overview refresh actions --- .../kotlin/cn/xiaobai/openclawapp/App.kt | 14 ++++++++++ .../feature/sessions/SessionListScreen.kt | 26 +++++++++++++++++++ .../feature/settings/SettingsScreen.kt | 8 ++++++ docs/MVP_PROGRESS.md | 1 + 4 files changed, 49 insertions(+) diff --git a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/App.kt b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/App.kt index e4cdcc4..7da5c12 100644 --- a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/App.kt +++ b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/App.kt @@ -326,12 +326,19 @@ private fun OpenClawRoot(appState: OpenClawAppState) { status = appState.repository.status, availableAgents = appState.repository.availableAgents, currentTheme = appState.themeMode, + isRefreshing = appState.isSyncing, onSelectAgent = { agent -> coroutineScope.launch { appState.updateDefaultAgent(agent) } }, onSelectTheme = appState::updateTheme, + onRefreshOverview = { + coroutineScope.launch { + appState.clearSyncError() + appState.syncRemoteIfNeeded() + } + }, onDisconnect = appState::disconnect, ) @@ -341,12 +348,19 @@ private fun OpenClawRoot(appState: OpenClawAppState) { status = appState.repository.status, availableAgents = appState.repository.availableAgents, currentTheme = appState.themeMode, + isRefreshing = appState.isSyncing, onSelectAgent = { agent -> coroutineScope.launch { appState.updateDefaultAgent(agent) } }, onSelectTheme = appState::updateTheme, + onRefreshOverview = { + coroutineScope.launch { + appState.clearSyncError() + appState.syncRemoteIfNeeded() + } + }, onDisconnect = appState::disconnect, ) } diff --git a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/sessions/SessionListScreen.kt b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/sessions/SessionListScreen.kt index 61f0117..6eaac88 100644 --- a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/sessions/SessionListScreen.kt +++ b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/sessions/SessionListScreen.kt @@ -66,6 +66,32 @@ fun SessionListScreen( ) } + item { + Row( + modifier = Modifier.fillMaxWidth(), + horizontalArrangement = Arrangement.spacedBy(8.dp), + verticalAlignment = Alignment.CenterVertically, + ) { + if (isLoading) { + CircularProgressIndicator(modifier = Modifier.padding(end = 4.dp)) + Text( + text = "同步中", + style = MaterialTheme.typography.bodySmall, + color = MaterialTheme.colorScheme.onSurfaceVariant, + modifier = Modifier.weight(1f), + ) + } else { + Text( + text = "", + modifier = Modifier.weight(1f), + ) + } + TextButton(onClick = onRetry, enabled = !isLoading) { + Text("刷新") + } + } + } + if (isLoading) { item { Card(modifier = Modifier.fillMaxWidth()) { diff --git a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/settings/SettingsScreen.kt b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/settings/SettingsScreen.kt index 7825704..067e7fc 100644 --- a/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/settings/SettingsScreen.kt +++ b/composeApp/src/commonMain/kotlin/cn/xiaobai/openclawapp/feature/settings/SettingsScreen.kt @@ -28,8 +28,10 @@ fun SettingsScreen( status: ServerStatus, availableAgents: List, currentTheme: AppThemeMode, + isRefreshing: Boolean, onSelectAgent: (String) -> Unit, onSelectTheme: (AppThemeMode) -> Unit, + onRefreshOverview: () -> Unit, onDisconnect: () -> Unit, ) { LazyColumn( @@ -138,6 +140,12 @@ fun SettingsScreen( ) } + item { + Button(onClick = onRefreshOverview, modifier = Modifier.fillMaxWidth(), enabled = !isRefreshing) { + Text(if (isRefreshing) "同步中…" else "立即同步") + } + } + item { Button(onClick = onDisconnect, modifier = Modifier.fillMaxWidth()) { Text("退出登录并重新连接") diff --git a/docs/MVP_PROGRESS.md b/docs/MVP_PROGRESS.md index 11f4117..5211136 100644 --- a/docs/MVP_PROGRESS.md +++ b/docs/MVP_PROGRESS.md @@ -457,3 +457,4 @@ Android/iOS App - 2026-03-07:继续收会话列表层级:最近访问卡降级成更轻的普通卡片,入口文案从“继续”改成“打开”;列表项把更新时间提到标题行右侧,底部只保留必要状态,置顶操作从文字按钮降成星标符号按钮,减少每项底部操作重量。 - 2026-03-07:继续压缩会话页头部:SectionHeader 标题字号和行距再收一档,统计文案改成更短的辅助信息;列表整体纵向间距减小,搜索框去掉表单式 label,改成更轻的 placeholder 搜索,减少头部在首屏占用的垂直空间。 - 2026-03-07:继续细化聊天时间线层级:system notice 改成更轻的窄条样式,thinking 去掉大 pill 改为更轻的 loading 行,tool error 文案收成“执行失败”并统一到更明显的错误容器语义,让过渡态 / 系统态 / 错误态和正式聊天消息的层级更清楚。 +- 2026-03-07:开始补主动自救能力:会话页新增常驻“刷新”入口,不再只有报错卡里才有重试;设置页新增“立即同步”入口,让用户能主动拉取状态 / agents / 会话列表,而不是只能等后台轮询或进详情页触发刷新。