13771 - iOS dictation bug (flutter/engine#6607)

According to the iOS docs, implementing
`- (id)insertDictationResultPlaceholder`

```Implementation of this method is optional but can be done when you want to provide a specific rectangle for the placeholder animation while the dictation results are being processed. ```

If you do not implement this method, UIKit will insert a default placeholder of 10 whitespace characters. By overriding this, no placeholder text will be inserted. If you implement the `insertDictationResultPlaceholder`, you must implement
`- (void)removeDictationResultPlaceholder:(id)placeholder willInsertResult:(BOOL)willInsertResult`
This commit is contained in:
Matthew Smith
2018-10-22 10:28:39 -07:00
committed by Chris Bracken
parent 043f78f65f
commit 437e15e3f5

View File

@@ -289,6 +289,13 @@ static UIReturnKeyType ToUIReturnKeyType(NSString* inputType) {
}
}
- (id)insertDictationResultPlaceholder {
return @"";
}
- (void)removeDictationResultPlaceholder:(id)placeholder willInsertResult:(BOOL)willInsertResult {
}
- (NSString*)textInRange:(UITextRange*)range {
NSRange textRange = ((FlutterTextRange*)range).range;
return [self.text substringWithRange:textRange];
@@ -297,7 +304,6 @@ static UIReturnKeyType ToUIReturnKeyType(NSString* inputType) {
- (void)replaceRange:(UITextRange*)range withText:(NSString*)text {
NSRange replaceRange = ((FlutterTextRange*)range).range;
NSRange selectedRange = _selectedTextRange.range;
// Adjust the text selection:
// * reduce the length by the intersection length
// * adjust the location by newLength - oldLength + intersectionLength