Skip to content

Commit

Permalink
String payload
Browse files Browse the repository at this point in the history
  • Loading branch information
cammellos committed Oct 21, 2019
1 parent 086f7a0 commit 792df32
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
14 changes: 14 additions & 0 deletions externs.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ var TopLevel = {
"charCodeAt" : function () {},
"checkAddressChecksum" : function () {},
"checkVideoAuthorizationStatus" : function () {},
"author": function() {},
"encryptionId": function() {},
"chat": function() {},
"messageId": function() {},
"clear" : function () {},
"clearCookies" : function () {},
"clearInterval" : function () {},
Expand All @@ -53,6 +57,10 @@ var TopLevel = {
"code" : function () {},
"concat" : function () {},
"confirmMessagesProcessed" : function () {},
"messages": function() {},
"discovery": function() {},
"negotiated": function() {},
"chatId": function() {},
"confirmMessagesProcessedByID" : function () {},
"connectionChange" : function () {},
"console" : function () {},
Expand All @@ -75,6 +83,8 @@ var TopLevel = {
"DateTimeFormat" : function () {},
"DEBUG" : function () {},
"decay" : function () {},

"dedupId": function() {},
"DECIMAL_SEP" : function () {},
"GROUP_SEP" : function () {},
"PERCENT" : function () {},
Expand Down Expand Up @@ -162,6 +172,8 @@ var TopLevel = {
"getNode" : function () {},
"getNodesFromContract" : function () {},
"getPublicKey" : function () {},
"publicKey": function() {},
"alias": function() {},
"getSecurityLevel" : function () {},
"getStateForAction" : function () {},
"getString" : function () {},
Expand Down Expand Up @@ -246,6 +258,7 @@ var TopLevel = {
"MessagesSeenHandler" : function () {},
"messaging" : function () {},
"method" : function () {},
"metadata": function() {},
"minus" : function () {},
"plus" : function () {},
"mkdir" : function () {},
Expand Down Expand Up @@ -510,6 +523,7 @@ var TopLevel = {
"toUtf8" : function () {},
"toWei" : function () {},
"translations" : function () {},
"type": function() {},
"Uint8Array" : function () {},
"unblockPin" : function () {},
"unlink" : function () {},
Expand Down
4 changes: 2 additions & 2 deletions src/status_im/data_store/messages.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@

(re-frame/reg-fx
::save-message
(fn [messages]
(save-messages-rpc messages)))
(fn [messages]))
;(save-messages-rpc messages)))

(fx/defn save-message [cofx message]
{::save-message [message]})
Expand Down
1 change: 0 additions & 1 deletion src/status_im/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@
(handlers/register-handler-fx
:bootnodes.ui/custom-bootnodes-switch-toggled
(fn [cofx [_ value]]
(native-module/stop-signals!)
(bootnodes/toggle-custom-bootnodes cofx value)))

(handlers/register-handler-fx
Expand Down
3 changes: 0 additions & 3 deletions src/status_im/native_module/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@

(def receive-signals (atom true))

(defn stop-signals! []
(reset! receive-signals (not @receive-signals)))

(defonce listener
(.addListener react/device-event-emitter "gethEvent"
#(re-frame/dispatch [:signals/signal-received (.-jsonEvent %)])))
Expand Down
7 changes: 2 additions & 5 deletions src/status_im/transport/message/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[re-frame.core :as re-frame]
[status-im.chat.models.message :as models.message]
[status-im.contact.device-info :as device-info]
[status-im.utils.handlers :as handlers]
[status-im.ethereum.json-rpc :as json-rpc]
[status-im.ethereum.core :as ethereum]
[status-im.transport.message.contact :as contact]
Expand All @@ -27,7 +28,7 @@
in order to stop receiving that message"
[cofx now-in-s filter-chat-id message-js]
(let [blocked-contacts (get-in cofx [:db :contacts/blocked] #{})
payload (.-payload (.-message message-js))
payload (.-payload message-js)
timestamp (.-timestamp (.-message message-js))
metadata-js (.-metadata message-js)
metadata {:author {:publicKey (.-publicKey (.-author metadata-js))
Expand All @@ -38,12 +39,8 @@
:messageId (.-messageId metadata-js)}
raw-payload {:raw-payload message-js}
status-message (-> payload
ethereum/hex-to-utf8
transit/deserialize)
sig (-> metadata :author :publicKey)]
(println "PAYLOAD")
(println "METADATA" metadata)
(println "RAW PAYLOAD" raw-payload)
(when (and sig
status-message
(not (blocked-contacts sig)))
Expand Down
11 changes: 2 additions & 9 deletions src/status_im/transport/message/protocol.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,9 @@
(let [received-message-fx {:chat-received-message/add-fx
[(assoc (into {} this)
:message-id
(or (get-in cofx [:metadata :messageId])
(transport.utils/message-id
signature
(.-payload (:js-obj cofx))))
(get-in cofx [:metadata :messageId])
:chat-id chat-id
:whisper-timestamp timestamp
:raw-payload-hash (ethereum/sha3
(.-payload (:js-obj cofx)))
:alias (get-in cofx [:metadata :author :alias])
:identicon (get-in cofx [:metadata :author :identicon])
:from signature
Expand All @@ -93,6 +88,4 @@
(get-in this [:content :tribute-transaction])
signature)))
(validate [this]
(if (spec/valid? :message/message this)
this
(log/warn "failed to validate Message" (spec/explain-str :message/message this)))))
this))
6 changes: 3 additions & 3 deletions status-go-version.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
"owner": "status-im",
"repo": "status-go",
"version": "v0.34.0-beta.0",
"commit-sha1": "94228bce2ee6a7a5f62917e28247a22c37b6699b",
"src-sha256": "0f62yh94vn6k4gqa50r3gxzscqabmgc047sng291g5wp6d755fmr"
"version": "5f2544f1e8f2ee832bbab95c8d74e26ba0ab2481",
"commit-sha1": "5f2544f1e8f2ee832bbab95c8d74e26ba0ab2481",
"src-sha256": "0dlkr6056mhyny9k895zs5012ywiz75qm6y7a6hypb3pfxr35931"
}

0 comments on commit 792df32

Please sign in to comment.