refactor: unify CandidateProto object for paged and bulk candidates#2021
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the candidate pipeline (JNI ↔ Kotlin UI) to use a single CandidateProto model for both paged (PagingSource) and bulk candidate retrieval, removing the older CandidateItem model and updating conversions/adapters accordingly.
Changes:
- Replaced
CandidateItem/CandidateListwithCandidateProtoacross JNI helpers, native APIs, and Kotlin adapters. - Updated JNI object conversion to always construct
CandidateProto(text, comment, label)with non-nullcomment. - Migrated UI adapters and message payloads to operate on
CandidateProtoarrays.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/jni/librime_jni/rime_jni.cc | Switch native candidate retrieval to return std::vector<CandidateProto> for paged and bulk paths. |
| app/src/main/jni/librime_jni/objconv.h | Remove CandidateItem conversions; convert CandidateProto lists to CandidateProto[] for JNI. |
| app/src/main/jni/librime_jni/jni-utils.h | Remove CandidateItem global refs; update CandidateProto constructor signature binding. |
| app/src/main/jni/librime_jni/helper-types.h | Remove CandidateList alias; make CandidateProto.comment non-optional and add a RimeCandidate ctor. |
| app/src/main/java/com/osfans/trime/ime/candidates/unrolled/PagingCandidateViewAdapter.kt | Update paging adapter to use CandidateProto. |
| app/src/main/java/com/osfans/trime/ime/candidates/unrolled/CandidatesPagingSource.kt | Update paging source generics to CandidateProto. |
| app/src/main/java/com/osfans/trime/ime/candidates/popup/LabeledCandidateItemUi.kt | Adjust comment rendering to non-null comment. |
| app/src/main/java/com/osfans/trime/ime/candidates/compact/CompactCandidateViewAdapter.kt | Update compact adapter to use CandidateProto. |
| app/src/main/java/com/osfans/trime/ime/candidates/CandidateItemUi.kt | Update candidate row UI binding to accept CandidateProto. |
| app/src/main/java/com/osfans/trime/core/SchemaItem.kt | Remove the CandidateItem data class from core models. |
| app/src/main/java/com/osfans/trime/core/RimeProto.kt | Make CandidateProto.comment non-nullable (String). |
| app/src/main/java/com/osfans/trime/core/RimeMessage.kt | Update CandidateListMessage payload to Array<CandidateProto>. |
| app/src/main/java/com/osfans/trime/core/RimeApi.kt | Update getCandidates() API to return Array<CandidateProto>. |
| app/src/main/java/com/osfans/trime/core/Rime.kt | Update native method typings and getCandidates() implementation to CandidateProto. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Bambooin
approved these changes
Jun 4, 2026
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.
Pull request
Issue tracker
Fixes will automatically close the related issues
Fixes # N/A
Feature
Describe features of this pull request
Code of conduct
Code style
make sytle-lintBuild pass
make debugManually test
Code Review
Daily build
Login and download artifact at https://github.com/osfans/trime/actions
Additional Info