Skip to content

Commit c43d0b8

Browse files
committed
refactor: cleanup the process of handling rime response inside Rime
1 parent 3591a2b commit c43d0b8

File tree

1 file changed

+6
-9
lines changed
  • app/src/main/java/com/osfans/trime/core

1 file changed

+6
-9
lines changed

app/src/main/java/com/osfans/trime/core/Rime.kt

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -157,20 +157,17 @@ class Rime :
157157

158158
private fun handleRimeResponse(response: RimeResponse) {
159159
SchemaManager.init(getCurrentRimeSchema())
160-
if (response.status != null) {
161-
val (item, status) =
162-
response.status.let {
163-
SchemaItem.fromStatus(it) to InputStatus.fromStatus(it)
164-
}
160+
response.status?.let {
161+
val status = InputStatus.fromStatus(it)
165162
inputStatusCached = status
166-
inputStatus = response.status // for compatibility
163+
inputStatus = it // for compatibility
164+
165+
val item = SchemaItem.fromStatus(it)
167166
if (item != schemaItemCached) {
168167
schemaItemCached = item
169168
}
170169
}
171-
if (response.context != null) {
172-
inputContext = response.context // for compatibility
173-
}
170+
response.context?.let { inputContext = it } // for compatibility
174171
}
175172

176173
fun startup(fullCheck: Boolean) {

0 commit comments

Comments
 (0)