Fix IME composition loss and reply prefix overwrite#120
Merged
malkoG merged 1 commit intohackers-pub:mainfrom Apr 17, 2026
Merged
Fix IME composition loss and reply prefix overwrite#120malkoG merged 1 commit intohackers-pub:mainfrom
malkoG merged 1 commit intohackers-pub:mainfrom
Conversation
- Use TextFieldValue.copy() instead of constructor to preserve IME composition state during ViewModel-driven text sync - Prevent setReplyTarget() from overwriting user-typed content when async network response arrives late - Add ComposeViewModelTest for setReplyTarget() behavior Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dalinaum
added a commit
to dalinaum/hackerspub-android
that referenced
this pull request
Apr 17, 2026
Settings - Add a leading back arrow in the Settings top bar so the screen can be exited without using the bottom-nav. - Add a "Theme" row that opens a dialog with four options: Follow system / Light / Dark / Dynamic color (Material You). Dynamic is disabled with a "Requires Android 12+" caption on API < 31. Theme system - New ThemeMode enum persisted as a string preference in PreferencesManager so the choice survives restarts. - HackersPubTheme now accepts a themeMode parameter and resolves the Material colorScheme accordingly. MainActivity collects the preference and passes it down before composing the app. - For Dynamic mode, derive LocalAppColors from the wallpaper-based ColorScheme (surface tonal layers carry the hue; outline-based divider was too strong, mapped to surfaceContainerHigh to match the brand's near-invisible-divider convention). - New AppColorScheme.composeOnAccent so the FAB content color tracks the theme; existing call sites (Timeline, PostDetail, Compose, ComposeArticle) drop the hard-coded Color.White. - WallpaperManager.OnColorsChangedListener registered only while Dynamic is active so wallpaper hue changes trigger Activity recreation and pick up the fresh palette without an app restart. Test fixes (pre-existing failures on main) - ComposeViewModelTest: stub repository.getViewer() in @before — the init coroutine added in PR hackers-pub#120 crashed under MockK relaxed mode with a Result/Object cast error. - ProfileViewModelTest: stub and verify getProfile(any(), any()) so the refresh-time call (refresh = true) is matched alongside the initial load. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ComposeScreen.kt:TextFieldValue()생성자 대신copy()사용하여 IME composition 상태 보존ComposeViewModel.kt:setReplyTarget()이 비동기 응답 후 사용자가 이미 입력한 content를 덮어쓰지 않도록 방어ComposeViewModelTest.kt: setReplyTarget() 동작 검증 테스트 추가Context
사용자 제보: "입력하다가 IME 바꿔서 입력하면 마지막 단어가 날라감"
디버그 로그로 확인한 결과, 삼성 키보드가 전체 텍스트를 하나의 composition으로 유지하여(
comp=TextRange(0, N)), IME 전환 시 commit 없이 composition이 통째로 버려지는 삼성 키보드 고유 동작이 원인. 이 부분은 앱 수준에서 완벽히 우회 불가.본 PR은 앱 코드에서 제어 가능한 두 가지 문제를 수정:
LaunchedEffect에서TextFieldValue재생성 시 composition 유실 방지Test plan
./gradlew assembleDebug빌드 성공🤖 Generated with Claude Code