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