mirror of
https://github.com/status-im/status-mobile.git
synced 2025-01-14 10:46:21 +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]]
|
||||||
|
@ -38,29 +38,29 @@
|
|||||||
(button-animation val to-value loop? answered?)
|
(button-animation val to-value loop? answered?)
|
||||||
#(if (and @loop? (not @answered?))
|
#(if (and @loop? (not @answered?))
|
||||||
(let [new-value (if (= to-value min-scale) max-scale min-scale)
|
(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'))
|
(request-button-animation-logic context'))
|
||||||
(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)
|
||||||
context {:to-value max-scale
|
context {:to-value max-scale
|
||||||
:val scale-anim-val
|
:val scale-anim-val
|
||||||
:answered? answered?
|
:answered? answered?
|
||||||
:loop? loop?}]
|
:loop? loop?}]
|
||||||
(r/create-class
|
(r/create-class
|
||||||
{:component-did-mount
|
{:component-did-mount
|
||||||
(when-not @answered? #(request-button-animation-logic context))
|
(when-not @answered? #(request-button-animation-logic context))
|
||||||
: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)}
|
||||||
@ -70,15 +70,16 @@
|
|||||||
|
|
||||||
(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
|
||||||
[text {:style st/command-request-from-text
|
[text {:style st/command-request-from-text
|
||||||
@ -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
|
||||||
|
@ -4,47 +4,48 @@
|
|||||||
[status-im.constants :refer [console-chat-id]]))
|
[status-im.constants :refer [console-chat-id]]))
|
||||||
|
|
||||||
;; initial state of app-db
|
;; initial state of app-db
|
||||||
(def app-db {:identity-password "replace-me-with-user-entered-password"
|
(def app-db {:identity-password "replace-me-with-user-entered-password"
|
||||||
:identity "me"
|
:identity "me"
|
||||||
:current-public-key "me"
|
:current-public-key "me"
|
||||||
|
|
||||||
:accounts {}
|
:accounts {}
|
||||||
:current-account-id nil
|
:current-account-id nil
|
||||||
|
|
||||||
:profile-edit {:edit? false
|
:profile-edit {:edit? false
|
||||||
:name nil
|
:name nil
|
||||||
:email nil
|
:email nil
|
||||||
:status nil
|
:status nil
|
||||||
:photo-path nil}
|
:photo-path nil}
|
||||||
|
|
||||||
:new-contact-identity ""
|
:new-contact-identity ""
|
||||||
:contacts {}
|
:contacts {}
|
||||||
:discoveries []
|
:discoveries []
|
||||||
:discovery-search-tags []
|
:discovery-search-tags []
|
||||||
:tags {}
|
:tags {}
|
||||||
|
|
||||||
:chats {}
|
:chats {}
|
||||||
:chat {:command nil
|
:chat {:command nil
|
||||||
:last-message nil}
|
:last-message nil}
|
||||||
:current-chat-id console-chat-id
|
:current-chat-id console-chat-id
|
||||||
|
|
||||||
:contacts-ids #{}
|
:contacts-ids #{}
|
||||||
:selected-contacts #{}
|
:selected-contacts #{}
|
||||||
:chats-updated-signal 0
|
:chats-updated-signal 0
|
||||||
:chat-ui-props {:show-actions? false
|
:chat-ui-props {:show-actions? false
|
||||||
:show-bottom-info? false}
|
:show-bottom-info? false}
|
||||||
:selected-participants #{}
|
:selected-participants #{}
|
||||||
:view-id nil
|
:view-id nil
|
||||||
:navigation-stack '()
|
:navigation-stack '()
|
||||||
:current-tag nil
|
:current-tag nil
|
||||||
:qr-codes {}
|
:qr-codes {}
|
||||||
:keyboard-height 0
|
:keyboard-height 0
|
||||||
:animations {;; todo clear this
|
:animations {;; todo clear this
|
||||||
:tabs-bar-value (anim/create-value 0)}
|
:tabs-bar-value (anim/create-value 0)}
|
||||||
: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