From bc4e80352cbbaa05245fa67c01bc29feeadc99e8 Mon Sep 17 00:00:00 2001 From: Omar Basem Date: Wed, 14 Dec 2022 18:31:29 +0400 Subject: [PATCH] updates https://github.com/status-im/status-go/compare/684e9654...85938668 --- src/status_im/chat/models/loading.cljs | 19 +++++++++++++++++-- src/status_im/chat/models/message.cljs | 1 - src/status_im/data_store/messages.cljs | 2 -- src/status_im/transport/message/protocol.cljs | 5 +---- .../ui2/screens/chat/messages/message.cljs | 3 +-- src/status_im2/setup/dev.cljs | 4 ++-- status-go-version.json | 6 ++++++ 7 files changed, 27 insertions(+), 13 deletions(-) diff --git a/src/status_im/chat/models/loading.cljs b/src/status_im/chat/models/loading.cljs index ac742e6856..e6e9dfb00d 100644 --- a/src/status_im/chat/models/loading.cljs +++ b/src/status_im/chat/models/loading.cljs @@ -97,11 +97,24 @@ :params [community-id] :on-success #(re-frame/dispatch [::mark-all-read-in-community-successful %])}]})) + +(defn find-albums [messages] + (let [last-album-id (atom nil) + album-count (atom 0)] + (doseq [message messages] + (if (and (:album-id (:content (val message))) (= (:album-id (:content (val message))) @last-album-id)) + (swap! album-count inc 1) + (reset! album-count 1)) + (reset! last-album-id (:album-id (:content (val message)))) + (if (> @album-count 3) + (println "COMPLETED AN ALBUMXXXX" @album-count) + (println "NO ALBUMXX" @album-count (:album-id (:content (val message))))))) + messages) + (fx/defn messages-loaded "Loads more messages for current chat" {:events [::messages-loaded]} [{db :db} chat-id session-id {:keys [cursor messages]}] - (println "ASDF" messages) (when-not (and (get-in db [:pagination-info chat-id :messages-initialized?]) (not= session-id (get-in db [:pagination-info chat-id :messages-initialized?]))) @@ -109,7 +122,7 @@ ;; We remove those messages that are already loaded, as we might get some duplicates {:keys [all-messages new-messages senders contacts]} (reduce (fn [{:keys [all-messages] :as acc} - {:keys [message-id from] + {:keys [message-id from content] :as message}] (cond-> acc (not (get-in db [:chats chat-id :users from])) @@ -125,8 +138,10 @@ :contacts {} :new-messages []} messages) + result (find-albums all-messages) current-clock-value (get-in db [:pagination-info chat-id :cursor-clock-value]) clock-value (when cursor (cursor->clock-value cursor))] + ;(println "ccc222" (count all-messages) (count new-messages) (count already-loaded-messages)) {:dispatch [:chat/add-senders-to-chat-users (vals senders)] :db (-> db (update-in [:pagination-info chat-id :cursor-clock-value] diff --git a/src/status_im/chat/models/message.cljs b/src/status_im/chat/models/message.cljs index 3e40e7c0f2..9d5c8a81c1 100644 --- a/src/status_im/chat/models/message.cljs +++ b/src/status_im/chat/models/message.cljs @@ -127,7 +127,6 @@ (reduce reduce-js-messages {:db db :chats #{} :senders {} :transactions #{}} messages-js)] - (println "MMMM" response-js) ;;we want to render new messages as soon as possible ;;so we dispatch later all other events which can be handled async {:db db diff --git a/src/status_im/data_store/messages.cljs b/src/status_im/data_store/messages.cljs index 49f7138324..550af42c47 100644 --- a/src/status_im/data_store/messages.cljs +++ b/src/status_im/data_store/messages.cljs @@ -16,7 +16,6 @@ :clock-value :clock}))) (defn <-rpc [message] - (println "CALLEDXXXX" message) (-> message (clojure.set/rename-keys {:id :message-id :whisperTimestamp :whisper-timestamp @@ -63,7 +62,6 @@ {::json-rpc/call [{:method "wakuext_chatMessages" :params [chat-id cursor limit] :on-success (fn [result] - (println "RESULTXXX" result) (on-success (update result :messages #(map <-rpc %)))) :on-error on-error}]}) diff --git a/src/status_im/transport/message/protocol.cljs b/src/status_im/transport/message/protocol.cljs index 6deedd41ee..5fa84ed268 100644 --- a/src/status_im/transport/message/protocol.cljs +++ b/src/status_im/transport/message/protocol.cljs @@ -32,10 +32,7 @@ {::json-rpc/call [{:method "wakuext_sendChatMessages" :params [(mapv build-message messages)] :js-response true - :on-success #(do - (println "MESSAGESENTXXX" %) - ;(re-frame/dispatch [:transport/message-sent %]) - ) + :on-success #(re-frame/dispatch [:transport/message-sent %]) :on-error #(do (log/warn "failed to send a message" %) (js/alert (str "failed to send a message: " %)))}]}) diff --git a/src/status_im/ui2/screens/chat/messages/message.cljs b/src/status_im/ui2/screens/chat/messages/message.cljs index c9a33ded47..2cf1a842c5 100644 --- a/src/status_im/ui2/screens/chat/messages/message.cljs +++ b/src/status_im/ui2/screens/chat/messages/message.cljs @@ -398,8 +398,7 @@ :on-load (image-set-size dimensions) :on-error #(swap! dimensions assoc :error true) :source {:uri uri}}] - [rn/view {:style (style/image-message-border style-opts)} - [rn/text (str "album-id: " (:album-id content))]]]]])))) + [rn/view {:style (style/image-message-border style-opts)}]]]])))) (defmulti ->message :content-type) diff --git a/src/status_im2/setup/dev.cljs b/src/status_im2/setup/dev.cljs index 648e96f28e..b72f1c6fc1 100644 --- a/src/status_im2/setup/dev.cljs +++ b/src/status_im2/setup/dev.cljs @@ -5,12 +5,12 @@ ["react-native" :refer (DevSettings LogBox)])) ;; Ignore all logs, because there are lots of temporary warnings when developing and hot reloading -;(.ignoreAllLogs LogBox) +(.ignoreAllLogs LogBox) ;; Only ignore warnings/errors that cannot be fixed for the time being. ;; When you add a warning to be ignored explain below why it is ignored and how it can be fixed. ;; When a warning is fixed make sure to remove it from here. -(.ignoreLogs ^js LogBox (clj->js ["undefined is not an object (evaluating 'e.message')" +#_(.ignoreLogs ^js LogBox (clj->js ["undefined is not an object (evaluating 'e.message')" "Cannot read property 'message' of undefined" "InternalError Metro has encountered an error" "undefined Unable to resolve module `parse-svg-path`" diff --git a/status-go-version.json b/status-go-version.json index 6679754e8d..7823b12ff6 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -4,6 +4,7 @@ "owner": "status-im", "repo": "status-go", <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD "version": "v0.117.1", "commit-sha1": "8593866862175eeab6f30765e5f0b813f3b1b4db", @@ -18,4 +19,9 @@ "commit-sha1": "bc582dea5862fb5af55b8bd1b55434ab6f8a1970", "src-sha256": "0qdr3mmy04hga51w93l9iyf1aa7mq3mf70py46lw8770pxqj765m" >>>>>>> 287ce6602... lint +======= + "version": "1544442347f8f86bdafce63b7c35835b1d7c9dfe", + "commit-sha1": "1544442347f8f86bdafce63b7c35835b1d7c9dfe", + "src-sha256": "15nwd0v1330dx324rlbx23xm8j91908j6phc1fiv9mk6zva4350g" +>>>>>>> 8cb5b4fc3... updates }