mirror of
https://github.com/status-im/status-react.git
synced 2025-01-14 04:55:13 +00:00
Start sign up chat
Former-commit-id: 048be42aa8bd95c8c560d3ec4fb1a903c0d2c0e6
This commit is contained in:
parent
76a29c6d83
commit
e7a10befbd
@ -52,4 +52,5 @@
|
|||||||
(dispatch [:initialize-protocol])
|
(dispatch [:initialize-protocol])
|
||||||
(dispatch [:load-user-phone-number])
|
(dispatch [:load-user-phone-number])
|
||||||
(dispatch [:load-syng-contacts])
|
(dispatch [:load-syng-contacts])
|
||||||
|
(dispatch [:set-sign-up-chat])
|
||||||
(.registerComponent app-registry "SyngIm" #(r/reactify-component app-root)))
|
(.registerComponent app-registry "SyngIm" #(r/reactify-component app-root)))
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
[reagent.core :as r]))
|
[reagent.core :as r]))
|
||||||
|
|
||||||
(defn plain-message-input-view []
|
(defn plain-message-input-view []
|
||||||
(let [text (r/atom "!")
|
(let [text (r/atom "")
|
||||||
chat-id (subscribe [:get-current-chat-id])]
|
chat-id (subscribe [:get-current-chat-id])]
|
||||||
(dispatch [:generate-suggestions @text])
|
(dispatch [:generate-suggestions @text])
|
||||||
(fn []
|
(fn []
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
[syng-im.handlers.contacts :as contacts-service]
|
[syng-im.handlers.contacts :as contacts-service]
|
||||||
[syng-im.handlers.suggestions :as suggestions-service]
|
[syng-im.handlers.suggestions :as suggestions-service]
|
||||||
[syng-im.handlers.commands :as commands-service]
|
[syng-im.handlers.commands :as commands-service]
|
||||||
|
[syng-im.handlers.sign-up :as sign-up-service]
|
||||||
|
|
||||||
[syng-im.models.chats :refer [create-chat]]
|
[syng-im.models.chats :refer [create-chat]]
|
||||||
[syng-im.models.chat :refer [signal-chat-updated
|
[syng-im.models.chat :refer [signal-chat-updated
|
||||||
@ -87,16 +88,18 @@
|
|||||||
(register-handler :send-chat-msg
|
(register-handler :send-chat-msg
|
||||||
(fn [db [action chat-id text]]
|
(fn [db [action chat-id text]]
|
||||||
(log/debug action "chat-id" chat-id "text" text)
|
(log/debug action "chat-id" chat-id "text" text)
|
||||||
(let [{msg-id :msg-id
|
(let [msg (if (= chat-id "console")
|
||||||
{from :from
|
(sign-up-service/send-console-msg text)
|
||||||
to :to} :msg} (api/send-user-msg {:to chat-id
|
(let [{msg-id :msg-id
|
||||||
:content text})
|
{from :from
|
||||||
msg {:msg-id msg-id
|
to :to} :msg} (api/send-user-msg {:to chat-id
|
||||||
:from from
|
:content text})]
|
||||||
:to to
|
{:msg-id msg-id
|
||||||
:content text
|
:from from
|
||||||
:content-type text-content-type
|
:to to
|
||||||
:outgoing true}]
|
:content text
|
||||||
|
:content-type text-content-type
|
||||||
|
:outgoing true}))]
|
||||||
(save-message chat-id msg)
|
(save-message chat-id msg)
|
||||||
(signal-chat-updated db chat-id))))
|
(signal-chat-updated db chat-id))))
|
||||||
|
|
||||||
@ -146,6 +149,12 @@
|
|||||||
(nav-push navigator {:view-id :chat})
|
(nav-push navigator {:view-id :chat})
|
||||||
(set-current-chat-id db chat-id)))
|
(set-current-chat-id db chat-id)))
|
||||||
|
|
||||||
|
(register-handler :set-sign-up-chat
|
||||||
|
(fn [db [_]]
|
||||||
|
(-> db
|
||||||
|
(set-current-chat-id "console")
|
||||||
|
sign-up-service/intro)))
|
||||||
|
|
||||||
;; -- Chat --------------------------------------------------------------
|
;; -- Chat --------------------------------------------------------------
|
||||||
|
|
||||||
(register-handler :generate-suggestions
|
(register-handler :generate-suggestions
|
||||||
|
38
syng-im/src/syng_im/handlers/sign_up.cljs
Normal file
38
syng-im/src/syng_im/handlers/sign_up.cljs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
(ns syng-im.handlers.sign-up
|
||||||
|
(:require [re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
||||||
|
[syng-im.db :as db]
|
||||||
|
;; [syng-im.models.commands :refer [commands suggestions]]
|
||||||
|
[syng-im.utils.utils :refer [log on-error http-post toast]]
|
||||||
|
[syng-im.utils.logging :as log]
|
||||||
|
[syng-im.utils.random :as random]
|
||||||
|
[syng-im.constants :refer [text-content-type]]))
|
||||||
|
|
||||||
|
(defn intro [db]
|
||||||
|
(dispatch [:received-msg {:msg-id "1"
|
||||||
|
:content "Hello there! It's Syng, a Dapp browser in your phone."
|
||||||
|
:content-type text-content-type
|
||||||
|
:outgoing false
|
||||||
|
:from "console"
|
||||||
|
:to "me"}])
|
||||||
|
(dispatch [:received-msg {:msg-id "2"
|
||||||
|
:content "Syng uses a highly secure key-pair authentication type to provide you a reliable way to access your account"
|
||||||
|
:content-type text-content-type
|
||||||
|
:outgoing false
|
||||||
|
:from "console"
|
||||||
|
:to "me"}])
|
||||||
|
(dispatch [:received-msg {:msg-id "3"
|
||||||
|
:content "A key pair has been generated and saved to your device. Create a password to secure your key"
|
||||||
|
:content-type text-content-type
|
||||||
|
:outgoing false
|
||||||
|
:from "console"
|
||||||
|
:to "me"}])
|
||||||
|
(dispatch [:set-input-command :keypair-password])
|
||||||
|
db)
|
||||||
|
|
||||||
|
(defn send-console-msg [text]
|
||||||
|
{:msg-id (random/id)
|
||||||
|
:from "me"
|
||||||
|
:to "console"
|
||||||
|
:content text
|
||||||
|
:content-type text-content-type
|
||||||
|
:outgoing true})
|
Loading…
x
Reference in New Issue
Block a user