From 8e7d03d51347d47ca7d507dbb770e9d4da31b228 Mon Sep 17 00:00:00 2001 From: Adrian Tiberius Date: Mon, 10 Oct 2016 18:23:20 +0300 Subject: [PATCH] add default status to accounts Former-commit-id: bf4358e30ffe922349b5894f05dc757c7c84cc8e --- src/status_im/accounts/handlers.cljs | 13 ++-- src/status_im/accounts/statuses.cljs | 89 ++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 6 deletions(-) create mode 100644 src/status_im/accounts/statuses.cljs diff --git a/src/status_im/accounts/handlers.cljs b/src/status_im/accounts/handlers.cljs index f3ec5c1a97..7d94683f7f 100644 --- a/src/status_im/accounts/handlers.cljs +++ b/src/status_im/accounts/handlers.cljs @@ -15,6 +15,7 @@ [clojure.string :as str] [status-im.utils.datetime :as time] [status-im.utils.handlers :as u] + [status-im.accounts.statuses :as statuses] [status-im.constants :refer [console-chat-id]])) @@ -23,9 +24,9 @@ (register-handler :add-account - (-> (fn [db [_ {:keys [address] :as account}]] - (update db :accounts assoc address account)) - ((after save-account)))) + ((after save-account) + (fn [db [_ {:keys [address] :as account}]] + (update db :accounts assoc address account)))) (defn account-created [result password] (let [data (json->clj result) @@ -36,12 +37,13 @@ account {:public-key public-key :address address :name address + :status (rand-nth statuses/data) :signed-up? true :updates-public-key public :updates-private-key private :photo-path (identicon public-key)}] (log/debug "account-created") - (when (not (str/blank? public-key)) + (when-not (str/blank? public-key) (do (dispatch [:add-account account]) (dispatch [:show-mnemonic mnemonic]) @@ -76,8 +78,7 @@ :account-update (-> (fn [{:keys [current-account-id accounts] :as db} [_ data]] (let [data (assoc data :last-updated (time/now-ms)) - account (-> (get accounts current-account-id) - (merge data))] + account (merge (get accounts current-account-id) data)] (assoc-in db [:accounts current-account-id] account))) ((after save-account!)) ((after send-account-update)))) diff --git a/src/status_im/accounts/statuses.cljs b/src/status_im/accounts/statuses.cljs new file mode 100644 index 0000000000..a9d5841404 --- /dev/null +++ b/src/status_im/accounts/statuses.cljs @@ -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"]) \ No newline at end of file