From 2f6cd2226a6be1cca30dbd49f331084a4bbfbd24 Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Thu, 18 Oct 2018 21:20:19 -0700 Subject: [PATCH] Implement iOS dictation placeholder methods to avoid default placeholder inserted by iOS. By default, ios inserts a series of space to show a graphic in. By overriding these methods it avoids it inserting placeholder characters. --- .../darwin/ios/framework/Source/FlutterTextInputPlugin.mm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm index da64123432f93..f8378d5d7174e 100644 --- a/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm +++ b/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.mm @@ -289,6 +289,13 @@ - (void)setSelectedTextRange:(UITextRange*)selectedTextRange updateEditingState: } } +- (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 @@ - (NSString*)textInRange:(UITextRange*)range { - (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