From d25a5a92e2063b68e05437195db49278bf84a324 Mon Sep 17 00:00:00 2001 From: Siddarth Kumar Date: Wed, 29 Nov 2023 05:45:41 +0530 Subject: [PATCH] debug: add extensive logging throughout --- src/status_im/chat/models/loading.cljs | 1 + src/status_im/data_store/messages.cljs | 3 +++ src/status_im/signals/core.cljs | 1 + src/status_im/transport/message/core.cljs | 2 ++ src/status_im2/contexts/chat/events.cljs | 2 ++ src/status_im2/contexts/chat/messages/list/view.cljs | 3 +++ src/status_im2/contexts/chat/messages/view.cljs | 2 ++ src/status_im2/subs/chats.cljs | 6 +++++- 8 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/status_im/chat/models/loading.cljs b/src/status_im/chat/models/loading.cljs index dec7141f36f0..4daac942bfa1 100644 --- a/src/status_im/chat/models/loading.cljs +++ b/src/status_im/chat/models/loading.cljs @@ -188,6 +188,7 @@ (rf/defn load-more-messages-for-current-chat {:events [:chat.ui/load-more-messages-for-current-chat]} [{:keys [db] :as cofx} on-loaded] + (log/info "load-more-messages for chat-id ->" (:current-chat-id db)) (load-more-messages cofx (:current-chat-id db) false on-loaded)) (rf/defn load-messages diff --git a/src/status_im/data_store/messages.cljs b/src/status_im/data_store/messages.cljs index d08eed7eabfb..dccc1ec83bed 100644 --- a/src/status_im/data_store/messages.cljs +++ b/src/status_im/data_store/messages.cljs @@ -86,9 +86,12 @@ limit on-success on-error] + (log/info "messages-by-chat-id-rpc called with following params " + {:chat-id chat-id :cursor cursor :limit limit}) {:json-rpc/call [{:method "wakuext_chatMessages" :params [chat-id cursor limit] :on-success (fn [result] + (log/info "on-success -> " (result :messages)) (on-success (update result :messages #(map <-rpc %)))) :on-error on-error}]}) diff --git a/src/status_im/signals/core.cljs b/src/status_im/signals/core.cljs index b9a919ae770a..c4cd7acb44e9 100644 --- a/src/status_im/signals/core.cljs +++ b/src/status_im/signals/core.cljs @@ -96,6 +96,7 @@ (let [^js data (.parse js/JSON event-str) ^js event-js (.-event data) type (.-type data)] + (log/info "signal with type " type "was received with data " data) (case type "node.login" (profile.login/login-node-signal cofx (transforms/js->clj event-js)) "backup.performed" {:db (assoc-in db diff --git a/src/status_im/transport/message/core.cljs b/src/status_im/transport/message/core.cljs index e1cc24c3cd21..fc6941f5a62f 100644 --- a/src/status_im/transport/message/core.cljs +++ b/src/status_im/transport/message/core.cljs @@ -20,6 +20,7 @@ [status-im2.contexts.chat.messages.pin.events :as messages.pin] [status-im2.contexts.contacts.events :as models.contact] [status-im2.contexts.shell.activity-center.events :as activity-center] + [taoensso.timbre :as log] [utils.re-frame :as rf])) (rf/defn process-next @@ -54,6 +55,7 @@ ^js accounts (.-accounts response-js) ^js ens-username-details-js (.-ensUsernameDetails response-js) sync-handler (when-not process-async process-response)] + (log/info "inside process-response, response-js is -> " response-js) (cond (seq chats) diff --git a/src/status_im2/contexts/chat/events.cljs b/src/status_im2/contexts/chat/events.cljs index 9819f370a698..302d6c1f46ec 100644 --- a/src/status_im2/contexts/chat/events.cljs +++ b/src/status_im2/contexts/chat/events.cljs @@ -104,6 +104,7 @@ :chats-home-list #{} :removed-chats #{}} (map (map-chats cofx) chats))] + (log/info ":chats will now become " all-chats) {:db (-> db (update :chats merge all-chats) (update :chats-home-list set/union chats-home-list) @@ -214,6 +215,7 @@ "Takes coeffects map and chat-id, returns effects necessary for navigation and preloading data" {:events [:chat/navigate-to-chat]} [{db :db :as cofx} chat-id animation] + (log/info "chat-id inside navigate-to-chat is -> " chat-id) (rf/merge cofx {:dispatch [(if animation :shell/navigate-to :navigate-to) :chat chat-id animation]} (when-not (#{:community :community-overview :shell} (:view-id db)) diff --git a/src/status_im2/contexts/chat/messages/list/view.cljs b/src/status_im2/contexts/chat/messages/list/view.cljs index a1c05ead7ab4..3144fee70a26 100644 --- a/src/status_im2/contexts/chat/messages/list/view.cljs +++ b/src/status_im2/contexts/chat/messages/list/view.cljs @@ -19,6 +19,7 @@ [status-im2.contexts.chat.messages.list.style :as style] [status-im2.contexts.chat.messages.navigation.style :as navigation.style] [status-im2.contexts.shell.jump-to.constants :as jump-to.constants] + [taoensso.timbre :as log] [utils.i18n :as i18n] [utils.re-frame :as rf])) @@ -76,6 +77,7 @@ (reanimated/set-shared-value scroll-y (+ (reanimated/get-shared-value scroll-y) (* n 200))))] + (log/info "list-on-end-reached was called") (reset! on-end-reached? true) (if @state/scrolling (rf/dispatch [:chat.ui/load-more-messages-for-current-chat on-loaded]) @@ -126,6 +128,7 @@ composer.constants/composer-default-height loading-indicator-extra-spacing) loading-indicator-page-loading-height)] + (when (not all-loaded?) (log/info "not all-loaded? ->" true " for chat-id ->" chat-id)) (when (or loading-messages? (not all-loaded?)) [rn/view {:padding-top top-spacing} ;; Only use animated loading skeleton for ios diff --git a/src/status_im2/contexts/chat/messages/view.cljs b/src/status_im2/contexts/chat/messages/view.cljs index 6a83a6da1df5..976d6c60c01b 100644 --- a/src/status_im2/contexts/chat/messages/view.cljs +++ b/src/status_im2/contexts/chat/messages/view.cljs @@ -11,6 +11,7 @@ [status-im2.contexts.chat.messages.list.style :as style] [status-im2.contexts.chat.messages.list.view :as list.view] [status-im2.contexts.chat.messages.navigation.view :as messages.navigation] + [taoensso.timbre :as log] [utils.re-frame :as rf])) (defn f-chat @@ -46,6 +47,7 @@ :i/close :i/arrow-left) {:keys [focused?]} (rf/sub [:chats/current-chat-input])] + (log/info "chat object inside f-chat is -> " chat) ;; Note - Don't pass `behavior :height` to keyboard avoiding view,. It breaks composer - ;; https://github.com/status-im/status-mobile/issues/16595 [rn/keyboard-avoiding-view diff --git a/src/status_im2/subs/chats.cljs b/src/status_im2/subs/chats.cljs index 6fe7bb6f29b0..a03dcc7032c6 100644 --- a/src/status_im2/subs/chats.cljs +++ b/src/status_im2/subs/chats.cljs @@ -8,7 +8,8 @@ [status-im2.constants :as constants] [status-im2.contexts.chat.composer.constants :as composer.constants] [status-im2.contexts.chat.events :as chat.events] - [status-im2.contexts.profile.utils :as profile.utils])) + [status-im2.contexts.profile.utils :as profile.utils] + [taoensso.timbre :as log])) (def memo-chats-stack-items (atom nil)) @@ -148,6 +149,7 @@ :<- [:chats/chats] :<- [:chats/current-chat-id] (fn [[chats current-chat-id]] + (log/info "inside :chats/current-raw-chat for current-chat-id -> " current-chat-id " and for chats -> " chats) (get chats current-chat-id))) (re-frame/reg-sub @@ -205,6 +207,8 @@ :<- [:chat/inputs] (fn [[{:keys [group-chat chat-id] :as current-chat} my-public-key community blocked-users-set contacts inputs]] + (log/info "inside re-frame/reg-sub :chats/current-chat current-chat is ->" current-chat) + (log/info "inside re-frame/reg-sub :chats/current-chat community is ->" community) (when current-chat (cond-> current-chat (chat.events/public-chat? current-chat)