Repository navigation
fix(chat): make the favorite star work in the voice assistant model picker - #398
Merged
Merged
Conversation
…icker The voice assistant settings opened the shared model picker without passing favoriteModelKeys or onToggleFavorite. Both had defaults (an empty set and a no-op), so that picker drew a star on every row that did nothing when tapped, while the chat and schedule pickers toggled fine. Thread the favorites from SettingsViewModel through SettingsNavGraph and VoiceSettingsScreen into the picker, and drop the defaults so a caller that forgets them no longer compiles. Add an instrumented test that tapping the star toggles the favorite without selecting the model. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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
favoriteModelKeysoronToggleFavorite. Both parameters had defaults (an empty set and a no-op), so that picker drew a star on every row that did nothing when tapped. The chat and schedule pickers passed them and toggled fine, which is why the star only failed "sometimes".SettingsViewModelthroughSettingsNavGraphandVoiceSettingsScreeninto the picker, so the voice picker shares the same favorites store as chat and schedules.ModelAndRuntimePickerSheet.favoriteModelKeys/onToggleFavorite, so a caller that forgets them no longer compiles.Test plan
./gradlew :app:compileGithubDebugKotlin :app:compileGithubDebugAndroidTestKotlin./gradlew spotlessCheck(afterspotlessApplyfixed an import order in the test)./gradlew :app:testGithubDebugUnitTest— 1394 tests, 0 failures, 8 skippedModelAndRuntimePickerSheetInstrumentedTeston the API 36 emulator — 2 tests, 0 failed (includes the newtappingStarTogglesFavoriteWithoutSelectingModel)Note: the new instrumented test exercises the sheet's tap behavior (toggle without selecting the model). It would also have passed before this change, because the sheet itself was fine; the regression guard for the wiring bug is the removal of the defaults, which turns a missed call site into a compile error.
Pre-PR review
repo-revieweris an OpenCode agent definition (.opencode/agents/repo-reviewer.md) and is not available as a subagent type in this Claude Code session. The review below was run by a read-only general-purpose subagent instructed to follow that definition exactly. It reviewedgit diff origin/main...HEADat commit 3b70257.判定: APPROVE
ブロッカー
なし
提案(非ブロッキング)
favoriteModelKeys: Set<String> = emptySet()とonToggleFavoriteModel = { _, _ -> }にはデフォルト値が残っている。今回ピッカー側で潰した「渡し忘れでスターが無反応になる」問題が、1階層上で再発しうる。ただし本番の呼び出し元は SettingsNavGraph.kt:162 の1箇所だけで、そこは今回配線済み。残りの呼び出しはデフォルトを使う @Preview のみ。同ファイルの他のコールバックも全部デフォルト付きなので、ファイル内の流儀とは揃っている。直すなら必須化したうえで Preview(VoiceSettingsScreen.kt:1092 付近)にも渡す。やらなくてもマージ可。providerModelList == trueでゲートする必要がある。チェック済み項目
settingsState.favoriteModelKeysとsettingsViewModel::toggleFavoriteModelを渡し、AssistantTargetSection 経由でピッカーまで抜けなく渡っている。settingsStateはcollectAsState()された値なので、トグル後に再コンポーズされスターの塗りが更新される。"$providerId/$modelId"をトグルして永続化。キー形式はピッカーの判定と一致し、チャット・スケジュール画面と共有ストア。app/src/main/res配下の変更なし。新規のユーザー向け文字列なし。R.string.cd_favoriteは既存キーで全8ロケールに存在する。cd_favoriteの content description でスターを特定し、「トグルされ、選択は起きない」をコード上も裏付けている。追加 import は全て使用されている。spotlessCheckは作成者がローカルで実行して通過済み。🤖 Generated with Claude Code