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