git.iko.soy/opencode-android
on master help sign in
Stop failed-send draft clobber, scroll chat to newest on open, drop deprecated statusBarColor
6f4f52ciko
app/src/main/java/soy/iko/opencode/ui/chat/ChatScreen.kt+6
@@ -150,6 +150,12 @@ fun ChatScreen(
150 }
150 }
151 }
151 }
152
152
153+ // Jump to the latest message when the conversation first loads so the user
154+ // lands on recent context, not the oldest.
155+ LaunchedEffect(messages.isNotEmpty()) {
156+ if (messages.isNotEmpty()) listState.scrollToItem(messages.lastIndex)
157+ }
158+
153 // Keep the newest content in view as parts stream in — only if already at the bottom.
159 // Keep the newest content in view as parts stream in — only if already at the bottom.
154 // Include the growing text length so we follow streaming within a single part, not
160 // Include the growing text length so we follow streaming within a single part, not
155 // only when a brand-new message or part is added.
161 // only when a brand-new message or part is added.
app/src/main/java/soy/iko/opencode/ui/chat/ChatViewModel.kt+2−1
@@ -209,7 +209,8 @@ class ChatViewModel(
209 _running.value = false
209 _running.value = false
210 if (!ok) {
210 if (!ok) {
211 _failedDraft.value = trimmed
211 _failedDraft.value = trimmed
212+ // Only restore the draft if the user hasn't typed anything new since.
212− updateDraft(trimmed)
213+ if (_draft.value.isBlank()) updateDraft(trimmed)
213 _error.value = container.string(R.string.error_failed_to_send)
214 _error.value = container.string(R.string.error_failed_to_send)
214 }
215 }
215 }
216 }
app/src/main/java/soy/iko/opencode/ui/theme/Theme.kt−2
@@ -11,7 +11,6 @@ import androidx.compose.material3.lightColorScheme
11import androidx.compose.runtime.Composable
11import androidx.compose.runtime.Composable
12import androidx.compose.runtime.SideEffect
12import androidx.compose.runtime.SideEffect
13import androidx.compose.ui.graphics.Color
13import androidx.compose.ui.graphics.Color
14−import androidx.compose.ui.graphics.toArgb
15import androidx.compose.ui.platform.LocalContext
14import androidx.compose.ui.platform.LocalContext
16import androidx.compose.ui.platform.LocalView
15import androidx.compose.ui.platform.LocalView
17import androidx.core.view.WindowCompat
16import androidx.core.view.WindowCompat
@@ -47,7 +46,6 @@ fun OpencodeTheme(
47 if (!view.isInEditMode) {
46 if (!view.isInEditMode) {
48 SideEffect {
47 SideEffect {
49 val window = (view.context as Activity).window
48 val window = (view.context as Activity).window
50− window.statusBarColor = colorScheme.background.toArgb()
51 WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme
49 WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = !darkTheme
52 }
50 }
53 }
51 }