disable 'create button' until new chat will be opened
This commit is contained in:
parent
9f5c3df150
commit
6e52fca420
|
@ -7,27 +7,28 @@
|
||||||
(def default-view :chat-list)
|
(def default-view :chat-list)
|
||||||
|
|
||||||
;; 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"
|
||||||
:contacts []
|
:contacts []
|
||||||
:contacts-ids #{}
|
:contacts-ids #{}
|
||||||
:selected-contacts #{}
|
:selected-contacts #{}
|
||||||
:current-chat-id "console"
|
:current-chat-id "console"
|
||||||
:chat {:command nil
|
:chat {:command nil
|
||||||
:last-message nil}
|
:last-message nil}
|
||||||
:chats {}
|
:chats {}
|
||||||
:chats-updated-signal 0
|
:chats-updated-signal 0
|
||||||
:show-actions false
|
:show-actions false
|
||||||
:new-participants #{}
|
:new-participants #{}
|
||||||
:signed-up true
|
:signed-up true
|
||||||
:view-id default-view
|
:view-id default-view
|
||||||
:navigation-stack (list default-view)
|
:navigation-stack (list default-view)
|
||||||
;; TODO fix hardcoded values
|
;; TODO fix hardcoded values
|
||||||
:username "My Name"
|
:username "My Name"
|
||||||
:phone-number "3147984309"
|
:phone-number "3147984309"
|
||||||
:email "myemail@gmail.com"
|
:email "myemail@gmail.com"
|
||||||
:status "Hi, this is my status"
|
:status "Hi, this is my status"
|
||||||
:current-tag nil})
|
:current-tag nil
|
||||||
|
:disable-group-creation false})
|
||||||
|
|
||||||
(def protocol-initialized-path [:protocol-initialized])
|
(def protocol-initialized-path [:protocol-initialized])
|
||||||
(defn chat-input-text-path [chat-id]
|
(defn chat-input-text-path [chat-id]
|
||||||
|
|
|
@ -58,12 +58,29 @@
|
||||||
[{:keys [new-group-id]} _]
|
[{:keys [new-group-id]} _]
|
||||||
(dispatch [:show-chat new-group-id :replace]))
|
(dispatch [:show-chat new-group-id :replace]))
|
||||||
|
|
||||||
|
(defn enable-creat-buttion
|
||||||
|
[db _]
|
||||||
|
(assoc db :disable-group-creation false))
|
||||||
|
|
||||||
(register-handler :create-new-group
|
(register-handler :create-new-group
|
||||||
(-> start-group-chat!
|
(-> start-group-chat!
|
||||||
((enrich prepare-chat))
|
((enrich prepare-chat))
|
||||||
((enrich add-chat))
|
((enrich add-chat))
|
||||||
((after create-chat!))
|
((after create-chat!))
|
||||||
((after show-chat!))))
|
((after show-chat!))
|
||||||
|
((enrich enable-creat-buttion))))
|
||||||
|
|
||||||
|
(defn disable-creat-button
|
||||||
|
[db _]
|
||||||
|
(assoc db :disable-group-creation true))
|
||||||
|
|
||||||
|
(defn dispatch-create-group
|
||||||
|
[_ [_ group-name]]
|
||||||
|
(dispatch [:create-new-group group-name]))
|
||||||
|
|
||||||
|
(register-handler :init-group-creation
|
||||||
|
(after dispatch-create-group)
|
||||||
|
disable-creat-button)
|
||||||
|
|
||||||
; todo rewrite
|
; todo rewrite
|
||||||
(register-handler :group-chat-invite-received
|
(register-handler :group-chat-invite-received
|
||||||
|
|
|
@ -18,12 +18,14 @@
|
||||||
|
|
||||||
|
|
||||||
(defview new-group-toolbar []
|
(defview new-group-toolbar []
|
||||||
[group-name [:get ::group-name]]
|
[group-name [:get ::group-name]
|
||||||
|
creation-disabled? [:get :disable-group-creation]]
|
||||||
[toolbar
|
[toolbar
|
||||||
{:title "New group chat"
|
{:title "New group chat"
|
||||||
:action {:image {:source res/v ;; {:uri "icon_search"}
|
:action {:image {:source res/v ;; {:uri "icon_search"}
|
||||||
:style st/toolbar-icon}
|
:style st/toolbar-icon}
|
||||||
:handler #(dispatch [:create-new-group group-name])}}])
|
:handler (when-not creation-disabled?
|
||||||
|
#(dispatch [:init-group-creation group-name]))}}])
|
||||||
|
|
||||||
(defview group-name-input []
|
(defview group-name-input []
|
||||||
[group-name [:get ::group-name]]
|
[group-name [:get ::group-name]]
|
||||||
|
|
Loading…
Reference in New Issue