mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-28 01:16:50 +00:00
parent
b6fa6c366c
commit
d8499e6bad
@ -154,12 +154,19 @@
|
||||
(commands/set-command-input :responses to-message-id command-key)
|
||||
(assoc :canceled-command false)))
|
||||
|
||||
(register-handler :set-response-chat-command
|
||||
(register-handler ::set-response-chat-command
|
||||
[(after invoke-suggestions-handler!)
|
||||
(after #(dispatch [:command-edit-mode]))
|
||||
(after #(dispatch [:set-chat-input-text ""]))]
|
||||
set-response-command)
|
||||
|
||||
(register-handler :set-response-chat-command
|
||||
(u/side-effect!
|
||||
(fn [{:keys [current-chat-id] :as db}
|
||||
[_ to-message-id command-key]]
|
||||
(when (get-in db [:chats current-chat-id :responses command-key])
|
||||
(dispatch [::set-response-chat-command to-message-id command-key])))))
|
||||
|
||||
(register-handler ::add-validation-errors
|
||||
(after #(dispatch [:fix-response-height]))
|
||||
(fn [db [_ chat-id errors]]
|
||||
|
@ -43,7 +43,7 @@
|
||||
(anim/start
|
||||
(button-animation val min-scale loop? answered?)))))
|
||||
|
||||
(defn request-button [message-id command]
|
||||
(defn request-button [message-id command status-initialized?]
|
||||
(let [scale-anim-val (anim/create-value min-scale)
|
||||
answered? (subscribe [:is-request-answered? message-id])
|
||||
loop? (r/atom true)
|
||||
@ -57,10 +57,10 @@
|
||||
:component-will-unmount
|
||||
#(reset! loop? false)
|
||||
:reagent-render
|
||||
(fn [message-id {command-icon :icon :as command}]
|
||||
(fn [message-id {command-icon :icon :as command} status-initialized?]
|
||||
(if command
|
||||
[touchable-highlight
|
||||
{:on-press (when-not @answered?
|
||||
{:on-press (when (and (not @answered?) status-initialized?)
|
||||
#(set-chat-command message-id command))
|
||||
:style st/command-request-image-touchable
|
||||
:accessibility-label (label command)}
|
||||
@ -71,13 +71,14 @@
|
||||
(defn message-content-command-request
|
||||
[{:keys [message-id content from incoming-group]}]
|
||||
(let [commands-atom (subscribe [:get-responses])
|
||||
answered? (subscribe [:is-request-answered? message-id])]
|
||||
answered? (subscribe [:is-request-answered? message-id])
|
||||
status-initialized? (subscribe [:get :status-module-initialized?])]
|
||||
(fn [{:keys [message-id content from incoming-group]}]
|
||||
(let [commands @commands-atom
|
||||
{:keys [command content]} (parse-command-request commands content)]
|
||||
[view st/comand-request-view
|
||||
[touchable-highlight
|
||||
{:on-press (when-not @answered?
|
||||
{:on-press (when (and (not @answered?) @status-initialized?)
|
||||
#(set-chat-command message-id command))}
|
||||
[view st/command-request-message-view
|
||||
(when incoming-group
|
||||
@ -87,7 +88,7 @@
|
||||
[text {:style st/style-message-text
|
||||
:font :default}
|
||||
content]]]
|
||||
[request-button message-id command]
|
||||
[request-button message-id command @status-initialized?]
|
||||
(when (:request-text command)
|
||||
[view st/command-request-text-view
|
||||
[text {:style st/style-sub-text
|
||||
|
@ -44,7 +44,8 @@
|
||||
:loading-allowed true
|
||||
|
||||
:sync-state :done
|
||||
:sync-listener nil})
|
||||
:sync-listener nil
|
||||
:status-module-initialized? js/goog.DEBUG})
|
||||
|
||||
(defn chat-staged-commands-path [chat-id]
|
||||
[:chats chat-id :staged-commands])
|
||||
|
@ -114,9 +114,11 @@
|
||||
(log/debug "Event " type " not handled"))))))
|
||||
|
||||
(register-handler :status-module-initialized!
|
||||
(u/side-effect!
|
||||
(after (u/side-effect!
|
||||
(fn [db]
|
||||
(status/module-initialized!))))
|
||||
(fn [db]
|
||||
(assoc db :status-module-initialized? true)))
|
||||
|
||||
(register-handler :crypt-initialized
|
||||
(u/side-effect!
|
||||
|
Loading…
x
Reference in New Issue
Block a user