Under offline inbox flag: sketch allowp2p, request-messages
- Add OFFLINE_INBOX_ENABLED flag - Under offline inbox flag: add allowp2p for 1on1 filter - Add skeleton web3.inbox ns with request-messages
This commit is contained in:
parent
25d3940d49
commit
90a0058a43
1
.env
1
.env
|
@ -5,4 +5,5 @@ STUB_STATUS_GO=0
|
|||
ETHEREUM_DEV_CLUSTER=1
|
||||
MAINNET_NETWORKS_ENABLED=1
|
||||
ERC20_ENABLED=1
|
||||
OFFLINE_INBOX_ENABLED=0
|
||||
LOG_LEVEL=debug
|
||||
|
|
|
@ -5,4 +5,5 @@ STUB_STATUS_GO=0
|
|||
ETHEREUM_DEV_CLUSTER=1
|
||||
MAINNET_NETWORKS_ENABLED=1
|
||||
ERC20_ENABLED=1
|
||||
OFFLINE_INBOX_ENABLED=0
|
||||
LOG_LEVEL=debug
|
||||
|
|
|
@ -5,4 +5,5 @@ STUB_STATUS_GO=0
|
|||
ETHEREUM_DEV_CLUSTER=0
|
||||
MAINNET_NETWORKS_ENABLED=0
|
||||
ERC20_ENABLED=0
|
||||
OFFLINE_INBOX_ENABLED=0
|
||||
LOG_LEVEL=info
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
[status-im.protocol.web3.utils :as u]
|
||||
[status-im.protocol.web3.filtering :as f]
|
||||
[status-im.protocol.web3.delivery :as d]
|
||||
[taoensso.timbre :refer-macros [debug]]
|
||||
[status-im.protocol.web3.inbox :as inbox]
|
||||
[taoensso.timbre :refer-macros [debug] :as log]
|
||||
[status-im.protocol.validation :refer-macros [valid?]]
|
||||
[status-im.protocol.web3.utils :as u]
|
||||
[status-im.protocol.web3.keys :as shh-keys]
|
||||
|
@ -13,6 +14,7 @@
|
|||
[status-im.protocol.encryption :as e]
|
||||
[status-im.protocol.discoveries :as discoveries]
|
||||
[cljs.spec.alpha :as s]
|
||||
[status-im.utils.config :as config]
|
||||
[status-im.utils.random :as random]))
|
||||
|
||||
;; user
|
||||
|
@ -90,11 +92,25 @@
|
|||
(let [options (merge listener-options group)]
|
||||
(group/start-watching-group! options)))
|
||||
;; start listening to user's inbox
|
||||
(f/add-filter!
|
||||
web3
|
||||
{:key identity
|
||||
:topics [f/status-topic]}
|
||||
(l/message-listener listener-options))
|
||||
(if config/offline-inbox-enabled?
|
||||
(do (log/info "offline-inbox-enabled, allowp2p")
|
||||
(f/add-filter!
|
||||
web3
|
||||
{:key identity
|
||||
:allowP2P true
|
||||
:topics [f/status-topic]}
|
||||
(l/message-listener listener-options))
|
||||
;; TODO(oskarth): Clarify opts (status-go #470)
|
||||
(inbox/request-messages!
|
||||
web3
|
||||
{}
|
||||
#(log/info "offline-inbox request-messages response:" %)))
|
||||
(f/add-filter!
|
||||
web3
|
||||
{:key identity
|
||||
:topics [f/status-topic]}
|
||||
(l/message-listener listener-options)))
|
||||
|
||||
;; start listening to profiles
|
||||
(doseq [{:keys [identity keypair]} contacts]
|
||||
(watch-user! {:web3 web3
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
(ns status-im.protocol.web3.inbox
|
||||
(:require [status-im.protocol.web3.utils :as utils]
|
||||
[taoensso.timbre :as log]))
|
||||
|
||||
;; TODO(oskarth): NYI yet (both in web3.js and status-go)
|
||||
(defn request-messages! [web3 opts callback]
|
||||
(log/info "offline-inbox: request-messages")
|
||||
(.requestMessages (utils/shh web3)
|
||||
(clj->js opts)
|
||||
callback
|
||||
#(log/warn :request-messages-error
|
||||
(.stringify js/JSON (clj->js opts)) %)))
|
||||
|
|
@ -8,6 +8,7 @@
|
|||
([k] (get config k))
|
||||
([k not-found] (get config k not-found)))
|
||||
|
||||
;; TODO(oskarth): Extend this to deal with true/false for Jenkins parameter builds
|
||||
(defn enabled? [v] (= "1" v))
|
||||
|
||||
;; NOTE(oskarth): Feature flag deprecation lifecycles. We want to make sure
|
||||
|
@ -17,12 +18,14 @@
|
|||
;; STUB_STATUS_GO - indefinite
|
||||
;; NOTIFICATIONS_WIP_ENABLED - in 0.9.12 release, remove in develop if all goes well
|
||||
;; ERC20_ENABLED - until idea #3 is merged, remove in develop when ready
|
||||
;; OFFLINE_INBOX_ENABLED - TBD, tenatively until #idea 1 is merged
|
||||
|
||||
(def testfairy-enabled? (enabled? (get-config :TESTFAIRY_ENABLED)))
|
||||
(def notifications-wip-enabled? (enabled? (get-config :NOTIFICATIONS_WIP_ENABLED 0)))
|
||||
(def stub-status-go? (enabled? (get-config :STUB_STATUS_GO 0)))
|
||||
(def mainnet-networks-enabled? (enabled? (get-config :MAINNET_NETWORKS_ENABLED 0)))
|
||||
(def erc20-enabled? (enabled? (get-config :ERC20_ENABLED 0)))
|
||||
(def offline-inbox-enabled? (enabled? (get-config :OFFLINE_INBOX_ENABLED 0)))
|
||||
(def log-level
|
||||
(-> (get-config :LOG_LEVEL "error")
|
||||
string/lower-case
|
||||
|
|
Loading…
Reference in New Issue