mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-17 07:22:45 +00:00
slightly tune when entries are added to user history
This commit is contained in:
parent
935dd77cf1
commit
5eaeb5892f
1 changed files with 11 additions and 5 deletions
|
@ -874,10 +874,17 @@ public final class InputLogic {
|
|||
private void addToHistoryIfEmoji(final String text, final SettingsValues settingsValues) {
|
||||
if (mLastComposedWord == LastComposedWord.NOT_A_COMPOSED_WORD // we want a last composed word, also to avoid storing consecutive emojis
|
||||
|| mWordComposer.isComposingWord() // emoji will be part of the word in this case, better do nothing
|
||||
|| !settingsValues.mBigramPredictionEnabled // this is for next word suggestions, so they need to be enabled
|
||||
|| settingsValues.mIncognitoModeEnabled // add nothing
|
||||
|| !StringUtilsKt.isEmoji(text) // obviously we need an emoji
|
||||
|| !settingsValues.mBigramPredictionEnabled // this is only for next word suggestions, so they need to be enabled
|
||||
|| settingsValues.mIncognitoModeEnabled
|
||||
|| settingsValues.mInputAttributes.mInputTypeNoAutoCorrect // see comment in performAdditionToUserHistoryDictionary
|
||||
|| !StringUtilsKt.isEmoji(text)
|
||||
) return;
|
||||
if (mConnection.hasSlowInputConnection()) {
|
||||
// Since we don't unlearn when the user backspaces on a slow InputConnection,
|
||||
// turn off learning to guard against adding typos that the user later deletes.
|
||||
Log.w(TAG, "Skipping learning due to slow InputConnection.");
|
||||
return;
|
||||
}
|
||||
mLastComposedWord = LastComposedWord.NOT_A_COMPOSED_WORD; // avoid storing consecutive emojis
|
||||
|
||||
// commit emoji to dictionary, so it ends up in history and can be suggested as next word
|
||||
|
@ -1549,8 +1556,7 @@ public final class InputLogic {
|
|||
// If correction is not enabled, we don't add words to the user history dictionary.
|
||||
// That's to avoid unintended additions in some sensitive fields, or fields that
|
||||
// expect to receive non-words.
|
||||
if (!settingsValues.mAutoCorrectionEnabledPerUserSettings
|
||||
|| settingsValues.mIncognitoModeEnabled)
|
||||
if (settingsValues.mInputAttributes.mInputTypeNoAutoCorrect || settingsValues.mIncognitoModeEnabled)
|
||||
return;
|
||||
if (mConnection.hasSlowInputConnection()) {
|
||||
// Since we don't unlearn when the user backspaces on a slow InputConnection,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue