Skip to content

Commit

Permalink
refactor: cleanup the process of handling rime response inside Rime
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiredPlanck committed Oct 9, 2024
1 parent 3591a2b commit c43d0b8
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions app/src/main/java/com/osfans/trime/core/Rime.kt
Original file line number Diff line number Diff line change
Expand Up @@ -157,20 +157,17 @@ class Rime :

private fun handleRimeResponse(response: RimeResponse) {
SchemaManager.init(getCurrentRimeSchema())
if (response.status != null) {
val (item, status) =
response.status.let {
SchemaItem.fromStatus(it) to InputStatus.fromStatus(it)
}
response.status?.let {
val status = InputStatus.fromStatus(it)
inputStatusCached = status
inputStatus = response.status // for compatibility
inputStatus = it // for compatibility

val item = SchemaItem.fromStatus(it)
if (item != schemaItemCached) {
schemaItemCached = item
}
}
if (response.context != null) {
inputContext = response.context // for compatibility
}
response.context?.let { inputContext = it } // for compatibility
}

fun startup(fullCheck: Boolean) {
Expand Down

0 comments on commit c43d0b8

Please sign in to comment.