From 0ab227eef83eda6501a12c7b76574fbbd565922b Mon Sep 17 00:00:00 2001 From: Volodymyr Kozieiev Date: Tue, 25 Aug 2020 11:51:49 +0300 Subject: [PATCH] Restrict message size on input Signed-off-by: Volodymyr Kozieiev --- src/status_im/chat/constants.cljs | 2 ++ src/status_im/ui/screens/chat/components/input.cljs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/status_im/chat/constants.cljs b/src/status_im/chat/constants.cljs index 37e80a59e8..d89d45bc97 100644 --- a/src/status_im/chat/constants.cljs +++ b/src/status_im/chat/constants.cljs @@ -12,3 +12,5 @@ {1 2000 2 5000 3 10000}) + +(def max-text-size 4096) diff --git a/src/status_im/ui/screens/chat/components/input.cljs b/src/status_im/ui/screens/chat/components/input.cljs index 40590ef08a..852d586405 100644 --- a/src/status_im/ui/screens/chat/components/input.cljs +++ b/src/status_im/ui/screens/chat/components/input.cljs @@ -6,6 +6,7 @@ [quo.design-system.colors :as colors] [status-im.ui.screens.chat.components.style :as styles] [status-im.ui.screens.chat.components.reply :as reply] + [status-im.chat.constants :as chat.constants] [status-im.utils.utils :as utils.utils] [quo.components.animated.pressable :as pressable] [quo.animated :as animated] @@ -86,6 +87,7 @@ :auto-focus false :on-focus #(set-active-panel nil) :on-change #(on-text-change (.-text ^js (.-nativeEvent ^js %))) + :max-length chat.constants/max-text-size :placeholder-text-color (:text-02 @colors/theme) :placeholder (if cooldown-enabled? (i18n/label :cooldown/text-input-disabled)