parent
2abd430e02
commit
a8ae933604
|
@ -1,27 +0,0 @@
|
|||
(ns status-im.anon-metrics.interceptors
|
||||
(:require [status-im.ethereum.json-rpc :as json-rpc]
|
||||
[taoensso.timbre :as log]
|
||||
[re-frame.interceptor :refer [->interceptor]]
|
||||
[status-im.utils.platform :as platform]
|
||||
[status-im.utils.build :as build]
|
||||
[status-im.anon-metrics.transformers :as txf]))
|
||||
|
||||
(defn transform-and-log [context]
|
||||
(log/info :catch-event-fn (get-in context [:coeffects :event]))
|
||||
(when-let [transformed-payload (txf/transform context)]
|
||||
(json-rpc/call {:method "appmetrics_saveAppMetrics"
|
||||
:params [[{:event (-> context :coeffects :event first)
|
||||
:value transformed-payload
|
||||
:app_version build/version
|
||||
:os platform/os}]]
|
||||
:on-failure log/error})))
|
||||
|
||||
(defn catch-events-before [context]
|
||||
(log/info "catch-events/interceptor fired")
|
||||
(transform-and-log context)
|
||||
context)
|
||||
|
||||
(def catch-events
|
||||
(->interceptor
|
||||
:id :catch-events
|
||||
:before catch-events-before))
|
|
@ -1,17 +0,0 @@
|
|||
(ns status-im.anon-metrics.transformers
|
||||
"`status-go` defines the shape of expected events so that we don't overcollect data (by mistake or intentionally).
|
||||
`transformers` ns transform the event payload to match the expected shape on `status-go` side.")
|
||||
|
||||
(defn navigate-to-txf [event]
|
||||
{:view-id (second event)
|
||||
:params (-> event
|
||||
(nth 2)
|
||||
(select-keys [:screen]))})
|
||||
|
||||
(def transformations
|
||||
{:navigate-to navigate-to-txf})
|
||||
|
||||
(defn transform [ctx]
|
||||
(let [event (-> ctx :coeffects :event)]
|
||||
(when-let [txf (-> event first transformations)]
|
||||
(txf event))))
|
|
@ -178,8 +178,7 @@
|
|||
"mailservers_addChatRequestRange" {}
|
||||
"mailservers_addChatRequestRanges" {}
|
||||
"mailservers_getChatRequestRanges" {}
|
||||
"mailservers_deleteChatRequestRange" {}
|
||||
"appmetrics_saveAppMetrics" {}})
|
||||
"mailservers_deleteChatRequestRange" {}})
|
||||
|
||||
(defn on-error-retry
|
||||
[call-method {:keys [method number-of-retries delay on-error] :as arg}]
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
(:require [re-frame.core :as re-frame]
|
||||
[status-im.ui.screens.routing.core :as navigation]
|
||||
[taoensso.timbre :as log]
|
||||
[status-im.utils.fx :as fx]
|
||||
[status-im.anon-metrics.interceptors :as anon-metrics]))
|
||||
[status-im.utils.fx :as fx]))
|
||||
|
||||
(re-frame/reg-fx
|
||||
::navigate-to
|
||||
|
@ -45,8 +44,7 @@
|
|||
::navigate-to [go-to-view-id screen-params]})
|
||||
|
||||
(fx/defn navigate-to
|
||||
{:events [:navigate-to]
|
||||
:interceptors [anon-metrics/catch-events]}
|
||||
{:events [:navigate-to]}
|
||||
[cofx go-to-view-id screen-params]
|
||||
(navigate-to-cofx cofx go-to-view-id screen-params))
|
||||
|
||||
|
@ -61,8 +59,7 @@
|
|||
{::navigate-reset config})
|
||||
|
||||
(fx/defn navigate-replace
|
||||
{:events [:navigate-replace]
|
||||
:interceptors [anon-metrics/catch-events]}
|
||||
{:events [:navigate-replace]}
|
||||
[{:keys [db]} go-to-view-id screen-params]
|
||||
(let [db (cond-> (assoc db :view-id go-to-view-id)
|
||||
(seq screen-params)
|
||||
|
|
Loading…
Reference in New Issue