diff --git a/src/status_im/ui/screens/chat/group.cljs b/src/status_im/ui/screens/chat/group.cljs index 5d8a096702..a1158464c1 100644 --- a/src/status_im/ui/screens/chat/group.cljs +++ b/src/status_im/ui/screens/chat/group.cljs @@ -8,7 +8,8 @@ [status-im.i18n.i18n :as i18n] [status-im.ui.components.list-selection :as list-selection] [quo.design-system.colors :as colors] - [status-im.utils.debounce :as debounce]) + [status-im.utils.debounce :as debounce] + [status-im.utils.platform :as platform]) (:require-macros [status-im.utils.views :refer [defview letsubs]])) (defn join-chat-button [chat-id] @@ -25,8 +26,11 @@ :on-press #(debounce/dispatch-and-chill [:group-chats.ui/leave-chat-confirmed chat-id] 2000)} (i18n/label :t/group-chat-decline-invitation)]) +(def message-max-length 100) + (defn request-membership [{:keys [state introduction-message] :as invitation}] - (let [{:keys [message retry?]} @(re-frame/subscribe [:chats/current-chat-membership])] + (let [{:keys [message retry?]} @(re-frame/subscribe [:chats/current-chat-membership]) + message-length (count message)] [react/view {:margin-horizontal 16 :margin-top 10} (cond (and invitation (= constants/invitation-state-requested state) (not retry?)) @@ -52,7 +56,10 @@ [react/text (i18n/label :t/introduce-yourself)] [quo/text-input {:placeholder (i18n/label :t/message) :on-change-text #(re-frame/dispatch [:group-chats.ui/update-membership-message %]) - :max-length 100 + :max-length (if platform/android? + message-max-length + (when (>= message-length message-max-length) + message-length)) :multiline true :default-value message :accessibility-label :introduce-yourself-input diff --git a/src/status_im/ui/screens/chat/views.cljs b/src/status_im/ui/screens/chat/views.cljs index ce09afda53..0b146399d9 100644 --- a/src/status_im/ui/screens/chat/views.cljs +++ b/src/status_im/ui/screens/chat/views.cljs @@ -162,7 +162,8 @@ (defn invitation-bar [chat-id] (let [{:keys [state chat-id] :as invitation} (first @(re-frame/subscribe [:group-chat/invitations-by-chat-id chat-id])) - {:keys [retry? message]} @(re-frame/subscribe [:chats/current-chat-membership])] + {:keys [retry? message]} @(re-frame/subscribe [:chats/current-chat-membership]) + message-length (count message)] [react/view {:margin-horizontal 16 :margin-top 10} (cond (and invitation (= constants/invitation-state-requested state) (not retry?)) @@ -193,7 +194,8 @@ [quo/button {:type :secondary :accessibility-label :introduce-yourself-button - :disabled (string/blank? message) + :disabled (or (string/blank? message) + (> message-length chat.group/message-max-length)) :on-press #(re-frame/dispatch [:send-group-chat-membership-request])} (i18n/label :t/request-membership)]}])]))