parent
67c8a63e26
commit
c64b157666
|
@ -18,8 +18,8 @@
|
|||
|
||||
(defn send-console-msg [text]
|
||||
{:msg-id (random/id)
|
||||
:from (t :me)
|
||||
:to (t :console)
|
||||
:from "me"
|
||||
:to "console"
|
||||
:content text
|
||||
:content-type text-content-type
|
||||
:outgoing true})
|
||||
|
@ -36,8 +36,8 @@
|
|||
:content (t :sign-up.contacts-syncronized)
|
||||
:content-type text-content-type
|
||||
:outgoing false
|
||||
:from (t :console)
|
||||
:to (t :me)}])
|
||||
:from "console"
|
||||
:to "me"}])
|
||||
(dispatch [:set-signed-up true]))
|
||||
|
||||
(defn sync-contacts []
|
||||
|
@ -50,8 +50,8 @@
|
|||
:content (:message body)
|
||||
:content-type text-content-type
|
||||
:outgoing false
|
||||
:from (t :console)
|
||||
:to (t :me)}])
|
||||
:from "console"
|
||||
:to "me"}])
|
||||
(when (:confirmed body)
|
||||
(dispatch [:stop-listening-confirmation-code-sms])
|
||||
(sync-contacts)
|
||||
|
@ -74,8 +74,8 @@
|
|||
(t :sign-up.confirmation-code))
|
||||
:content-type content-type-command-request
|
||||
:outgoing false
|
||||
:from (t :console)
|
||||
:to (t :me)}])))
|
||||
:from "console"
|
||||
:to "me"}])))
|
||||
|
||||
(defn handle-sms [{body :body}]
|
||||
(when-let [matches (re-matches #"(\d{4})" body)]
|
||||
|
@ -98,22 +98,22 @@
|
|||
:content (t :sign-up.password-saved)
|
||||
:content-type text-content-type
|
||||
:outgoing false
|
||||
:from (t :console)
|
||||
:to (t :me)}])
|
||||
:from "console"
|
||||
:to "me"}])
|
||||
(dispatch [:received-msg
|
||||
{:msg-id (random/id)
|
||||
:content (t :sign-up.generate-passphrase)
|
||||
:content-type text-content-type
|
||||
:outgoing false
|
||||
:from (t :console)
|
||||
:to (t :me)}])
|
||||
:from "console"
|
||||
:to "me"}])
|
||||
(dispatch [:received-msg
|
||||
{:msg-id (random/id)
|
||||
:content (t :sign-up.passphrase)
|
||||
:content-type text-content-type
|
||||
:outgoing false
|
||||
:from (t :console)
|
||||
:to (t :me)}])
|
||||
:from "console"
|
||||
:to "me"}])
|
||||
;; TODO generate passphrase
|
||||
(let [passphrase (str "The brash businessman's braggadocio and public squabbing with "
|
||||
"candidates in the US presidential election")]
|
||||
|
@ -122,15 +122,15 @@
|
|||
:content passphrase
|
||||
:content-type text-content-type
|
||||
:outgoing false
|
||||
:from (t :console)
|
||||
:to (t :me)}]))
|
||||
:from "console"
|
||||
:to "me"}]))
|
||||
(dispatch [:received-msg
|
||||
{:msg-id "8"
|
||||
:content (t :sign-up.written-down)
|
||||
:content-type text-content-type
|
||||
:outgoing false
|
||||
:from (t :console)
|
||||
:to (t :me)}])
|
||||
:from "console"
|
||||
:to "me"}])
|
||||
;; TODO highlight '!phone'
|
||||
(let [msg-id (random/id)]
|
||||
(dispatch [:received-msg
|
||||
|
@ -140,18 +140,18 @@
|
|||
(t :sign-up.phone-number-required))
|
||||
:content-type content-type-command-request
|
||||
:outgoing false
|
||||
:from (t :console)
|
||||
:to (t :me)}])))
|
||||
:from "console"
|
||||
:to "me"}])))
|
||||
|
||||
(def intro-status
|
||||
{:msg-id "intro-status"
|
||||
:content (t :sign-up.intro-status)
|
||||
:delivery-status "seen"
|
||||
:from (t :console)
|
||||
:chat-id (t :console)
|
||||
:from "console"
|
||||
:chat-id "console"
|
||||
:content-type content-type-status
|
||||
:outgoing false
|
||||
:to (t :me)})
|
||||
:to "me"})
|
||||
|
||||
(defn intro [db]
|
||||
(dispatch [:received-msg intro-status])
|
||||
|
@ -160,15 +160,15 @@
|
|||
:content (t :sign-up.intro-message1)
|
||||
:content-type text-content-type
|
||||
:outgoing false
|
||||
:from (t :console)
|
||||
:to (t :me)}])
|
||||
:from "console"
|
||||
:to "me"}])
|
||||
(dispatch [:received-msg
|
||||
{:msg-id "intro-message2"
|
||||
:content (t :sign-up.intro-message2)
|
||||
:content-type text-content-type
|
||||
:outgoing false
|
||||
:from (t :console)
|
||||
:to (t :me)}])
|
||||
:from "console"
|
||||
:to "me"}])
|
||||
(let [msg-id "into-message3"]
|
||||
(dispatch [:received-msg
|
||||
{:msg-id msg-id
|
||||
|
@ -177,18 +177,18 @@
|
|||
(t :sign-up.keypair-generated))
|
||||
:content-type content-type-command-request
|
||||
:outgoing false
|
||||
:from (t :console)
|
||||
:to (t :me)}]))
|
||||
:from "console"
|
||||
:to "me"}]))
|
||||
db)
|
||||
|
||||
(def console-chat
|
||||
{:chat-id (t :console)
|
||||
:name (t :console)
|
||||
{:chat-id "console"
|
||||
:name "console"
|
||||
:color default-chat-color
|
||||
:group-chat false
|
||||
:is-active true
|
||||
:timestamp (.getTime (js/Date.))
|
||||
:contacts [{:identity (t :console)
|
||||
:contacts [{:identity "console"
|
||||
:text-color "#FFFFFF"
|
||||
:background-color "#AB7967"}]})
|
||||
|
||||
|
@ -202,10 +202,10 @@
|
|||
(def init
|
||||
(create-chat
|
||||
(fn [{:keys [chats] :as db}]
|
||||
(if (chats (t :console))
|
||||
(if (chats "console")
|
||||
db
|
||||
(-> db
|
||||
(assoc-in [:chats (t :console)] console-chat)
|
||||
(assoc-in [:chats "console"] console-chat)
|
||||
(assoc :new-chat console-chat)
|
||||
(assoc :current-chat-id (t :console))
|
||||
(assoc :current-chat-id "console")
|
||||
(intro))))))
|
||||
|
|
|
@ -8,26 +8,26 @@
|
|||
|
||||
;; todo delete
|
||||
(def commands [{:command :money
|
||||
:text (t :commands.money.text)
|
||||
:text "!money"
|
||||
:description (t :commands.money.description)
|
||||
:color color-dark-mint
|
||||
:request-icon {:uri "icon_lock_white"}
|
||||
:icon {:uri "icon_lock_gray"}
|
||||
:suggestion true}
|
||||
{:command :location
|
||||
:text (t :commands.location.text)
|
||||
:text "!location"
|
||||
:description (t :commands.location.description)
|
||||
:color "#9a5dcf"
|
||||
:suggestion true}
|
||||
{:command :phone
|
||||
:text (t :commands.phone.text)
|
||||
:text "!phone"
|
||||
:description (t :commands.phone.description)
|
||||
:color color-dark-mint
|
||||
:request-text (t :commands.phone.request-text)
|
||||
:suggestion true
|
||||
:handler #(dispatch [:sign-up %])}
|
||||
{:command :confirmation-code
|
||||
:text (t :commands.confirmation-code.text)
|
||||
:text "!confirmationCode"
|
||||
:description (t :commands.confirmation-code.description)
|
||||
:request-text (t :commands.confirmation-code.request-text)
|
||||
:color color-blue
|
||||
|
@ -36,17 +36,17 @@
|
|||
:suggestion true
|
||||
:handler #(dispatch [:sign-up-confirm %])}
|
||||
{:command :send
|
||||
:text (t :commands.send.text)
|
||||
:text "!send"
|
||||
:description (t :commands.send.description)
|
||||
:color "#9a5dcf"
|
||||
:suggestion true}
|
||||
{:command :request
|
||||
:text (t :commands.request.text)
|
||||
:text "!request"
|
||||
:description (t :commands.request.description)
|
||||
:color "#48ba30"
|
||||
:suggestion true}
|
||||
{:command :keypair-password
|
||||
:text (t :commands.keypair-password.text)
|
||||
:text "!keypair-password"
|
||||
:description (t :commands.keypair-password.description)
|
||||
:color color-blue
|
||||
:request-icon {:uri "icon_lock_white"}
|
||||
|
@ -54,7 +54,7 @@
|
|||
:suggestion false
|
||||
:handler #(dispatch [:save-password %])}
|
||||
{:command :help
|
||||
:text (t :commands.help.text)
|
||||
:text "!help"
|
||||
:description (t :commands.help.description)
|
||||
:color "#9a5dcf"
|
||||
:suggestion true}])
|
||||
|
|
|
@ -63,24 +63,16 @@
|
|||
:group-name "Group Name"}
|
||||
:participants {:add "Add Participants"
|
||||
:remove "Remove Participants"}
|
||||
:commands {:money {:text "!money"
|
||||
:description "Send money"}
|
||||
:location {:text "!location"
|
||||
:description "Send location"}
|
||||
:phone {:text "!phone"
|
||||
:description "Send phone number"
|
||||
:commands {:money {:description "Send money"}
|
||||
:location {:description "Send location"}
|
||||
:phone {:description "Send phone number"
|
||||
:request-text "Phone number request"}
|
||||
:confirmation-code {:text "!confirmationCode"
|
||||
:description "Send confirmation code"
|
||||
:confirmation-code {:description "Send confirmation code"
|
||||
:request-text "Confirmation code request"}
|
||||
:send {:text "!send"
|
||||
:description "Send location"}
|
||||
:request {:text "!request"
|
||||
:description "Send request"}
|
||||
:keypair-password {:text "!keypair-password"
|
||||
:description ""}
|
||||
:help {:text "!help"
|
||||
:description "Help"}}
|
||||
:send {:description "Send location"}
|
||||
:request {:description "Send request"}
|
||||
:keypair-password {:text:description ""}
|
||||
:help {:description "Help"}}
|
||||
:protocol {:received-invitation "received chat invitation"
|
||||
:removed-from-chat "removed you from group chat"}
|
||||
:colors {:blue "Blue"
|
||||
|
@ -94,6 +86,4 @@
|
|||
:left "left"
|
||||
:invited "invited"
|
||||
:removed "removed"
|
||||
:You "You"
|
||||
:me "me"
|
||||
:console "console"})
|
||||
:You "You"})
|
Loading…
Reference in New Issue