Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 842260d

Browse files
authored
trim whitespace and newline from text cache (#1435)
1 parent b8bacd5 commit 842260d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Local Pods/MessageViewController/MessageViewController/MessageViewController.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ open class MessageViewController: UIViewController, MessageAutocompleteControlle
138138

139139
internal func cache() {
140140
guard let key = fullCacheKey else { return }
141-
UserDefaults.standard.set(messageView.text, forKey: key)
141+
let text = messageView.text.trimmingCharacters(in: .whitespacesAndNewlines)
142+
guard !text.isEmpty else { return }
143+
UserDefaults.standard.set(text, forKey: key)
142144
}
143145

144146
var cachedText: String? {

0 commit comments

Comments
 (0)