2016-03-23 16:48:26 +02:00
|
|
|
(ns syng-im.db
|
|
|
|
(:require [schema.core :as s :include-macros true]))
|
|
|
|
|
|
|
|
;; schema of app-db
|
|
|
|
(def schema {:greeting s/Str})
|
|
|
|
|
2016-05-11 10:36:13 +03:00
|
|
|
(def default-view :chat-list)
|
2016-05-06 14:06:58 +03:00
|
|
|
|
2016-03-23 16:48:26 +02:00
|
|
|
;; initial state of app-db
|
2016-03-29 23:45:31 +03:00
|
|
|
(def app-db {:greeting "Hello Clojure in iOS and Android!"
|
|
|
|
:identity-password "replace-me-with-user-entered-password"
|
2016-05-06 14:06:58 +03:00
|
|
|
:identity "me"
|
2016-03-30 15:23:37 +03:00
|
|
|
:contacts []
|
2016-05-06 14:06:58 +03:00
|
|
|
:current-chat-id "console"
|
|
|
|
:chat {:command nil
|
2016-04-29 15:43:36 +03:00
|
|
|
:last-message nil}
|
2016-03-29 23:45:31 +03:00
|
|
|
:chats {}
|
2016-04-01 18:05:55 +03:00
|
|
|
:chats-updated-signal 0
|
2016-05-03 16:39:08 +03:00
|
|
|
:show-actions false
|
2016-04-08 12:17:10 +03:00
|
|
|
:new-group #{}
|
2016-04-21 22:12:33 +03:00
|
|
|
:new-participants #{}
|
2016-05-06 14:06:58 +03:00
|
|
|
:signed-up false
|
|
|
|
:view-id default-view
|
2016-05-09 16:40:45 +03:00
|
|
|
:navigation-stack (list default-view)
|
2016-05-05 16:33:48 +03:00
|
|
|
:name "My Name"
|
2016-05-05 15:55:11 +03:00
|
|
|
:current-tag nil})
|
2016-03-23 21:05:42 +02:00
|
|
|
|
|
|
|
(def protocol-initialized-path [:protocol-initialized])
|
|
|
|
(def identity-password-path [:identity-password])
|
2016-05-06 17:12:24 +03:00
|
|
|
(def contact-identity-path [:contact-identity])
|
2016-05-06 14:06:58 +03:00
|
|
|
(def current-chat-id-path [:current-chat-id])
|
2016-03-29 23:45:31 +03:00
|
|
|
(def updated-chats-signal-path [:chats-updated-signal])
|
|
|
|
(defn updated-chat-signal-path [chat-id]
|
|
|
|
[:chats chat-id :chat-updated-signal])
|
2016-04-05 17:00:49 +03:00
|
|
|
(defn chat-input-text-path [chat-id]
|
|
|
|
[:chats chat-id :input-text])
|
2016-04-21 12:26:05 +03:00
|
|
|
(defn chat-staged-commands-path [chat-id]
|
|
|
|
[:chats chat-id :staged-commands])
|
2016-04-05 17:00:49 +03:00
|
|
|
(defn chat-command-path [chat-id]
|
|
|
|
[:chats chat-id :command-input :command])
|
2016-04-08 20:08:40 +03:00
|
|
|
(defn chat-command-to-msg-id-path [chat-id]
|
|
|
|
[:chats chat-id :command-input :to-msg-id])
|
2016-04-05 17:00:49 +03:00
|
|
|
(defn chat-command-content-path [chat-id]
|
|
|
|
[:chats chat-id :command-input :content])
|
2016-04-08 20:08:40 +03:00
|
|
|
(defn chat-command-requests-path [chat-id]
|
|
|
|
[:chats chat-id :command-requests])
|
|
|
|
(defn chat-command-request-path [chat-id msg-id]
|
|
|
|
[:chats chat-id :command-requests msg-id])
|
2016-05-03 16:39:08 +03:00
|
|
|
(def show-actions-path [:show-actions])
|
2016-04-01 18:05:55 +03:00
|
|
|
(def new-group-path [:new-group])
|
2016-04-07 14:21:02 +03:00
|
|
|
(def new-participants-path [:new-participants])
|
2016-04-17 16:49:35 +03:00
|
|
|
(def updated-discoveries-signal-path [:discovery-updated-signal])
|
|
|
|
(defn updated-discovery-signal-path [whisper-id]
|
|
|
|
[:discoveries whisper-id :discovery-updated-signal])
|
2016-05-05 15:55:11 +03:00
|
|
|
(def current-tag-path [:current-tag])
|
|
|
|
(def updated-current-tag-signal-path [:current-tag-updated-signal])
|