mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
Fix input connection termination crash case
This commit is contained in:
parent
88403fad79
commit
14a846673d
@ -177,19 +177,29 @@ public class LanguageModelFacilitator(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val wordComposer = inputLogic.mWordComposer
|
if(!inputLogic.mConnection.isConnected) return
|
||||||
val ngramContext = inputLogic.getNgramContextFromNthPreviousWordForSuggestion(settingsValues.mSpacingAndPunctuations, 2)
|
|
||||||
|
|
||||||
val values = PredictionInputValues(
|
try {
|
||||||
wordComposer.getComposedDataSnapshot(),
|
val wordComposer = inputLogic.mWordComposer
|
||||||
ngramContext,
|
val ngramContext = inputLogic.getNgramContextFromNthPreviousWordForSuggestion(
|
||||||
inputStyle,
|
settingsValues.mSpacingAndPunctuations,
|
||||||
++currentSequenceId
|
2
|
||||||
)
|
)
|
||||||
|
|
||||||
lifecycleScope.launch {
|
val values = PredictionInputValues(
|
||||||
println("LatinIME: Emitting values")
|
wordComposer.composedDataSnapshot,
|
||||||
sharedFlow.emit(values)
|
ngramContext,
|
||||||
|
inputStyle,
|
||||||
|
++currentSequenceId
|
||||||
|
)
|
||||||
|
|
||||||
|
lifecycleScope.launch {
|
||||||
|
println("LatinIME: Emitting values")
|
||||||
|
sharedFlow.emit(values)
|
||||||
|
}
|
||||||
|
} catch(e: Exception) {
|
||||||
|
println("Failed to get context, composed data snapshot, etc: $e")
|
||||||
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user