@@ -108,25 +108,20 @@ - (BOOL)textOf:(NSAttributedString*)newText equals:(NSAttributedString*)oldText{
108108 // If the user added an emoji, the system adds a font attribute for the emoji and stores the original font in
109109 // NSOriginalFont. Lastly, when entering a password, etc., there will be additional styling on the field as the native
110110 // text view handles showing the last character for a split second.
111- __block BOOL isDictationRunning = false ;
112- [oldText enumerateAttribute: NSAttachmentAttributeName
113- inRange: NSMakeRange (0 , oldText.length)
114- options: kNilOptions
115- usingBlock: ^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) {
116- if ([value respondsToSelector: NSSelectorFromString (@" typingAttributesBeforeInsertion" )]) {
117- isDictationRunning = true ;
118- *stop = true ;
119- }
120- }];
121111 __block BOOL fontHasBeenUpdatedBySystem = false ;
122112 [oldText enumerateAttribute: @" NSOriginalFont" inRange: NSMakeRange (0 , oldText.length) options: 0 usingBlock: ^(id value, NSRange range, BOOL *stop) {
123113 if (value){
124114 fontHasBeenUpdatedBySystem = true ;
125115 }
126116 }];
127117
118+ BOOL shouldFallbackDictation = [self .backedTextInputView.textInputMode.primaryLanguage isEqualToString: @" dictation" ];
119+ if (@available (iOS 16.0 , *)) {
120+ shouldFallbackDictation = self.backedTextInputView .dictationRecognizing ;
121+ }
122+
128123 BOOL shouldFallbackToBareTextComparison =
129- isDictationRunning ||
124+ shouldFallbackDictation ||
130125 [self .backedTextInputView.textInputMode.primaryLanguage isEqualToString: @" ko-KR" ] ||
131126 self.backedTextInputView .markedTextRange || self.backedTextInputView .isSecureTextEntry ||
132127 fontHasBeenUpdatedBySystem;
0 commit comments