add default status to accounts

This commit is contained in:
Adrian Tiberius 2016-10-10 18:23:20 +03:00
parent a0d4da62ee
commit bf4358e30f
2 changed files with 96 additions and 6 deletions

View File

@ -15,6 +15,7 @@
[clojure.string :as str] [clojure.string :as str]
[status-im.utils.datetime :as time] [status-im.utils.datetime :as time]
[status-im.utils.handlers :as u] [status-im.utils.handlers :as u]
[status-im.accounts.statuses :as statuses]
[status-im.constants :refer [console-chat-id]])) [status-im.constants :refer [console-chat-id]]))
@ -23,9 +24,9 @@
(register-handler (register-handler
:add-account :add-account
(-> (fn [db [_ {:keys [address] :as account}]] ((after save-account)
(update db :accounts assoc address account)) (fn [db [_ {:keys [address] :as account}]]
((after save-account)))) (update db :accounts assoc address account))))
(defn account-created [result password] (defn account-created [result password]
(let [data (json->clj result) (let [data (json->clj result)
@ -36,12 +37,13 @@
account {:public-key public-key account {:public-key public-key
:address address :address address
:name address :name address
:status (rand-nth statuses/data)
:signed-up? true :signed-up? true
:updates-public-key public :updates-public-key public
:updates-private-key private :updates-private-key private
:photo-path (identicon public-key)}] :photo-path (identicon public-key)}]
(log/debug "account-created") (log/debug "account-created")
(when (not (str/blank? public-key)) (when-not (str/blank? public-key)
(do (do
(dispatch [:add-account account]) (dispatch [:add-account account])
(dispatch [:show-mnemonic mnemonic]) (dispatch [:show-mnemonic mnemonic])
@ -76,8 +78,7 @@
:account-update :account-update
(-> (fn [{:keys [current-account-id accounts] :as db} [_ data]] (-> (fn [{:keys [current-account-id accounts] :as db} [_ data]]
(let [data (assoc data :last-updated (time/now-ms)) (let [data (assoc data :last-updated (time/now-ms))
account (-> (get accounts current-account-id) account (merge (get accounts current-account-id) data)]
(merge data))]
(assoc-in db [:accounts current-account-id] account))) (assoc-in db [:accounts current-account-id] account)))
((after save-account!)) ((after save-account!))
((after send-account-update)))) ((after send-account-update))))

View File

@ -0,0 +1,89 @@
(ns status-im.accounts.statuses)
(def data
["be the hero of your own journey"
"nature is pleased with simplicity"
"accept yourself and keep moving forward"
"only wise men look for new wisdom"
"do it or not, but do"
"any human-defined truth is ultimately relative"
"success is not an activity but a process"
"the future is forever a projection of the present"
"open source can propagate to fill all the corners of the universe"
"wisdom is unlearning what you have learnt"
"people who are afraid of the truth never find it"
"a single thought can shift your entire world"
"the man who is not permitted to own is owned"
"the wisest are the most annoyed at the loss of time"
"freedom flourishes upon the bedrock of ethics and integrity"
"speaking less and doing more says more"
"the future belongs to those who never forget to think"
"begin, be bold, and venture to be wise"
"wisdom is the reward for surviving our own stupidity"
"history is the insight to foresight"
"being surrounded by great people can get you really really far"
"cheapen words and they'll cheapen you"
"there is always exception to every rule"
"the future is certain. it is just not known"
"the future depends on what we do in the present"
"waiting leads to wondering"
"imagination is an endless possibility"
"if we don't make our own future, it will be made for us"
"i would rather risk failure than achieve it without risk"
"life would be much easier if i had the source code"
"relax and recreate yourself!"
"your history is not your future"
"wise men speak only of what they know"
"make time to read"
"we learn from failure, not from success"
"science is a way humans try to tell themselves the truths"
"success is simply the wisdom born out of so called failures"
"little decisions shape big consequences"
"it's possible to go on, no matter how impossible it seems"
"the intelligent have plans; the wise have principles"
"embrace the future and keep your back up against the past"
"knowledge is beautiful; science is amazing"
"realize that everything connects to everything else"
"wonder is the seed of knowledge"
"i want something that is nothing like the past"
"the future belongs to those who innovate"
"for the newborn and wise, everything begins small"
"your future is only as bright as your mind is open"
"all too often, the rabbit hole is as deep as you have dug it"
"ego is recessive in wisdom"
"without courage, wisdom bears no fruit"
"explore, experiment and experience"
"we are star stuff harvesting sunlight"
"he who knows all the answers has not been asked all the questions"
"the future will be different from how they have told us"
"read. you can always talk with another reader"
"the best way to predict your future is to create it"
"our thoughts create our future"
"today is the beginning of new history"
"reading & thinking breeds limitless progress"
"stuff your brain with knowledge"
"look for patterns, and then ask why those patterns exist"
"he who doesn't understand history is doomed to repeat it"
"asking why, is the root of a scientific mindset"
"thinking breeds inventions and innovations"
"every past used to be a future once upon a time"
"the future begins with hope"
"censorship exists to protect corruption"
"devote yourself to reading, learning and writing"
"the highest form of wisdom is often hidden in simplicity"
"today's science is tomorrow's technology"
"prediction is very difficult, especially about the future"
"wishes are memories coming from our future"
"fight for greater course than for greater loss"
"the life we're given is on a thread, so wear it well"
"a free thinker walks on shortcuts among wisdoms"
"free your mind from routine, keep your brain somewhere else"
"let discernment be your trustee, and mistakes your teacher"
"he who forgets the past is doomed to repeat it"
"everybody's gotta learn, nobody's born knowing"
"in a broader sense, systems thinking is a path to greater awareness"
"your choices are where your future begins"
"value your freedom or you will lose it"
"the future starts today, not tomorrow"
"our future starts in our decisions"
"there's no greater show on earth than observing human nature"])