unused symbols
This commit is contained in:
parent
0c69a27d95
commit
81257b815a
|
@ -17,5 +17,5 @@
|
|||
:heads-up-display false
|
||||
:jsload-callback #(swap! cnt inc))
|
||||
|
||||
(core/init :test)
|
||||
(core/init)
|
||||
;(init-stubs)
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
:check-status-change
|
||||
(u/side-effect!
|
||||
(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)
|
||||
(not= status old-status))]
|
||||
(when status-updated?
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
(register-handler
|
||||
:change-account
|
||||
(u/side-effect!
|
||||
(fn [db [_ address new-account? callback]]
|
||||
(fn [_ [_ address new-account? callback]]
|
||||
(data-store/change-account address new-account?
|
||||
#(callback % address new-account?)))))
|
||||
|
||||
|
|
|
@ -37,11 +37,7 @@
|
|||
(defn render-row [row _ _]
|
||||
(list-item [account-view row]))
|
||||
|
||||
(defn render-separator [_ row-id _]
|
||||
(list-item [view {:style st/row-separator
|
||||
:key row-id}]))
|
||||
|
||||
(defn create-account [event]
|
||||
(defn create-account [_]
|
||||
(dispatch-sync [:reset-app])
|
||||
; add accounts screen to history ( maybe there is a better way ? )
|
||||
(dispatch [:navigate-to-clean :accounts])
|
||||
|
|
|
@ -123,7 +123,7 @@
|
|||
:contact-list-modal contact-list)]
|
||||
[component])]])]))))})))
|
||||
|
||||
(defn init [& [env]]
|
||||
(defn init []
|
||||
(status/call-module status/init-jail)
|
||||
(dispatch-sync [:reset-app])
|
||||
(.registerComponent app-registry "StatusIm" #(r/reactify-component app-root))
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
(register-handler :start-cancel-command
|
||||
(after #(dispatch [:set-soft-input-mode :resize]))
|
||||
(u/side-effect!
|
||||
(fn [db _]
|
||||
(fn []
|
||||
(dispatch [:animate-cancel-command])
|
||||
(dispatch [:cancel-command]))))
|
||||
|
||||
|
@ -326,10 +326,9 @@
|
|||
chats
|
||||
(->> loaded-chats
|
||||
(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)])))
|
||||
(into (priority-map-by compare-chats))))
|
||||
ids (set (keys chats'))]
|
||||
(into (priority-map-by compare-chats))))]
|
||||
|
||||
(-> db
|
||||
(assoc :chats chats')
|
||||
|
@ -571,7 +570,7 @@
|
|||
(u/side-effect! send-seen!))
|
||||
|
||||
(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
|
||||
:message {:from current-public-key
|
||||
:to from
|
||||
|
@ -593,7 +592,7 @@
|
|||
(let [clock-value (+ last-clock-value i 1)]
|
||||
(messages/update (assoc message :clock-value 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))))
|
||||
|
||||
(register-handler :send-clock-value!
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
(register-handler :console-respond-command
|
||||
(u/side-effect!
|
||||
(fn [_ [_ {:keys [command] :as parameters}]]
|
||||
(fn [_ [_ {:keys [command]}]]
|
||||
(let [{:keys [command handler-data]} command]
|
||||
(when command
|
||||
(let [{:keys [name]} command]
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
(defmulti open-faucet (fn [_ _ {:keys [type]}] type))
|
||||
|
||||
(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)]
|
||||
(http-get api-url
|
||||
#(received-message (label :t/faucet-success))
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
(not= from current-identity)
|
||||
(or (not exists?) active?))
|
||||
(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
|
||||
(cu/check-author-direction previous-message)
|
||||
(check-preview))
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
[taoensso.timbre :as log]))
|
||||
|
||||
(defn store-request!
|
||||
[{:keys [new-request] :as db}]
|
||||
[{:keys [new-request]}]
|
||||
(requests/save new-request))
|
||||
|
||||
(defn add-request
|
||||
|
|
|
@ -210,7 +210,7 @@
|
|||
|
||||
(register-handler ::send-dapp-message
|
||||
(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])
|
||||
path [:functions
|
||||
:message-handler]
|
||||
|
@ -226,7 +226,7 @@
|
|||
|
||||
(register-handler ::received-dapp-message
|
||||
(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
|
||||
content (if err
|
||||
err
|
||||
|
@ -257,7 +257,7 @@
|
|||
:as db} [_ {{:keys [message-type]
|
||||
:as message} :message
|
||||
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?
|
||||
(dispatch [::send-dapp-message chat-id message])
|
||||
(when message
|
||||
|
|
|
@ -119,7 +119,7 @@
|
|||
[add-contact-bar]])
|
||||
|
||||
(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)
|
||||
{:message-id "intro-status"
|
||||
:content-type content-type-status
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
[status-im.chat.constants :refer [max-input-height
|
||||
min-input-height]]))
|
||||
|
||||
(defn message-input-button-touchable [width content-height]
|
||||
(defn message-input-button-touchable [width]
|
||||
{:width width
|
||||
:flex 1})
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
(ns status-im.chat.subs
|
||||
(:require-macros [reagent.ratom :refer [reaction]])
|
||||
(:require [re-frame.core :refer [register-sub dispatch subscribe path]]
|
||||
[status-im.utils.platform :refer [ios?]]
|
||||
[status-im.models.commands :as commands]
|
||||
[status-im.data-store.chats :as chats]
|
||||
[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.command :as command]
|
||||
[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
|
||||
(fn [db [_ properties]]
|
||||
|
@ -251,7 +250,7 @@
|
|||
:else 0)))))
|
||||
|
||||
(register-sub :max-layout-height
|
||||
(fn [db [_ status-bar]]
|
||||
(fn [_ [_ status-bar]]
|
||||
(let [layout-height (subscribe [:get :layout-height])
|
||||
input-margin (subscribe [:input-margin])
|
||||
status-bar-height (get-in platform-specific [:component-styles :status-bar status-bar :height])]
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
(ns status-im.chat.views.emoji
|
||||
(:require-macros [status-im.utils.views :refer [defview]])
|
||||
(:require [re-frame.core :refer [subscribe dispatch]]
|
||||
[reagent.core :as r]
|
||||
[status-im.components.react :refer [view
|
||||
text
|
||||
icon
|
||||
|
|
|
@ -41,9 +41,7 @@
|
|||
(let [{:keys [chat-id group-chat name color]} (subscribe [:chat-properties [:chat-id :group-chat :name :color]])
|
||||
members (subscribe [:current-chat-contacts])]
|
||||
(fn [{:keys [messages-count content datemark]}]
|
||||
(let [{:keys [photo-path
|
||||
status
|
||||
last-online]} (if @group-chat
|
||||
(let [{:keys [status]} (if @group-chat
|
||||
{:photo-path nil
|
||||
:status nil
|
||||
:last-online 0}
|
||||
|
@ -354,7 +352,7 @@
|
|||
{:component-did-update
|
||||
on-update
|
||||
:reagent-render
|
||||
(fn [message & children]
|
||||
(fn [_ & children]
|
||||
@layout-height
|
||||
[animated-view {:style (st/message-animated-container anim-value)}
|
||||
(into [view {:style (st/message-container window-width)
|
||||
|
@ -377,7 +375,7 @@
|
|||
:from from
|
||||
:message-id message-id}])))
|
||||
:reagent-render
|
||||
(fn [{:keys [outgoing group-chat clock-value] :as message}]
|
||||
(fn [{:keys [outgoing group-chat] :as message}]
|
||||
[message-container message
|
||||
[view
|
||||
(let [incoming-group (and group-chat (not outgoing))]
|
||||
|
|
|
@ -28,14 +28,10 @@
|
|||
:editable (not disable?)
|
||||
:on-submit-editing plain-message/send})
|
||||
|
||||
(defn on-press-commands-handler
|
||||
[{:keys [suggestions-trigger]}]
|
||||
#(dispatch [:send-command!]))
|
||||
|
||||
(defn command-input-options [command icon-width disable?]
|
||||
(defn command-input-options [icon-width disable?]
|
||||
{:style (st-response/command-input icon-width disable?)
|
||||
: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]
|
||||
[input-message [:get-chat-input-text]
|
||||
|
@ -59,12 +55,12 @@
|
|||
:default-value (or input-message "")}
|
||||
input-options)])
|
||||
|
||||
(defview command-input [input-options {:keys [fullscreen] :as command}]
|
||||
(defview command-input [input-options {:keys [fullscreen]}]
|
||||
[input-command [:get-chat-command-content]
|
||||
icon-width [:command-icon-width]
|
||||
disable? [:get :disable-input]]
|
||||
[text-input (merge
|
||||
(command-input-options command icon-width disable?)
|
||||
(command-input-options icon-width disable?)
|
||||
{:auto-focus (not fullscreen)
|
||||
:blur-on-submit false
|
||||
:accessibility-label :input
|
||||
|
@ -106,7 +102,7 @@
|
|||
(when (or (and @command? (not (str/blank? @input-command)))
|
||||
@valid-plain-message?)
|
||||
(let [on-press (if @command?
|
||||
(on-press-commands-handler @command)
|
||||
#(dispatch [:send-command!])
|
||||
plain-message/send)]
|
||||
[send-button {:on-press #(do (dispatch [:set-chat-ui-props :show-emoji? false])
|
||||
(on-press %))}]))
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
:delay delay})
|
||||
#(dispatch [:set :disable-input false])))))
|
||||
|
||||
(defn commands-button [height on-press]
|
||||
(defn commands-button [_ _]
|
||||
(let [command? (subscribe [:command?])
|
||||
requests (subscribe [:get-requests])
|
||||
suggestions (subscribe [:get-suggestions])
|
||||
|
@ -61,7 +61,7 @@
|
|||
(dispatch [:switch-command-suggestions!])
|
||||
(on-press))
|
||||
: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?
|
||||
[animated-view {:style (st/message-input-button
|
||||
buttons-scale
|
||||
|
@ -84,7 +84,7 @@
|
|||
(when (and @command? (.-finished e))
|
||||
(anim/set-value width 0.1)))))))
|
||||
|
||||
(defn smile-button [height]
|
||||
(defn smile-button [_]
|
||||
(let [command? (subscribe [:command?])
|
||||
buttons-scale (anim/create-value (if @command? 1 0))
|
||||
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?])
|
||||
(dismiss-keyboard!))
|
||||
: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)}
|
||||
[icon :smile st/smile-icon]]]])})))
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
(anim/start
|
||||
(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)
|
||||
answered? (subscribe [:is-request-answered? message-id])
|
||||
loop? (r/atom true)
|
||||
|
@ -71,7 +71,7 @@
|
|||
[icon command-icon st/command-request-image])]]))})))
|
||||
|
||||
(defn message-content-command-request
|
||||
[{:keys [message-id content from incoming-group]}]
|
||||
[{:keys [message-id _ _ _]}]
|
||||
(let [top-offset (r/atom {:specified? false})
|
||||
commands-atom (subscribe [:get-responses])
|
||||
answered? (subscribe [:is-request-answered? message-id])
|
||||
|
|
|
@ -61,7 +61,7 @@
|
|||
layout-height
|
||||
:fix-response-height)
|
||||
command (subscribe [:get-chat-command])]
|
||||
(fn [response-height]
|
||||
(fn [_]
|
||||
(if (= :response (:type @command))
|
||||
[view (merge (drag/pan-handlers pan-responder)
|
||||
{:style (st/request-info (:color @command))})
|
||||
|
@ -86,7 +86,7 @@
|
|||
:duration 300}))
|
||||
(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
|
||||
;; for each chat
|
||||
to-response-height (subscribe [:response-height :default])
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
(anim/start (anim/spring val {:toValue 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
|
||||
;; for each chat
|
||||
to-response-height (subscribe [:command-suggestions-height])
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
(defn suggestions-events-handler!
|
||||
[{:keys [current-chat-id] :as db} [[n 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)))]
|
||||
(case (keyword n)
|
||||
:set-value (if command?
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
(dispatch [::fetch-commands! identity])))
|
||||
|
||||
(defn fetch-commands!
|
||||
[db [{:keys [whisper-identity dapp? dapp-url]}]]
|
||||
[_ [{:keys [whisper-identity dapp? dapp-url]}]]
|
||||
(when true
|
||||
;-let [url (get-in db [:chats identity :dapp-url])]
|
||||
(cond
|
||||
|
@ -168,12 +168,12 @@
|
|||
(u/side-effect!
|
||||
(fn [{:keys [chats]}]
|
||||
(doseq [[id {:keys [name photo-path public-key add-chat?
|
||||
dapp? dapp-url dapp-hash] :as contact}] js-res/default-contacts]
|
||||
(let [id (clojure.core/name id)]
|
||||
(when-not (chats id)
|
||||
dapp? dapp-url dapp-hash]}] js-res/default-contacts]
|
||||
(let [id' (clojure.core/name id)]
|
||||
(when-not (chats id')
|
||||
(when add-chat?
|
||||
(dispatch [:add-chat id {:name (:en name)}]))
|
||||
(dispatch [:add-contacts [{:whisper-identity id
|
||||
(dispatch [:add-chat id' {:name (:en name)}]))
|
||||
(dispatch [:add-contacts [{:whisper-identity id'
|
||||
:name (:en name)
|
||||
:photo-path photo-path
|
||||
:public-key public-key
|
||||
|
|
|
@ -129,12 +129,6 @@
|
|||
(when (pos? 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]
|
||||
(let [props (rc/extract-props new-argv)]
|
||||
(log/debug "component-will-receive-props: props=" props)
|
||||
|
@ -163,7 +157,6 @@
|
|||
(let [page-width (get-page-width data)
|
||||
page-style (get-page-style data)
|
||||
gap (get-gap data)
|
||||
sneak (get-sneak data)
|
||||
count (get-count data)]
|
||||
(doall (map-indexed (fn [index child]
|
||||
(let [page-index index
|
||||
|
@ -180,11 +173,10 @@
|
|||
(let [starting-position (atom 0)
|
||||
component (reagent.core/current-component)
|
||||
state (reagent.core/state component)
|
||||
sneak (get-sneak state)
|
||||
gap (get-gap state)]
|
||||
(log/debug "reagent-render: " data state)
|
||||
[view {:style st/scroll-view-container}
|
||||
[scroll-view {:contentContainerStyle (st/content-container sneak gap)
|
||||
[scroll-view {:contentContainerStyle (st/content-container gap)
|
||||
:automaticallyAdjustContentInsets false
|
||||
:bounces false
|
||||
:decelerationRate 0.9
|
||||
|
@ -197,12 +189,10 @@
|
|||
:ref #(set! (.-scrollView component) %)}
|
||||
(get-pages component state children)]]))
|
||||
|
||||
(defn carousel [data children]
|
||||
(defn carousel [_ _]
|
||||
(let [component-data {:component-did-mount component-did-mount
|
||||
:component-will-mount component-will-mount
|
||||
:component-will-receive-props component-will-receive-props
|
||||
:component-will-update component-will-update
|
||||
:component-did-update component-did-update
|
||||
:display-name "carousel"
|
||||
:reagent-render reagent-render}]
|
||||
(reagent.core/create-class component-data)))
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
(def scroll-view-container
|
||||
{:flex 1})
|
||||
|
||||
(defn content-container [sneak gap]
|
||||
(defn content-container [gap]
|
||||
{:paddingLeft (quot gap 2)
|
||||
:paddingRight (quot gap 2)})
|
||||
|
||||
|
|
|
@ -56,8 +56,7 @@
|
|||
status-text (r/atom nil)]
|
||||
(fn []
|
||||
(let [{:keys [name photo-path status]} @account
|
||||
{new-name :name
|
||||
new-status :status} @profile]
|
||||
{new-name :name} @profile]
|
||||
[view st/drawer-menu
|
||||
[touchable-without-feedback {:on-press #(dismiss-keyboard!)}
|
||||
[view st/drawer-menu
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
(r/set-state component {:focused? true}))
|
||||
|
||||
(defn- on-selection-change
|
||||
[event component]
|
||||
[event _]
|
||||
(let [selection (.-selection (.-nativeEvent event))
|
||||
start (.-start selection)
|
||||
end (.-end selection)]
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
(anim/timing val {:toValue to-value
|
||||
:duration 300})))))))
|
||||
|
||||
(defn tabs-container [& children]
|
||||
(defn tabs-container [& _]
|
||||
(let [chats-scrolled? (subscribe [:get :chats-scrolled?])
|
||||
tabs-bar-value (subscribe [:animations :tabs-bar-value])
|
||||
shadows? (get-in platform-specific [:tabs :tab-shadows?])
|
||||
|
@ -52,7 +52,7 @@
|
|||
:pointerEvents (if @chats-scrolled? :none :auto)}]
|
||||
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
|
||||
[view st/tabs-inner-container
|
||||
(doall (map-indexed #(create-tab %1 %2 selected-view-id prev-view-id) tab-list))]])
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
; Invoked once before the component is mounted. The return value will be used
|
||||
; as the initial value of this.state.
|
||||
(defn get-initial-state [component]
|
||||
(defn get-initial-state [_]
|
||||
{:has-focus false
|
||||
:float-label? false
|
||||
:label-top 0
|
||||
|
@ -62,7 +62,7 @@
|
|||
; 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.
|
||||
(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)
|
||||
(:label-bottom config)
|
||||
(:label-top config)))
|
||||
|
@ -73,50 +73,6 @@
|
|||
;(log/debug "component-will-mount")
|
||||
(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]}]
|
||||
(do
|
||||
(log/debug "input focused")
|
||||
|
@ -136,10 +92,9 @@
|
|||
(defn get-width [event]
|
||||
(.-width (.-layout (.-nativeEvent event))))
|
||||
|
||||
(defn reagent-render [data children]
|
||||
(defn reagent-render [_ _]
|
||||
(let [component (r/current-component)
|
||||
{:keys [has-focus
|
||||
float-label?
|
||||
{:keys [float-label?
|
||||
label-top
|
||||
label-font-size
|
||||
line-width
|
||||
|
@ -189,14 +144,9 @@
|
|||
[animated-view {:style (st/underline focus-line-color line-width)}]]
|
||||
[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
|
||||
: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"
|
||||
:reagent-render reagent-render}]
|
||||
;(log/debug "Creating text-field component: " data)
|
||||
|
|
|
@ -57,7 +57,6 @@
|
|||
(dispatch [:set-in [:toolbar-search :text] nil])))
|
||||
|
||||
(defn- toolbar-with-search-content [{:keys [show-search?
|
||||
search-key
|
||||
search-placeholder
|
||||
title
|
||||
on-search-submit]}]
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
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 (command-type? content-type)
|
||||
(clojure.core/update message :content str-to-map)
|
||||
|
|
|
@ -64,14 +64,14 @@
|
|||
(defn has-contact?
|
||||
[chat-id identity]
|
||||
(let [contacts (get-contacts chat-id)
|
||||
contact (.find contacts (fn [object index collection]
|
||||
contact (.find contacts (fn [object _ _]
|
||||
(= identity (aget object "identity"))))]
|
||||
(if contact true false)))
|
||||
|
||||
(defn- save-contacts
|
||||
[identities contacts added-at]
|
||||
(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"))))]
|
||||
(doto contact
|
||||
(aset "is-in-chat" true)
|
||||
|
@ -89,7 +89,7 @@
|
|||
(defn- delete-contacts
|
||||
[identities contacts]
|
||||
(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"))))]
|
||||
(realm/delete @realm/account-realm contact))))
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
(defn get-by-chat-id
|
||||
[chat-id]
|
||||
(realm/get-one-by-field-clj @realm/account-realm :command
|
||||
:chat-id identity))
|
||||
:chat-id chat-id))
|
||||
|
||||
(defn save
|
||||
[command]
|
||||
|
|
|
@ -152,10 +152,9 @@
|
|||
(:type field-def)
|
||||
field-def)))
|
||||
|
||||
(defmulti to-query (fn [realm schema-name operator field value]
|
||||
operator))
|
||||
(defmulti to-query (fn [_ _ 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)
|
||||
field-type (field-type schema schema-name field)
|
||||
escaped-value (when value (str/replace (str value) #"\"" "\\\""))
|
||||
|
|
|
@ -36,5 +36,5 @@
|
|||
:contact-info {:type :string
|
||||
:optional true}}})
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(defn migration [_ _]
|
||||
(log/debug "migrating chat schema"))
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
:is-in-chat {:type "bool"
|
||||
:default true}}})
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(defn migration [_ _]
|
||||
(log/debug "migrating chat-contact schema"))
|
|
@ -6,5 +6,5 @@
|
|||
:properties {:chat-id "string"
|
||||
:file "string"}})
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(defn migration [_ _]
|
||||
(log/debug "migrating command schema"))
|
|
@ -22,5 +22,5 @@
|
|||
:dapp-hash {:type :int
|
||||
:optional true}}})
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(defn migration [_ _]
|
||||
(log/debug "migrating contact schema"))
|
||||
|
|
|
@ -12,5 +12,5 @@
|
|||
:objectType "tag"}
|
||||
:created-at {:type "int" :default 0}}})
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(defn migration [_ _]
|
||||
(log/debug "migrating discover schema"))
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
:properties {:key "string"
|
||||
:value "string"}})
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(defn migration [_ _]
|
||||
(log/debug "migrating kv-store schema"))
|
|
@ -32,5 +32,5 @@
|
|||
:show? {:type :bool
|
||||
:default true}}})
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(defn migration [_ _]
|
||||
(log/debug "migrating message schema"))
|
||||
|
|
|
@ -18,5 +18,5 @@
|
|||
:attempts :int
|
||||
:was-sent? :bool}})
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(defn migration [_ _]
|
||||
(log/debug "migrating pending-message schema"))
|
|
@ -9,5 +9,5 @@
|
|||
:optional true}
|
||||
:ttl :int}})
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(defn migration [_ _]
|
||||
(log/debug "migrating processed-message schema"))
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
:default "open"}
|
||||
:added :date}})
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(defn migration [_ _]
|
||||
(log/debug "migrating request schema"))
|
|
@ -6,5 +6,5 @@
|
|||
:properties {:name "string"
|
||||
:count {:type "int" :optional true :default 0}}})
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(defn migration [_ _]
|
||||
(log/debug "migrating tag schema"))
|
|
@ -8,5 +8,5 @@
|
|||
:default ""}
|
||||
:status "string"}})
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(defn migration [_ _]
|
||||
(log/debug "migrating user-status schema"))
|
|
@ -19,5 +19,5 @@
|
|||
:default false}
|
||||
:network :string}})
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(defn migration [_ _]
|
||||
(log/debug "migrating account schema"))
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
:properties {:key "string"
|
||||
:value "string"}})
|
||||
|
||||
(defn migration [old-realm new-realm]
|
||||
(defn migration [_ _]
|
||||
(log/debug "migrating kv-store schema"))
|
|
@ -54,7 +54,7 @@
|
|||
|
||||
(register-handler :status-received
|
||||
(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)))
|
||||
(not (get discoveries (:message-id payload))))
|
||||
(let [{:keys [message-id status hashtags profile]} payload
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
remove-identities selected-participants))
|
||||
|
||||
(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))
|
||||
|
||||
(defn notify-about-removing!
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
(.addEntropy (.. ecc -sjcl -random)))
|
||||
(dispatch [:crypt-initialized]))))))))
|
||||
|
||||
(defn node-started [db result]
|
||||
(defn node-started [_ _]
|
||||
(log/debug "Started Node")
|
||||
(enet/get-network #(dispatch [:set :network %])))
|
||||
|
||||
|
@ -131,7 +131,7 @@
|
|||
|
||||
(register-handler :status-module-initialized!
|
||||
(after (u/side-effect!
|
||||
(fn [db]
|
||||
(fn [_]
|
||||
(status/module-initialized!))))
|
||||
(fn [db]
|
||||
(assoc db :status-module-initialized? true)))
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
(l/message-listener (dissoc options :identity))))
|
||||
|
||||
(defn stop-watching-user!
|
||||
[{:keys [web3 identity] :as options}]
|
||||
[{:keys [web3 identity]}]
|
||||
(f/remove-filter!
|
||||
web3
|
||||
{:from identity
|
||||
|
|
|
@ -281,9 +281,8 @@
|
|||
(messages/update message)))))))
|
||||
|
||||
(defn save-message-clock-value!
|
||||
[{:keys [message-extras] :as db}
|
||||
[_ {:keys [from]
|
||||
{:keys [message-id clock-value]} :payload}]]
|
||||
[{:keys [message-extras]}
|
||||
[_ {{:keys [message-id clock-value]} :payload}]]
|
||||
(when-let [{old-clock-value :clock-value
|
||||
:as message} (merge (messages/get-by-id message-id)
|
||||
(get message-extras message-id))]
|
||||
|
@ -330,7 +329,7 @@
|
|||
|
||||
(register-handler :message-clock-value-request
|
||||
(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)
|
||||
message-overhead (chats/get-message-overhead chat-id)
|
||||
last-clock-value (messages/get-last-clock-value chat-id)]
|
||||
|
@ -346,11 +345,9 @@
|
|||
(register-handler :message-clock-value
|
||||
(after save-message-clock-value!)
|
||||
(fn [{:keys [message-extras] :as db}
|
||||
[_ {:keys [from]
|
||||
{:keys [message-id clock-value]} :payload}]]
|
||||
(if-let [{old-clock-value :clock-value
|
||||
:as message} (merge (messages/get-by-id message-id)
|
||||
(get message-extras message-id))]
|
||||
[_ {{:keys [message-id clock-value]} :payload}]]
|
||||
(if-let [{old-clock-value :clock-value} (merge (messages/get-by-id message-id)
|
||||
(get message-extras message-id))]
|
||||
(if (> clock-value old-clock-value)
|
||||
(assoc-in db [:message-extras message-id] {:clock-value clock-value
|
||||
:show? true})
|
||||
|
|
|
@ -69,7 +69,7 @@
|
|||
|
||||
(register-handler ::discard-transaction
|
||||
(u/side-effect!
|
||||
(fn [db [_ id]]
|
||||
(fn [_ [_ id]]
|
||||
(status/discard-transaction id))))
|
||||
|
||||
(register-handler ::remove-transactions
|
||||
|
|
Loading…
Reference in New Issue