Skip to content

[#12919] Allow adding emoji in status input even if it exceeds limit #12949

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions src/status_im/ui/screens/status/new/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
[status-im.ui.components.icons.icons :as icons]
[quo.components.animated.pressable :as pressable]
[status-im.ui.screens.status.views :as status.views]
[status-im.ui.screens.status.new.styles :as styles]))
[status-im.ui.screens.status.new.styles :as styles]
[status-im.utils.platform :as platform]))

(defn buttons []
[react/view styles/buttons
Expand Down Expand Up @@ -43,7 +44,7 @@
^{:key (str "image" img)}
[image-preview img])]]))

(def message-max-lenght 600)
(def message-max-length 600)

(defn my-status []
(let [images-opened (reagent/atom false)
Expand All @@ -53,7 +54,8 @@
input-text (re-frame/subscribe [:chats/timeline-chat-input-text])
sending-image (re-frame/subscribe [:chats/timeline-sending-image])]
(fn []
(let [{:keys [uri]} (first (vals @sending-image))]
(let [{:keys [uri]} (first (vals @sending-image))
text-length (count @input-text)]
[kb-presentation/keyboard-avoiding-view {:style {:flex 1}}
[:<>
[react/scroll-view {:style {:flex 1}
Expand All @@ -65,7 +67,10 @@
{:style {:margin 16}
:scroll-enabled false
:accessibility-label :my-status-input
:max-length message-max-lenght
:max-length (if platform/android?
message-max-length
(when (>= text-length message-max-length)
text-length))
:auto-focus true
:multiline true
:on-selection-change (fn [args]
Expand Down Expand Up @@ -100,11 +105,14 @@
{:accessibility-label :send-my-status-button
:type :secondary
:after :main-icon/send
:disabled (and (string/blank? @input-text) (not uri))
:disabled (or (> text-length message-max-length)
(and (string/blank? @input-text) (not uri)))
:on-press #(do
(re-frame/dispatch [:profile.ui/send-my-status-message])
(re-frame/dispatch [:navigate-back]))}
(i18n/label :t/wallet-send)]}]
[react/view styles/count-container
[react/text {:style {:color colors/gray}}
(str (count @input-text) " / " message-max-lenght)]]]]]]))))
[react/text {:style {:color (if (> text-length message-max-length)
colors/red
colors/gray)}}
(str text-length " / " message-max-length)]]]]]]))))