mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-28 19:59:55 +00:00
get all suggestions without coroutines
This commit is contained in:
parent
deec4d1f98
commit
0a9c9fdab8
1 changed files with 2 additions and 4 deletions
|
@ -469,18 +469,16 @@ class DictionaryFacilitatorImpl : DictionaryFacilitator {
|
|||
val proximityInfoHandle = keyboard.proximityInfo.nativeProximityInfo
|
||||
val weightOfLangModelVsSpatialModel = floatArrayOf(Dictionary.NOT_A_WEIGHT_OF_LANG_MODEL_VS_SPATIAL_MODEL)
|
||||
|
||||
val deferredSuggestions = dictionaryGroups.map {
|
||||
scope.async {
|
||||
val suggestions = dictionaryGroups.map {
|
||||
// todo: if the order does not matter, we could add the suggestions right away without awaitAll first
|
||||
getSuggestions(composedData, ngramContext, settingsValuesForSuggestion, sessionId,
|
||||
proximityInfoHandle, weightOfLangModelVsSpatialModel, it)
|
||||
}
|
||||
}
|
||||
val suggestionResults = SuggestionResults(
|
||||
SuggestedWords.MAX_SUGGESTIONS, ngramContext.isBeginningOfSentenceContext,
|
||||
false
|
||||
)
|
||||
runBlocking { deferredSuggestions.awaitAll() }.forEach {
|
||||
suggestions.forEach {
|
||||
suggestionResults.addAll(it)
|
||||
suggestionResults.mRawSuggestions?.addAll(it)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue