From 44edc08f878bf5e4b6d84a10c4e8475766e48978 Mon Sep 17 00:00:00 2001 From: David Langley Date: Fri, 12 Jul 2024 21:28:35 +0100 Subject: [PATCH 1/2] Moving the dot back after predictive text was introduced in 17.5 --- .../WysiwygComposerView/WysiwygComposerViewModel.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platforms/ios/lib/WysiwygComposer/Sources/WysiwygComposer/Components/WysiwygComposerView/WysiwygComposerViewModel.swift b/platforms/ios/lib/WysiwygComposer/Sources/WysiwygComposer/Components/WysiwygComposerView/WysiwygComposerViewModel.swift index 72815408d..41a0e1863 100644 --- a/platforms/ios/lib/WysiwygComposer/Sources/WysiwygComposer/Components/WysiwygComposerView/WysiwygComposerViewModel.swift +++ b/platforms/ios/lib/WysiwygComposer/Sources/WysiwygComposer/Components/WysiwygComposerView/WysiwygComposerViewModel.swift @@ -467,6 +467,10 @@ public extension WysiwygComposerViewModel { /// accepting an inline predictive text suggestion. It then reconciles with the model if it did. /// - Returns: Whether the an update was applied. func updateDotAfterInlineTextPredicationIfNeeded() -> Bool { + // This optimisation to predictive inline text only came in in 17.5 + guard #available(iOS 17.5, *) else { + return false + } let text = textView.attributedText.htmlChars.withNBSP let textSelection = textView.selectedRange // Check if the last character in the editor is a dot. From ee0795eddbf3bdfaca1d396df36f9011c3a68c6e Mon Sep 17 00:00:00 2001 From: David Langley Date: Fri, 12 Jul 2024 21:57:26 +0100 Subject: [PATCH 2/2] Fix test. --- .../WysiwygUITests/WysiwygUITests+Keyboard.swift | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/platforms/ios/example/WysiwygUITests/WysiwygUITests+Keyboard.swift b/platforms/ios/example/WysiwygUITests/WysiwygUITests+Keyboard.swift index 57f1f217e..ada6a00df 100644 --- a/platforms/ios/example/WysiwygUITests/WysiwygUITests+Keyboard.swift +++ b/platforms/ios/example/WysiwygUITests/WysiwygUITests+Keyboard.swift @@ -116,11 +116,19 @@ extension WysiwygUITests { app.keys["space"].tap() app.keys["more"].tap() app.keys["."].tap() - assertTextViewContent("hello how are you.") + + // This optimisation to predictive inline text was introduced in 17.5 + let correctText: String + if #available(iOS 17.5, *) { + correctText = "hello how are you." + } else { + correctText = "hello how are you ." + } + assertTextViewContent(correctText) // In the failure case a second dot is added in the tree. assertTreeEquals( """ - └>"hello how are you." + └>"\(correctText)" """ ) }