unused symbols

This commit is contained in:
Roman Volosovskyi 2016-12-27 17:16:53 +02:00
parent 0c69a27d95
commit 81257b815a
54 changed files with 98 additions and 177 deletions

View File

@ -17,5 +17,5 @@
:heads-up-display false :heads-up-display false
:jsload-callback #(swap! cnt inc)) :jsload-callback #(swap! cnt inc))
(core/init :test) (core/init)
;(init-stubs) ;(init-stubs)

View File

@ -89,7 +89,7 @@
:check-status-change :check-status-change
(u/side-effect! (u/side-effect!
(fn [{:keys [current-account-id accounts]} [_ status]] (fn [{:keys [current-account-id accounts]} [_ status]]
(let [{old-status :status :as account} (get accounts current-account-id) (let [{old-status :status} (get accounts current-account-id)
status-updated? (and (not= status nil) status-updated? (and (not= status nil)
(not= status old-status))] (not= status old-status))]
(when status-updated? (when status-updated?

View File

@ -34,7 +34,7 @@
(register-handler (register-handler
:change-account :change-account
(u/side-effect! (u/side-effect!
(fn [db [_ address new-account? callback]] (fn [_ [_ address new-account? callback]]
(data-store/change-account address new-account? (data-store/change-account address new-account?
#(callback % address new-account?))))) #(callback % address new-account?)))))

View File

@ -37,11 +37,7 @@
(defn render-row [row _ _] (defn render-row [row _ _]
(list-item [account-view row])) (list-item [account-view row]))
(defn render-separator [_ row-id _] (defn create-account [_]
(list-item [view {:style st/row-separator
:key row-id}]))
(defn create-account [event]
(dispatch-sync [:reset-app]) (dispatch-sync [:reset-app])
; add accounts screen to history ( maybe there is a better way ? ) ; add accounts screen to history ( maybe there is a better way ? )
(dispatch [:navigate-to-clean :accounts]) (dispatch [:navigate-to-clean :accounts])

View File

@ -123,7 +123,7 @@
:contact-list-modal contact-list)] :contact-list-modal contact-list)]
[component])]])]))))}))) [component])]])]))))})))
(defn init [& [env]] (defn init []
(status/call-module status/init-jail) (status/call-module status/init-jail)
(dispatch-sync [:reset-app]) (dispatch-sync [:reset-app])
(.registerComponent app-registry "StatusIm" #(r/reactify-component app-root)) (.registerComponent app-registry "StatusIm" #(r/reactify-component app-root))

View File

@ -95,7 +95,7 @@
(register-handler :start-cancel-command (register-handler :start-cancel-command
(after #(dispatch [:set-soft-input-mode :resize])) (after #(dispatch [:set-soft-input-mode :resize]))
(u/side-effect! (u/side-effect!
(fn [db _] (fn []
(dispatch [:animate-cancel-command]) (dispatch [:animate-cancel-command])
(dispatch [:cancel-command])))) (dispatch [:cancel-command]))))
@ -326,10 +326,9 @@
chats chats
(->> loaded-chats (->> loaded-chats
(map (fn [{:keys [chat-id] :as chat}] (map (fn [{:keys [chat-id] :as chat}]
(let [last-message (messages/get-last-message db chat-id)] (let [last-message (messages/get-last-message chat-id)]
[chat-id (assoc chat :last-message last-message)]))) [chat-id (assoc chat :last-message last-message)])))
(into (priority-map-by compare-chats)))) (into (priority-map-by compare-chats))))]
ids (set (keys chats'))]
(-> db (-> db
(assoc :chats chats') (assoc :chats chats')
@ -571,7 +570,7 @@
(u/side-effect! send-seen!)) (u/side-effect! send-seen!))
(defn send-clock-value-request! (defn send-clock-value-request!
[{:keys [web3 current-public-key]} [_ {:keys [message-id from] :as message}]] [{:keys [web3 current-public-key]} [_ {:keys [message-id from]}]]
(protocol/send-clock-value-request! {:web3 web3 (protocol/send-clock-value-request! {:web3 web3
:message {:from current-public-key :message {:from current-public-key
:to from :to from
@ -593,7 +592,7 @@
(let [clock-value (+ last-clock-value i 1)] (let [clock-value (+ last-clock-value i 1)]
(messages/update (assoc message :clock-value clock-value)) (messages/update (assoc message :clock-value clock-value))
(send-clock-value! db to message-id clock-value)))) (send-clock-value! db to message-id clock-value))))
(fn [db [_ _ i {:keys [message-id] :as message} last-clock-value]] (fn [db [_ _ i {:keys [message-id]} last-clock-value]]
(assoc-in db [:message-extras message-id :clock-value] (+ last-clock-value i 1)))) (assoc-in db [:message-extras message-id :clock-value] (+ last-clock-value i 1))))
(register-handler :send-clock-value! (register-handler :send-clock-value!

View File

@ -47,7 +47,7 @@
(register-handler :console-respond-command (register-handler :console-respond-command
(u/side-effect! (u/side-effect!
(fn [_ [_ {:keys [command] :as parameters}]] (fn [_ [_ {:keys [command]}]]
(let [{:keys [command handler-data]} command] (let [{:keys [command handler-data]} command]
(when command (when command
(let [{:keys [name]} command] (let [{:keys [name]} command]

View File

@ -35,7 +35,7 @@
(defmulti open-faucet (fn [_ _ {:keys [type]}] type)) (defmulti open-faucet (fn [_ _ {:keys [type]}] type))
(defmethod open-faucet :api (defmethod open-faucet :api
[faucet-name current-address {:keys [api-url]}] [_ current-address {:keys [api-url]}]
(let [api-url (gstring/format api-url current-address)] (let [api-url (gstring/format api-url current-address)]
(http-get api-url (http-get api-url
#(received-message (label :t/faucet-success)) #(received-message (label :t/faucet-success))

View File

@ -48,7 +48,7 @@
(not= from current-identity) (not= from current-identity)
(or (not exists?) active?)) (or (not exists?) active?))
(let [group-chat? (not (nil? group-id)) (let [group-chat? (not (nil? group-id))
previous-message (messages/get-last-message db chat-id') previous-message (messages/get-last-message chat-id')
message' (assoc (->> message message' (assoc (->> message
(cu/check-author-direction previous-message) (cu/check-author-direction previous-message)
(check-preview)) (check-preview))

View File

@ -6,7 +6,7 @@
[taoensso.timbre :as log])) [taoensso.timbre :as log]))
(defn store-request! (defn store-request!
[{:keys [new-request] :as db}] [{:keys [new-request]}]
(requests/save new-request)) (requests/save new-request))
(defn add-request (defn add-request

View File

@ -210,7 +210,7 @@
(register-handler ::send-dapp-message (register-handler ::send-dapp-message
(u/side-effect! (u/side-effect!
(fn [db [_ chat-id {:keys [content] :as message}]] (fn [db [_ chat-id {:keys [content]}]]
(let [data (get-in db [:local-storage chat-id]) (let [data (get-in db [:local-storage chat-id])
path [:functions path [:functions
:message-handler] :message-handler]
@ -226,7 +226,7 @@
(register-handler ::received-dapp-message (register-handler ::received-dapp-message
(u/side-effect! (u/side-effect!
(fn [{:keys [current-chat-id] :as db} [_ chat-id {:keys [returned] :as message}]] (fn [_ [_ chat-id {:keys [returned]}]]
(let [{:keys [data messages err]} returned (let [{:keys [data messages err]} returned
content (if err content (if err
err err
@ -257,7 +257,7 @@
:as db} [_ {{:keys [message-type] :as db} [_ {{:keys [message-type]
:as message} :message :as message} :message
chat-id :chat-id}]] chat-id :chat-id}]]
(let [{:keys [dapp?] :as contact} (get-in db [:contacts chat-id])] (let [{:keys [dapp?]} (get-in db [:contacts chat-id])]
(if dapp? (if dapp?
(dispatch [::send-dapp-message chat-id message]) (dispatch [::send-dapp-message chat-id message])
(when message (when message

View File

@ -119,7 +119,7 @@
[add-contact-bar]]) [add-contact-bar]])
(defn get-intro-status-message [all-messages] (defn get-intro-status-message [all-messages]
(let [{:keys [timestamp content-type] :as last-message} (last all-messages)] (let [{:keys [timestamp content-type]} (last all-messages)]
(when (not= content-type content-type-status) (when (not= content-type content-type-status)
{:message-id "intro-status" {:message-id "intro-status"
:content-type content-type-status :content-type content-type-status

View File

@ -3,7 +3,7 @@
[status-im.chat.constants :refer [max-input-height [status-im.chat.constants :refer [max-input-height
min-input-height]])) min-input-height]]))
(defn message-input-button-touchable [width content-height] (defn message-input-button-touchable [width]
{:width width {:width width
:flex 1}) :flex 1})

View File

@ -1,7 +1,6 @@
(ns status-im.chat.subs (ns status-im.chat.subs
(:require-macros [reagent.ratom :refer [reaction]]) (:require-macros [reagent.ratom :refer [reaction]])
(:require [re-frame.core :refer [register-sub dispatch subscribe path]] (:require [re-frame.core :refer [register-sub dispatch subscribe path]]
[status-im.utils.platform :refer [ios?]]
[status-im.models.commands :as commands] [status-im.models.commands :as commands]
[status-im.data-store.chats :as chats] [status-im.data-store.chats :as chats]
[status-im.constants :refer [response-suggesstion-resize-duration]] [status-im.constants :refer [response-suggesstion-resize-duration]]
@ -9,7 +8,7 @@
[status-im.chat.views.plain-message :as plain-message] [status-im.chat.views.plain-message :as plain-message]
[status-im.chat.views.command :as command] [status-im.chat.views.command :as command]
[status-im.constants :refer [content-type-status]] [status-im.constants :refer [content-type-status]]
[status-im.utils.platform :refer [platform-specific]])) [status-im.utils.platform :refer [platform-specific ios?]]))
(register-sub :chat-properties (register-sub :chat-properties
(fn [db [_ properties]] (fn [db [_ properties]]
@ -251,7 +250,7 @@
:else 0))))) :else 0)))))
(register-sub :max-layout-height (register-sub :max-layout-height
(fn [db [_ status-bar]] (fn [_ [_ status-bar]]
(let [layout-height (subscribe [:get :layout-height]) (let [layout-height (subscribe [:get :layout-height])
input-margin (subscribe [:input-margin]) input-margin (subscribe [:input-margin])
status-bar-height (get-in platform-specific [:component-styles :status-bar status-bar :height])] status-bar-height (get-in platform-specific [:component-styles :status-bar status-bar :height])]

View File

@ -1,7 +1,6 @@
(ns status-im.chat.views.emoji (ns status-im.chat.views.emoji
(:require-macros [status-im.utils.views :refer [defview]]) (:require-macros [status-im.utils.views :refer [defview]])
(:require [re-frame.core :refer [subscribe dispatch]] (:require [re-frame.core :refer [subscribe dispatch]]
[reagent.core :as r]
[status-im.components.react :refer [view [status-im.components.react :refer [view
text text
icon icon

View File

@ -41,9 +41,7 @@
(let [{:keys [chat-id group-chat name color]} (subscribe [:chat-properties [:chat-id :group-chat :name :color]]) (let [{:keys [chat-id group-chat name color]} (subscribe [:chat-properties [:chat-id :group-chat :name :color]])
members (subscribe [:current-chat-contacts])] members (subscribe [:current-chat-contacts])]
(fn [{:keys [messages-count content datemark]}] (fn [{:keys [messages-count content datemark]}]
(let [{:keys [photo-path (let [{:keys [status]} (if @group-chat
status
last-online]} (if @group-chat
{:photo-path nil {:photo-path nil
:status nil :status nil
:last-online 0} :last-online 0}
@ -354,7 +352,7 @@
{:component-did-update {:component-did-update
on-update on-update
:reagent-render :reagent-render
(fn [message & children] (fn [_ & children]
@layout-height @layout-height
[animated-view {:style (st/message-animated-container anim-value)} [animated-view {:style (st/message-animated-container anim-value)}
(into [view {:style (st/message-container window-width) (into [view {:style (st/message-container window-width)
@ -377,7 +375,7 @@
:from from :from from
:message-id message-id}]))) :message-id message-id}])))
:reagent-render :reagent-render
(fn [{:keys [outgoing group-chat clock-value] :as message}] (fn [{:keys [outgoing group-chat] :as message}]
[message-container message [message-container message
[view [view
(let [incoming-group (and group-chat (not outgoing))] (let [incoming-group (and group-chat (not outgoing))]

View File

@ -28,14 +28,10 @@
:editable (not disable?) :editable (not disable?)
:on-submit-editing plain-message/send}) :on-submit-editing plain-message/send})
(defn on-press-commands-handler (defn command-input-options [icon-width disable?]
[{:keys [suggestions-trigger]}]
#(dispatch [:send-command!]))
(defn command-input-options [command icon-width disable?]
{:style (st-response/command-input icon-width disable?) {:style (st-response/command-input icon-width disable?)
:on-change-text (when-not disable? command/set-input-message) :on-change-text (when-not disable? command/set-input-message)
:on-submit-editing (on-press-commands-handler command)}) :on-submit-editing #(dispatch [:send-command!])})
(defview message-input [input-options set-layout-size] (defview message-input [input-options set-layout-size]
[input-message [:get-chat-input-text] [input-message [:get-chat-input-text]
@ -59,12 +55,12 @@
:default-value (or input-message "")} :default-value (or input-message "")}
input-options)]) input-options)])
(defview command-input [input-options {:keys [fullscreen] :as command}] (defview command-input [input-options {:keys [fullscreen]}]
[input-command [:get-chat-command-content] [input-command [:get-chat-command-content]
icon-width [:command-icon-width] icon-width [:command-icon-width]
disable? [:get :disable-input]] disable? [:get :disable-input]]
[text-input (merge [text-input (merge
(command-input-options command icon-width disable?) (command-input-options icon-width disable?)
{:auto-focus (not fullscreen) {:auto-focus (not fullscreen)
:blur-on-submit false :blur-on-submit false
:accessibility-label :input :accessibility-label :input
@ -106,7 +102,7 @@
(when (or (and @command? (not (str/blank? @input-command))) (when (or (and @command? (not (str/blank? @input-command)))
@valid-plain-message?) @valid-plain-message?)
(let [on-press (if @command? (let [on-press (if @command?
(on-press-commands-handler @command) #(dispatch [:send-command!])
plain-message/send)] plain-message/send)]
[send-button {:on-press #(do (dispatch [:set-chat-ui-props :show-emoji? false]) [send-button {:on-press #(do (dispatch [:set-chat-ui-props :show-emoji? false])
(on-press %))}])) (on-press %))}]))

View File

@ -38,7 +38,7 @@
:delay delay}) :delay delay})
#(dispatch [:set :disable-input false]))))) #(dispatch [:set :disable-input false])))))
(defn commands-button [height on-press] (defn commands-button [_ _]
(let [command? (subscribe [:command?]) (let [command? (subscribe [:command?])
requests (subscribe [:get-requests]) requests (subscribe [:get-requests])
suggestions (subscribe [:get-suggestions]) suggestions (subscribe [:get-suggestions])
@ -61,7 +61,7 @@
(dispatch [:switch-command-suggestions!]) (dispatch [:switch-command-suggestions!])
(on-press)) (on-press))
:disabled @command?} :disabled @command?}
[animated-view {:style (st/message-input-button-touchable container-width height)} [animated-view {:style (st/message-input-button-touchable container-width)}
(when-not @command? (when-not @command?
[animated-view {:style (st/message-input-button [animated-view {:style (st/message-input-button
buttons-scale buttons-scale
@ -84,7 +84,7 @@
(when (and @command? (.-finished e)) (when (and @command? (.-finished e))
(anim/set-value width 0.1))))))) (anim/set-value width 0.1)))))))
(defn smile-button [height] (defn smile-button [_]
(let [command? (subscribe [:command?]) (let [command? (subscribe [:command?])
buttons-scale (anim/create-value (if @command? 1 0)) buttons-scale (anim/create-value (if @command? 1 0))
container-width (anim/create-value (if @command? 0.1 56)) container-width (anim/create-value (if @command? 0.1 56))
@ -102,6 +102,6 @@
[touchable-highlight {:on-press #(do (dispatch [:toggle-chat-ui-props :show-emoji?]) [touchable-highlight {:on-press #(do (dispatch [:toggle-chat-ui-props :show-emoji?])
(dismiss-keyboard!)) (dismiss-keyboard!))
:disabled @command?} :disabled @command?}
[animated-view {:style (st/message-input-button-touchable container-width height)} [animated-view {:style (st/message-input-button-touchable container-width)}
[animated-view {:style (st/message-input-button buttons-scale 16)} [animated-view {:style (st/message-input-button buttons-scale 16)}
[icon :smile st/smile-icon]]]])}))) [icon :smile st/smile-icon]]]])})))

View File

@ -45,7 +45,7 @@
(anim/start (anim/start
(button-animation val min-scale loop? answered?))))) (button-animation val min-scale loop? answered?)))))
(defn request-button [message-id command status-initialized? top-offset?] (defn request-button [message-id _ _ top-offset?]
(let [scale-anim-val (anim/create-value min-scale) (let [scale-anim-val (anim/create-value min-scale)
answered? (subscribe [:is-request-answered? message-id]) answered? (subscribe [:is-request-answered? message-id])
loop? (r/atom true) loop? (r/atom true)
@ -71,7 +71,7 @@
[icon command-icon st/command-request-image])]]))}))) [icon command-icon st/command-request-image])]]))})))
(defn message-content-command-request (defn message-content-command-request
[{:keys [message-id content from incoming-group]}] [{:keys [message-id _ _ _]}]
(let [top-offset (r/atom {:specified? false}) (let [top-offset (r/atom {:specified? false})
commands-atom (subscribe [:get-responses]) commands-atom (subscribe [:get-responses])
answered? (subscribe [:is-request-answered? message-id]) answered? (subscribe [:is-request-answered? message-id])

View File

@ -61,7 +61,7 @@
layout-height layout-height
:fix-response-height) :fix-response-height)
command (subscribe [:get-chat-command])] command (subscribe [:get-chat-command])]
(fn [response-height] (fn [_]
(if (= :response (:type @command)) (if (= :response (:type @command))
[view (merge (drag/pan-handlers pan-responder) [view (merge (drag/pan-handlers pan-responder)
{:style (st/request-info (:color @command))}) {:style (st/request-info (:color @command))})
@ -86,7 +86,7 @@
:duration 300})) :duration 300}))
(anim/set-value val to-value)))))) (anim/set-value val to-value))))))
(defn container [response-height & children] (defn container [response-height & _]
(let [;; todo to-response-height, cur-response-height must be specific (let [;; todo to-response-height, cur-response-height must be specific
;; for each chat ;; for each chat
to-response-height (subscribe [:response-height :default]) to-response-height (subscribe [:response-height :default])

View File

@ -101,7 +101,7 @@
(anim/start (anim/spring val {:toValue to-value})) (anim/start (anim/spring val {:toValue to-value}))
(anim/set-value val to-value)))))) (anim/set-value val to-value))))))
(defn container [h & elements] (defn container [h & _]
(let [;; todo to-response-height, cur-response-height must be specific (let [;; todo to-response-height, cur-response-height must be specific
;; for each chat ;; for each chat
to-response-height (subscribe [:command-suggestions-height]) to-response-height (subscribe [:command-suggestions-height])

View File

@ -57,7 +57,7 @@
(defn suggestions-events-handler! (defn suggestions-events-handler!
[{:keys [current-chat-id] :as db} [[n data]]] [{:keys [current-chat-id] :as db} [[n data]]]
(log/debug "Suggestion event: " data) (log/debug "Suggestion event: " data)
(let [{:keys [dapp?] :as contact} (get-in db [:contacts current-chat-id]) (let [{:keys [dapp?]} (get-in db [:contacts current-chat-id])
command? (= :command (:type (cm/get-chat-command db)))] command? (= :command (:type (cm/get-chat-command db)))]
(case (keyword n) (case (keyword n)
:set-value (if command? :set-value (if command?

View File

@ -27,7 +27,7 @@
(dispatch [::fetch-commands! identity]))) (dispatch [::fetch-commands! identity])))
(defn fetch-commands! (defn fetch-commands!
[db [{:keys [whisper-identity dapp? dapp-url]}]] [_ [{:keys [whisper-identity dapp? dapp-url]}]]
(when true (when true
;-let [url (get-in db [:chats identity :dapp-url])] ;-let [url (get-in db [:chats identity :dapp-url])]
(cond (cond
@ -168,12 +168,12 @@
(u/side-effect! (u/side-effect!
(fn [{:keys [chats]}] (fn [{:keys [chats]}]
(doseq [[id {:keys [name photo-path public-key add-chat? (doseq [[id {:keys [name photo-path public-key add-chat?
dapp? dapp-url dapp-hash] :as contact}] js-res/default-contacts] dapp? dapp-url dapp-hash]}] js-res/default-contacts]
(let [id (clojure.core/name id)] (let [id' (clojure.core/name id)]
(when-not (chats id) (when-not (chats id')
(when add-chat? (when add-chat?
(dispatch [:add-chat id {:name (:en name)}])) (dispatch [:add-chat id' {:name (:en name)}]))
(dispatch [:add-contacts [{:whisper-identity id (dispatch [:add-contacts [{:whisper-identity id'
:name (:en name) :name (:en name)
:photo-path photo-path :photo-path photo-path
:public-key public-key :public-key public-key

View File

@ -129,12 +129,6 @@
(when (pos? initial-page) (when (pos? initial-page)
(go-to-page component initial-page)))) (go-to-page component initial-page))))
(defn component-will-update [component new-argv]
(log/debug "component-will-update: "))
(defn component-did-update [component old-argv]
(log/debug "component-did-update"))
(defn component-will-receive-props [component new-argv] (defn component-will-receive-props [component new-argv]
(let [props (rc/extract-props new-argv)] (let [props (rc/extract-props new-argv)]
(log/debug "component-will-receive-props: props=" props) (log/debug "component-will-receive-props: props=" props)
@ -163,7 +157,6 @@
(let [page-width (get-page-width data) (let [page-width (get-page-width data)
page-style (get-page-style data) page-style (get-page-style data)
gap (get-gap data) gap (get-gap data)
sneak (get-sneak data)
count (get-count data)] count (get-count data)]
(doall (map-indexed (fn [index child] (doall (map-indexed (fn [index child]
(let [page-index index (let [page-index index
@ -180,11 +173,10 @@
(let [starting-position (atom 0) (let [starting-position (atom 0)
component (reagent.core/current-component) component (reagent.core/current-component)
state (reagent.core/state component) state (reagent.core/state component)
sneak (get-sneak state)
gap (get-gap state)] gap (get-gap state)]
(log/debug "reagent-render: " data state) (log/debug "reagent-render: " data state)
[view {:style st/scroll-view-container} [view {:style st/scroll-view-container}
[scroll-view {:contentContainerStyle (st/content-container sneak gap) [scroll-view {:contentContainerStyle (st/content-container gap)
:automaticallyAdjustContentInsets false :automaticallyAdjustContentInsets false
:bounces false :bounces false
:decelerationRate 0.9 :decelerationRate 0.9
@ -197,12 +189,10 @@
:ref #(set! (.-scrollView component) %)} :ref #(set! (.-scrollView component) %)}
(get-pages component state children)]])) (get-pages component state children)]]))
(defn carousel [data children] (defn carousel [_ _]
(let [component-data {:component-did-mount component-did-mount (let [component-data {:component-did-mount component-did-mount
:component-will-mount component-will-mount :component-will-mount component-will-mount
:component-will-receive-props component-will-receive-props :component-will-receive-props component-will-receive-props
:component-will-update component-will-update
:component-did-update component-did-update
:display-name "carousel" :display-name "carousel"
:reagent-render reagent-render}] :reagent-render reagent-render}]
(reagent.core/create-class component-data))) (reagent.core/create-class component-data)))

View File

@ -3,7 +3,7 @@
(def scroll-view-container (def scroll-view-container
{:flex 1}) {:flex 1})
(defn content-container [sneak gap] (defn content-container [gap]
{:paddingLeft (quot gap 2) {:paddingLeft (quot gap 2)
:paddingRight (quot gap 2)}) :paddingRight (quot gap 2)})

View File

@ -56,8 +56,7 @@
status-text (r/atom nil)] status-text (r/atom nil)]
(fn [] (fn []
(let [{:keys [name photo-path status]} @account (let [{:keys [name photo-path status]} @account
{new-name :name {new-name :name} @profile]
new-status :status} @profile]
[view st/drawer-menu [view st/drawer-menu
[touchable-without-feedback {:on-press #(dismiss-keyboard!)} [touchable-without-feedback {:on-press #(dismiss-keyboard!)}
[view st/drawer-menu [view st/drawer-menu

View File

@ -14,7 +14,7 @@
(r/set-state component {:focused? true})) (r/set-state component {:focused? true}))
(defn- on-selection-change (defn- on-selection-change
[event component] [event _]
(let [selection (.-selection (.-nativeEvent event)) (let [selection (.-selection (.-nativeEvent event))
start (.-start selection) start (.-start selection)
end (.-end selection)] end (.-end selection)]

View File

@ -31,7 +31,7 @@
(anim/timing val {:toValue to-value (anim/timing val {:toValue to-value
:duration 300}))))))) :duration 300})))))))
(defn tabs-container [& children] (defn tabs-container [& _]
(let [chats-scrolled? (subscribe [:get :chats-scrolled?]) (let [chats-scrolled? (subscribe [:get :chats-scrolled?])
tabs-bar-value (subscribe [:animations :tabs-bar-value]) tabs-bar-value (subscribe [:animations :tabs-bar-value])
shadows? (get-in platform-specific [:tabs :tab-shadows?]) shadows? (get-in platform-specific [:tabs :tab-shadows?])
@ -52,7 +52,7 @@
:pointerEvents (if @chats-scrolled? :none :auto)}] :pointerEvents (if @chats-scrolled? :none :auto)}]
children))}))) children))})))
(defn tabs [{:keys [tab-list selected-view-id prev-view-id swiper]}] (defn tabs [{:keys [tab-list selected-view-id prev-view-id]}]
[tabs-container [tabs-container
[view st/tabs-inner-container [view st/tabs-inner-container
(doall (map-indexed #(create-tab %1 %2 selected-view-id prev-view-id) tab-list))]]) (doall (map-indexed #(create-tab %1 %2 selected-view-id prev-view-id) tab-list))]])

View File

@ -50,7 +50,7 @@
; Invoked once before the component is mounted. The return value will be used ; Invoked once before the component is mounted. The return value will be used
; as the initial value of this.state. ; as the initial value of this.state.
(defn get-initial-state [component] (defn get-initial-state [_]
{:has-focus false {:has-focus false
:float-label? false :float-label? false
:label-top 0 :label-top 0
@ -62,7 +62,7 @@
; rendering occurs. If you call setState within this method, render() will see ; rendering occurs. If you call setState within this method, render() will see
; the updated state and will be executed only once despite the state change. ; the updated state and will be executed only once despite the state change.
(defn component-will-mount [component] (defn component-will-mount [component]
(let [{:keys [value] :as props} (r/props component) (let [{:keys [value]} (r/props component)
data {:label-top (anim/create-value (if (s/blank? value) data {:label-top (anim/create-value (if (s/blank? value)
(:label-bottom config) (:label-bottom config)
(:label-top config))) (:label-top config)))
@ -73,50 +73,6 @@
;(log/debug "component-will-mount") ;(log/debug "component-will-mount")
(r/set-state component data))) (r/set-state component data)))
; Invoked once, only on the client (not on the server), immediately after the
; initial rendering occurs. At this point in the lifecycle, you can access any
; refs to your children (e.g., to access the underlying DOM representation).
; The componentDidMount() method of child components is invoked before that of
; parent components.
(defn component-did-mount [component]
(let [props (r/props component)]
;(log/debug "component-did-mount:")
))
; Invoked when a component is receiving new props. This method is not called for
; the initial render. Use this as an opportunity to react to a prop transition
; before render() is called by updating the state using this.setState().
; The old props can be accessed via this.props. Calling this.setState() within
; this function will not trigger an additional render.
(defn component-will-receive-props [component new-props]
;(log/debug "component-will-receive-props: new-props=" new-props)
)
; Invoked before rendering when new props or state are being received. This method
; is not called for the initial render or when forceUpdate is used. Use this as
; an opportunity to return false when you're certain that the transition to the
; new props and state will not require a component update.
; If shouldComponentUpdate returns false, then render() will be completely skipped
; until the next state change. In addition, componentWillUpdate and
; componentDidUpdate will not be called.
(defn should-component-update [component next-props next-state]
;(log/debug "should-component-update: " next-props next-state)
true)
; Invoked immediately before rendering when new props or state are being received.
; This method is not called for the initial render. Use this as an opportunity
; to perform preparation before an update occurs.
(defn component-will-update [component next-props next-state]
;(log/debug "component-will-update: " next-props next-state)
)
; Invoked immediately after the component's updates are flushed to the DOM.
; This method is not called for the initial render. Use this as an opportunity
; to operate on the DOM when the component has been updated.
(defn component-did-update [component prev-props prev-state]
;(log/debug "component-did-update: " prev-props prev-state)
)
(defn on-input-focus [{:keys [component animation onFocus]}] (defn on-input-focus [{:keys [component animation onFocus]}]
(do (do
(log/debug "input focused") (log/debug "input focused")
@ -136,10 +92,9 @@
(defn get-width [event] (defn get-width [event]
(.-width (.-layout (.-nativeEvent event)))) (.-width (.-layout (.-nativeEvent event))))
(defn reagent-render [data children] (defn reagent-render [_ _]
(let [component (r/current-component) (let [component (r/current-component)
{:keys [has-focus {:keys [float-label?
float-label?
label-top label-top
label-font-size label-font-size
line-width line-width
@ -189,14 +144,9 @@
[animated-view {:style (st/underline focus-line-color line-width)}]] [animated-view {:style (st/underline focus-line-color line-width)}]]
[text {:style (st/error-text error-color)} error]])) [text {:style (st/error-text error-color)} error]]))
(defn text-field [data children] (defn text-field [_ _]
(let [component-data {:get-initial-state get-initial-state (let [component-data {:get-initial-state get-initial-state
:component-will-mount component-will-mount :component-will-mount component-will-mount
:component-did-mount component-did-mount
:component-will-receive-props component-will-receive-props
:should-component-update should-component-update
:component-will-update component-will-update
:component-did-update component-did-update
:display-name "text-field" :display-name "text-field"
:reagent-render reagent-render}] :reagent-render reagent-render}]
;(log/debug "Creating text-field component: " data) ;(log/debug "Creating text-field component: " data)

View File

@ -57,7 +57,6 @@
(dispatch [:set-in [:toolbar-search :text] nil]))) (dispatch [:set-in [:toolbar-search :text] nil])))
(defn- toolbar-with-search-content [{:keys [show-search? (defn- toolbar-with-search-content [{:keys [show-search?
search-key
search-placeholder search-placeholder
title title
on-search-submit]}] on-search-submit]}]

View File

@ -84,7 +84,7 @@
message)))))) message))))))
(defn get-last-message (defn get-last-message
[db chat-id] [chat-id]
(if-let [{:keys [content-type] :as message} (data-store/get-last-message chat-id)] (if-let [{:keys [content-type] :as message} (data-store/get-last-message chat-id)]
(if (command-type? content-type) (if (command-type? content-type)
(clojure.core/update message :content str-to-map) (clojure.core/update message :content str-to-map)

View File

@ -64,14 +64,14 @@
(defn has-contact? (defn has-contact?
[chat-id identity] [chat-id identity]
(let [contacts (get-contacts chat-id) (let [contacts (get-contacts chat-id)
contact (.find contacts (fn [object index collection] contact (.find contacts (fn [object _ _]
(= identity (aget object "identity"))))] (= identity (aget object "identity"))))]
(if contact true false))) (if contact true false)))
(defn- save-contacts (defn- save-contacts
[identities contacts added-at] [identities contacts added-at]
(doseq [contact-identity identities] (doseq [contact-identity identities]
(if-let [contact (.find contacts (fn [object index collection] (if-let [contact (.find contacts (fn [object _ _]
(= contact-identity (aget object "identity"))))] (= contact-identity (aget object "identity"))))]
(doto contact (doto contact
(aset "is-in-chat" true) (aset "is-in-chat" true)
@ -89,7 +89,7 @@
(defn- delete-contacts (defn- delete-contacts
[identities contacts] [identities contacts]
(doseq [contact-identity identities] (doseq [contact-identity identities]
(when-let [contact (.find contacts (fn [object index collection] (when-let [contact (.find contacts (fn [object _ _]
(= contact-identity (aget object "identity"))))] (= contact-identity (aget object "identity"))))]
(realm/delete @realm/account-realm contact)))) (realm/delete @realm/account-realm contact))))

View File

@ -4,7 +4,7 @@
(defn get-by-chat-id (defn get-by-chat-id
[chat-id] [chat-id]
(realm/get-one-by-field-clj @realm/account-realm :command (realm/get-one-by-field-clj @realm/account-realm :command
:chat-id identity)) :chat-id chat-id))
(defn save (defn save
[command] [command]

View File

@ -152,10 +152,9 @@
(:type field-def) (:type field-def)
field-def))) field-def)))
(defmulti to-query (fn [realm schema-name operator field value] (defmulti to-query (fn [_ _ operator _ _] operator))
operator))
(defmethod to-query :eq [schema schema-name operator field value] (defmethod to-query :eq [schema schema-name _ field value]
(let [value (to-string value) (let [value (to-string value)
field-type (field-type schema schema-name field) field-type (field-type schema schema-name field)
escaped-value (when value (str/replace (str value) #"\"" "\\\"")) escaped-value (when value (str/replace (str value) #"\"" "\\\""))

View File

@ -36,5 +36,5 @@
:contact-info {:type :string :contact-info {:type :string
:optional true}}}) :optional true}}})
(defn migration [old-realm new-realm] (defn migration [_ _]
(log/debug "migrating chat schema")) (log/debug "migrating chat schema"))

View File

@ -6,5 +6,5 @@
:is-in-chat {:type "bool" :is-in-chat {:type "bool"
:default true}}}) :default true}}})
(defn migration [old-realm new-realm] (defn migration [_ _]
(log/debug "migrating chat-contact schema")) (log/debug "migrating chat-contact schema"))

View File

@ -6,5 +6,5 @@
:properties {:chat-id "string" :properties {:chat-id "string"
:file "string"}}) :file "string"}})
(defn migration [old-realm new-realm] (defn migration [_ _]
(log/debug "migrating command schema")) (log/debug "migrating command schema"))

View File

@ -22,5 +22,5 @@
:dapp-hash {:type :int :dapp-hash {:type :int
:optional true}}}) :optional true}}})
(defn migration [old-realm new-realm] (defn migration [_ _]
(log/debug "migrating contact schema")) (log/debug "migrating contact schema"))

View File

@ -12,5 +12,5 @@
:objectType "tag"} :objectType "tag"}
:created-at {:type "int" :default 0}}}) :created-at {:type "int" :default 0}}})
(defn migration [old-realm new-realm] (defn migration [_ _]
(log/debug "migrating discover schema")) (log/debug "migrating discover schema"))

View File

@ -6,5 +6,5 @@
:properties {:key "string" :properties {:key "string"
:value "string"}}) :value "string"}})
(defn migration [old-realm new-realm] (defn migration [_ _]
(log/debug "migrating kv-store schema")) (log/debug "migrating kv-store schema"))

View File

@ -32,5 +32,5 @@
:show? {:type :bool :show? {:type :bool
:default true}}}) :default true}}})
(defn migration [old-realm new-realm] (defn migration [_ _]
(log/debug "migrating message schema")) (log/debug "migrating message schema"))

View File

@ -18,5 +18,5 @@
:attempts :int :attempts :int
:was-sent? :bool}}) :was-sent? :bool}})
(defn migration [old-realm new-realm] (defn migration [_ _]
(log/debug "migrating pending-message schema")) (log/debug "migrating pending-message schema"))

View File

@ -9,5 +9,5 @@
:optional true} :optional true}
:ttl :int}}) :ttl :int}})
(defn migration [old-realm new-realm] (defn migration [_ _]
(log/debug "migrating processed-message schema")) (log/debug "migrating processed-message schema"))

View File

@ -9,5 +9,5 @@
:default "open"} :default "open"}
:added :date}}) :added :date}})
(defn migration [old-realm new-realm] (defn migration [_ _]
(log/debug "migrating request schema")) (log/debug "migrating request schema"))

View File

@ -6,5 +6,5 @@
:properties {:name "string" :properties {:name "string"
:count {:type "int" :optional true :default 0}}}) :count {:type "int" :optional true :default 0}}})
(defn migration [old-realm new-realm] (defn migration [_ _]
(log/debug "migrating tag schema")) (log/debug "migrating tag schema"))

View File

@ -8,5 +8,5 @@
:default ""} :default ""}
:status "string"}}) :status "string"}})
(defn migration [old-realm new-realm] (defn migration [_ _]
(log/debug "migrating user-status schema")) (log/debug "migrating user-status schema"))

View File

@ -19,5 +19,5 @@
:default false} :default false}
:network :string}}) :network :string}})
(defn migration [old-realm new-realm] (defn migration [_ _]
(log/debug "migrating account schema")) (log/debug "migrating account schema"))

View File

@ -6,5 +6,5 @@
:properties {:key "string" :properties {:key "string"
:value "string"}}) :value "string"}})
(defn migration [old-realm new-realm] (defn migration [_ _]
(log/debug "migrating kv-store schema")) (log/debug "migrating kv-store schema"))

View File

@ -54,7 +54,7 @@
(register-handler :status-received (register-handler :status-received
(u/side-effect! (u/side-effect!
(fn [{:keys [discoveries] :as db} [_ {:keys [from payload]}]] (fn [{:keys [discoveries]} [_ {:keys [from payload]}]]
(when (and (not (discoveries/exists? (:message-id payload))) (when (and (not (discoveries/exists? (:message-id payload)))
(not (get discoveries (:message-id payload)))) (not (get discoveries (:message-id payload))))
(let [{:keys [message-id status hashtags profile]} payload (let [{:keys [message-id status hashtags profile]} payload

View File

@ -75,7 +75,7 @@
remove-identities selected-participants)) remove-identities selected-participants))
(defn remove-members-from-chat! (defn remove-members-from-chat!
[{:keys [current-chat-id selected-participants] :as db} _] [{:keys [current-chat-id selected-participants]} _]
(chats/remove-contacts current-chat-id selected-participants)) (chats/remove-contacts current-chat-id selected-participants))
(defn notify-about-removing! (defn notify-about-removing!

View File

@ -106,7 +106,7 @@
(.addEntropy (.. ecc -sjcl -random))) (.addEntropy (.. ecc -sjcl -random)))
(dispatch [:crypt-initialized])))))))) (dispatch [:crypt-initialized]))))))))
(defn node-started [db result] (defn node-started [_ _]
(log/debug "Started Node") (log/debug "Started Node")
(enet/get-network #(dispatch [:set :network %]))) (enet/get-network #(dispatch [:set :network %])))
@ -131,7 +131,7 @@
(register-handler :status-module-initialized! (register-handler :status-module-initialized!
(after (u/side-effect! (after (u/side-effect!
(fn [db] (fn [_]
(status/module-initialized!)))) (status/module-initialized!))))
(fn [db] (fn [db]
(assoc db :status-module-initialized? true))) (assoc db :status-module-initialized? true)))

View File

@ -47,7 +47,7 @@
(l/message-listener (dissoc options :identity)))) (l/message-listener (dissoc options :identity))))
(defn stop-watching-user! (defn stop-watching-user!
[{:keys [web3 identity] :as options}] [{:keys [web3 identity]}]
(f/remove-filter! (f/remove-filter!
web3 web3
{:from identity {:from identity

View File

@ -281,9 +281,8 @@
(messages/update message))))))) (messages/update message)))))))
(defn save-message-clock-value! (defn save-message-clock-value!
[{:keys [message-extras] :as db} [{:keys [message-extras]}
[_ {:keys [from] [_ {{:keys [message-id clock-value]} :payload}]]
{:keys [message-id clock-value]} :payload}]]
(when-let [{old-clock-value :clock-value (when-let [{old-clock-value :clock-value
:as message} (merge (messages/get-by-id message-id) :as message} (merge (messages/get-by-id message-id)
(get message-extras message-id))] (get message-extras message-id))]
@ -330,7 +329,7 @@
(register-handler :message-clock-value-request (register-handler :message-clock-value-request
(u/side-effect! (u/side-effect!
(fn [db [_ {:keys [from] {:keys [message-id]} :payload}]] (fn [_ [_ {:keys [from] {:keys [message-id]} :payload}]]
(let [{:keys [chat-id]} (messages/get-by-id message-id) (let [{:keys [chat-id]} (messages/get-by-id message-id)
message-overhead (chats/get-message-overhead chat-id) message-overhead (chats/get-message-overhead chat-id)
last-clock-value (messages/get-last-clock-value chat-id)] last-clock-value (messages/get-last-clock-value chat-id)]
@ -346,11 +345,9 @@
(register-handler :message-clock-value (register-handler :message-clock-value
(after save-message-clock-value!) (after save-message-clock-value!)
(fn [{:keys [message-extras] :as db} (fn [{:keys [message-extras] :as db}
[_ {:keys [from] [_ {{:keys [message-id clock-value]} :payload}]]
{:keys [message-id clock-value]} :payload}]] (if-let [{old-clock-value :clock-value} (merge (messages/get-by-id message-id)
(if-let [{old-clock-value :clock-value (get message-extras message-id))]
:as message} (merge (messages/get-by-id message-id)
(get message-extras message-id))]
(if (> clock-value old-clock-value) (if (> clock-value old-clock-value)
(assoc-in db [:message-extras message-id] {:clock-value clock-value (assoc-in db [:message-extras message-id] {:clock-value clock-value
:show? true}) :show? true})

View File

@ -69,7 +69,7 @@
(register-handler ::discard-transaction (register-handler ::discard-transaction
(u/side-effect! (u/side-effect!
(fn [db [_ id]] (fn [_ [_ id]]
(status/discard-transaction id)))) (status/discard-transaction id))))
(register-handler ::remove-transactions (register-handler ::remove-transactions