Skip to content

refactor: unify CandidateProto object for paged and bulk candidates#2021

Merged
WhiredPlanck merged 1 commit into
osfans:developfrom
WhiredPlanck:candidate
Jun 4, 2026
Merged

refactor: unify CandidateProto object for paged and bulk candidates#2021
WhiredPlanck merged 1 commit into
osfans:developfrom
WhiredPlanck:candidate

Conversation

@WhiredPlanck

Copy link
Copy Markdown
Collaborator

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

Build pass

  • make debug

Manually test

  • Done

Code Review

  1. No wildcards import
  2. Manual build and test pass
  3. GitHub Action CI pass
  4. At least one contributor review and approve
  5. Merged clean without conflicts
  6. PR will be merged by rebase upstream base

Daily build

Login and download artifact at https://github.com/osfans/trime/actions

Additional Info

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/CandidateList with CandidateProto across JNI helpers, native APIs, and Kotlin adapters.
  • Updated JNI object conversion to always construct CandidateProto(text, comment, label) with non-null comment.
  • Migrated UI adapters and message payloads to operate on CandidateProto arrays.

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.

Comment thread app/src/main/jni/librime_jni/rime_jni.cc
Comment thread app/src/main/jni/librime_jni/helper-types.h
@WhiredPlanck WhiredPlanck merged commit e60e2dd into osfans:develop Jun 4, 2026
4 checks passed
@WhiredPlanck WhiredPlanck deleted the candidate branch June 4, 2026 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants