From 6f43dcadbcb6f0c21321c74d1cf17c8da40baac9 Mon Sep 17 00:00:00 2001 From: Taksh Date: Fri, 31 Jul 2026 17:47:31 +0300 Subject: [PATCH] fix: drop dead autocorrect helper and invalidate trait timer Periphery flagged shouldDisableAutocorrect after the debounce path switched to appliedAutocorrectDisabled. Also cancel autocorrectTraitTimer on disappear so a pending tick cannot fire after the view is gone. --- bitchat/Views/ContentComposerView.swift | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/bitchat/Views/ContentComposerView.swift b/bitchat/Views/ContentComposerView.swift index eb975203..fe777724 100644 --- a/bitchat/Views/ContentComposerView.swift +++ b/bitchat/Views/ContentComposerView.swift @@ -160,17 +160,12 @@ struct ContentComposerView: View { .themedChromePanel(edge: .bottom) .onDisappear { autocompleteDebounceTimer?.invalidate() + autocorrectTraitTimer?.invalidate() } } } private extension ContentComposerView { - /// Mirror autocomplete's end-of-string caret: SwiftUI's TextField doesn't - /// expose selection, and suggestions already assume the caret is at the end. - var shouldDisableAutocorrect: Bool { - ComposerAutocorrect.shouldDisable(for: messageText, cursorPosition: messageText.count) - } - /// Debounce trait flips so UIKit isn't asked to reload the keyboard on /// every character while the user is still deciding the token. func scheduleAutocorrectTraitUpdate(for text: String) {