diff --git a/env/dev/env/android/main.cljs b/env/dev/env/android/main.cljs index 3a4d1ba9d2..e9a810c134 100644 --- a/env/dev/env/android/main.cljs +++ b/env/dev/env/android/main.cljs @@ -2,7 +2,8 @@ (:require [reagent.core :as r] [re-frisk-remote.core :as rr] [status-im.android.core :as core] - [figwheel.client :as figwheel :include-macros true])) + [figwheel.client :as figwheel :include-macros true] + [status-im.utils.handlers :as utils.handlers])) (enable-console-print!) @@ -19,4 +20,6 @@ :heads-up-display false :jsload-callback callback) -(rr/enable-re-frisk-remote! {:host "localhost:4567" :on-init core/init :pre-send (fn [db] (update db :chats #(into {} %)))}) +(utils.handlers/add-pre-event-callback rr/pre-event-callback) + +(rr/enable-re-frisk-remote! {:host "10.0.3.2:4567" :on-init core/init}) diff --git a/env/dev/env/ios/main.cljs b/env/dev/env/ios/main.cljs index 19f0a6d10f..5162d1f08a 100644 --- a/env/dev/env/ios/main.cljs +++ b/env/dev/env/ios/main.cljs @@ -2,6 +2,7 @@ (:require [reagent.core :as r] [re-frisk-remote.core :as rr] [status-im.ios.core :as core] + [status-im.utils.handlers :as utils.handlers] [figwheel.client :as figwheel :include-macros true] [cljs.pprint])) @@ -16,4 +17,6 @@ :heads-up-display false :jsload-callback #(swap! cnt inc)) -(rr/enable-re-frisk-remote! {:host "localhost:4567" :on-init core/init :pre-send (fn [db] (update db :chats #(into {} %)))}) +(utils.handlers/add-pre-event-callback rr/pre-event-callback) + +(rr/enable-re-frisk-remote! {:host "localhost:4567" :on-init core/init}) \ No newline at end of file diff --git a/project.clj b/project.clj index eafe34ab4c..3c12ce8560 100644 --- a/project.clj +++ b/project.clj @@ -13,7 +13,7 @@ [com.cognitect/transit-cljs "0.8.243"]] :plugins [[lein-cljsbuild "1.1.7"] [lein-figwheel "0.5.13"] - [lein-re-frisk "0.5.2"]] + [lein-re-frisk "0.5.4"]] :clean-targets ["target/" "index.ios.js" "index.android.js"] :aliases {"prod-build" ^{:doc "Recompile code with prod profile."} ["do" "clean" @@ -23,8 +23,8 @@ "test-protocol" ["with-profile" "test" "doo" "node" "protocol" "once"]} :figwheel {:nrepl-port 7888} :profiles {:dev {:dependencies [[figwheel-sidecar "0.5.11"] - [re-frisk-remote "0.5.0"] - [re-frisk-sidecar "0.5.2"] + [re-frisk-remote "0.5.2"] + [re-frisk-sidecar "0.5.3"] [com.cemerick/piggieback "0.2.2"] [hawk "0.2.11"]] :source-paths ["src" "env/dev"] diff --git a/src/status_im/utils/handlers.cljs b/src/status_im/utils/handlers.cljs index 29b17ce5ea..60e6003015 100644 --- a/src/status_im/utils/handlers.cljs +++ b/src/status_im/utils/handlers.cljs @@ -6,6 +6,11 @@ [taoensso.timbre :as log]) (:require-macros status-im.utils.handlers)) +(def pre-event-callback (atom nil)) + +(defn add-pre-event-callback [callback] + (reset! pre-event-callback callback)) + (defn side-effect! "Middleware for handlers that will not affect db." [handler] @@ -19,6 +24,8 @@ :id :debug-handlers-names :before (fn debug-handlers-names-before [context] + (when @pre-event-callback + (@pre-event-callback (get-coeffect context :event))) (log/debug "Handling re-frame event: " (first (get-coeffect context :event))) context)))