Skip to content

Commit

Permalink
debug: add extensive logging throughout
Browse files Browse the repository at this point in the history
  • Loading branch information
siddarthkay committed Dec 1, 2023
1 parent bad3df6 commit d25a5a9
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/status_im/chat/models/loading.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/status_im/data_store/messages.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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}]})

Expand Down
1 change: 1 addition & 0 deletions src/status_im/signals/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/status_im/transport/message/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions src/status_im2/contexts/chat/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down
3 changes: 3 additions & 0 deletions src/status_im2/contexts/chat/messages/list/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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]))

Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/status_im2/contexts/chat/messages/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion src/status_im2/subs/chats.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit d25a5a9

Please sign in to comment.