Skip to content
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

[#12919] Allow adding emoji to group intro message if it exceeds limit #13024

Merged
merged 1 commit into from
Jan 19, 2022
Merged
Show file tree
Hide file tree
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
13 changes: 10 additions & 3 deletions src/status_im/ui/screens/chat/group.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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?))
Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions src/status_im/ui/screens/chat/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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?))
Expand Down Expand Up @@ -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)]}])]))

Expand Down