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]]
|
||||
|
|
|
@ -38,29 +38,29 @@
|
|||
(button-animation val to-value loop? answered?)
|
||||
#(if (and @loop? (not @answered?))
|
||||
(let [new-value (if (= to-value min-scale) max-scale min-scale)
|
||||
context' (assoc context :to-value new-value)]
|
||||
context' (assoc context :to-value new-value)]
|
||||
(request-button-animation-logic context'))
|
||||
(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)
|
||||
context {:to-value max-scale
|
||||
:val scale-anim-val
|
||||
:answered? answered?
|
||||
:loop? loop?}]
|
||||
answered? (subscribe [:is-request-answered? message-id])
|
||||
loop? (r/atom true)
|
||||
context {:to-value max-scale
|
||||
:val scale-anim-val
|
||||
:answered? answered?
|
||||
:loop? loop?}]
|
||||
(r/create-class
|
||||
{:component-did-mount
|
||||
(when-not @answered? #(request-button-animation-logic context))
|
||||
: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)}
|
||||
|
@ -70,15 +70,16 @@
|
|||
|
||||
(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])]
|
||||
(let [commands-atom (subscribe [:get-responses])
|
||||
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?
|
||||
#(set-chat-command message-id command))}
|
||||
{:on-press (when (and (not @answered?) @status-initialized?)
|
||||
#(set-chat-command message-id command))}
|
||||
[view st/command-request-message-view
|
||||
(when incoming-group
|
||||
[text {:style st/command-request-from-text
|
||||
|
@ -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
|
||||
|
|
|
@ -4,47 +4,48 @@
|
|||
[status-im.constants :refer [console-chat-id]]))
|
||||
|
||||
;; initial state of app-db
|
||||
(def app-db {:identity-password "replace-me-with-user-entered-password"
|
||||
:identity "me"
|
||||
:current-public-key "me"
|
||||
(def app-db {:identity-password "replace-me-with-user-entered-password"
|
||||
:identity "me"
|
||||
:current-public-key "me"
|
||||
|
||||
:accounts {}
|
||||
:current-account-id nil
|
||||
:accounts {}
|
||||
:current-account-id nil
|
||||
|
||||
:profile-edit {:edit? false
|
||||
:name nil
|
||||
:email nil
|
||||
:status nil
|
||||
:photo-path nil}
|
||||
:profile-edit {:edit? false
|
||||
:name nil
|
||||
:email nil
|
||||
:status nil
|
||||
:photo-path nil}
|
||||
|
||||
:new-contact-identity ""
|
||||
:contacts {}
|
||||
:discoveries []
|
||||
:discovery-search-tags []
|
||||
:tags {}
|
||||
:new-contact-identity ""
|
||||
:contacts {}
|
||||
:discoveries []
|
||||
:discovery-search-tags []
|
||||
:tags {}
|
||||
|
||||
:chats {}
|
||||
:chat {:command nil
|
||||
:last-message nil}
|
||||
:current-chat-id console-chat-id
|
||||
:chats {}
|
||||
:chat {:command nil
|
||||
:last-message nil}
|
||||
:current-chat-id console-chat-id
|
||||
|
||||
:contacts-ids #{}
|
||||
:selected-contacts #{}
|
||||
:chats-updated-signal 0
|
||||
:chat-ui-props {:show-actions? false
|
||||
:show-bottom-info? false}
|
||||
:selected-participants #{}
|
||||
:view-id nil
|
||||
:navigation-stack '()
|
||||
:current-tag nil
|
||||
:qr-codes {}
|
||||
:keyboard-height 0
|
||||
:animations {;; todo clear this
|
||||
:tabs-bar-value (anim/create-value 0)}
|
||||
:loading-allowed true
|
||||
:contacts-ids #{}
|
||||
:selected-contacts #{}
|
||||
:chats-updated-signal 0
|
||||
:chat-ui-props {:show-actions? false
|
||||
:show-bottom-info? false}
|
||||
:selected-participants #{}
|
||||
:view-id nil
|
||||
:navigation-stack '()
|
||||
:current-tag nil
|
||||
:qr-codes {}
|
||||
:keyboard-height 0
|
||||
:animations {;; todo clear this
|
||||
:tabs-bar-value (anim/create-value 0)}
|
||||
:loading-allowed true
|
||||
|
||||
:sync-state :done
|
||||
:sync-listener nil})
|
||||
:sync-state :done
|
||||
: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!
|
||||
(fn [db]
|
||||
(status/module-initialized!))))
|
||||
(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…
Reference in New Issue